source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
Bitmex_websocket_mod.py | import websocket
import threading
import traceback
from time import sleep
import json
import logging
import urllib
import math
from util.api_key import generate_nonce, generate_signature
# from bitmex_websocket import BitMEXWebsocket # , find_by_keys, order_leaves_quantity
# the copy of class from BitMEXWebsocket bu... |
parallel_run.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : parallel_run.py
# Author : Chi Han
# Email : haanchi@gmail.com
# Date : 17.10.2019
# Last Modified Date: 17.10.2019
# Last Modified By : Chi Han
#
# Welcome to this little kennel of Glaciohound!
import os
import ... |
presubmit_support.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Enables directory-specific presubmit checks to run at upload and/or commit.
"""
from __future__ import print_function
__versio... |
TESTE_Extração MagMax COVID - placas VWR.py | from opentrons.types import Point
import json
import os
import math
import threading
from time import sleep
metadata = {
'protocolName': 'V1_Extração MagMax COVID - placas VWR',
'adapted by': 'Ricardo Magalhães',
'author': 'Nick <ndiehl@opentrons.com',
'apiLevel': '2.3'
}
NUM_SAMPLES = 40 # start with... |
test_cached_property.py | # -*- coding: utf-8 -*-
"""
tests.py
----------------------------------
Tests for `cached-property` module.
"""
from time import sleep
from threading import Lock, Thread
import unittest
from cached_property import cached_property
class TestCachedProperty(unittest.TestCase):
def test_cached_property(self):
... |
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... |
bot.py | #! /usr/bin/env python3
#
# 4chan thread live shitposter IRC bot
import sys
import time
import re
import threading
import configparser
from socket import timeout
from io import StringIO
import textwrap
import requests
import basc_py4chan
import irc.client
from . import __version__
from .helper import clean_comment_b... |
cluster_monitor_test.py | # Copyright (c) 2018 PaddlePaddle 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 app... |
utils.py | from jaraco.functools import first_invoke
from collections import defaultdict
from fnmatch import fnmatch
import irc.client as irclib
import functools
import threading
import requests
import inspect
import codecs
import socket
import queue
import code
import time
import sys
import re
from log import log
global comman... |
api_server.py | import os
from flask import Flask, request
from company_jira import jira
from multiprocessing import Process
from gevent.pywsgi import WSGIServer
import project_issue_transition
import shlex
import requests
import threading
JIRA_CONTROL_SECRET = os.environ.get('JIRA_CONTROL_SECRET')
JIRA_CONTROL_PATH = os.environ.get... |
log_util_test.py | # Copyright 2014 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... |
common.py | '''
This is a extended unittest module for Kivy, to make unittests based on
graphics with an OpenGL context.
The idea is to render a Widget tree, and after 1, 2 or more frames, a
screenshot will be made and be compared to the original one.
If no screenshot exists for the current test, the very first one will be used.
... |
MainFrame.py | # -*- coding: utf-8 -*-
#
import os
import sys
import wx
import threading
from form.panel.FilePanel import FilePanel
from form.panel.MorphPanel import MorphPanel
from form.panel.MultiPanel import MultiPanel
from form.panel.ArmPanel import ArmPanel
from form.panel.LegPanel import LegPanel
from form.panel.CameraPanel im... |
http.py | import scrollphathd
import threading
from argparse import ArgumentParser
try:
from queue import Queue, Empty
except ImportError:
from Queue import Queue, Empty
from .action import Action
from .stoppablethread import StoppableThread
try:
import http.client as http_status
except ImportError:
import h... |
factory.py | """
RPyC connection factories: ease the creation of a connection for the common
cases)
"""
from __future__ import with_statement
import socket
from contextlib import closing
from functools import partial
import threading
try:
from thread import interrupt_main
except ImportError:
try:
from _thread impor... |
Run_CtaStrategy_NoUI_2.py | import multiprocessing
import sys
from time import sleep
from datetime import date, datetime, time
from logging import INFO
from vnpy.event import EventEngine
from vnpy.trader.setting import SETTINGS
from vnpy.trader.engine import MainEngine
from vnpy.trader.utility import load_json, send_dingding, send_weixin
from v... |
uow_status_listener.py | __author__ = 'Bohdan Mushkevych'
from threading import Thread
from amqp import AMQPError
from synergy.db.model.mq_transmission import MqTransmission
from synergy.db.model import unit_of_work
from synergy.db.dao.unit_of_work_dao import UnitOfWorkDao
from synergy.scheduler.scheduler_constants import QUEUE_UOW_STATUS
f... |
using_sprites.py | import pygame
import threading
import time
from lib import colors as color
# In Pygame, the Sprite class helps to detect collisions between
# sprites. This is not our case (yet) because there is only a bouncing
# ball in the screen, and the limits of the screen should not be
# considered as an huge sprite with a big h... |
threader3000.py | #!/usr/bin/python3
# Threader3000 - Multi-threader Port Scanner
# A project by The Mayor
# v1.0.7
# https://github.com/dievus/threader3000
# Licensed under GNU GPLv3 Standards. https://www.gnu.org/licenses/gpl-3.0.en.html
import socket
import os
import signal
import time
import threading
import sys
import subprocess... |
sqsmover.py | #!/usr/bin/env python3
import boto3
import argparse
import multiprocessing
def worker(num, profile, region, src, dst):
print('Worker Starting', num+1)
aws_region = region
src_queue_name = src
dst_queue_name = dst
print('Connecting to SQS...')
print('Source ' + src_queue_name)
print('Des... |
test_search.py | import pdb
import struct
from random import sample
import pytest
import threading
import datetime
import logging
from time import sleep
from multiprocessing import Process
import numpy
import sklearn.preprocessing
from milvus import IndexType, MetricType
from utils import *
dim = 128
collection_id = "test_search"
add... |
testServe.py | import sys
from time import sleep, time
import multiprocessing
import xsig
secUpdate = 5
mgr = multiprocessing.Manager()
dictionary = mgr.dict()
serverLocal = multiprocessing.Process(target=xsig.startServe, args=(60001, dictionary))
if __name__ == '__main__':
## multiprocessing server
serverLocal.start()
... |
ssh_paramiko.py | import posixpath
import select
import stat
import threading
from interface_meta import override
from omniduct.errors import DuctAuthenticationError
from omniduct.filesystems.base import FileSystemFileDesc
from omniduct.remotes.base import RemoteClient
from omniduct.utils.debug import logger
from omniduct.utils.proces... |
test_base_events.py | """Tests for base_events.py"""
import concurrent.futures
import errno
import math
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from test.test_asyncio import utils as test_utils
from test imp... |
th04.py | import time
import sys
from threading import Thread
from multiprocessing import Process,Manager
Rx = 2
Ry = 10**7
bt=[[],[]]
def demo1():
print("demo 1")
b = [[],[]]
for i in range(Rx):
for j in range(Ry):
b[i].append(i+j*2)
print("b[{}][{}] = {}".format(Rx-1,Ry-1,b[... |
watherApp.py | import tkinter as tk
from tkinter import *
import json, requests
import threading
import time
from tkinter.messagebox import showinfo
canCall = True
clock = 20
calls = 0
def callClock(max):
global canCall, calls
t = 0
while True:
if t != max:
time.sleep(1)
t += 1
e... |
testwindow.py | """Class for adding functionality to Settings modal window."""
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.modalview import ModalView
from kivy.properties import StringProperty, BooleanProperty, ListProperty, ObjectProperty
from kivy.clock import C... |
webcamvideostream.py | # import the necessary packages
from threading import Thread
import cv2
class WebcamVideoStream:
def __init__(self, src=0, name="WebcamVideoStream"):
# initialize the video camera stream and read the first frame
# from the stream
print('initializing VideoStream')
self.stream = cv2.VideoCapture(src, cv2.CAP_DS... |
naive_logger.py | import sys
import logging
import threading
from threaded_exception import RunsInAThread
logger = logging.getLogger(__name__)
logging.basicConfig(filename='naive.log', filemode='w', level=logging.DEBUG)
try:
foo = RunsInAThread("Runs on thread")
thread = threading.Thread(target=foo.run, args=())
thread.... |
data_loader.py | # Original code from https://github.com/araffin/robotics-rl-srl
# Authors: Antonin Raffin, René Traoré, Ashley Hill
import os
import queue
import time
from multiprocessing import Queue, Process
from threading import Thread
import cv2
import numpy as np
from joblib import Parallel, delayed
from config import IMAGE_WID... |
websockets.py | #!/usr/bin/env python
#
# Fermatum - lightweight IoP client
# Copyright (C) 2015 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 lim... |
rdd.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... |
vince_solver.py | import copy
import os
import random
import time
import traceback
from queue import Queue
from threading import Thread
import numpy as np
import scipy.stats
import torch
import torchvision.datasets as datasets
import tqdm
from dg_util.python_utils import drawing
from dg_util.python_utils import pytorch_util as pt_util
... |
base.py | import hashlib
import httplib
import os
import threading
import traceback
import socket
import urlparse
from abc import ABCMeta, abstractmethod
from ..testrunner import Stop
from protocol import Protocol, BaseProtocolPart
here = os.path.split(__file__)[0]
# Extra timeout to use after internal test timeout at which t... |
startup_task.py | from config.app import app as flask_app
from tasks.reaper_tasks import cve_fix_interrupted_at_start, update_deepfence_key_in_redis
from threading import Thread
from tasks.registry_images import update_all_registry_images
from models.setting import Setting
from utils.constants import AES_SETTING_KEY, CLOUD_CREDENTIAL_AE... |
test_worker.py | # -*- encoding: 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, Version 2.0
# (the ... |
daemons.py | #!/usr/bin/env python
from signal import SIGTERM
from os import remove, path, kill, getpid, chdir, dup2, fork, setsid, umask
from sqlalchemy.exc import OperationalError
from time import sleep
from datetime import timedelta, datetime
from pytz import timezone
from perception.database.models import OpenvasAdmin,\
Ope... |
rReadSensors.py | #!/usr/bin/env python
from gpio_utils import *
from Constants import *
from rTSL2561 import *
from rBME280 import *
import socket
import time
import csv
import threading
import sys
import os
from rMemini import *
from rPixieLog import pixieLog
import logging
from rawADC import readADC
from Audio import... |
tello.py | import socket
import threading
import time
import numpy as np
import h264decoder
class Tello:
"""Wrapper class to interact with the Tello drone."""
def __init__(self, local_ip, local_port, imperial=False, command_timeout=.3, tello_ip='192.168.10.1',
tello_port=8889):
"""
... |
main.py | # Date: 2021/7/19
# Author: Lan_zhijiang
# Description: AntiDDoS的Base
import queue
import threading
import time
from log import Log
from anti_ddos.collector import Collector
from anti_ddos.analyzer import Analyzer
from anti_ddos.monitor import Monitor
class Base:
def __init__(self):
self.log = Log()
... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
import logging
import getpass
import multiprocessing
import fnmatch
import copy
import os
import hashlib
import re
import types
import threading
import time
import traceback
import sys
import signal
from random import randint
# Import th... |
udp_endpoint.py | #! /usr/bin/env python
# _*_coding:utf-8 -*_
import socket
import time
import threading
import json
import psutil
class UDPEndPoint(threading.Thread):
def __init__(self, port=8888, handler=None):
self.buff_size = 4096
self.handler = handler
self.port = port
self.udp_socket = self.... |
test_threading.py | import gc
from threading import Thread
import pytest
from sentry_sdk import configure_scope, capture_message
from sentry_sdk.integrations.threading import ThreadingIntegration
@pytest.mark.forked
@pytest.mark.parametrize("integrations", [[ThreadingIntegration()], []])
def test_handles_exceptions(sentry_init, captu... |
eapol_test.py | #!/usr/bin/env python2
#
# eapol_test controller
# Copyright (c) 2015, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import argparse
import logging
import os
import Queue
import sys
import threading
logger = logging.getLogger()
dir = os... |
http_server.py | import webview
import sys
import threading
try:
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
from http.server import SimpleHTTPRequestHandler, HTTPServer
"""
This example demonstrates how a trivial application can ... |
datasets.py | #
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/
# Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch>
#
from bisect import bisect_left
from collections import OrderedDict, deque
from functools import partial
import gzip
from itertools import islice
import os
from os import path
impo... |
servermocha.py | from flcore.clients.clientmocha import clientMOCHA
from flcore.servers.serverbase import Server
from utils.data_utils import read_client_data
from threading import Thread
import itertools
import torch
import wandb
class MOCHA(Server):
def __init__(self, device, dataset, algorithm, model, batch_size, learning_rate,... |
videoOut.py | from threading import Thread
import cv2
class VideoShow:
# """
# Class that continuously shows a frame using a dedicated thread.
# """
def __init__(self, frame=None):
self.frame = frame
self.stopped = False
def start(self):
Thread(target=self.show, args=()).start()
... |
test_ClientSocket.py | import socket
import threading
import unittest
from ev3dev2simulator.config.config import get_simulation_settings, load_config
from ev3dev2simulator.connection.message.RotateCommand import RotateCommand
class TestClientSocket(unittest.TestCase):
def setUp(self) -> None:
load_config(None)
def run_f... |
urc.py | #!/usr/bin/env python3
#
# urc.py -- one long long horrible python script
#
# monolithic urc hub in python
#
# public domain
#
# for hexchat
__module_name__ = "urc"
__module_version__ = "0.1"
__module_description__ = "urc network plugin"
import binascii
import struct
import asyncio
from random import randrange, Rand... |
smiler.py | import os
import subprocess
import re
import shutil
import threading
import signal
import logging
import time
from smiler.config import config
from smiler.granularity import Granularity
from smiler.instrumenting import manifest_instrumenter
from smiler.libs.libs import Libs
from smiler.instrumenting.apkil.smalitree imp... |
main.py | import os
import threading
import requests
from bs4 import BeautifulSoup as bs
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
# 파일확장자 2020-12-04 업데이트
fileExtensions = {
'Ada': 'ada',
'Algol 68': 'a68',
'Assembly (32bit)': '32bit.asm',
'Assembly (64bit)': '64bi... |
spadesRun.py | #!/usr/bin/env python3
from olctools.accessoryFunctions.accessoryFunctions import dotter, get_version, printtime, run_subprocess, \
write_to_logfile
from threading import Thread
from subprocess import call
from queue import Queue
import threading
import os
__author__ = 'adamkoziol'
class Spades(object):
def ... |
two_channel_plot.py | #!/usr/bin/python3
"""
Plots both channels of the Attys in two different windows. Requires pyqtgraph.
"""
import threading
from time import sleep
import sys
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
import pyattyscomm as c
ch1 = c.AttysComm.INDEX_Analogue_channel_1
ch2 = c.A... |
__init__.py | """Tests for the CloseableQueue class.
These tests build on the unit tests provided for the Queue module
in order to perform on the CloseableQueue queue classes
both regression testing of basic queue functionality
and testing of the added functionality.
The ``Queue`` module's test code is included in the file ``test_... |
test_client.py | # Copyright 2013-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
runapp.py | """
Main module for the program excecution.
Made with ❤️ by kalaLokia
"""
import threading
from app import APPLOG
from app.base import App, MainApplication
from core.load_database import loadDatabase
if __name__ == "__main__":
APPLOG.append("Made with ❤️ by Fortune Branch")
APPLOG.append("... |
draw.py | import pygame
import sys
import math
import time
import threading
from WizardVsWorld.assets.image_loader import *
from WizardVsWorld.assets.sounds.sound_loader import *
from WizardVsWorld.classes.const import TileTexture, TileTint, ENTITIES
from WizardVsWorld.classes.entity import Player, Archer, Knight, GreatKnight, G... |
wsRemoteService.py | """
An RPC server base class for encapsulating a service class and receiving requests that
will call that encapsulated class. This is part of a remote service that communicates
with the projectServer.
"""
import os
import sys
import re
import time
import json
import pickle
import logging
import argparse
import threadin... |
loader.py | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
hub.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import copy
import os
import select
import socket
import threading
import time
import uuid
import warnings
import queue
import xmlrpc.client as xmlrpc
from urllib.parse import urlunparse
from astropy import log
from .constants import SAMP_STATUS_OK
fro... |
test_structured_logging.py | import asyncio
import contextlib
import json
import logging
import math
import os
import signal
import threading
import time
from datetime import datetime
from uuid import UUID
import pytest
from nivacloud_logging.log_utils import setup_logging, LogContext, auto_context, log_exceptions
def _readout_json(capsys):
... |
handler.py | import os.path
import socket
import time
import tornado.httpserver
import tornado.web
import tornado.websocket
import queue
from threading import Thread
class WSHandler(tornado.websocket.WebSocketHandler):
def initialize(self, options, q_in, q_out):
self.options = options
self.q_in = q_in
... |
admin.py | # Copyright (c) 2021-2022, NVIDIA CORPORATION. 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 ... |
keylogger.py | import os
from pynput.keyboard import Listener
import time
import threading
class Keylogger():
keys = []
count = 0
flag = 0
path = os.environ['appdata'] +'\\processmanager.txt'
#path = 'processmanager.txt'
def on_press(self, key):
self.keys.append(key)
self.count += 1
... |
test_base.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import time
import threading
from nose.tools import assert_equals
from ...backends.base import BackendBase
class BackendStub(BackendBase):
pass
def test_backend_has_name():
backend = BackendStub(None, "mock")
assert_equals(repr(backend), "<backend: m... |
logcat.py | import subprocess
import logging
import copy
from .adapter import Adapter
class Logcat(Adapter):
"""
A connection with the target device through logcat.
"""
def __init__(self, device=None):
"""
initialize logcat connection
:param device: a Device instance
"""
s... |
read_new_rfid.py | #!/usr/bin/env python
#
# Concrete display implementation using Nokia5110
#
#
import sys
import time
import serial
import config
appDebug = True
class RFIDReader():
serialInterfaceDevice = "/dev/ttyAMA0"
serialInterfaceDeviceBaud = 9600
# represents one RFID Tag
rfidTag = ""
ID = ""
tagID = ... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import traceback
import asyncore
import weakref
import platform
import functools
ssl = support.import_... |
events.py | import Queue
import time
from threading import Thread
class ActiveThreadListItem():
def __init__(self, thread, name):
self.thread = thread
self.name = name
def getThread(self):
return self.thread
def getName(self):
return self.name
class EventObject():
def __init__(... |
process.py | from multiprocessing import Process
import os
def run_proc(name):
print('Run child process %s(%s)' % (name, os.getpid()))
if __name__ == '__main__':
print('Parent process %s.' % os.getpid())
# 两个参数,target表示子进程要执行的代码,args是一个元组,表示传入target函数的参数
p = Process(target=run_proc, args=('test',))
# 启动进程
... |
track.py | import sys
sys.path.insert(0, './yolov5')
from yolov5.utils.datasets import LoadImages, LoadStreams
from yolov5.utils.general import check_img_size, non_max_suppression, scale_coords
from yolov5.utils.torch_utils import select_device, time_synchronized
from deep_sort_pytorch.utils.parser import get_config
from deep_sor... |
UR_ActivateMonitoring.py | # This script creates a thread to monitor the position and other variables from a real UR robot
# With this script active, RoboDK will create a new target when the robot is moved a certain tolerance
#
# More information about the RoboDK API here:
# https://robodk.com/doc/en/RoboDK-API.html
# Press F5 to run the script
... |
coref_model.py | from . import metrics
from . import conll
from . import coref_ops
from . import util
from . import bert
import logging
import h5py
import tensorflow_hub as hub
import os
import sys
import operator
import random
import math
import json
import threading
import numpy as np
import tensorflow.compat.v1 as tf
tf.disable_v2_... |
main.py | import tkinter
from tkinter import *
from PIL import ImageTk, Image
from tkinter import messagebox
import tkinter as tk
from datetime import datetime
from tkcalendar import Calendar, DateEntry
from tkinter import messagebox
import datetime
import time
from playsound import playsound
from tkinter import filedialog
from ... |
GO_Elite.py | ###GO-Elite
#Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California
#Author Nathan Salomonis - nsalomonis@gmail.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 ... |
main.py | from trade_client import *
from store_order import *
from logger import logger
from load_config import *
from new_listings_scraper import *
from collections import defaultdict
from datetime import datetime, time
import time
import threading
import json
from json import JSONEncoder
import os.path
import sys, os
old_... |
spark.py | # Copyright 2020 Maintainers of OarphPy
#
# 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 ... |
running.py | # -*- coding: utf-8 -*-
"""Code for maintaining the background process and for running
user programs
Commands get executed via shell, this way the command line in the
shell becomes kind of title for the execution.
"""
import collections
import logging
import os.path
import re
import shlex
import signal
import sub... |
clientserver.py | # -*- coding: utf-8 -*-
"""
pyzco.clientserver
~~~~~~~~~~~~~~~~~~
Implements Client and Server agents.
:copyright: 2013 by Hernan E. Grecco, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import inspect
import threading
import traceback
from c... |
threads.py | #!/usr/bin/env python3
"""
threads.py: shows that Python threads are slower than
sequential code for CPU-intensive work.
"""
import os
import sys
from queue import SimpleQueue
from time import perf_counter
from typing import NamedTuple
from threading import Thread
from primes import is_prime, NUMBERS
class PrimeRes... |
test_threading_local.py | import unittest
from doctest import DocTestSuite
from test import support
import weakref
import gc
# Modules under test
_thread = support.import_module('_thread')
threading = support.import_module('threading')
import _threading_local
class Weak(object):
pass
def target(local, weaklist):
weak = Weak()
lo... |
mtime_file_watcher.py | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
schedule.py | """Leaf 任务计划与调度"""
import uuid
import time
import threading
from typing import Dict, Callable, Optional, Generator, NoReturn
# 时间间隔常量定义
MINUTE = 60 # 分钟间隔
HOUR = MINUTE * 60 # 小时间隔
DAY = HOUR * 24 # 每天间隔
WEEK = DAY * 7 # 一周间隔
MONTH = DAY * 30 # 每月间隔
class Worker:
"""工作任务类"""
def __repr__(self) -> str... |
test_tomcat.py | # (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
import os
import threading
import time
from types import ListType
import unittest
import mock
# 3p
from nose.plugins.attrib import attr
# project
from aggregator import MetricsAggregator
import logging... |
test_rejoin.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import multiprocessing
import os
import subprocess
import sys
import time
import unittest
from maro.communication import Proxy, SessionMessage, SessionType
from tests.communication.utils import get_random_port
PROXY_PARAMETER = {
"group_na... |
test_socket.py | zaimportuj unittest
z test zaimportuj support
zaimportuj errno
zaimportuj io
zaimportuj itertools
zaimportuj socket
zaimportuj select
zaimportuj tempfile
zaimportuj time
zaimportuj traceback
zaimportuj queue
zaimportuj sys
zaimportuj os
zaimportuj array
zaimportuj platform
zaimportuj contextlib
z weakref zaimportuj pr... |
tests.py | import os
import shutil
import sys
import tempfile
import threading
import time
import unittest
from datetime import datetime, timedelta
from io import StringIO
from pathlib import Path
from urllib.request import urlopen
from django.core.cache import cache
from django.core.exceptions import SuspiciousFileOperation
fro... |
train_pg_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany
"""
import numpy as np
import tensorflow as tf
import gym
import logz
import os
import time
im... |
candy3.py | #!/usr/bin/env python
from atexit import register
from random import randrange
from threading import BoundedSemaphore, Lock, Thread
from time import sleep, ctime
lock = Lock()
MAX = 5
candytray = BoundedSemaphore(MAX)
def refill():
lock.acquire()
print('Refilling candy...', end=' ')
try:
... |
session_test.py | # Copyright 2015 Google 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 applicable law or a... |
start_server.py | from multiprocessing import Process
import uvicorn
from gevent.pywsgi import WSGIServer
from dotenv import load_dotenv
from io import StringIO
from os.path import join, dirname
import os
proc = None
app = None
def get_port():
if port:
return port
else:
raise Exception("Port can be not Null")
... |
eventEngine.py | # encoding: UTF-8
# 系统模块
from Queue import Queue, Empty
from threading import Thread
from time import sleep
from collections import defaultdict
# 第三方模块
from qtpy.QtCore import QTimer
# 自己开发的模块
from eventType import *
########################################################################
class EventEngine(object)... |
data.py | """
Represents A1s database and database access functions.
In the future, this may change to use a different backend, possibly dramatically.
Hopefully, the access functions are a good api so nothing else has to change when this happens
For now, the database is in memory.
We use dict data structures (KV) with the expec... |
main.py | # Copyright (c) 2020, Md Imam Hossain (emamhd at gmail dot com)
# see LICENSE.txt for details
import os
import sys
import math
import re
import subprocess
import json
import requests
import requests.exceptions
import urllib.request
import threading
import io
import wx
import wx.lib.agw.hyperlink as hl
class SnapIm... |
phy_serial.py | # External Dependencies
import serial
import queue
import time
import threading
from binascii import hexlify, unhexlify
# Internal Dependencies
from pyroot import RootPhy
from .packet import Packet
class RootSerial(RootPhy): # TODO: Make RootPhy ABC
RX_PACKET_LEN = (Packet.PACKET_LEN * 2) + 1
TX_PACKET_LEN =... |
camera_coco.py | import cv2
import numpy as np
import tensorflow as tf
from PIL import Image
import tensorflow_hub as hub
from tensorflow.python.saved_model import tag_constants
from time import time
from threading import Thread, Event
from PIL import Image, ImageDraw, ImageFont
# Draws a list of bounding boxes and labels to image and... |
python_test_mt.py | #!/usr/bin/python
import threading
import sys
import time
from Queue import Queue
DATA_LENGTH = 10000000
def count_binary_ones(n):
result = 0
while n:
result += n % 2
n = n / 2
return result
def count_ones(q):
q.put(sum([count_binary_ones(n) for n in q.get()]))
def main():
threa... |
kmkahip.py |
'''
Pipeline to:
-create knn graphs from dataset.
-recursively partitions dataset using KaHIP in parallel.
-learn tree of neural networks in tandem with partitions tree.
'''
import _init_paths
import sys
import os
import os.path as osp
import pickle
import create_graph
import torch
import numpy as np
... |
_kit2fiff_gui.py | """Mayavi/traits GUI for converting data from KIT systems."""
# Authors: Christian Brodbeck <christianbrodbeck@nyu.edu>
#
# License: BSD-3-Clause
from collections import Counter
import os
import queue
import sys
from threading import Thread
import numpy as np
from mayavi.core.ui.mayavi_scene import MayaviScene
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.