source
stringlengths
3
86
python
stringlengths
75
1.04M
PyPotter.py
# HELLO import sys import cv2 from cv2 import * import numpy as np import math import os from os import listdir from os.path import isfile, join, isdir import time import threading from threading import Thread from statistics import mean from CountsPerSec import CountsPerSec from GitApi import GitApi # Check for req...
terminal.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import sys import time import shlex import codecs import curses import logging import threading import webbrowser import subprocess import curses.ascii from curses import textpad from multiprocessing import Process from contextlib import context...
automate.py
# This is the main file which controls the logic for the UI automation. import parse import common from constants import * import performance import sys # Platforms import web import mac import win import os import json import time from multiprocessing import Process import subprocess import slackbot platform = None...
portable.py
import git_config import os import pager import platform import re import shutil import socket import stat import sys import subprocess import threading from trace import Trace def isUnix(): return platform.system() != "Windows" if isUnix(): import fcntl def to_windows_path(path): return path.replace('/', '\\'...
test_controller.py
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
rebuild_mooring_changed_booking.py
from django.core.management.base import BaseCommand from django.utils import timezone from django.conf import settings import threading #from mooring.models import RegisteredVessels from mooring import models from datetime import datetime import json import time from mooring import property_cache from datetime import ...
pip.py
# Standard library from datetime import date import http import http.server import json import os import os.path import re import shutil import subprocess import threading from typing import List, Optional, Union import urllib.request # Local import dbtenv from dbtenv import Dbt, DbtenvError, Environment, Version lo...
player.py
# -*- coding: utf-8 -*- # @Time : 2021/3/8 18:51 # @Author : He Ruizhi # @File : player.py # @Software: PyCharm from threading import Thread import numpy as np from time import sleep from mcts import MCTS, evaluate_rollout from policy_value_net import PolicyValueNet import paddle import os class Player: d...
tj.py
#!/usr/bin/env python import socket import threading import logging import os import sys import time import configargparse from googlesamples.assistant import auth_helpers import audio import action import i18n import speech import tts class Client(object): def __init__(self, actor, say, player): #Threa...
main.py
""" Main function for training and evaluating agents in traffic envs @author: Tianshu Chu """ import argparse import configparser import logging import tensorflow as tf import threading # from envs.test_env import GymEnv from envs.two_grid_env import TwoGridEnv, TwoGridController from envs.small_grid_env import SmallG...
configurator.py
""" Enrich2 gui configurator module =============================== This is class representing the main TK window, which is the parent window for all other frames. """ import json import platform import logging import threading import queue import tkinter as tk import tkinter.filedialog import tkinter.messagebox impo...
rpc.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
zipcracker.py
#!/usr/env python3 ##___glicOne dictionary zipfile brute___## import argparse import zipfile from threading import Thread def extract_zip(zFile, pass_from_file): try: zFile.extractall(pwd=pass_from_file.encode('cp850','replace')) print("[+] Password found: " + pass_from_file + "\n" ) except: ...
training.py
# Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the 'License'). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the 'license' fil...
with_notebook.py
import os import time from threading import Thread from jupyter_core.paths import jupyter_data_dir import notebook import IPython from IPython.display import display, Javascript from .vpython import GlowWidget, baseObj, canvas from .rate_control import ws_queue from . import __version__ import tornado.httpserver imp...
ETL_ORCID.py
from lxml import etree from tqdm import tqdm import json import pysolr import time from os import listdir from os.path import isfile, join import re import tarfile import os import gc from threading import Thread import argparse from pathlib import Path # Get list of file inside the dir def get_files_in_dir(path): ...
api.py
import flask import requests import argparse import json import websockets import uuid import asyncio import logging import re import threading from flask import Flask, request, jsonify logging.basicConfig(filename='parlai_api.log', level=30) parser = argparse.ArgumentParser(description="Simple API for ...
record.py
import argparse import logging import pathlib import re import sys import threading import yaml from datetime import datetime, timedelta from rprecorder import recorder log = logging.getLogger(__name__) def _parse_datetime(text:str) -> datetime: def _int(s:str) -> int: if s: return int(s) ...
extraction_line_manager.py
# =============================================================================== # Copyright 2011 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
utils.py
from __future__ import print_function import sys import time import threading import platform import subprocess import os import numpy as np from fibre.utils import Event import odrive.enums from odrive.enums import * try: if platform.system() == 'Windows': import win32console import colorama ...
ZMQServers.py
import zmq import zmq.devices import os import multiprocessing from .ZMQServer import ZMQServer from .ZMQPingServer import ZMQPingServer from hkube_python_wrapper.util.logger import log class ZMQServers(object): def __init__(self, port, replyFunc, config): self._replyFunc = replyFunc self._url_wo...
simplexPipesTester.py
#Import built-in functions for multiprocessing and timing import multiprocessing as mp import time #Import custom functions to process primes and encrypt import primes import encrypt #Store the number of cores in the CPU to control number of processes to spawn cpus = int(mp.cpu_count()) #Pass in the minimum and maxi...
eventing_dataset.py
# Intentionally adding 1 new line # coding=utf-8 import copy import logging from couchbase.bucket import Bucket from lib.couchbase_helper.documentgenerator import BlobGenerator, JsonDocGenerator, JSONNonDocGenerator from lib.couchbase_helper.tuq_helper import N1QLHelper from lib.membase.api.rest_client import RestConne...
ThreadedClient.py
import abc import logging import threading from queue import Queue, Empty from typing import Optional from src.clients.IClient import IClient, Msg, ClientError class ThreadedClient(IClient): """ A template for a threaded client. Behavior can be modified by overriding hooks. Inheriting classes MUST imple...
dag_processing.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
appserver.py
#!/usr/bin/env/python # File name : server.py # Production : Gtank # Website : www.gewbot.com # E-mail : gewubot@163.com # Author : William # Date : 2019/10/28 import socket import threading import time import os import LED import move import servo import switch servo.servo_init() switch.switch...
event.py
# # BitBake Tests for the Event implementation (event.py) # # Copyright (C) 2017 Intel Corporation # # SPDX-License-Identifier: GPL-2.0-only # import collections import importlib import logging import pickle import threading import time import unittest from unittest.mock import Mock from unittest.mock import call imp...
test_util_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
ctaBacktesting1.py
# encoding: UTF-8 ''' ๆœฌๆ–‡ไปถไธญๅŒ…ๅซ็š„ๆ˜ฏCTAๆจกๅ—็š„ๅ›žๆต‹ๅผ•ๆ“Ž๏ผŒๅ›žๆต‹ๅผ•ๆ“Ž็š„APIๅ’ŒCTAๅผ•ๆ“Žไธ€่‡ด๏ผŒ ๅฏไปฅไฝฟ็”จๅ’Œๅฎž็›˜็›ธๅŒ็š„ไปฃ็ ่ฟ›่กŒๅ›žๆต‹ใ€‚ ''' from __future__ import division from itertools import product import copy import os import sys import re import csv import time import multiprocessing import json import pymongo import threading from datetime import datetime from collect...
testharness_MultiphasePrototype.py
#!/usr/bin/env python import sys import os import os.path import glob import time try: import fluidity.regressiontest as regressiontest except ImportError: # try again by adding the path "../python" relative to testharness' own location to sys.path head,tail = os.path.split(sys.argv[0]) python_path = os.path.absp...
test_websocket.py
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
crawler.py
import contextlib from functools import partial import os import re import threading from ..compatibility import PY3 from .http import CachedWeb, Web, FetchError from .tracer import TRACER if PY3: from queue import Empty, Queue from urllib.parse import urlparse, urljoin else: from Queue import Empty, Queue fr...
ttyNode.py
############################################# ## ttyNode ############################################# print('Load ttyNode') from multiprocessing import Process from dbus.mainloop.glib import DBusGMainLoop import os, sys, time, json, asyncio, traceback, queue, threading, importlib path = os.path.join(os...
util.py
# Copyright 2013-2021 Aerospike, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
test_dota_base_rh.py
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import tqdm import argparse from multiprocessing import Queue, Process sys.path.append("....
GulpCIFToInputData.py
"""Execute Zeo++ and generate config XML which describes window and near-window fractional positions for all host crystals. Modified Zeo++ runs on HOST.CIF files derived from GULP-optimised HOST.CIF files, but converted to include unique atom labels and chemical symbols (necessary as Zeo++ requires chemical symbols an...
failure_test.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import json import os import ray import sys import tempfile import threading import time import ray.ray_constants as ray_constants from ray.utils import _random_string import pytest from ra...
allreduce.py
""" Utility functions to retrieve information about available services and setting up security for the Hops platform. These utils facilitates development by hiding complexity for programs interacting with Hops services. """ import os from hops import hdfs as hopshdfs from hops import tensorboard from hops import devi...
power_monitoring.py
import random import threading import time from statistics import mean from typing import Optional from cereal import log from common.params import Params, put_nonblocking from common.realtime import sec_since_boot from selfdrive.hardware import HARDWARE from selfdrive.swaglog import cloudlog from selfdrive.statsd imp...
TeslaAPI.py
import base64 import hashlib import json import logging import os import re import requests from threading import Thread import time from urllib.parse import parse_qs from ww import f logger = logging.getLogger("TWC TeslaAPI") class TeslaAPI: __apiCaptcha = None __apiCaptchaCode = None __apiCaptchaInter...
update.py
#!/usr/bin/env python # coding:utf-8 import os import urllib2 import json import time import threading import zipfile import sys from distutils.version import LooseVersion from instances import xlog import config import uuid import platform import update_from_github #opener = urllib2.build_opener() #update_url = "h...
net.py
# James Clarke # 25/09/2019 from . import serialize from . import protocol from threading import Thread import socket, logging, os DEFAULT_PORT = 3141 USE_MULTITHREADING = True BLOCK_SIZE = 128 SIZE_INFO = 10 logging.basicConfig(level=os.environ.get("LOGLEVEL", "NOTSET")) # Format a message for sending by adding si...
example.py
import pyotherside import time import threading def slow_function(): for i in range(100): pyotherside.send('progress', i) time.sleep(0.2) pyotherside.send('finished') class Downloader: def __init__(self): self.bgthread = threading.Thread() def download(self): if self.b...
lenovo_fix.py
#!/usr/bin/env python3 from __future__ import print_function import argparse import configparser import glob import gzip import os import re import struct import subprocess import sys from collections import defaultdict from datetime import datetime from errno import EACCES, EIO, EPERM from multiprocessing import cpu_...
ISICDataset.py
# ---------------------------------------- # Written by Xiaoqing GUO # ---------------------------------------- from __future__ import print_function, division import os import torch import pandas as pd import cv2 import multiprocessing from skimage import io from PIL import Image import numpy as np from torch.utils.d...
Runner.py
import multiprocessing import traceback class Process(multiprocessing.Process): def __init__(self, *args, **kwargs): multiprocessing.Process.__init__(self, *args, **kwargs) self._pconn, self._cconn = multiprocessing.Pipe() self._exception = None def run(self): try: ...
test_sys.py
from test import support from test.support.script_helper import assert_python_ok, assert_python_failure import builtins import codecs import gc import locale import operator import os import struct import subprocess import sys import sysconfig import test.support import textwrap import unittest import warnings # coun...
kodi.py
#!/usr/bin/env python # For a complete discussion, see http://forum.kodi.tv/showthread.php?tid=254502 import datetime import threading import json import hashlib import time import codecs import urllib import os import io import random import re import string import sys import unicodedata import logging import roman ...
socketFunctions.py
import socket import datetime from game import * import threading INTERVAL = 5 hostIP = "" g = "" run=True def listenUDPThread(): global run s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: s.bind((hostIP, PORT)) except: pass while run: data, addr = s.recvfrom(1024)...
zed_stereo_camera.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Referenced to ZED SDK live_camera.py ''' import cv2 import pyzed.camera as zcam import pyzed.types as tp import pyzed.core as core import pyzed.defines as sl import threading import time import os class WebcamVideoStream: """ Reference: https://www.pyi...
looper.py
import datetime import time from threading import Event, Thread from typing import Optional, Union class _LooperMixIn(object): def __init__(self): self._stop_event = Event() self._thread: Optional[Thread] = None def _before_loop(self): pass def _before_work(self): pass ...
sfp_s3bucket.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: sfp_s3bucket # Purpose: SpiderFoot plug-in for identifying potential S3 buckets related to # the target. # # Author: Steve Micallef <steve@binarypool.com> # # Created: 24...
alert.py
# Copyright 2020 by KFMgang. # All rights reserved. # and is released under the "MIT License Agreement". Please see the LICENSE # file that should have been included as part of this package. import os, sys, time from discord_webhook import DiscordWebhook, DiscordEmbed import psutil from threading import Thread from ti...
pinuz.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from io import StringIO from datetime import datetime import time,random,sys,json,codecs,threading,glob,sys import re,string,os import os.path,sys,urllib,shutil,subprocess cl = LINETCR.LINE() cl.login(token="ErLI9m25wTbzaPTz2Ue5.Cq2h8Jc15PC...
c-realV2.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ MIT License Copyright (c) 2020 - 2021 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights t...
test_wait.py
import asyncio from contextlib import contextmanager from threading import Thread from time import sleep import pytest from busypie import (FIVE_HUNDRED_MILLISECONDS, MILLISECOND, ConditionTimeoutError, reset_defaults, set_default_timeout, wait) from backports.asyncio import ...
server.py
import logging import socket import threading logger = logging.getLogger('server') class MessageServer: def __init__(self, port): self.handlers = {} self.port = port def addHandler(self, name, proc): self.handlers[name] = proc def _listen(self): sock = socket.socket() ...
FacialRecognition.py
import os import cv2 import threading import time import concurrent.futures from DetRec import DetecRecog from UserInterface import Facial_RecognitionApp class FacialDetecRecog: def runDetRec(self): while True: self.det_rec_out.main() cv2.imshow('Video', self.det_rec_out.frame) ...
osmWebWizard.py
#!/usr/bin/env python """ @file osmWebWizard.py @author Jakob Stigloher @author Jakob Erdmann @author Michael Behrisch @date 2014-14-10 @version $Id$ Browser GUI for OSMget, OSMbuild, optionally randomTrips and SUMO GUI SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2014-2017 DLR (...
_VideoPlay.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import time import threading from multiprocessing import Process, Queue, Pipe, Manager, Lock import PyQt4.QtCore as QtCore import PyQt4.QtGui as QtGui import glob import random import subprocess print(os.path.dirname(__file__)) print(os.path.basena...
ipython_memory_usage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Profile mem usage envelope of IPython commands and report interactively""" import time import memory_profiler from IPython import get_ipython __version__ = 1.1 # set to desired value. # To run: %run -i ipython_memory_usage.py # keep a global accounting for the last k...
test_language_server.py
# Copyright 2017 Palantir Technologies, Inc. import os import time import multiprocessing from threading import Thread from test import unix_only from pyls_jsonrpc.exceptions import JsonRpcMethodNotFound import pytest from pyls.python_ls import start_io_lang_server, PythonLanguageServer CALL_TIMEOUT = 10 def start...
_app.py
""" websocket - WebSocket client library for Python Copyright (C) 2010 Hiroki Ohtani(liris) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, ...
xmlstream.py
""" sleekxmpp.xmlstream.xmlstream ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module provides the module for creating and interacting with generic XML streams, along with the necessary eventing infrastructure. Part of SleekXMPP: The Sleek XMPP Library :copyright: (c) 2011 Nathanael C. Fritz :...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
email.py
from threading import Thread from flask import current_app, render_template from flask.ext.mail import Message from . import mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(to, subject, template, **kwargs): app = current_app._get_current_object() subject ...
prompt.py
""" Line editing functionality. --------------------------- This provides a UI for a line input, similar to GNU Readline, libedit and linenoise. Either call the `prompt` function for every line input. Or create an instance of the :class:`.PromptSession` class and call the `prompt` method from that class. In the secon...
async.py
import argparse import asyncio import collections import cProfile import gc import random import socket import string import sys from multiprocessing import Process, set_start_method, Barrier from scipy.stats import tmean, tstd from numpy import array, median import aiohttp def find_port(): s = socket.socket(so...
test_functools.py
import abc import builtins import collections import collections.abc import copy from itertools import permutations import pickle from random import choice import sys from test import support import threading import time import typing import unittest import unittest.mock import os import weakref import gc from weakref ...
mobZpro.py
''' โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” โ”ฃ ๐€€ [x!as ๐—Œ๐–พ๐—…๐–ฟ๐–ป๐—ˆ๐—]. โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” ''' from linepy import * from liff.ttypes import LiffChatContext, LiffContext, LiffSquareChatContext, LiffNoneContext, LiffViewRequest from thrift import transport, protocol, server from akad.ttypes import * from akad.ttypes import Message from akad...
red_light_green_light.py
import threading import time import datetime import logging import pygame import random from queue import Queue from pygame import mixer from pygame.locals import * pygame.init() mixer.init() # -------------- variables Init ----------- win_x = 600 win_y = 700 player_loc_x = 300 player_loc_y = 650 ini = 0 img = 0 ...
_exposition.py
# Copyright 2015-2019 Prometheus Python Client Developers # Copyright 2019 Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
parallel.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import print_function import multiprocessing import multiprocessing.pool import traceback import util import gc import time import random #import sys import os from six.moves import range #sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) ...
train.py
#!/usr/bin/env python """Train models.""" import os import signal import torch import onmt.opts as opts import onmt.utils.distributed from onmt.utils.misc import set_random_seed from onmt.utils.logging import init_logger, logger from onmt.train_single import main as single_main from onmt.utils.parse import ArgumentPa...
scripts.py
""" This module contains the function calls to execute command line scripts """ import functools import logging import os import signal import sys import threading import time import traceback from random import randint import salt.defaults.exitcodes # pylint: disable=unused-import from salt.exceptions import SaltC...
local-webserver.py
from threading import Thread from webtest import TestApp from errbot.core_plugins import flask_app from werkzeug.serving import ThreadedWSGIServer from errbot import botcmd, BotPlugin, webhook from typing import Dict, Any from decouple import config as get_config TEST_REPORT = """*** Test Report URL : %s Detected y...
alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Hello. I am alive!" def run(): app.run(host='0.0.0.0',port=8080) def alive(): t = Thread(target=run) t.start()
client.py
from socket import socket, AF_INET, SOCK_STREAM import logging from threading import Thread from utils import * logging.basicConfig(level=logging.DEBUG) class Client: def __init__(self, token, server_ip, server_port): self.token = token self.server_addr = (server_ip, server_port) self.skt...
fetchStream.py
import os import cv2 import m3u8 import time import threading from requests import get # ็”จไบŽไธ‹่ฝฝ็›ดๆ’ญ class FetchStream: def __init__(self, url, root_dir): self.url = url self.save_dir = os.path.join(root_dir, 'fetch') if not os.path.exists(self.save_dir): os.mkdir(self.save_dir) ...
scheduler.py
import time from multiprocessing import Process from proxypool.api import app from proxypool.getter import Getter from proxypool.tester import Tester from proxypool.setting import * class Scheduler(): def schedule_tester(self, cycle=TESTER_CYCLE): """ ๅฎšๆ—ถๆต‹่ฏ•ไปฃ็† """ tester = Tester() ...
kvarp_server.py
import sys import os import socket import collections import time import threading from random import randint import robolink import robodk as rdk # A server which controls a Kuka KR 16 industrial robot arm via RoboDK based on # simple plotting/drawing commands. For example: # "line,100,50,200,250\n" causes the robot...
main.py
# author: Dark # Data: 2020-2-7 # Detail: This is a test for QT import sys,os,time,multiprocessing,requests from PyQt4.QtGui import QMainWindow , QIcon , \ QApplication, QListWidgetItem, \ QMessageBox, QDesktopServices, \ QFileDialog from PyQt4.QtCore import pyqtSig...
spl_interpreter.py
from bin import spl_lexer as lex, spl_ast as ast, spl_token_lib as stl, spl_parser as psr, spl_memory as mem import bin.spl_lib as lib import bin.graphic_lib as gra import script import multiprocessing import math import inspect import os import subprocess import traceback from bin.environment import Environment, Globa...
simple_task_queue_logging_separate_files.py
# simple_task_queue_logging_separate_files.py import os import time import logging import multiprocessing from tasks import get_word_counts PROCESSES = multiprocessing.cpu_count() - 1 NUMBER_OF_TASKS = 10 def create_logger(pid): logger = multiprocessing.get_logger() logger.setLevel(logging.INFO) fh = ...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import support import socket import select import time import gc import os import errno import pprint import tempfile import urllib.request import traceback import asyncore import weakref import platform import functools ssl = support.import_...
flic.py
"""Contains functionality to use flic buttons as a binary sensor.""" import logging import threading import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.const import ( CONF_HOST, CONF_PORT, CONF_DISCOVERY, CONF_TIMEOUT, EVENT_HOMEASSISTANT_STOP) from homeassistant....
reactor.py
#-*- coding: utf-8 -*- import multiprocessing import logging try: # Python 2.7+ from logging import NullHandler except ImportError: class NullHandler(logging.Handler): def emit(self, record): pass LOG = logging.getLogger(__name__) LOG.addHandler(NullHandler()) class Reactor(object): ...
val.py
# YOLOv5 ๐Ÿš€ by Ultralytics, GPL-3.0 license """ Validate a trained YOLOv5 model accuracy on a custom dataset Usage: $ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640 """ import argparse import json import os import sys from pathlib import Path from threading import Thread import numpy as...
run_experiments.py
""" needs GPUtil """ import GPUtil import json import main import time from threading import Thread gpus = GPUtil.getGPUs() gpus_available = [2, 3] """ different experiments, each one is a dictionary with the changes performed at the base json """ experiments = [ { "experiment_name": "logs/adapt4_dice", ...
concurrent_calculation.py
""" Learning Concurrency in Python - Chapter 01 - concurrent calculation """ import time import random from multiprocessing import Process def calculate_prime_factors(n_p): """ This does all of our prime factorization on a given number 'n' """ prime_factors = [] d_v = 2 while d_v * d_v <= n_p: ...
node.py
# FUSE imports from __future__ import print_function, absolute_import, division import logging from collections import defaultdict from errno import ENOENT from stat import S_IFDIR, S_IFLNK, S_IFREG from time import time import os from fuse import FUSE, FuseOSError, Operations, LoggingMixIn from cmd import * from c...
dj_cluster.py
from models import PhotoClusterRun from models import PhotoCluster from math_functions.cyclical_math import month_wrap import traceback import time from datetime import datetime import sys from Queue import Queue from threading import Thread from django.db import models from django.db.models import Q class DjCluster: ...
OMC_pc_shut.py
#!/usr/bin/python3 """ Author : BITAM SALIM GITHUB : https://github.com/soolidsnake/ """ import socket from threading import Thread import datetime import time import os command = 'systemctl poweroff' #command to shutdown def time_shutdown(): while 1: if datetime.datetime.now().hour > 20:#time to shu...
main.py
#!/usr/bin/env python3 import Slide, threading, signal, multiprocessing terminator = multiprocessing.Event() def main(): # load configurations configurations = ["white_slide.ini", "purple_slide.ini"] threads = [] # load all slides in threads and start for configuration in configurations: ...
proyecto.py
# -*- coding: utf-8 -*- #El bufon en el trono from threading import Semaphore, Thread from time import sleep from random import randint import config as c N = 10 # Tolerancia de cortesanos que pasan M = 5 # Tolerancia de cortesanos esperando #Semaforos y variables de condicion #Seรฑalizaciรณn debeLevantarse = Semapho...
materialized_views_test.py
import collections import re import sys import time import traceback from functools import partial from multiprocessing import Process, Queue from unittest import skip, skipIf from cassandra import ConsistencyLevel from cassandra.concurrent import execute_concurrent_with_args from cassandra.cluster import Cluster from...
server.bak.py
INTRO_TEXT = """################################################ HELLO, welcome to this server. Your IP will be temporary allowed. If you supply the correct email, your IP will be permenently whitelisted. If you don't, the temporary whitelist will be removed. ################################################ Please ente...
collect_2.py
import threading import urllib2 import time, json import requests import os.path #"284330,150810,09,1109,52,071040,17,28432,7406" countrylist = ["brazil","canada","china","france","japan","india","mexico","russia","uk","us"] yrs = ["2011","2012","2013","2014","2015"] dataTable ={"284330":"gold","150810":"crude","09...
emulator.py
import os, sys import traceback from threading import Thread from functools import partial try: from importlib import reload except: pass from kivy.lang import Builder from kivy.clock import mainthread from kivy.resources import resource_add_path, resource_remove_path # from kivystudio.components.emulator_area ...
change.py
import logging import threading import time import gdrivefs.state from gdrivefs.conf import Conf from gdrivefs.account_info import AccountInfo from gdrivefs.drive import get_gdrive from gdrivefs.volume import PathRelations, EntryCache _logger = logging.getLogger(__name__) _logger.setLevel(logging.WARNING) class _C...