source
stringlengths
3
86
python
stringlengths
75
1.04M
throttled.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_...
singleton.py
""" 单例模式: 一个类只有一个对象,并提供全局访问点 优点: 1.提高性能 2.严格控制客户怎样访问类实例 缺点: 1.扩展困难 2.违背单一职责,既充当工厂角色,又充当产品角色 python的几种实现方式: 1.1 工厂方法 1.2 工厂方法,加锁 1.3 工厂方法,加锁, 优化 2.使用模块, 线程安全的 3.装饰器,也有线程问题 4.使用__new__, 也有线程问题  5.metaclass, 也有线程问题  """ import threading import time from src.utils import star...
test_subprocess.py
import unittest from test import test_support import subprocess import sys import platform import signal import os import errno import tempfile import time import re import sysconfig import textwrap try: import ctypes except ImportError: ctypes = None else: import ctypes.util try: ...
manager.py
# database connection import random import time import timeit # import threading from multiprocessing import Process, Value from app import db from app.base.models import Configure, Experiment, Subject, RealTimeData from .hardware_manager import hardwareManager from datetime import datetime from .hx711 import HX711 sa...
collective_ops_test.py
# Copyright 2020 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 applicab...
target.py
# # author: Cosmin Basca # # Copyright 2015 Cosmin Basca # # 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 applicabl...
drs.py
""" Authors: Porebski Elvis C00170343 Tyrakowski Bartosz C00155128 Date: February, 2016 """ import os import threading from drs.mft.mftanalyser import MftAnalyser from drs.mft.mfttable import MftTable from drs.partition.ntfspartition import NtfsPartition from drs.partition.partitionmanager ...
bot.py
# coding=utf8 """ bot.py - Willie IRC Bot Copyright 2008, Sean B. Palmer, inamidst.com Copyright 2012, Edward Powell, http://embolalia.net Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> Licensed under the Eiffel Forum License 2. http://willie.dftba.net/ """ from __future__ import unicode_literals from __futu...
train_mujoco.py
import argparse import gym import logz import numpy as np import os import tensorflow as tf import time import nn from sac import SAC import utils from multiprocessing import Process def train_SAC(args, seed, logdir): alpha = { 'Ant-v2': 0.1, 'HalfCheetah-v2': 0.2, 'Hopper-v2': 0.2, ...
musiasem_methodology_support.py
""" Persistent store, in database * server (URL, UUID) * case study (UUID). The case study can be stored in several servers * submission (UUID). Several versions of the case study * transaction. A submission can be composed of several transactions * commands. A transaction is made of several comman...
websocket.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, ...
train_yolov3.py
import argparse import logging import os import random import time from pathlib import Path from threading import Thread from warnings import warn import math import numpy as np import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_sche...
parallel_seq2seq_train.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ """ from __future__ import unicode_literals from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import range from builtins import object from threading import Thread import socket import pickle a...
plot_widget.py
# # Pavel Kirienko, 2013 <pavel.kirienko@gmail.com> # from PyQt4.QtCore import Qt from PyQt4.QtGui import QColor, QVBoxLayout, QWidget from pyqtgraph import PlotWidget, mkPen import numpy, time class RealtimePlotWidget(QWidget): COLORS = [Qt.red, Qt.blue, Qt.green, Qt.magenta, Qt.cyan, Qt.darkRed, ...
MultiStick_GoogLeNet_Camera.py
#! /usr/bin/env python3 # ******************************************************* # Copyright(c) 2017 Intel Corporation. # License: MIT See LICENSE file in root directory. # ******************************************************* # ******************************************************* # Demo with GoogleNet V1 and...
test_linsolve.py
import sys import threading import numpy as np from numpy import array, finfo, arange, eye, all, unique, ones, dot import numpy.random as random from numpy.testing import ( assert_array_almost_equal, assert_almost_equal, assert_equal, assert_array_equal, assert_, assert_allclose, assert_warns, ...
wandb_run.py
# # -*- coding: utf-8 -*- from __future__ import print_function import atexit from datetime import timedelta import glob import json import logging import numbers import os import platform import re import sys import threading import time import traceback import click import requests from six import iteritems, strin...
test_execute.py
import asyncio import tempfile import time from threading import Thread import dagster_pandas as dagster_pd import pytest from dagster import ( DagsterUnmetExecutorRequirementsError, InputDefinition, ModeDefinition, execute_pipeline, execute_pipeline_iterator, file_relative_path, pipeline, ...
s8_slide_split.py
import argparse import math import os import sys from linecache import getline from multiprocessing import Process import Constants as c #In: -i in_decoded_dir -o out_dir [-t time window] [-s slide_interval] [-p num_processes] #Out: tab-delim txt w/ header: frame_num\tts\tts_delta\tframe_len\tip_src\tip_dst\thost #...
sub_process.py
import subprocess import time import sys import threading import re class sub_process(): #def __init__(self): #self.p = subprocess.Popen(r"D:\similator_test\Debug\test_audio.exe",stdin=subprocess.PIPE) def connect_command_sim(self,_exe_path): #self.handle = open(r'stdout.txt','w',0) #sel...
orphan_process_monitor.py
import os import threading import time import traceback from splunktalib.common import log logger = log.Logs().get_logger("util") class OrphanProcessChecker(object): def __init__(self, callback=None): """ Only work for Linux platform. On Windows platform, is_orphan is always False ...
prntscrReader.py
from random import choice, randint from psutil import cpu_count from threading import Thread from urllib import request from time import sleep from lxml import html # Headers _Oheaders = request.build_opener() _Oheaders.addheaders = [('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML...
Mongo_Cluster_BackUp.py
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: Mongo_Cluster_BackUp.py Description : MongoDB集群备份 Author : charl date: 2018/12/5 ------------------------------------------------- Change Activity: 2018/12/5: ------------------------------------...
audio_reader.py
import fnmatch import os import random import re import threading import librosa import numpy as np import tensorflow as tf FILE_PATTERN = r'p([0-9]+)_([0-9]+)\.wav' def get_category_cardinality(files): id_reg_expression = re.compile(FILE_PATTERN) min_id = None max_id = None for filename in files: ...
IntegrationTests.py
from __future__ import absolute_import import os import multiprocessing import time import unittest import percy import threading import platform import flask import requests from selenium import webdriver from selenium.webdriver.chrome.options import Options class IntegrationTests(unittest.TestCase): @classmet...
clear.2.py
#!/usr/bin/env python #Author: Jason Riedel import paramiko import getpass import Queue import threading import argparse import os.path import time import logging import re import datetime ZTE='' ## SETUP AVAILABLE ARGUMENTS ## parser = argparse.ArgumentParser() parser.add_argument('-f', action="store", dest="file_pa...
server.py
# -*- coding: utf-8 -*- #!/usr/bin/env python from inspect import trace import json import os import traceback from lib.mongo_db_controller import UserDB import tornado.gen import tornado.httpserver import tornado.ioloop import tornado.web from common.spark import Spark from lib.mongo_db_controller import UserDB fr...
app.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Dec 22 16:25:36 2018 @author: erandra """ import sys import numpy as np import tensorflow as tf import pandas as pd import matplotlib matplotlib.use("TkAgg") from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.figure import...
test_backoff.py
# coding:utf-8 import datetime import pytest import random import threading import backoff from tests.common import _log_hdlrs, _save_target def test_on_predicate(monkeypatch): monkeypatch.setattr('time.sleep', lambda x: None) @backoff.on_predicate(backoff.expo) def return_true(log, n): val = (...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from collections import OrderedDict import os import pickle import random import re import subprocess import sys import textwrap import threading import time import unitt...
command.py
# Copyright (c) 2016-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict import argparse import enum import logging import os import re import resource import signal import subprocess import threading from ...
server.py
# =============================================================================== # Copyright 2013 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...
manager.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2015 clowwindy # # 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 b...
web.py
import click import tensorflow as tf from flask import Flask, jsonify, request, render_template from threading import Thread from PIL import Image from six.moves import _thread from luminoth.tools.checkpoint import get_checkpoint_config from luminoth.utils.config import get_config, override_config_params from luminot...
domain.py
from typing import Optional from typing import Dict from syft.core.common.message import SignedImmediateSyftMessageWithReply from syft.core.common.message import SignedImmediateSyftMessageWithoutReply from syft.core.node.common.action.exception_action import ExceptionMessage from syft.core.node.common.action.exceptio...
MyPrintReubenPython2and3Class.py
# -*- coding: utf-8 -*- ''' Reuben Brewer, reuben.brewer@gmail.com, www.reubotics.com Apache 2 License Software Revision C, 05/28/2021 Verified working on: Python 2.7 and 3.7 for Windows 8.1 64-bit and Raspberry Pi Buster (no Mac testing yet). ''' __author__ = 'reuben.brewer' import os, sys, platform i...
alpaca.py
# # Copyright 2018 Alpaca # # 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 writing, sof...
MonitoringPullRequest.py
#!/usr/bin/env python3 import re import requests import json import time import copy import threading from github import Github class MonitoringPullRequest: class PullReqInfo: STATE_STR = "state" MERGEABLE_STR = "mergeable" def __init__(self, no, slack_ts): self.__no =...
federated_learning_keras_low_power_PS_FL.py
from DataSets import RadarData from DataSets_tasks import RadarData_tasks from consensus.consensus_v3 import CFA_process from consensus.parameter_server_v2 import Parameter_Server # use only for consensus , PS only for energy efficiency # from ReplayMemory import ReplayMemory import numpy as np import os import tensorf...
ellcgatspyOpSim.py
import numpy as np import argparse import ellc import gatspy from gatspy import datasets, periodic from gatspy.periodic import LombScargleMultiband, LombScargle, LombScargleFast, LombScargleMultibandFast import astropy from astropy import units, constants import csv import multiprocessing, logging import pandas as ...
_lib.py
# Author: Lisandro Dalcin # Contact: dalcinl@gmail.com """Management of MPI worker processes.""" # pylint: disable=broad-except # pylint: disable=too-many-lines # pylint: disable=protected-access # pylint: disable=missing-docstring # pylint: disable=import-outside-toplevel import os import sys import time import atex...
main.py
# -*- coding:utf-8 -*- import os import getInfo import time from multiprocessing import Process,Queue import subprocess from time import sleep import requests def is_connected(q): print "is p {}".format(os.getppid()) print "is {}".format(os.getpid()) count=0 while True: count+=1 try: ...
test_e2e_thing_mutation.py
"""An authorized client can create and mutate a :class:`.Thing`.""" import threading import json import tempfile import shutil import os import time from unittest import TestCase, mock from urllib import parse from http import HTTPStatus from arxiv.users.helpers import generate_token from zero.routes.external_api imp...
test_urllib.py
"""Regression tests for what was in Python 2's "urllib" module""" import urllib.parse import urllib.request import urllib.error import http.client import email.message import io import unittest from unittest.mock import patch from test import support import os try: import ssl except ImportError: ssl = None imp...
Extração MagMax COVID.py
from opentrons.types import Point import json import os import math import threading from time import sleep metadata = { 'protocolName': 'USO_v6_station_b_M300_Pool_magmax', 'author': 'Nick <ndiehl@opentrons.com', 'apiLevel': '2.3' } NUM_SAMPLES = 96 # start with 8 samples, slowly increase to 48, then 94 ...
concurrent_stat.py
# -*- coding:utf8 -*- # File : concurrent_stat.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 6/21/17 # # This file is part of TensorArtist. import itertools import threading import queue import collections import time __all__ = ['TSCounter', 'TSCounterBasedEvent', 'TSCounterMonitor'] class...
attach_server.py
# ############################################################################ # # Copyright (c) Microsoft Corporation. # # This source code is subject to terms and conditions of the Apache License, Version 2.0. A # copy of the license can be found in the License.html file at the root of this distribution....
test_controller.py
import requests import unittest import time import json from http.server import HTTPServer from threading import Thread, Event from util import Singleton from controller import ControllerFromArgs from chatbot import ChatbotBehavior, Chatbot from usecase import Usecase, Reply from handler import LocationHandler, Usecas...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight UraniumX client # Copyright (C) 2012 thomasv@gitorious # # 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 with...
pbreeder.py
#!/usr/bin/env python3 import socket from struct import pack from random import randint from binascii import hexlify from binascii import unhexlify from threading import Thread from time import time from math import modf # All TPID TPID_IP4 = b'\x08\x00' # IP4 TPID_IP6 = b'\x86\xdd' # IP6 TPID_ARP = b'\x08\x06' ...
server.py
# =============================================================================== # Copyright 2015 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...
read_serial.py
#!/usr/bin/env python import serial import signal import sys import re import MySQLdb import time import threading ser = None running = True def send_to_serial(data): global ser if ser != None: ser.write(data) return True else: return False def do_something_every_runner...
process.py
import atexit import logging import os import shlex import subprocess import threading import time from http import HTTPStatus from urllib.request import Request, urlopen import yaml from pyngrok import conf, installer from pyngrok.exception import PyngrokNgrokError, PyngrokSecurityError __author__ = "Alex Laird" __...
test_dist_graph_store.py
import os os.environ['OMP_NUM_THREADS'] = '1' import dgl import sys import numpy as np import time import socket from scipy import sparse as spsp from numpy.testing import assert_array_equal from multiprocessing import Process, Manager, Condition, Value import multiprocessing as mp from dgl.heterograph_index import cre...
__init__.py
import typing from threading import Thread from . import host, watcher from .tray import Tray def init_tray(trays: typing.List[Tray]): host_thread = Thread(target=host.init, args=[0, trays]) host_thread.daemon = True host_thread.start() watcher_thread = Thread(target=watcher.init) watcher_thread...
test_itertools.py
import unittest from test import support from itertools import * import weakref from decimal import Decimal from fractions import Fraction import operator import random import copy import pickle from functools import reduce import sys import struct import threading maxsize = support.MAX_Py_ssize_t minsize = -maxsize-1 ...
discrete_DPPO.py
""" A simple version of OpenAI's Proximal Policy Optimization (PPO). [https://arxiv.org/abs/1707.06347] Distributing workers in parallel to collect data, then stop worker's roll-out and train PPO on collected data. Restart workers once PPO is updated. The global PPO updating rule is adopted from DeepMind's paper (DPP...
test_client.py
# Copyright (C) 2003-2009 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko 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, or (a...
runtests.py
#!/usr/bin/env python # vim:ts=4:sw=4:et: # no unicode literals from __future__ import absolute_import, division, print_function import argparse import json import math import multiprocessing import os import os.path import random import shutil import signal import subprocess import sys import threading import time i...
hungry_birds.py
#!/usr/bin/env python """hungry_birds.py - example of concurrent multi-thread application""" __copyright__ = "Copyright (C) 2015 Andrea Sindoni, Paolo Rovelli" __author__ = "Andrea Sindoni, Paolo Rovelli" __email__ = "paolorovelli@yahoo.it" import threading import time import random NUM_BIRDS = 7 NUM_WORMS = 13 de...
app.py
# -*- coding: utf-8 -* """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under the MIT License. License for BK-BASE 蓝鲸基础平台: -------------------------------------------...
context.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 us...
cometblue.py
from workers.base import BaseWorker from mqtt import MqttMessage from interruptingcow import timeout from bluepy.btle import Peripheral, BTLEDisconnectError import logging import threading import time import datetime import sys import traceback import functools import random import typing REQUIREMENTS = ["bluepy"] _L...
server.py
from gevent import monkey monkey.patch_all() import time from threading import Thread from flask import Flask, render_template, session, request from flask.ext.socketio import SocketIO, emit, join_room, leave_room, \ close_room, disconnect thread = None def background_thread(): #simular enviar eventos al cl...
MudaeAutoBot.py
import discum import re import asyncio import json import time import logging import threading from utils import * msg_buf = CacheDict(max=50) jsonf = open("Settings_Mudae.json") settings = json.load(jsonf) jsonf.close() bot = discum.Client(token=settings["token"],log={"console":False, "file":False}) mudae = 432610...
__init__.py
""" Create ssh executor system """ import base64 import binascii import copy import datetime import getpass import hashlib import logging import multiprocessing import os import queue import re import subprocess import sys import tarfile import tempfile import time import uuid import salt.client.ssh.shell import salt...
server.py
#!/usr/bin/python2 import __init__ from comm.server import Server as Base_Server import pika from utils.log import SELOG, SERVERLOG from utils.conf import CONF from utils.ftime import format_time from database.manager import Manager import json import time import threading from Queue import Queue as Q from comm.client...
async_recorder.py
from queue import Queue, Full, Empty from threading import Thread from typing import Optional # noqa from .metric import Metric class AsyncRecorder: """Offload actual sending to a thread""" def __init__(self, recorder) -> None: self._recorder = recorder self._queue = Queue(maxsize=1000) # ...
ProblemCrawler.py
import requests from pymongo import MongoClient import threading def isQuestionExist(question): return False if db.Question.find({'_id': question}).count() == 0 else True def insertQuestion(question, api): print question db.Question.insert_one({ '_id': question, 'API': api }) def c...
__init__.py
# Copyright 2019 Uber Technologies, Inc. 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...
cli.py
# -*- coding: utf-8 -*- """ flask.cli ~~~~~~~~~ A simple command line application to run flask apps. :copyright: © 2010 by the Pallets team. :license: BSD, see LICENSE for more details. """ from __future__ import print_function import ast import inspect import os import re import ssl import sys ...
redditplace.py
#!/usr/bin/env python3 import sys,os,urllib.request,time #try importing stuff needed for interactive use interactive=True try: import threading,tty,termios,queue except: interactive=False colors=[str(i) for i in [ 231, 253, 245, 16, 213, 196, 202, 130, 214, 112, 22, 51, 33, 19, 170, 53 ]]...
server.py
import os import sys import re import importlib import subprocess import threading import psutil import phanterpwa import configparser from tornado import ( web, ioloop, httpserver, autoreload ) from phanterpwa.tools import config from phanterpwa import compiler from phanterpwa import configer CURRENT_...
PyCover.py
from __future__ import print_function import os import sublime import sublime_plugin import subprocess import sys import time import threading SETTINGS = None def plugin_loaded(): global SETTINGS SETTINGS = sublime.load_settings('PyCover.sublime-settings') if SETTINGS and SETTINGS.get('python') is not None: ...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import test_support import asyncore import socket import select import errno import subprocess import time import gc import os import errno import pprint import urllib, urlparse import shutil import traceback import weakref from BaseHTTPServe...
test_cluster_connection_pool.py
# -*- coding: utf-8 -*- # python std lib import os import re import time from threading import Thread # rediscluster imports from rediscluster.connection import ( ClusterConnectionPool, ClusterReadOnlyConnectionPool, ClusterConnection, UnixDomainSocketConnection) from rediscluster.exceptions import RedisClust...
subject.py
#! /usr/bin/env python3 """This module defines the subject functionalities for the pub-sub-python """ __version__ = '1.0.0.1' __author__ = 'Midhun C Nair <midhunch@gmail.com>' __maintainers__ = [ 'Midhun C Nair <midhunch@gmail.com>', ] from time import sleep from threading import Thread from concurrent.futures ...
run_evolution.py
#!/usr/bin/env python """ Author: Shashank Kotyan Email: shashankkotyan@gmail.com """ import os, sys, warnings os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' warnings.filterwarnings('ignore') import argparse, glob, pickle, time, GPUtil, numpy as np from scipy.cluster.vq import whiten as normalise from multiprocessing....
prodstub.py
# ============LICENSE_START=============================================== # Copyright (C) 2020 Nordix Foundation. All rights reserved. # ======================================================================== # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in...
train_abstractive.py
#!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import torch import distributed from pytorch_transformers import BertTokenizer from models import data_loader from models.data_loader import load_datas...
test_integration.py
import json import multiprocessing import os from fastapi.testclient import TestClient from app.consumer.main import consume_queue from app.producer.main import app def test_produce_consume_message(mocker, tmpdir): """ Tests integration between producer and consumer. Posts data to the '/process' endpoi...
run.py
from flask import Flask, render_template, request, Response from uuid import uuid4 import json from time import sleep from threading import Thread app = Flask(__name__) import psycopg2 from jinja2 import Environment, FileSystemLoader, select_autoescape env = Environment( loader = FileSystemLoader ('templates'), ...
monitor_test.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import multiprocessing import os import subprocess import time import unittest import ray class MonitorTest(unittest.TestCase): def _testCleanupOnDriverExit(self, num_redis_shards): stdout = subp...
email.py
from threading import Thread from flask_mail import Message from app import app, mail def send(recipient, subject, body): ''' Send a mail to a recipient. The body is usually a rendered HTML template. The sender's credentials has been configured in the config.py file. ''' sender = app.config['MAIL_...
engine.py
""" Event-driven framework of VeighNa framework. """ from collections import defaultdict from queue import Empty, Queue from threading import Thread from time import sleep from typing import Any, Callable, List EVENT_TIMER = "eTimer" class Event: """ Event object consists of a type string which is used ...
pb_util.py
import functools import inspect import os import pkgutil import platform import random import threading import time from numbers import Number import cv2 import numpy as np import pybullet as p import pybullet_data import airobot from airobot.utils.common import clamp GRAVITY_CONST = -9.8 def create_pybullet_client...
test_browser.py
# coding=utf-8 # Copyright 2013 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. from __future__ import print_function import argparse ...
__init__.py
import json import subprocess import threading import pkg_resources from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from uvicorn import Config, Server from daemon.excepts import Runtime400Exception, daemon_runtime_exception_handler from jina import __version__ from jina.logging import J...
panel.py
from tkinter.ttk import Frame, LabelFrame, Label, Entry, Button from stimulator import Stimulator from data import get_config_by_config_id, update_config_by_config_id from threading import Thread class Panel(Frame): def __init__(self, master, stimulator): super().__init__(master) self.master = mas...
fastqsearch.py
#!/usr/bin/env python3 import argparse import gzip from multiprocessing import Pool, Queue, Process import re import sys import time def get_seqs(fastq_file, chunk_size=40): seqs = [] seq_re = re.compile(b'@.*\n(.*)\n', re.MULTILINE) with gzip.open(fastq_file, 'rb') as f: data = b'' size =...
fetch_cluster_info.py
""" Fetch cluster's information, for example: temperature, service type and etc. Currently, FetchCluster only knows existing cluster, that is ['india', 'bravo', 'echo', 'delta'] If more cluster are added later, this class MUST be modified carefully """ from cloudmesh.rack.rack_data import RackData from cloudmesh.rack.r...
websocket_manage.py
import threading import websocket import gzip import ssl import logging import urllib.parse from huobi.constant import * from huobi.utils import * from huobi.exception.huobi_api_exception import HuobiApiException from huobi.connection.impl.private_def import ConnectionState # Key: original_connection, Value: connecti...
cdc_in_loopback.py
# -*- coding:utf-8 -*- import serial import serial.tools.list_ports import struct import time import sys import random import threading import datetime ############################################################################### #文件设置 ###################################################################...
dumeter.py
import tkinter as tk import psutil import threading from tkinter import ttk, VERTICAL, HORIZONTAL, N, S, E, W, NW, SE, SW import requests import time class UploadDownloadMeter(): def __init__(self, root): self.frame = root self.root = root self.download_speed_var = tk.StringVar() ...
installwizard.py
from functools import partial import threading import os from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform...
group_reposter_bot.py
#!/usr/bin/env python3 """ Author:hms5232 Repo:https://github.com/hms5232/NCNU-etutor-reposter-telegram-bot Bug:https://github.com/hms5232/NCNU-etutor-reposter-telegram-bot/issues """ from telegram.ext import Updater, CommandHandler from configparser import ConfigParser import requests import time import threading i...
commandhandler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ts=2 sw=2 et ai ############################################################################### # Copyright (c) 2012,2013 Andreas Vogel andreas@wellenvogel.net # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and a...
utils.py
import os import threading from pathlib import Path from uuid import uuid4 from base64 import b64encode from traceback import print_exc from subprocess import call import imageio import cv2 import numpy as np ##################### # Generic Functions # ##################### def get_cache_directory(directory = 'sourc...
accessory.py
import threading import logging import itertools import struct from os import urandom import ed25519 import base36 from pyqrcode import QRCode import pyhap.util as util from pyhap.loader import get_serv_loader logger = logging.getLogger(__name__) class Category: """Known category values. Category is a hin...
bySensitivity_withObstruction.py
from __future__ import division import numpy as np import math # for math.ceil import matplotlib.pyplot as plt from numpy.linalg import norm from numpy.random import uniform from scipy.stats import multivariate_normal # for bivariate gaussian -> brownian motion ( normal with mu x(t-1), and variance sigma ) from fil...