source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
coro.py | '''
Async/Coroutine related utilities.
'''
import os
import queue
import atexit
import asyncio
import inspect
import logging
import functools
import multiprocessing
import concurrent.futures
logger = logging.getLogger(__name__)
import synapse.exc as s_exc
import synapse.glob as s_glob
import synapse.common as s_commo... |
packeter_single_large.py | #!/usr/bin/env python
"""
Send a single large packet over a single connection.
@author: David Siroky (siroky@dasir.cz)
@license: MIT License (see LICENSE.txt or
U{http://www.opensource.org/licenses/mit-license.php})
"""
import time
import logging
import sys
from multiprocessing import Process
sys.path.ins... |
aniplot_TkinterControl.py | '''
datecreated: 190930
objective: want to use opencv to make some kind of animated plotting tool.
KJG190930: using cv2 is MUCH MUCH faster, will use this instead of matplotlib
KJG190930: at this point, will use tkinter to try and control the rectangle
KJG191001: tkinter now functional, with multi-key input. now capabl... |
replay_actions.py | #!/usr/bin/python
# NOTE: This code is to a large degree based on DeepMind work for
# AI in StarCraft2, just ported towards the Dota 2 game.
# DeepMind's License is posted below.
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License... |
TimeLapse.py | import picamera
import os
import time
import threading
import subprocess
import Movie
def runAsync(fn):
def run(*k, **kw):
t = threading.Thread(target=fn, args=k, kwargs=kw)
t.start()
return t
return run
class Timer(object):
def __init__(self):
self.oldTime = -1
def st... |
perf.py | #!/usr/bin/env python3.9
import multiprocessing as mp
import threading as th
import os
def do():
if os.system('./checker.py check localhost:4040 1>/dev/null 2>/dev/null') != 0x6500:
print('pref test failed')
def fef(x):
print(f'\b\b\b\b\b\b\b\b\b{x // 1000 * 100}%')
threads = []
for i in range(3):
t ... |
supervisor.py | # Copyright 2016 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... |
timing.py | import datetime
import time
import threading
import state
def update_time():
while True:
now = datetime.datetime.now()
state.set_time(now.hour, now.minute, now.second)
time.sleep(1)
t = threading.Thread(target=update_time)
t.start() |
tetris.py | #!/usr/bin/env python3
from zencad import *
import threading
import time
import random
import types
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import threading
w, h = 10, 20
sz = 10
FIELDS = []
body = box(sz*w+2*sz, sz, sz*h+2*sz, center=True) - \
box(sz*w, sz, sz*h, cen... |
shareingvar.py | # -*- coding:utf-8 -*-
import threading
import time
"""
多个线程方法中可以共用全局变量.
查看work1线程对全局变量的修改,
在work2中能否查看修改后的结果.
"""
"""
# 定义全局变量
num = 0
# work1
def work1():
# 声明num是一个全局变量
global num
for i in range(10):
num += 1
print("work1--------",num)
# work2
def work2():
# num可以在多个线程中共享.
p... |
cloud.py | """
Object Store plugin for Cloud storage.
"""
import logging
import multiprocessing
import os
import shutil
import subprocess
import threading
import time
from datetime import datetime
from galaxy.exceptions import ObjectInvalid, ObjectNotFound
from galaxy.util import (
directory_hash_id,
safe_relpath,
s... |
bert_service_simple.py | # bert 模型华为部署inference代码 v1
# by clz 20211216
# 参考 https://support.huaweicloud.com/engineers-modelarts/modelarts_23_0301.html
import logging
import threading
import numpy as np
import tensorflow as tf
import os
from PIL import Image
from model_service.tfserving_model_service import TfServingBaseService
from .bert_to... |
78_customer_order_details_new.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import csv
import xmlrpc.client as xmlrpclib
import multiprocessing as mp
from scriptconfig import URL, DB, UID, PSW, WORKERS
# ==================================== SALE ORDER LINE ====================================
def update_sale_order_line... |
MTSv_prune.py | import subprocess, shutil
from io import BytesIO
import argparse
import fnmatch
import os, datetime
from ftplib import FTP, all_errors
from time import sleep
import gzip
import tarfile
from multiprocessing import Pool, Queue, Process, Manager, RLock
import pickle, json
lock = RLock()
def serialization(gi2tx,fasta_pat... |
backend.py | import time
import hashlib
import json
import requests
import base64
from flask import Flask, request
from multiprocessing import Process, Pipe
import ecdsa
from config import MINER_ADDRESS, MINER_NODE_URL, PEER_NODES
node = Flask(__name__)
class Block:
def __init__(self, index, timestamp, data, previous_hash):... |
13_customer_terms.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
from xmlrpc import client as xmlrpclib
import multiprocessing as mp
from scriptconfig import URL, DB, UID, PSW, WORKERS
# =================================== C U S T O M E R ========================================
def update_customer_terms(pid, data_pool, w... |
segment.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import json
import logging
import math
import os
from os.path import exists, join, split
import threading
import glob
import time
import numpy as np
import shutil
import sys
from PIL import Image
import torch
from torch import nn
import torch.backends.cu... |
conftest.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
import json
import time
import random
import os.path
import tempfile
import threading
import subprocess
import pytest
import requests
# Variables ======... |
test_linsolve.py | from __future__ import division, print_function, absolute_import
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, as... |
testing_server.py |
import traceback
import uuid
import socket
import logging
import os
import base64
import zlib
import gzip
import time
import datetime
from http import cookies
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from threading import Thread
import WebRequest
def capture_expected_headers... |
core.py | # -*- coding: utf-8 -*-
#
# 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, software
... |
reporting_send.py | #!/usr/bin/python
import SocketServer
import socket
import threading
import sys
import os
import shlex
import subprocess
import Queue
import platform
import time
import datetime
import argparse
import traceback
uploadPort=4445
#syscallList=list()
Timer=0
TimerInterval = 15 * 60 * 1000 #15 mins
serverUrl = 'https://ag... |
blockchain_processor.py | #!/usr/bin/env python
# Copyright(C) 2011-2016 Thomas Voegtlin
#
# 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 to use, copy, ... |
SampleService_test.py | # These tests cover the integration of the entire system and do not go into details - that's
# what unit tests are for. As such, typically each method will get a single happy path test and
# a single unhappy path test unless otherwise warranted.
# Tests of the auth user lookup and workspace wrapper code are at the bot... |
cleanup.py | import os
import time
import requests
from glob import glob
import os.path as path
from datetime import datetime
from multiprocessing import Process, Queue
def worker(i:int, q: Queue):
while q.qsize()>0:
try:
files_batch = q.get_nowait()
start2 = time.time()
#print(f"[{i... |
async_script.py | # -*- coding: utf-8 -*-
"""
Display output of a given script asynchronously.
Always displays the last line of output from a given script, set by
`script_path`. If a line contains only a color (/^#[0-F]{6}$/), it is used
as such (set force_nocolor to disable). The script may have parameters.
Configuration parameters:
... |
Context_test.py | # coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee kongyeeku@163.com #
# #
# version 1.0 ... |
gui_server.py | # import all the required modules
import socket
import threading
from tkinter import *
from tkinter import font
from tkinter import ttk
# import all functions /
# everthing from chat.py file
# from chat import *
PORT = 5000
# SERVER = "192.168.0.103"
SERVER = '127.0.1.1'
ADDRESS = (SERVER, PORT)
FORMAT = "utf-8"
# C... |
core_test.py | # Copyright 2017 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... |
test_fsm.py | """Unit tests for fsm.py"""
import datetime
import logging
import select
import socket
from struct import pack
import sys
import threading
import time
import pytest
from pynetdicom import AE, build_context, evt, debug_logger
from pynetdicom.association import Association
from pynetdicom import fsm as FINITE_STATE
fr... |
athenad.py | #!/usr/bin/env python3
import base64
import hashlib
import io
import json
import os
import sys
import queue
import random
import select
import socket
import threading
import time
from collections import namedtuple
from functools import partial
from typing import Any
import requests
from jsonrpc import JSONRPCResponseM... |
multi_processing2.py | from multiprocessing import Process
import os,time
# 子进程要执行的代码
def run_proc(name):
for i in range(10):
time.sleep(1)
print(f'Run child process {name}: {os.getpid()}-', i)
if __name__=='__main__':
print(f'Parent process: {os.getpid()}')
p = Process(target=run_proc, args=('test',))
print... |
services.py | # coding: utf-8
#
# This module implements background service management.
#
# Background service management features:
# - Proper starting and killing of background service.
# - proctitle definition.
# - SIGTERM and SIGHUP propagation.
# - SIGCHLD management. No zombie.
# - Child suicide on parent death.
#
# Two classes... |
test_bz2.py | from test import test_support as support
from test.test_support import TESTFN, _4G, bigmemtest, import_module, findfile
import unittest
from cStringIO import StringIO
import os
import subprocess
import sys
try:
import threading
except ImportError:
threading = None
bz2 = import_module('bz2')
from bz2 import B... |
test_crud.py | # Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
object_storage_service_benchmark.py | # Copyright 2016 PerfKitBenchmarker 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 appli... |
manager.py | #!/usr/bin/env python3
import datetime
import os
import signal
import subprocess
import sys
import traceback
from multiprocessing import Process
import cereal.messaging as messaging
import selfdrive.crash as crash
from common.basedir import BASEDIR
from common.params import Params, ParamKeyType
from common.text_window... |
stress.py | """
Run all of the unit tests for this package multiple times in a highly
multithreaded way to stress the system. This makes it possible to look
for memory leaks and threading issues and provides a good target for a
profiler to accumulate better data.
"""
from __future__ import print_function
import sys, os, gc, time,... |
client.py | import os
import sys
from ftplib import FTP, all_errors
from threading import Thread, Event
import requests
from tcp_latency import measure_latency
NAMENODE_ADDR = 'namenode'
def print_help():
print("""\nList of available commands:
init
create <file name/path in FS>
read <file name/path in FS> <fi... |
test_random.py | from __future__ import division, absolute_import, print_function
import warnings
import numpy as np
from numpy.testing import (
assert_, assert_raises, assert_equal, assert_warns,
assert_no_warnings, assert_array_equal, assert_array_almost_equal,
suppress_warnings
)
from numpy import ra... |
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... |
test_manager.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... |
airline-colors.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Johan Kanflo (github.com/kanflo)
#
# 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 li... |
gameState.py | from collections import deque
from os import system
import numpy as np
import win32ui
from grabber import Grabber
import time
import os
import sys
from directkeys import W,A,S,D,P,U,E,Q,T,L,I,R,F1,F2,F3,F11,NUM1,NUM2,NUM4,SPACE,G,E,PressKey,ReleaseKey,ReleaseKeys,PressAndRelease,PressAndFastRelease
from numpy import ge... |
tunnel.py | """Code for IP tunnel over a mesh
# Note python-pytuntap was too buggy
# using pip3 install pytap2
# make sure to "sudo setcap cap_net_admin+eip /usr/bin/python3.8" so python can access tun device without being root
# sudo ip tuntap del mode tun tun0
# sudo bin/run.sh --port /dev/ttyUSB0 --setch-shortfast
# sudo bin/r... |
multi_process_runner_test.py | # Copyright 2019 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... |
di_lan.py | import paramiko,time,datetime, re, os
import threading
from threading import Thread, Lock
_db_lock = Lock()
import sys
import time
ssh1 = paramiko.SSHClient()
ssh1.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh2 = paramiko.SSHClient()
ssh2.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh3 = param... |
SpotifyLyrics.pyw | #!/usr/bin/env python3
import sys
import webbrowser
import sentry_sdk
import configparser
import os
import re
import subprocess
import threading
import time
import pathvalidate
import pylrc
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QSystemTrayIcon, QAction, QMenu, qApp, QMessageBox
impor... |
rabbitmq.py | #! /usr/bin/env python
import time
import datetime
import functools
import logging
import pika
import threading
from contextlib import suppress
from pika.exceptions import StreamLostError, ChannelClosed, AMQPConnectionError, ConnectionWrongStateError
from sqapi.processing.exception import SqapiPluginExecutionError, Pl... |
a3c_test.py | # -*- coding: utf-8 -*-
import pdb
import tensorflow as tf
import os
import threading
import numpy as np
import h5py
import glob
import random
from networks.qa_planner_network import QAPlannerNetwork
from networks.free_space_network import FreeSpaceNetwork
from networks.end_to_end_baseline_network import EndToEndBase... |
obj.py | '''
from math import pi
class Circel(object):
def __init__(self,radius):
self.radius = radius
def getRadius(self):
return self.radius
def setRadius(self,value):
if not isinstance(value,(int, float) ): #python3 没有long
raise ValueError('wrong type')
self.radius = float(value)
def getArea(self):
retu... |
test_debug.py | import importlib
import inspect
import os
import re
import sys
import tempfile
import threading
from io import StringIO
from pathlib import Path
from unittest import mock
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseError, connection
from djan... |
apps.py | # based on: https://github.com/bokeh/bokeh/blob/0.12.16/examples/howto/server_embed/flask_embed.py
from django.apps import AppConfig
from bokeh.server.server import Server
from tornado.ioloop import IOLoop
from . import bk_sliders
from . import bk_config
def bk_worker():
# Note: num_procs must be 1; see e.g. fl... |
parallel_render.py | """
Small addon for blender to help with rendering in VSE.
It automates rendering with multiple instances of blender.
It should come up as "Parallel Render" in addons list.
Copyright (c) 2017 Krzysztof Trzcinski
"""
from bpy import props
from bpy import types
from collections import namedtuple
from enum ... |
thread_stopper.py | import threading
import inspect
import ctypes
import time
def _async_raise(tid, exctype):
"""raises the exception, performs cleanup if needed"""
if not inspect.isclass(exctype):
raise TypeError("Only types can be raised (not instances)")
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(ctypes.c_... |
tcp.py | # -*- coding: utf-8 -*-
'''
TCP transport classes
Wire protocol: "len(payload) msgpack({'head': SOMEHEADER, 'body': SOMEBODY})"
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import errno
import logging
import msgpack
import socket
import os
import weakref
import ti... |
gdb.py | import gdb
import re
import zmq
import msgpack
import threading
class GdbEvent():
def __init__(self, cmd, callback=None, callback_data=None):
self.cmd = cmd;
self.callback = callback
self.callback_data = callback_data
def __call__(self):
if self.callback != None:
ret... |
__init__.py | #
# pymldb
# Nicolas Kructhen, 2015-05-28
# Mich, 2016-01-26
# Copyright (c) 2013 Datacratic. All rights reserved.
#
from __future__ import absolute_import, division, print_function
from .version import __version__ # noqa
import pandas as pd
import requests
import json
from pymldb.util import add_repr_html_to_respon... |
main.py | import time
import multiprocessing
from renderer import base16_render_loop, base10_render_loop
from render_server import start_render_server
if __name__ == "__main__":
base16_render_process = multiprocessing.Process(target=base16_render_loop)
base16_render_process.start()
base10_render_process = multiproc... |
perf2.py | # perf2.py
# request/sec of a fast request
from threading import Thread
from socket import *
import time
sock = socket(AF_INET, SOCK_STREAM) # create a socket connection to the server
sock.connect(('localhost', 25000))
n = 0 # start global counter
def monitor():
global n
while True:
time.sleep(... |
test_celery.py | import threading
import pytest
pytest.importorskip("celery")
from sentry_sdk import Hub, configure_scope, start_transaction
from sentry_sdk.integrations.celery import CeleryIntegration
from sentry_sdk._compat import text_type
from celery import Celery, VERSION
from celery.bin import worker
try:
from unittest i... |
test_etcdlock.py | import unittest
import time
import etcd
from threading import Thread
from etcdlock.etcdlock import EtcdLock
class TestEtcdLock(unittest.TestCase):
def setUp(self):
self._thread_value = None
self._etcdlock = EtcdLock(key="key", id="id")
try:
self._etcdlock._client.delete("key")... |
robocode_test.py | import json
import os
import pickle
import shlex
import socket
import tempfile
import time
from threading import Thread
import numpy as np
from rlai.environments.robocode import RobocodeFeatureExtractor
from rlai.runners.trainer import run
def test_learn():
# set the following to True to update the fixture. if... |
test_sys.py | import unittest, test.support
from test.support.script_helper import assert_python_ok, assert_python_failure
import sys, io, os
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
import gc
import sysconfig
import platform
import locale
numruns = 0
try:
import threading
exc... |
main.py | #!/usr/bin/python3
# -*- coding:utf-8 -*-
from plumbum import cli
import time
import threading
import socket
from log import *
from influxdb import InfluxDBClient
import pandas as pd
import pyarrow.parquet as pq
import pyarrow as pa
from utils import set_last_time,get_last_time_config
import numpy as np
from parquetco... |
test_mongoexp.py | import six.moves.cPickle as pickle
import os
import signal
import subprocess
import sys
import threading
import time
import unittest
import numpy as np
import nose
import nose.plugins.skip
from hyperopt.base import JOB_STATE_DONE
from hyperopt.mongoexp import parse_url
from hyperopt.mongoexp import MongoTrials
from h... |
test_pdb.py | # A test suite for pdb; not very comprehensive at the moment.
import doctest
import os
import pdb
import sys
import types
import codecs
import unittest
import subprocess
import textwrap
from contextlib import ExitStack
from io import StringIO
from test import support
# This little helper class is essential for testin... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
run.py |
#!/usr/bin/env python3
# encoding: utf-8
"""
Usage:
python [options]
Options:
-h,--help 显示帮助
-a,--algorithm=<name> 算法
specify the training algorithm [default: ppo]
-c,--copys=<n> 指定并行训练的数量
... |
_streamer.py | '''Utilities for processing a continuous stream of data.
An input data stream goes through a series of operations.
The target use case is that one or more operations is I/O bound,
hence can benefit from multi-thread concurrency.
These operations are triggered via `transform`.
The other operations are typically light ... |
predict.py | import ctypes
import logging
import multiprocessing as mp
import numpy as np
from functools import reduce
from gunpowder.array import ArrayKey, Array
from gunpowder.ext import tensorflow as tf
from gunpowder.nodes.generic_predict import GenericPredict
from gunpowder.tensorflow.local_server import LocalServer
from oper... |
views.py | from django.shortcuts import render
from rest_framework import status
from rest_framework.generics import (
ListAPIView,
ListCreateAPIView,
ListAPIView,
RetrieveUpdateAPIView,)
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from rest_framework.decorat... |
CodigoAntigo.py | # -*- coding: utf-8 -*-
import serial # pip install pyserial
import threading
import time
import pyttsx3 # pip install pyttsx3
from vosk import Model, KaldiRecognizer
import pyaudio
import re
# chatbot
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
AMGbot = ChatBot("Assistente")
# text... |
qadapters.py | """
Part of this code is based on a similar implementation present in FireWorks (https://pypi.python.org/pypi/FireWorks).
Work done by D. Waroquiers, A. Jain, and M. Kocher.
The main difference wrt the Fireworks implementation is that the QueueAdapter
objects provide a programmatic interface for setting important attr... |
tasking.py | import asyncio
import threading
class Tasker:
def __init__(self, name="tasker"):
self.loop = asyncio.new_event_loop()
self.thread = threading.Thread(name=name, target=self._run, daemon=True)
def _run(self):
asyncio.set_event_loop(self.loop)
try:
self.loop.run_fore... |
__init__.py | #### PATTERN | WEB #################################################################################
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
####################################... |
launch_live.py | """ Script for running pyspace live controlling
.. image:: ../../graphics/launch_live.png
:width: 500
A script for running pyspace live. The script contains
a class to control the other related classes needed in the online mode,
and several methods that are used for the general startup of the suite.
"""
import s... |
rovio.py | #!/usr/bin/env python
# rovio.py v0.0.1 alpha -- text-mode Rovio client for Linux
#
# a Rudforce Intragalactic endeavor
# http://www.rudforce.com/
#
# copyleft 2008 Del Rudolph
# see http://www.gnu.org/copyleft/gpl.html for latest license
# Set up the important stuff
# need to make this an interactive, first-run thing... |
kinect.py | import ctypes
from turtle import distance
import _ctypes
import pygame
import pygame.freetype
import sys
import time
import math
import threading
from queue import Empty, Queue
from dataclasses import dataclass
from pykinect2 import PyKinectV2, PyKinectRuntime
from pykinect2.PyKinectV2 import *
from PyQt5.QtCore impor... |
runner.py | #!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# 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... |
anime.py | from .stream import Stream
from .cacher import Cacher
from .events import EventEmitter
from .handling import Result, Status
from typing import Union
from threading import Thread #, Semaphore, Lock
# from queue import Queue
import os, time
class Anime(EventEmitter):
def __init__(self, name: str):
EventEmitter.__init... |
control.py | import asyncio
import functools
import os
import json
import logging
from aiohttp import web
from threading import Thread
from opentrons import instruments
from opentrons.config import pipette_config
from opentrons.trackers import pose_tracker
from opentrons.config import feature_flags as ff
from opentrons.types impor... |
server.py | # -*- coding: utf-8 -*-
"""TLS server
"""
import os
import socket
import ssl
import time
from threading import Thread
from pyssldemo.peer import Peer
class Server(Peer):
def __init__(self, context=None, port=0):
super(Server, self).__init__(context)
self.context.sni_callback = self.sni_callbac... |
worker.py | import threading
tasks = []
MAX_TASKS = 1
def worker(task):
task.run()
def spawn_task(task):
while (len(tasks) >= MAX_TASKS):
tasks.pop().join()
t = threading.Thread(target=worker, args=[task])
t.start()
tasks.append(t)
def wait_tasks():
while (len(tasks) > 0):
tasks.pop(... |
game_modes.py | # For python 3 compatible
from __future__ import division, absolute_import, print_function
try: input = raw_input
except: pass
from getch import getch
import game_structure as gs
from musictools import (play_progression, random_progression,
random_key, isvalidnote, resolve_with_chords, chordname,
random_chor... |
semaphore_test.py | import threading
import time
from parameterized import parameterized
from hazelcast import HazelcastClient
from hazelcast.errors import (
DistributedObjectDestroyedError,
IllegalStateError,
)
from tests.integration.backward_compatible.proxy.cp import CPTestCase
from tests.util import get_current_timestamp, ra... |
main.py | from annotatePDF import *
from tkinter import *
from tkinter.ttk import *
from tkinter import filedialog
from PyInstaller.utils.hooks import collect_data_files
def functiona():
print("a")
def loadPDFfile(master):
master.filename = filedialog.askopenfilename(initialdir="/", title="Select file",
... |
euler357mp.py | """Prime generating integers
Problem 357
Consider the divisors of 30: 1,2,3,5,6,10,15,30.
It can be seen that for every divisor d of 30, d+30/d is prime.
Find the sum of all positive integers n not exceeding 100 000 000
such that for every divisor d of n, d+n/d is prime.
"""
# Multiprocessing version!!!!!
from euler... |
piotroski_greenblatt_more_piotroski.py | #!/usr/bin/env python3
# Para a análise, são utilizados princípios do Joseph D. Piotroski
# Estipulados no livro: "Value Investing: The Use of Historical Financial Statement Information to Separate Winners from Losers"
# No estudo original de Piotroski, ao longo de 20 anos (1976–1996), uma estratégia de investimento b... |
test_executors.py | import multiprocessing
import threading
import time
from datetime import timedelta
from unittest.mock import MagicMock
import pytest
import prefect
from prefect.utilities.executors import Heartbeat, timeout_handler
def test_heartbeat_calls_function_on_interval():
class A:
def __init__(self):
... |
benchmark.py | # Usage:
# PYTHONPATH=. DJANGO_SETTINGS_MODULE=sequences.test_postgresql_settings django-admin migrate
# PYTHONPATH=. DJANGO_SETTINGS_MODULE=sequences.test_postgresql_settings python benchmark.py
import threading
import time
import django
from django.db import connection
from sequences import get_next_value
django.... |
advanced.py | #!./venv_nano_local/bin/python
import unittest
from src.nano_block_ops import BlockGenerator, BlockAsserts, BlockReadWrite
from src.parse_nano_local_config import ConfigReadWrite, ConfigParser, Helpers
import time
import json
from multiprocessing import Process, Queue, Value
def is_not_in_config(module,qual_name, fun... |
test_read_parsers.py | from __future__ import print_function
from __future__ import absolute_import
#
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2015. It is licensed under
# the three-clause BSD license; see LICENSE.
# Contact: khmer-project@idyll.org
#
# Tests for... |
api.py | import pytorch_quik as pq
import multiprocessing as mp
from urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
from requests import Session
from typing import List, OrderedDict
from multiprocessing.connection import Connection
import pandas as pd
import numpy as np
from math import ceil
from pand... |
spider2.py | #coding=utf-8
# Download all of a model's pictures
#Usage:
# python3 spider2.py https://www.nvshens.com/girl/24282/ or python3 spider2.py https://www.nvshens.com/girl/25361/
# TODO:
#
import requests
from lxml import etree
import os
import sys
import time
# import multiprocessing
from multiprocessing import Poo... |
weather.py | #!/usr/bin/env python
from lib.forecast import DarkskyWeather
from lib.view import LCDView
from time import sleep
import threading
apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
weather = DarkskyWeather(apikey, 71.0281183, -8.1249335, units = 'auto', lang = 'en')
CONDITION_REFRESH_INTERVAL = 30
FORECAST_REFRESH_INTERVA... |
debug.py | import sys
import time
import threading
class Debug(object):
def __init__(self, arg):
super(Debug, self).__init__()
self.debug_verbose = arg
self.stop_spinner = False
def log(self, text, log=False, pre=True, new=False, end='\n'):
if log and pre:
if new: print(f"\n... |
main.py |
import time
import threading
import mido
import sys
import MRQ1
#import duplexPort
# globals
MIDI_PORT = False
MIDI_note_mapping = [None] * 127
MIDI_note_mapping[91] = [MRQ1.droneSnare,16]
MIDI_note_mapping[93] = [MRQ1.droneBongo,16]
MIDI_note_mapping[95] = [MRQ1.droneBass, 16]
MIDI_note_mapping[96] = [MRQ1.droneBru... |
__init__.py | import time
import datetime
import threading
from .hardware import Sensor, GPIOSwitch, GPIOState
from flask import Flask, request
from flask_restful import Api, Resource, abort
app = Flask(__name__)
app.secret_key = 'x6TbAJ5QLWPtDtElwDpZu64XjvcrVV_w'
app.config['DEBUG'] = True
class HardwareState(object):
def __... |
worker.py | import asyncio
import inspect
import threading
import time
import traceback
from functools import partial
from queue import Queue
from threading import Thread
from typing import Callable
from .yqueue import Queuey, from_coroutine
class Worker:
def __init__(self, n: int, queue_maxsize=0, ignore_exceptions=()):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.