source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
basicp2p.py | import isocketet
import threading
import sys
from random import randint
import time
class GenesisNode:
peersList = []
peers = []
def __init__(self):
isocket = isocketet.isocketet(isocketet.AF_INET, isocketet.isocket_STREAM)
isocket.setisocketopt(isocketet.SOL_isocketET, isocketet.SO_REUSE... |
tests_base.py | import base64
from multiprocessing import Process
import os
import runpy
import time
import unittest
import rexec
BASE_DIR = os.path.dirname(__file__)
CONFIG_PATH = os.path.join(BASE_DIR, "config.py")
CONFIG = runpy.run_path(CONFIG_PATH)
ACTIONS = CONFIG["ACTIONS"]
LOG_PATH = CONFIG["LOG_PATH"]
SERVER_ADDRESS = CONFI... |
dflow.py | import atexit
import itertools
import logging
import os
import pathlib
import pickle
import random
import threading
import inspect
import sys
import multiprocessing
import time
from getpass import getuser
from uuid import uuid4
from socket import gethostname
from concurrent.futures import Future
from functools import ... |
track_rubbish_test.py | # Python code generated by CAIT's Visual Programming Interface
from sqlalchemy import true
import cait.essentials
import threading
import time
object_coordinate = None
screen_center = None
rotate_power = None
x1 = None
object_of_interest = None
x2 = None
object_center = None
coordinates = None
object2 = None
power =... |
common.py | import io
import os
import sys
import json
import time
import fcntl
import types
import base64
import shutil
import struct
import decimal
import fnmatch
import hashlib
import logging
import binascii
import builtins
import tempfile
import warnings
import functools
import itertools
import threading
import traceback
impor... |
cpt_opener.py | #!/usr/bin/python
import threading, os, time
from subprocess import call
#os.environ["PATH"] = "C:/ProgramFiles/nodejs"
def exec_cmd():
#call('r"C:/Program Files/nodejs/node.exe" "C:/Users/Administrator/Downloads/bot/bot/cpt/index.js"', shell=True)
#os.system("start cpt/index-win.exe")
os.system("C:/Users/A... |
explorer.py | """
Simlair to the controller, but the goal here is to go towards the area with the worst reconstruction error.
"""
import argparse
import sys
from os.path import join, exists
from os import mkdir, unlink, listdir, getpid
from time import sleep
from torch.multiprocessing import Process, Queue
import torch
import cma
f... |
a3c.py | import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Categorical
# import torch.multiprocessing as mp
import multiprocessing as mp
import time
# Hyperparameters
n_train_processes = 5
learning_rate = 0.0002
update_interval = 5
gamma = ... |
notebookapp.py | """A tornado based IPython notebook server.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distribute... |
vnpy_event_source.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 r... |
app.py | #!/usr/bin/env python3
import connexion
from multiprocessing import Process, Queue
from worker import workloop
from os import environ
import conf
if __name__ == '__main__':
train_q = Queue()
result_q = Queue()
master = environ.get("OPH_MASTER", "local[*]")
dburl = environ.get("OPH_DBURL", "mongodb:/... |
env_wrappers.py | """
Modified from OpenAI Baselines code to work with multi-agent envs
"""
import numpy as np
from multiprocessing import Process, Pipe
from baselines.common.vec_env import VecEnv, CloudpickleWrapper
VecEnv
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
whi... |
webcam.py | #!/usr/bin/env python3
import cv2
import queue
import threading
import time
import signal
import sys
import joblib
import pickle
import requests
import sys
import argparse
from timeit import default_timer as timer
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="localhost:5000", help="... |
get_transformed_action_distance.py | import os
import pandas as pd
import numpy as np
from scipy.optimize import linear_sum_assignment
from scipy.spatial import distance
from IPython.display import clear_output
from itertools import combinations
import multiprocessing as mp
import logging
import argparse
import time
'''
This script will compare action se... |
powercap.py | """
Modified from https://github.com/mozilla/energia/blob/8bfc8e2cf774b702ea1085a164403356cc10086b/wrappers/PowerGadget.py
"""
import multiprocessing
import os
import platform
import re
import shlex
import shutil
import subprocess
import sys
import tempfile
import pandas as pd
from pandas import DataFrame
sys.path.ap... |
thread_log.py | #!/usr/bin/env python3
import logging
import threading
import time
from broker.config import IgnoreThreadsFilter, ThreadFilter
# Attach the IgnoreThreadsFilter to the main root log handler
# This is responsible for ignoring all log records originating from
# new threads.
main_handler = logging.FileHandler("/tmp/main... |
runner.py | import argparse
import json
import logging
import os
import threading
import time
import traceback
import colors
import docker
import numpy
import psutil
from ann_benchmarks.algorithms.definitions import (Definition,
instantiate_algorithm)
from ann_benchmarks.dataset... |
mpm_solver.py | import taichi as ti
import numpy as np
import time
import numbers
import math
import multiprocessing as mp
USE_IN_BLENDER = False
ti.require_version(0, 6, 22)
@ti.data_oriented
class MPMSolver:
material_water = 0
material_elastic = 1
material_snow = 2
material_sand = 3
materials = {
'WAT... |
database_throughput_test.py | #!/usr/bin/env python3
# Copyright 2018 Braxton Mckee
#
# 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 ap... |
socks5proxy.py | # -*- coding: UTF8 -*-
# --------------------------------------------------------------
# Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
... |
lambda_executors.py | import os
import re
import sys
import glob
import json
import time
import logging
import threading
import traceback
import subprocess
import six
import base64
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
from pipes import quote as cmd_quote # for Pyth... |
test_unix_events.py | """Tests for unix_events.py."""
import collections
import errno
import io
import os
import pathlib
import signal
import socket
import stat
import sys
import tempfile
import threading
import unittest
from unittest import mock
from test import support
if sys.platform == 'win32':
raise unittest.SkipTest('UNIX only')... |
latest-build-publisher.py | #!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
This script polls git for new commits, build electrscash and publishes it.
'''
from datetime import d... |
cammotor.py | #!/usr/bin/env python3
import rospy
import threading
import time
import atexit
from components import Servo
from geometry_msgs.msg import Twist
CHN_PWM_CAM_YAW = 1
CHN_PWM_CAM_PITCH = 2
ROT_MAX = 180
ROT_MIN = 0
NODE_NAME = 'camera_controller'
class CameraMotorNode(object):
msg = Twist()
freq = 25
i... |
datasets.py | # Copyright 2020 Lorna 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 applicable l... |
main.py | import os, imagezmq, traceback, sys, time
from PIL import Image, ImageTk
import tkinter as tk
import threading
"""to handle multi thread processes."""
#import detector as dkv
debug = True
do_detect = False
# class Plate:
# def __init__(self,image_rgb):
# self.image = image_rgb
# def perspective(se... |
test_basic.py | # -*- coding: utf-8 -*-
"""
tests.basic
~~~~~~~~~~~~~~~~~~~~~
The basic functionality.
:copyright: 2010 Pallets
:license: BSD-3-Clause
"""
import re
import sys
import time
import uuid
from datetime import datetime
from threading import Thread
import pytest
import werkzeug.serving
from werkzeug.ex... |
data_utils.py | # Lint as python3
# Copyright 2018 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 r... |
safe_t.py | from binascii import hexlify, unhexlify
import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrum_xazab.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum_xazab.bip32 import BIP32Node
from electrum_xazab import con... |
twitter.py | from json import loads
from os import getenv
from queue import Empty
from queue import Queue
from threading import Event
from threading import Thread
from time import time
from tweepy import API
from tweepy import Cursor
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListen... |
driver_station.py | import os
import time
import threading
from networktables import NetworkTables
import logging # Required
logging.basicConfig(level=logging.INFO)
#ip = "roboRIO-1721-FRC"
ip = "10.17.21.2"
#ip = "localhost"
NetworkTables.initialize(server=ip)
table = NetworkTables.getTable("SmartDashboard")
class Queue():
def __... |
A3CTrainer.py | import threading
import multiprocessing
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.contrib.slim as slim
import scipy.signal
import os
from A3C import AC_Network
from A3CWorker import *
from random import choice
from time import sleep
from time import time
import matp... |
test.py | import warnings
from . import expected
from gffutils import example_filename, create, parser, feature
import gffutils
import gffutils.helpers as helpers
import gffutils.gffwriter as gffwriter
import gffutils.inspect as inspect
import gffutils.iterators as iterators
import sys
import os
import six
import shutil
import t... |
test_bmuf.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from multiprocessing import Manager
import random
import unittest
import torch
import torch.nn as nn
from fairseq import dis... |
ble_task_win.py | import time
import json
import base64
import asyncio
from typing import Optional
from queue import Queue
from threading import Thread
from bleak import discover, BleakClient, BleakError
from modi.task.conn_task import ConnTask
from modi.util.conn_util import MODIConnectionError
class BleTask(ConnTask):
def __... |
dataset.py | import os
import random
import cv2
import numpy as np
from queue import Queue
from threading import Thread
from six.moves import cPickle as pickle
from util.figs import imshow
class DataSet(object):
def __init__(self, dataset_params):
#process params
self.data_path = str(dataset_params['path'])
... |
long_mpc.py | from datetime import datetime
from enum import Enum
import os
import math
from threading import Thread
from queue import Empty, Full, Queue
import struct
import subprocess
import time
import cereal.messaging as messaging
from selfdrive.swaglog import cloudlog
from common.realtime import sec_since_boot
from selfdrive.c... |
gazebo_controller.py | # -*- coding: utf-8 -*-
"""
Written by Daniel M. Aukes and CONTRIBUTORS
Email: danaukes<at>asu.edu.
Please see LICENSE for full license.
"""
import asyncio #NOTE: Trollius requires protobuffer from Google
#import trollius #This is what is changed
#from trollius import from This is necessary for Python 2 support until I... |
magma_disk_full.py | '''
Created on 16-Feb-2021
@author: riteshagarwal
'''
import copy
import os
import threading
import time
from Cb_constants.CBServer import CbServer
from cb_tools.cbstats import Cbstats
from magma_base import MagmaBaseTest
from memcached.helper.data_helper import MemcachedClientHelper
from remote.remote_util import Re... |
duplicates.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from multiprocessing import Process, Manager
from os import kill
from random import shuffle
from time import time, sleep
import pandas as pd
from ._loop import _loop
from ._memory_check import _memory_check
from ._timer import _timer
##################################... |
test_gc.py | import unittest
from test.support import (verbose, refcount_test, run_unittest,
strip_python_stderr, cpython_only, start_threads,
temp_dir, requires_type_collecting)
from test.support.script_helper import assert_python_ok, make_script
import sys
import time
import gc... |
Sniffer.py | import threading
import logging
import time
import scapy.all as sc
class Sniffer:
def __init__(self, host_state, packet_parser):
self.host_state = host_state
self.lock = threading.Lock()
self._active = False
self.packet_parser = packet_parser
self.filter = lambda ... |
stream.py | # stream.py/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:46 PM
"""Entrypoint for taking a picture."""
import time
import logging
import argparse
import threading
from pathlib import Path
from typing import Tuple, Op... |
__init__.py | import os
import queue
import random
from typing import List, Optional
import requests
import threading
import time
from platypush.context import get_bus
from platypush.plugins import Plugin, action
from platypush.message.event.torrent import \
TorrentDownloadStartEvent, TorrentDownloadedMetadataEvent, TorrentSta... |
smbrelayx.py | #!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# SMB Relay Module
#
# Author:
# Alberto Solino (@agso... |
daemon.py | #!/usr/bin/env python3
import contextlib
import os
import select
import socket
import sys
import threading
@contextlib.contextmanager
def unlinking(path):
try:
yield path
finally:
os.unlink(path)
@contextlib.contextmanager
def exiting(retcode=0):
try:
yield
finally:
os... |
network.py | #!/usr/bin/env python
"""IonServer Network handler
This contains functions responsible Server-Client communication
(You shouldn't use this file directly due to the very specialized
interactions required for it to function in addition to parameters
i.e: Pipes, Queues. This is the reason for the simple docstrin... |
controller.py | # !/usr/local/lib64/python3.8
"""
Controller Library
1. controller_data/sdk_base_url
2. login credentials
"""
import base64
import datetime
import json
import re
import ssl
import time
import urllib
import requests
import swagger_client
from swagger_client import FirmwareManagementApi
from swagger_... |
EMAR.py | ############################################################################################
#
# Project: Peter Moss COVID-19 AI Research Project
# Repository: EMAR Mini, Emergency Assistance Robot
#
# Author: Adam Milton-Barker (AdamMiltonBarker.com)
# Contributors:
# Title: EMAR Mini Emergency... |
util.py | # -*- coding: utf-8 -*-
# (c) 2009-2018 Martin Wendt and contributors; see WsgiDAV https://github.com/mar10/wsgidav
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
"""
Test helpers.
Example:
with WsgiDavTestServer(opts):
... test methods
"""
from __future__ import... |
test_threading.py | # Very rudimentary test of threading module
import test.support
from test.support import verbose, strip_python_stderr, import_module
import random
import re
import sys
_thread = import_module('_thread')
threading = import_module('threading')
import time
import unittest
import weakref
import os
from test.script_helper ... |
trex_subscriber.py | #!/router/bin/python
import json
import threading
import time
import datetime
import zmq
import re
import random
import os
import signal
import traceback
import sys
from .trex_types import RC_OK, RC_ERR
#from .trex_stats import *
from ..utils.text_opts import format_num
from ..utils.zipmsg import ZippedMsg
# basic... |
process.py | import atexit
from datetime import timedelta
import logging
import os
from queue import Queue as PyQueue
import re
import threading
import weakref
import dask
from .utils import mp_context
from tornado import gen
from tornado.concurrent import Future
from tornado.ioloop import IOLoop
logger = logging.getLogger(__na... |
e1.py | import logging
import threading
import time
def thread_function(name):
logging.info("Thread %s: starting", name)
time.sleep(2)
logging.info("Thread %s: finishing", name)
if __name__ == "__main__":
format = "%(asctime)s: %(message)s"
logging.basicConfig(format=format, level=logging.INFO, datefmt="... |
compounds.py | from pdb import set_trace
from threading import Thread
import time
from animations.interfaces import RangeableAnimation, LoopableAnimation, MultiEffectableAnimation
from models.zone import Zone
from models.effect import Effect
from queues import SubEffectQueue
class SirenAnimation(RangeableAnimation):
def __init... |
validate.py | import os
import sys
import json
import csv
import random
import shutil
import math
import multiprocessing
from enum import Enum, auto
from posix import O_APPEND
from automates.program_analysis.GCC2GrFN.gcc_plugin_driver import run_gcc_plugin
from automates.program_analysis.GCC2GrFN.gcc_ast_to_cast import GCC2CAST
G... |
gan_grid.py | #!/usr/bin/env python2
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# This document should comply with PEP-8 Style Guide
# Linter: pylint
"""
TensorFlow training executable for DIGITS
Defines the training procedure
Usage:
See the self-documenting flags below.
"""
from __future__ import absolute... |
speech_api_julius.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# COPYRIGHT (C) 2014-2020 Mitsuo KONDOU.
# This software is released under the MIT License.
# https://github.com/konsan1101
# Thank you for keeping the rules.
import sys
import os
import time
import datetime
import codecs
import glob
import queue
import threading
impor... |
runTestbench.py | import argparse
import os
import sys
import time
import traceback
import multiprocessing
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.animation as animation
from collections import OrderedDict
from pynput.keyboard import Listener, Key, KeyCo... |
TServer.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 u... |
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
:... |
camera_config.py | '''
Minimalistic client to configure your car's camera
Author: Maxime Ellerbach
'''
import json
import threading
import tkinter
import cv2
from test_client import SimpleClient
class windowInterface(tkinter.Tk): # screen to display interface for ALL client
def __init__(self, name="camera configuration interface... |
helpers.py | """
Helper functions file for OCS QE
"""
import base64
import random
import datetime
import hashlib
import json
import logging
import os
import re
import statistics
import tempfile
import threading
import time
import inspect
from concurrent.futures import ThreadPoolExecutor
from itertools import cycle
from subprocess i... |
torch_policy.py | import copy
import functools
import gym
import logging
import math
import numpy as np
import os
import threading
import time
import tree # pip install dm_tree
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Set,
Tuple,
Type,
Union,
TYPE_CHECKING,
)
import ray
from ray... |
test_decimal.py | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
"""
These are the test cases for the Decim... |
test_ptds.py | import multiprocessing as mp
import logging
import traceback
from numba.cuda.testing import unittest, CUDATestCase
from numba.cuda.testing import skip_on_cudasim
def child_test():
from numba import cuda, int32, void
from numba.core import config
import io
import numpy as np
import threading
#... |
cross_thread.py | #!/usr/bin/env python
"""
Example of an Eliot action context spanning multiple threads.
"""
from __future__ import unicode_literals
from threading import Thread
from sys import stdout
from eliot import to_file, preserve_context, start_action
to_file(stdout)
def add_in_thread(x, y):
with start_action(action_ty... |
yt-watch.py | from threading import Thread
import configparser
import datetime
import re
import subprocess
import time
import pyperclip as clp # install using "pip install pyperclip"
import logging
LIVESTREAMER = "livestreamer"
YOUTUBE = "youtube"
MPV = "mpv"
TWITCH = "twitch"
MAIN = "main"
MESSAGES = "messages"
LOGT... |
test_waiting.py | import sys
import time
from threading import Thread
import pytest
from mock import ANY, Mock, call, patch
from nameko.testing.waiting import WaitResult, wait_for_call
@pytest.yield_fixture
def forever():
value = [True]
yield value
value.pop()
class TestPatchWaitUseCases(object):
def test_wait_for... |
test_connection.py | #!/usr/bin/env python
# test_connection.py - unit test for connection attributes
#
# Copyright (C) 2008-2011 James Henstridge <james@jamesh.id.au>
#
# psycopg2 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 Foun... |
github_sync.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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, V... |
test_core.py | "Test diskcache.core.Cache."
from __future__ import print_function
import collections as co
import errno
import functools as ft
import hashlib
import io
import mock
import os
import os.path as op
import pytest
import random
import shutil
import sqlite3
import subprocess as sp
import sys
import tempfile
import threadi... |
ws_mgr.py | import os
import time
import json
import copy
import multiprocessing as mp
from ws.shared.logger import *
from ws.shared.proto import ManagerPrototype
from ws.resources.billboard import Billboard
from ws.resources.config import Config
from ws.resources.jobs import Jobs
from ws.resources.job import Job
from flask ... |
manage.py | #!/usr/bin/env python3
import argparse
import multiprocessing
import os
import signal
import sys
import time
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
APP_PATH = os.path.join(PROJECT_PATH, "app")
PYTHON = os.path.join(PROJECT_PATH, "env/bin/python3")
sys.path.append(APP_PATH)
for p in os.listdir(os.p... |
test_concurrent_futures.py | import test.support
# Skip tests if _multiprocessing wasn't built.
test.support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
test.support.import_module('multiprocessing.synchronize')
# import threading after _multiprocessing to raise a more revelant error
# message: "No module n... |
example18_iot_chime.py | #!/usr/bin/env python3
# coding: utf-8
# Example 18 IoT チャイム WSGI 版
port = 4 # GPIO ポート番号
ping_f = 554 # チャイム音の周波数1
pong_f = 440 # チャイム音の周波数2
from wsgiref.simple_server import make_server
from RPi import GPIO ... |
btlejack.py | from threading import Lock
from queue import Queue
import time
from serial.tools.list_ports import comports
from serial import Serial,SerialException
from mirage.libs.ble_utils.constants import *
from mirage.libs.ble_utils.scapy_btlejack_layers import *
from mirage.libs import io,utils,wireless
class BTLEJackDevice(wi... |
iterators.py | import multiprocessing
import random
import sys
import queue
import threading
import traceback
from itertools import islice
from typing import Any, TypeVar, Iterable, Iterator, List, Callable, Optional, Union, Tuple
T = TypeVar('T')
__all__ = ['ThreadedIterator', 'MultiWorkerCallableIterator', 'BufferedIte... |
rebalance.py | #!/usr/bin/env python3
from pyln.client import Plugin, Millisatoshi, RpcError
from threading import Thread, Lock
import time
import uuid
plugin = Plugin()
plugin.rebalance_stop = False
def setup_routing_fees(plugin, route, msatoshi):
delay = plugin.cltv_final
for r in reversed(route):
r['msatoshi'] =... |
bottleServerTest.py | from bottle import route, run, template
import time
import threading
from PIL import Image
dot = {'r':0,'g':0,'b':0}
class Server():
def __init__(self):
pass
@route('/dotColor')
def dotColor(self):
dot = Image.open('../game-files/data/dot.png')
size= dot.size
print(size)
... |
drEngine.py | # encoding: UTF-8
'''
本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。
使用DR_setting.json来配置需要收集的合约,以及主力合约代码。
'''
import json
import os
import copy
from collections import OrderedDict
from datetime import datetime, timedelta
from queue import Queue, Empty
from threading import Thread
from vnpy.trader.event imp... |
rgbmatrix.py | #!/usr/bin/env python3
import sys, time, colorsys, threading
from enum import Enum
try:
import numpy
except ImportError:
sys.exit("This script requires the numpy module\nInstall with: sudo pip3 install numpy")
from lib.logger import Level, Logger
from lib.feature import Feature
from lib.enums import Color
fr... |
pjf_server.py | """
The MIT License (MIT)
Copyright (c) 2016 Daniele Linguaglossa <d.linguaglossa@mseclab.com>
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 th... |
btbridge.py |
import logging
import mido
import sys
import threading
from audioled_controller import bluetooth, grpc_midi_pb2, grpc_midi_pb2_grpc
import grpc
import time
import queue
import argparse
import os
logger = logging.getLogger(__name__)
orig_factory = logging.getLogRecordFactory()
def record_factory(*args, **kwargs):
... |
pythonian_v2.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 3.6
# @Filename: pythonian.py
# @Date: 2018-11-08 15:25:41
# @Last Modified by: Samuel Hill
# @Last Modified time: 2020-03-01 06:11:42
"""
Wrapper class around the KQML module to allow for easy integration of python
code with Common Lisp - specifically Compan... |
server.py | # -*- coding: utf-8 -*-
#
# Classes for setting up server mock.
#
# -----------------------------------
# imports
# -------
import os
import re
import six
import json
import time
import logging
import hashlib
from functools import wraps
from xml.etree import ElementTree
from threading import Thread
from .utils impo... |
xkcd_down_multi.py | #!/usr/bin/python3
''' XKCD_DOWNLOADER: Simple downloader to downloader all xkcd comics since the beginning of time and also automate
the downloading at your defined time(edit the cron entry section).Cheers!
MIT License
Copyright (c) 2017 Rohan Bampal
Permission is hereby granted, free of charge, to any person obt... |
genmulti.py | # genmulti.py
#
# Generate items from multiple generators (multiplex)
#
import queue, threading
def gen_multiplex(genlist):
item_q = queue.Queue()
def run_one(source):
for item in source: item_q.put(item)
def run_all():
thrlist = []
for source in genlist:
t = threading... |
database.py | """
The database panel allows users to start up a previously configured Neo4j database.
"""
__author__ = 'Lisa Rottjers'
__email__ = 'lisa.rottjers@kuleuven.be'
__status__ = 'Development'
__license__ = 'Apache 2.0'
from threading import Thread
import wx
import wx.lib.newevent as NE
from pubsub import pub
from mako.sc... |
fitmap.py | from multiprocessing import Pool
n_process = 12
x_naxis, y_naxis = 319, 315
gas_names = ['Hbeta', 'Halpha', '[SII]6716', '[SII]6731', '[OIII]4960',
'[OIII]5008', '[OI]6300_d', '[NII]6549', '[NII]6585', 'Balmer_v', 'Forbidden_v']
multimap = dict(zip(gas_names, np.zeros((len(gas_names), 2, y_naxis, x_naxis... |
run_test.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import multiprocessing as mp
import os
import shutil
import subprocess
import tempfile
imp... |
mr-class.py | # !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: mango
@contact: w4n9@sina.com
@create: 16/9/7
hail hydra!
"""
__author__ = "mango"
__version__ = "0.1"
import os
from threading import Thread
class GenericInputData(object):
def read(self):
raise NotImplementedError # read 方法必须由子类实现
... |
btcompletedirgui.py | #!/usr/bin/env python
# Written by Bram Cohen
# see LICENSE.txt for license information
import sys
import os
import threading
from BitTornado.BT1.makemetafile import completedir
try:
from wxPython import wx
except:
print 'wxPython is not installed or has not been installed properly.'
sys.exit(1)
wxEVT_IN... |
plc_dummy_server.py | import socket
import time
import tkinter as tk
import threading
from tkinter import font
from plc_master_manager import PlcMasterManager
from order_list import Order
from socket_server_manager import SocketServerManager
from config_parser import parseConfig
LAST_STATION_NUM = 60
STATION_INTERVAL = 10
STATION_COUNT = i... |
testing.py | """
Testing utilities.
"""
import os
import re
import threading
import functools
from tempfile import NamedTemporaryFile
from numpy import testing
import numpy as np
from ._warnings import expected_warnings
import warnings
from .. import data, io, img_as_uint, img_as_float, img_as_int, img_as_ubyte
SKIP_RE = re.c... |
main copy.py | # necessary for spawning new threads without getting deleted by the background thread
import eventlet
eventlet.monkey_patch()
from flask import Flask, Blueprint, render_template, request, session, redirect, url_for, flash
from flask_socketio import SocketIO, join_room, leave_room
from . import db
import os, sys
from .... |
test_perflog.py | import time
import perflog
import socket
import threading
PORT = 9007
def listen():
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(('localhost', PORT))
serversocket.listen(5)
while 1:
(s, address) = serversocket.accept()
def client_connect():
s = so... |
extractor.py | from urllib import urlretrieve, urlopen
from threading import Thread, activeCount
from time import sleep
from json import loads
from os import path
from sys import exit
class Extractor:
Queue = []
__Limit = 50
__DistSM2 = 'sm2'
__DistSMW = 'smw'
__DistKS = 'ks'
__DistHUG = 'hug'
def do(se... |
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... |
driver.py | import asyncio
from mirai_core import Bot, Updater
from mirai_core.models.Event import Message, BotOnlineEvent
from mirai_core.models.Types import MessageType
from mirai_core.models.Message import MessageChain, Image, Plain, At, AtAll, Face, Source, Quote, FlashImage
from unified_message_relay.Core.UMRType import Cha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.