source
stringlengths
3
86
python
stringlengths
75
1.04M
vntq.py
# encoding: UTF-8 """ 对接天勤行情的网关接口,可以提供国内期货的报价/K线/Tick序列等数据的实时推送和历史仿真 使用时需要在本机先启动一个天勤终端进程 天勤行情终端: http://www.tq18.cn """ import json import threading import tornado from tornado import websocket from sortedcontainers import SortedDict ######################################################################## class TqA...
Milestone3.py
from concurrent.futures import thread from fileinput import filename import threading import datetime import time import csv from numpy import append import yaml outputStack = dict() outputEvent = dict() with open('Milestone3A.yaml', 'r') as file: data = yaml.safe_load(file) output = open("Milestone3A.txt", "w") ...
test_server.py
import asyncio import json import os import time import urllib.parse import uuid import sys from http import HTTPStatus from multiprocessing import Process, Manager from multiprocessing.managers import DictProxy from pathlib import Path from typing import List, Text, Type, Generator, NoReturn, Dict, Optional from unitt...
bp_performance.py
#!/usr/bin/env python import argparse import csv import datetime import io import itertools import json import numpy import pygal import time import threading import traceback import sys from collections import defaultdict, deque, Counter, namedtuple from ciso8601 import parse_datetime from concurrent.futures import Th...
Blocky-autoPWN.py
#!/usr/bin/python3 import zipfile from pwn import * # pip3 install pwn banner = """ ____ __ __ __ ____ _ ___ __ / __ )/ /___ _____/ /____ __ ____ ___ __/ /_____ / __ \ | / / | / / / __ / / __ \/ ___/ //_/ / / /_____/ __ `/ / / / __/ __ \/ /_/ ...
main.py
import sys from PyQt5 import uic from PyQt5.QtCore import QObject, pyqtSignal, QTimer, QTime, Qt from PyQt5.QtWidgets import QApplication, QMainWindow, QInputDialog, \ QTableWidgetItem from PyQt5.QtGui import QIntValidator import sqlite3 import threading import make_db from random import choice, randint import time...
test_bootstrap_link_via_app_data.py
from __future__ import absolute_import, unicode_literals import os import sys from stat import S_IRGRP, S_IROTH, S_IRUSR, S_IXUSR from threading import Thread import pytest from virtualenv.discovery.py_info import PythonInfo from virtualenv.info import fs_supports_symlink from virtualenv.run import cli_run from virt...
serialization.py
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import (verbose, import_module, cpython_only, requires_type_collecting) from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys _thread = import_module('_thread') thr...
wss_app.py
#!-*-coding:utf-8 -*- #@TIME : 2018/6/11/0011 15:32 #@Author : Nogo import math import time import talib import numpy as np import logging from collections import defaultdict from threading import Thread from fcoin import Fcoin from WSS.fcoin_client import fcoin_client from balance import balance import config ...
o_gui_user.py
#!/usr/bin/env python3 import socket import os import ast from threading import Thread import random as r import time import datetime as dt import paho.mqtt.client as mqtt # import matplotlib.pyplot as plt from drawnow import * import subprocess as sp import config import smtplib import record as rc import paramiko h...
command_listener.py
"""Support for voice command recording.""" import json import math import os import subprocess import threading import uuid from datetime import timedelta from typing import Any, Dict, List, Optional, Type import webrtcvad from rhasspy.actor import RhasspyActor, WakeupMessage from rhasspy.audio_recorder import AudioD...
manual_ctrl.py
#!/usr/bin/env python3 # set up wheel import array import os import struct from fcntl import ioctl # Iterate over the joystick devices. print('Available devices:') for fn in os.listdir('/dev/input'): if fn.startswith('js'): print(' /dev/input/%s' % (fn)) # We'll store the states here. axis_states = {} bu...
use-miltipro.py
#!/usr/bin/env python3 # ! -*- coding: utf-8 -*- 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()) p = Process(target=run_proc, args=('test',)) ...
properties.py
import logging, subprocess import math import threading, random class Properties(object): useKliepCVSigma = 0 kliepDefSigma = 0.00 kliepParEta = 0.0 kliepParLambda = 0.00 kliepParB = 0 kliepParThreshold = 0.0 useSvmCVParams = 1 svmDefGamma = 0.0001 svmDefC = 131072 ENSEMBLE_SIZE = 0 CONFTHRESHOLD = 0.0 C...
views.py
from django.shortcuts import render import pyrebase import json import os.path import datetime import socket import time import threading def getData(): scriptpath = os.path.dirname(__file__) filename = os.path.join(scriptpath, 'Unknownn') config = { "apiKey": "AIzaSyA19-RiG_V7X-ugMLPbVZG-a02tTDROPgQ", "aut...
darkfb_wrd_123.py
# -*- coding: utf-8 -*- import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize from multiprocessing.pool import ThreadPool try: import mechanize except ImportError: os.system('pip2 install mechanize') else: try: import requests except ImportEr...
loop.py
import sys import time import json import threading import traceback import collections try: import Queue as queue except ImportError: import queue from . import exception from . import _find_first_key, flavor_router class RunForeverAsThread(object): def run_as_thread(self, *args, **kwargs): t =...
videostream.py
# import the necessary packages from threading import Thread import cv2 import time class WebcamVideoStream: def __init__(self, src=0, name="WebcamVideoStream"): # initialize the video camera stream and read the first frame # from the stream self.stream = cv2.VideoCapture(src) (self.grabbed, self.frame) = se...
light_reaper.py
# Copyright 2016-2018 CERN for the benefit of the ATLAS collaboration. # # 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...
ParentProcess.py
# -*- coding: utf-8 -*- __author__ = 'matth' import os import sys if __name__ == '__main__': #python issue 18298 if sys.platform.startswith('win'): #When running under pythonw.exe you can end up with 'invalid' files for stdin+stdout+stder #For this reason, I just open devnull for them #...
ardundzdf.py
# -*- coding: utf-8 -*- # Python3-Kompatibilität: from __future__ import absolute_import # sucht erst top-level statt im akt. Verz. from __future__ import division # // -> int, / -> float from __future__ import print_function # PYTHON2-Statement -> Funktion from kodi_six import xbmc, xbmcaddon, xbmcplugin, xbmcg...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional from PyQt5.QtCore i...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Baricoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including with...
pt_opt_eva.py
from multiprocessing import Process import os import subprocess import pandas as pd from rdkit import Chem from rdkit.Chem import Descriptors from rdkit import DataStructs from random import shuffle import numpy as np import time def read_dev_output(file_name): # read generated SMILES in seq2seq dev output file ...
unity_stream_plugin.py
''' (*)~---------------------------------------------------------------------------------- Author: Tim Cofala and Henrik Reichmann This backend is based on the fake_backend created by Pupil Labs and was extended to allow receiving video data from an Unity application via a network stream. ------------------------------...
upnp.py
import logging import threading from queue import Queue from typing import Optional try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) class UPnP: thread: Optional[threading.Thread] = None queue: Queue = Queue() def __init__(self): def run(): t...
test_concurrent_transaction.py
from test.integration.base import DBTIntegrationTest, use_profile import threading from dbt.adapters.factory import FACTORY def get_adapter_standalone(config): cls = FACTORY.adapter_types[config.credentials.type] return cls(config) class BaseTestConcurrentTransaction(DBTIntegrationTest): def reset(self...
test_pubsub.py
from pyzac import pyzac_decorator from pyzac import started_processes from pyzac import assertlist from pyzac import debuglist from pyzac import partial_sub from pyzac import add_debug_info from pyzac import create_pub_func from pyzac import create_sub_socket from multiprocessing import Process import zmq from time imp...
autocast_variable_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...
GUI.py
from Sudoku import sudoku from tkinter import * from tkinter import Tk,simpledialog from threading import Thread from time import sleep as nap class GUI(sudoku): def __init__(self,root): super().__init__() self.root = root self.root.title('Sudoku AI') self.width,self.height = 455,60...
base_events.py
"""Base implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a c...
TWCManager.py
#! /usr/bin/python3 ################################################################################ # Code and TWC protocol reverse engineering by Chris Dragon. # # Additional logs and hints provided by Teslamotorsclub.com users: # TheNoOne, IanAmber, and twc. # Thank you! # # For support and information, please re...
hello.py
import time import threading def main(): threads = [ threading.Thread(target=greeter, args=("Michael", 10), daemon=True), threading.Thread(target=greeter, args=("Sarah", 5), daemon=True), threading.Thread(target=greeter, args=("Zoe", 2), daemon=True), threading.Thread(target=greete...
Hiwin_RT605_ArmCommand_Socket_20190627173345.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * from std_msgs.msg import Int32MultiArray import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端...
producers_consumers.py
from threading import Semaphore, Thread, current_thread from Queue import Queue from itertools import chain def produce(buffer, mutex, space_free_sem, space_available_sem): for num in xrange(1000): space_free_sem.acquire() mutex.acquire() buffer.put(num) mutex.release() s...
main_sparse_multi_gpus.py
from collections import defaultdict import math import os import sys import time import datetime import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parallel import DistributedDataParallel from tqdm.auto import tqdm from numpy import random from torch.nn.parameter import...
analyse_simple_simulated.py
# -*- coding: utf-8 -*- """ Created on Tue Jan 2 13:04:57 2018 @author: pscog """ #import sys #import os #sys.path.append(os.path.dirname(os.getcwd())) from multiprocessing import Process import PyThurstonian from PyThurstonian import thurstonian, hdi import pandas as pd import seaborn as sns import matplot...
instaboom.py
import threading import argparse import requests import random import time import sys class Instaboom: s = requests.session() def __init__(self, proxy): self.s.headers = { 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-US,en;q=0.9', 'Referer': 'https://www.instagram.com', 'Origin': 'htt...
extended-monitoring.py
#!/usr/bin/env python3 # Copyright 2021 Flant JSC # Licensed under the Deckhouse Platform Enterprise Edition (EE) license. # See https://github.com/deckhouse/deckhouse/blob/main/ee/LICENSE from concurrent.futures.thread import ThreadPoolExecutor from itertools import chain from threading import Thread from time import...
workflow_manager.py
import subprocess import time import re import sys import threading import multiprocessing as mp import csv import os import tarfile import sqlite3 import importlib.util from datetime import datetime # import Classifier knn_classifier_spec = importlib.util.spec_from_file_location('KNN_Classifier', './Classifiers/KNN_C...
ait_bsc.py
#!/usr/bin/env python # Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT) # Bespoke Link to Instruments and Small Satellites (BLISS) # # Copyright 2016, by the California Institute of Technology. ALL RIGHTS # RESERVED. United States Government Sponsorship acknowledged. Any # commercial use must...
upgrader.py
import os import git from threading import Thread from time import sleep os.environ["BOT_UPGRADE"] = "no" def threaded_function(): while(True): if os.getenv("BOT_UPGRADE") == "yes": repo = git.Repo(os.getcwd()) o = repo.remotes.origin o.pull() sleep(1) def sta...
action_component.py
from .component import Component from threading import Thread class ActionComponent(Component): def __init__(self, device_id, **kwargs): super().__init__(device_id, **kwargs) self.action_name = None self.action_config = None def init_action(self, action_name, action_config): s...
threadmgr.py
# -*- encoding: utf-8 -*- import contextlib import six import socket import sys import threading class TestThread(threading.Thread): """ A Thread class that save exceptions raised by the thread. """ def __init__(self, exnlist, *args, **kwargs): self._exnlist = exnlist super(TestThread, self)....
graphic_user_interface.py
_SCRIPT_VERSION = "Script version: Nuthouse01 - 1/24/2021 - v5.06" # This code is free to use and re-distribute, but I cannot be held responsible for damages that it may or may not cause. ##################### # pyinstaller --onefile --noconsole graphic_user_interface.py # to get better GUI responsiveness, I need t...
load_test_runner.py
from eventlet import greenpool, sleep from multiprocessing import Process class LoadTestRunner(object): def __init__(self, load_pattern): self.load_pattern = load_pattern def run(self, api_caller, *args, **kwargs): print self.load_pattern.get_steps() for step in self.load_pattern.get_...
lambda_executors.py
import base64 import contextlib import glob import json import logging import os import re import subprocess import sys import threading import time import traceback import uuid from multiprocessing import Process, Queue from typing import Any, Callable, Dict, List, Optional, Tuple, Union from localstack import config...
cls_ServerTCP.py
import socket from time import sleep import threading class cls_ServerTCP (threading.Thread) : def __init__(self, ipServerToConnect, portServerToConnect) : threading.Thread.__init__(self) self.ipServer = ipServerToConnect self.portServer = portServerToConnect self.lMessageToClient ...
python_lang.py
""" **Source** Kevin Markham https://github.com/justmarkham/python-reference """ ############################################################################### # Import libraries # ---------------- # # 'generic import' of math module import math math.sqrt(25) # import a function from math import sqrt sqrt(25) ...
main.py
from __future__ import print_function import argparse import os import torch import torch.multiprocessing as mp import my_optim from envs import create_atari_env from model import ActorCritic from test import test from train import train # Based on # https://github.com/pytorch/examples/tree/master/mnist_hogwild # T...
example_test.py
# Need Python 3 string formatting functions from __future__ import print_function import os import sys from threading import Thread try: import IDF from IDF.IDFDUT import ESP32DUT except ImportError: # The test cause is dependent on the Tiny Test Framework. Ensure the # `TEST_FW_PATH` environment varia...
rc_driver_new.py
import threading import SocketServer import serial import cv2 import numpy as np import math # distance data measured by ultrasonic sensor sensor_data = " " class NeuralNetwork(object): def __init__(self): self.model = cv2.ANN_MLP() def create(self): layer_size = np.int32([38400, 32, 4]) ...
test_payload.py
# -*- coding: utf-8 -*- """ :codeauthor: Pedro Algarvio (pedro@algarvio.me) tests.unit.payload_test ~~~~~~~~~~~~~~~~~~~~~~~ """ from __future__ import absolute_import, print_function, unicode_literals import copy import datetime import errno import logging import threading import time import salt.except...
views.py
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from .models import Leads from django.contrib.auth import authenticate, login as authlogin, logout as authlogout from django.urls import reverse from django.contrib im...
thread_safe_datastore.py
import threading from contextlib import contextmanager from pymodbus.datastore.store import BaseModbusDataBlock class ContextWrapper(object): ''' This is a simple wrapper around enter and exit functions that conforms to the pyhton context manager protocol: with ContextWrapper(enter, leave): d...
datasets.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Dataloaders and dataset utils """ import glob import hashlib import json import os import random import shutil import time from itertools import repeat from multiprocessing.pool import Pool, ThreadPool from pathlib import Path from threading import Thread from zipfile im...
btcomm.py
import socket import sys from time import sleep from .utils import register_spp, get_mac, get_adapter_powered_status, get_adapter_discoverable_status, get_adapter_pairable_status, get_paired_devices, device_pairable, device_discoverable, device_powered, string_to_bytes from .threads import WrapThread if sys.version_...
gui3.py
import sys import os from PyQt5 import QtGui from PyQt5 import QtCore import functools import numpy as np import random as rd import matplotlib matplotlib.use("Qt4Agg") from matplotlib.figure import Figure from matplotlib.animation import TimedAnimation from matplotlib.lines import Line2D from matplotlib.backends.backe...
map_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...
launcher.py
import multiprocessing as mp import multiprocessing.managers as managers import time import numpy as np import pandas as pd import utils import datasets import os import errno import signal from collections import Sequence from itertools import product import progressbar ############################## # Experiment...
__init__.py
#!/usr/bin/env python # vim: set fdm=marker: # Imports {{{1 from __future__ import print_function, annotations from collections import defaultdict from enum import Enum, auto from select import select from typing import Iterator threading = globals()['__builtins__'].__dict__['__import__']("threading") hashlib = globa...
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...
robot_ui.py
import time, redis import digitalio import board from PIL import Image, ImageDraw, ImageOps import adafruit_rgb_display.st7735 as st7735 from software.display.lcd_user_interface import LcdDisplay from software.display.rotary_encoder import RotaryEncoder from software.display.screens.home_screen import HomeScreen from ...
test_flags.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details. # # Distributed under the terms of the BSD license. # # The full license is in the file LICENCE, distributed with this software. # ---------------...
slack-unread.1s.py
#!/usr/bin/env python # coding=utf-8 # # <bitbar.title>Slack Notification</bitbar.title> # <bitbar.version>v1.2</bitbar.version> # <bitbar.author>mgjo5899</bitbar.author> # <bitbar.author.github>mgjo5899</bitbar.author.github> # <bitbar.desc>Displays number of unread Slack messages</bitbar.desc> # <bitbar.image>https:/...
test_code_server.py
from __future__ import unicode_literals import json try: from Queue import Queue except ImportError: from queue import Queue from threading import Thread import unittest from six.moves import urllib from yaksh.code_server import ServerPool, SERVER_POOL_PORT, submit, get_result from yaksh import settings clas...
Binance_Detect_Moonings.py
""" Disclaimer All investment strategies and investments involve risk of loss. Nothing contained in this program, scripts, code or repositoy should be construed as investment advice.Any reference to an investment's past or potential performance is not, and should not be construed as, a recommendation or as a guarantee...
rpc.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright (c) 2013 Qin Xuye <qin@qinxuye.me> 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...
generate.py
# Python modules import argparse import threading import queue import logging import sys import os.path from logging.handlers import RotatingFileHandler from string import ascii_lowercase # Third party import wikipedia from bitarray import bitarray # My modules import worker import bitarray_io from thread_messaging ...
mongotracer.py
from fedn.common.tracer.tracer import Tracer from fedn.common.storage.db.mongo import connect_to_mongodb import time import threading import psutil from datetime import datetime class MongoTracer(Tracer): def __init__(self,mongo_config,network_id): try: self.mdb = connect_to_mongodb(mongo_confi...
test_diskutils.py
import functools import gc import os import queue import shutil import subprocess import sys from time import sleep from unittest import mock import pytest import dask from distributed.compatibility import WINDOWS from distributed.diskutils import WorkSpace from distributed.metrics import time from distributed.utils ...
wgen.py
import json import os import time from multiprocessing import Event, Lock, Process, Value from random import randint from typing import Callable, List, Tuple from decorator import decorator from numpy import random from psutil import cpu_count from requests.auth import HTTPBasicAuth from twisted.internet import reacto...
sensor.py
"""Sensor to monitor incoming/outgoing phone calls on a Fritz!Box router.""" from datetime import datetime, timedelta import logging import queue from threading import Event as ThreadingEvent, Thread from time import sleep from fritzconnection.core.fritzmonitor import FritzMonitor import voluptuous as vol from homeas...
vcenter.py
##################################################### # # vcenter.py # # Copyright 2011 Hewlett-Packard Development Company, L.P. # # Hewlett-Packard and the Hewlett-Packard logo are trademarks of # Hewlett-Packard Development Company, L.P. in the U.S. and/or other countries. # # Confidential computer software...
bot.py
# coding=utf8 """ bot.py - Willie IRC Bot Copyright 2008, Sean B. Palmer, inamidst.com Copyright 2012, Edward Powell, http://embolalia.net Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> Licensed under the Eiffel Forum License 2. http://willie.dftba.net/ """ from __future__ import unicode_literals from __futu...
diagnose.py
def self_diagnostics(): led_off() global powerSwitch global ledSwitch ledSwitch = 1 Thread(target = led_rolling).start() try: powerSwitch = 0 with open("error_log.csv", "a") as error_log: error_log.write("\n{0},Log,Diagnostics start up sequence".format(strftime("%Y-%m-%d %H:%M:%S"))) tts = gTTS(t...
main.py
from threading import Thread, Semaphore, Lock from time import sleep io = Lock() queue = [] lock = Semaphore(value=1) signal_new_element = Semaphore(value=0) signal_free_space = Semaphore(value=5) def producer_worker(producer_id): for task_id in 'ABCDEFGHIJKLMN': # Produce an element. ...
test.py
#!/usr/bin/env python2.7 import os import signal import subprocess import threading import time import urllib2 import json import base64 def main(): # test_koala_go() test_ld_preload() # test_java() def test_koala_go(): GOBIN = os.path.abspath(os.curdir) + '/bin' env = os.environ.copy() env...
keyboard.py
# -*- coding: utf-8 -*- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ### Alias : console.keyboard & Last Modded : 2021.05.05. ### Coded with Python 3.9 for Windows (CRLF) by IRACK000 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' import os import sys sys....
exp_leading.py
"""Makes BlueBot lead another BlueBot. Conscious random walk checks for distance to follower and adjusts speed accordingly. Attributes: caudal: Fin object for caudal fin depth_sensor: DepthSensor object dorsal: Fin object for dorsal fin ema: EMA filter object leds: LED object max_centroids (in...
04 join方法.py
# encoding = utf-8 __author__ = "mcabana.com" import threading import time def worker(timeout): print('in the', threading.current_thread().name, threading.current_thread().ident) time.sleep(timeout) print('finished ~~~~~~~~~~~~~~') t1 = threading.Thread(target=worker, name='worker1', daemon=True, args...
test_api.py
""" mbed SDK Copyright (c) 2011-2014 ARM Limited 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 wr...
test_logging.py
"""Stupid tests that ensure logging works as expected""" from __future__ import (division, absolute_import, print_function, unicode_literals) import sys import threading import logging as log from StringIO import StringIO import beets.logging as blog from beets import plugins, ui import beetsp...
open_context.py
# -*- coding: utf-8 -*- """ Market quote and trade context setting """ from .quote_query import * from .trade_query import * from .utils import is_str from multiprocessing import Queue from threading import RLock, Thread import select import sys import pandas as pd import asyncore import socket as sock import tim...
usps.py
# Copyright 2019 The FastEstimator 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 appl...
quad_walk.py
import gym import gym_solo from gym_solo.envs import solo8v2vanilla_realtime from gym_solo.core import rewards from gym_solo import testing from tqdm import tqdm import matplotlib.pyplot as plt import numpy as np import argparse import math import threading import time import wandb epi_times, epi_rewards = [], [] ...
base_camera.py
import threading import time try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident class CameraEvent(object): """An Event-like class that signals all active clients when a new frame is ...
compute_cli.py
import logging import json from threading import Thread from functools import partial from flask import Blueprint, request, Response from app.resources.compute import ( create_instance, get_instances, find_instance, terminate_instance, instance_action, ) from app.enums.compute.instance_action imp...
wsdump.py
#!/home/ubuntu/CCF/tests/sandbox/.venv_ccf_sandbox/bin/python3.8 import argparse import code import sys import threading import time import ssl import gzip import zlib import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): ...
kb_SetUtilitiesServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
sync.py
#!/usr/bin/env python3 from typing import List, Tuple, Set from hailtop.aiotools import BackgroundTaskManager from contextlib import closing from hailtop.utils import check_shell, CalledProcessError from hailtop.utils import retry_transient_errors from hailtop.hail_logging import configure_logging from fswatch import M...
test_load_collection.py
import pdb import pytest from utils import * from constants import * uid = "load_collection" field_name = default_float_vec_field_name default_single_query = { "bool": { "must": [ {"vector": {field_name: {"topk": default_top_k, "query": gen_vectors(1, default_dim), "metric_type": "L2", ...
copy_on_write.py
#!/usr/bin/env python3 # # Copyright (C) 2019 Jayson # from multiprocessing import Process var = 0 def worker(worker_id): global var print(worker_id, id(var), var) var = worker_id print(worker_id, id(var), var) if __name__ == '__main__': process1 = Process(target=worker, args...
socket_manager.py
#!/usr/bin/env python3 # 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 errno import logging import json import threading import time from queue import PriorityQueue, Empty import webso...
super_button.py
import RPi.GPIO as GPIO import time import threading import denexapp_config import random import led # 57 - first sound, 31 - third class SuperButton: def __init__(self, speech_object, led_lamp_object, led_magic_object, hand_object): self.list_of_phrases = ("effects/20.mp3", ...
NWD.py
from threading import Thread import threading import pickle import timeit def inputCHECK(): try: value = int(input('Type value : ')) if value < 1: raise ValueError return value except ValueError: print('Digits bigger than one are accepted') exit(0) def sho...
test_local_task_job.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...
test_profile.py
from __future__ import annotations import dataclasses import sys import threading from collections.abc import Iterator, Sequence from time import sleep import pytest from tlz import first from distributed.compatibility import WINDOWS from distributed.metrics import time from distributed.profile import ( call_sta...
tests.py
# coding: utf-8 """ Tests for the file storage mechanism >>> import tempfile >>> from django.core.files.storage import FileSystemStorage >>> from django.core.files.base import ContentFile # Set up a unique temporary directory >>> import os >>> temp_dir = tempfile.mktemp() >>> os.makedirs(temp_dir) >>> temp_storage =...