source
stringlengths
3
86
python
stringlengths
75
1.04M
test_enum.py
import enum import inspect import pydoc import sys import unittest import threading from collections import OrderedDict from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto from io import StringIO from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL from test import support from test.suppor...
conftest.py
import threading, time, json import pytest import requests from flask import request from machina import Machina, trial @pytest.fixture def experiment(): experiment = Machina('test', __name__, seed=18) experiment.app.config['TESTING'] = True return experiment @pytest.fixture def flask_client(experiment...
framework.py
#!/usr/bin/env python3 from __future__ import print_function import gc import logging import sys import os import select import signal import subprocess import unittest import tempfile import time import faulthandler import random import copy import psutil import platform from collections import deque from threading i...
main.py
import sublime import sublime_plugin import os import socket import sys import threading # Load modules try: from .xdebug import * except: from xdebug import * # Set Python libraries from system installation python_path = S.get_project_value('python_path') or S.get_package_value('python_path') if python_path...
qrngfifosource.py
# Copyright 2014-2015 Whitewood Encryption Systems, 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 l...
noise_shaping_emph.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2021 Patrick Lumban Tobing (Nagoya University) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import division from __future__ import print_function import argparse from distutils.util import strtobool import multiprocessing as mp ...
TaxonAPIServer.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...
punchVPN.py
#!/usr/bin/python3 import logging logging.basicConfig() log = logging.getLogger("PunchVPN") import punchVPN import socket from random import randint from punchVPN.udpKnock import udpKnock from punchVPN.WebConnect import WebConnect import argparse from multiprocessing import Process from time import sleep import os from...
can2RNET.py
#!/Python3.4 #Python canbus functions for R-net exploration by Specter and RedDragonX # This file is part of can2RNET. # # can2RNET is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
mws.py
from cmd import Cmd import docker import socket from contextlib import closing import os import etcd import shutil import sys import threading import time from src.mws_persistance import * from src.NginxConfigBuilder import * from src.auto_scaling import * from src.initializations import * dockerClient = docker.from_...
params.py
#!/usr/bin/env python3 """ROS has a parameter server, we have files. The parameter store is a persistent key value store, implemented as a directory with a writer lock. On Android, we store params under params_dir = /data/params. The writer lock is a file "<params_dir>/.lock" taken using flock(), and data is stored in...
test_threadutils.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. from parlai.core.thread_utils import SharedTable from multiprocessing import Process import unittest import random import...
linkcheck.py
""" sphinx.builders.linkcheck ~~~~~~~~~~~~~~~~~~~~~~~~~ The CheckExternalLinksBuilder class. :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import json import queue import re import socket import threading from html.parser import HTMLP...
raspbeeconnector.py
from threading import Thread from serial import Serial from zigbear.radio.connector import Connector class RaspbeeConnector(Connector): def __init__(self, port='/dev/ttyS0', wireshark_host="127.0.0.1"): super().__init__(wireshark_host) self.port = port self.baud = 38400 self.time...
test_models.py
import fcntl from multiprocessing import Process from pathlib import Path import shutil import mock from django.core import mail from django.utils.encoding import force_bytes, force_text from django_celery_beat.models import PeriodicTask from mayan.apps.common.serialization import yaml_dump from mayan.apps.document...
app_window.py
import threading import time from gi.repository import Gtk from algorithms import GeneticAlgorithm, ParticleSwarmOptimization from data_reader import DataReader from history import History from map import Map from models import CostMap @Gtk.Template(filename='ui/window.glade') class AppWindow(Gtk.ApplicationWindow)...
utils.py
import imp import os import sys import multiprocessing import colorama import contextlib import subprocess import threading def invalid_command(cmdname, cmdlist=None): from .mplog import MachopLog as color msg = "" if cmdname is not None: ylwcmd = color.yellow(cmdname, True) msg = color.r...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
start.py
import threading from click_canvas import MainWindow from web_feed import WebFeed wf = WebFeed() wf.get_feed() # window = MainWindow() # window.run() # window_thread = threading.Thread(target=MainWindow().run())
datasets.py
# Dataset utils and dataloaders import glob import logging import math import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool from pathlib import Path from threading import Thread import cv2 import numpy as np import torch import torch.nn.functional ...
undertaker.py
# Copyright 2013-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...
httpd.py
#!/usr/bin/env python """ Copyright (c) 2020 NIDDS developers (https://github.com/prasanthc41m/nidds/) See the file 'LICENSE' for copying permission """ from __future__ import print_function import datetime import glob import gzip import hashlib import io import json import mimetypes import os import re import socket...
tests.py
# -*- coding: utf-8 -*- # Unit and doctests for specific database backends. from __future__ import absolute_import, unicode_literals import datetime import threading from django.conf import settings from django.core.management.color import no_style from django.db import (backend, connection, connections, DEFAULT_DB_A...
basic.py
################################################################## # Copyright 2016 OSGeo Foundation, # # represented by PyWPS Project Steering Committee, # # licensed under MIT, Please consult LICENSE.txt for details # ####################################################...
test_workers_parallel.py
import harvester from multiprocessing import Queue, Process, Manager #Set appropriate global variables WORK_QUEUE_MAX_SIZE = 100 RESP_QUEUE_MAX_SIZE = 100 URL_BATCH = [("http://127.0.0.1:8080", 0, "http://127.0.0.1:8080")] manager = Manager() visited = manager.dict() work_queue = manager.Queue(maxsize=WORK_QUEUE_MAX_S...
subtitle_with_thread_multi_processing.py
# importing the multiprocessing module import multiprocessing import os import time import subtitle_with_threading def worker1(path): print("\nFull text from worker 1:",subtitle_with_threading.get_large_audio_transcription(path)) def worker2(path): print("\nFull text from worker 2:",subtitle_with_threading.ge...
environment.py
# -*- coding: utf-8 -*- ''' Modules for installation -> torch, torchvision, numpy, keyboard, cv2, mss. Use pip3 install 'module'. ''' from skimage.filters import threshold_otsu from skimage import img_as_ubyte import torchvision.transforms as T from PIL import Image import numpy as np import threading import keyboa...
destroy.py
from core.config import Settings from core.providers.aws import BaseAction from core.terraform import PyTerraform from core import constants as K from time import sleep from threading import Thread from datetime import datetime import importlib import sys class Destroy(BaseAction): executed_with_error = False ...
test_local_apigw_service.py
from unittest import TestCase import threading import os import shutil import json import time import requests import random from unittest.mock import Mock from samcli.local.apigw.local_apigw_service import Route, LocalApigwService from tests.functional.function_code import ( nodejs_lambda, API_GATEWAY_ECHO_E...
Crawler.py
print("Starting Crawler imports... ") from io import TextIOWrapper from os.path import isfile from typing import Union, Iterable from datetime import datetime from time import sleep from timeit import timeit from sys import argv from multiprocessing import Process, Manager from xml.etree import ElementTree as ET from...
ast_bulk_processor.py
import logging import json from multiprocessing import Queue, Pool, Process from bigcode_astgen import glob from bigcode_astgen import ast_generator from bigcode_astgen.queue_item import FailedFileItem, ProcessedFileItem def process_file_init(queue, options): process_file.queue = queue process_file.options =...
state.py
""" The State Compiler is used to execute states in Salt. A state is unlike an execution module in that instead of just executing a command, it ensures that a certain state is present on the system. The data sent to the state calls is as follows: { 'state': '<state module name>', 'fun': '<state function name...
swim.py
from expression import * import multiprocessing ok1=1;ok2=1 changeDegree([3,5,6,4],[20,40,140,140]) def Right(): changeDegree([3,2],[20,0]) #time.sleep(0.5) changeDegree([2,4],[130,50],0.01) #time.sleep(0.5) def Left(): changeDegree([4,1],[140,180]) #time.sleep(0.5) changeDegree([1,3],[50,1...
TopicModeling.py
from .BaseStep import BaseStep, time from ..data.Posts import Posts import pandas as pd import tomotopy as tp from multiprocessing import Process import gc class TopicModeling(BaseStep): def __init__(self): super().__init__('Topic modeling') self.__posts = Posts(preProcessed=True, memory=Fal...
cron.py
from collections import namedtuple from datetime import datetime, timedelta import logging import threading from time import sleep CRON_ENCORE = 'CRON_ENCORE' CRON_STOP = 'CRON_STOP' logger = logging.getLogger('liberapay.cron') Daily = namedtuple('Daily', 'hour') Weekly = namedtuple('Weekly', 'weekday hour') cl...
exchange_rate.py
from datetime import datetime import inspect import requests import sys import os import json from threading import Thread import time import csv import decimal from decimal import Decimal from .bitcoin import COIN from .i18n import _ from .util import PrintError, ThreadJob, make_dir # See https://e...
PC_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Python PC Miner (v2.2) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## import socket, statistics, threading, multiprocessing, time...
receiver.py
from configparser import ConfigParser from io import StringIO from functools import wraps from greplin import scales from celery.bin.base import Command import collections import json import logging import _thread as thread import threading import time import zbxsend log = logging.getLogger(__name__) stats = scales.c...
proxy.py
import sys import socket import threading def server_loop(local_host, local_port, remote_host, remote_port, receive_first): server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: server.bind((local_host, local_port)) except: print('[!!] Failed to listen on %s:%d' % (local_host, lo...
client3.py
import threading import socket name = "3" def receive(): try: while True: message = sock.recv(1024).decode() print(message) except ConnectionResetError: pass def send(): try: while True: message = (name + ": " + input()).encode() s...
test_autograd.py
import gc import io import math import os import random import sys import tempfile import threading import time import unittest import uuid import warnings from copy import deepcopy from collections import OrderedDict from itertools import product, permutations from operator import mul from functools import reduce, par...
linz_data_importer.py
""" /*************************************************************************** LINZ Data Importer A QGIS plugin Import LINZ (and others) OGC Datasets into QGIS ------------------- begin : 2018-04-07 git sha : ...
deployer_utils.py
""" Name: deployer_utils.py Purpose: Utility functions for general usage in the project Author: PNDA team Created: 21/03/2016 Copyright (c) 2016 Cisco and/or its affiliates. This software is licensed to you under the terms of the Apache License, Version 2.0 (the "License"). You may obtain a copy of t...
serve.py
#! /usr/bin/env python # -*- coding: utf-8 -*- from multiprocessing import Process import os import time from sanic import Sanic from watchdog.observers import Observer import watchdog def watch(builder): """Watch changes in directories and yield events indicating where the change happened: BLOG_FOLDER, ST...
test_output.py
import subprocess import sys import pytest import re import signal import time import os import ray from ray._private.test_utils import run_string_as_driver_nonblocking @pytest.mark.skipif(sys.platform == "win32", reason="Failing on Windows.") def test_autoscaler_infeasible(): script = """ import ray import tim...
backend.py
from threading import Thread from pymitter import EventEmitter from typing import List, Dict, Any, Tuple, NamedTuple, Callable, TYPE_CHECKING from whitewater.view.pins import Pin # For typing only import logging from time import time logger = logging.getLogger(__name__) # backend types InputEntry = NamedTuple('Inpu...
StaffGUI.py
# -*- coding: utf-8 -*- from tkinter import * from tkinter import ttk import random ###############NETWORK################ import socket import threading server_ip = '192.168.1.150' port = 8000 allplayer = {} def Server(): while True: server = socket.socket() server.setsockopt(socket.SOL_SOCKE...
plan.py
"""CFNgin plan, plan componenets, and functions for interacting with a plan.""" from __future__ import annotations import json import logging import os import threading import time import uuid from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, NoReturn, Optional, OrderedDict...
SQLiFinder.py
import os, re, sys, glob, time, urllib2, cookielib, random from urlparse import urlparse import threading from Queue import Queue try: import requests except ImportError: print '---------------------------------------------------' print '[*] pip install requests' print ' [-] you need to ins...
ProgramSlider.py
# This macro provides an example to extract the joints of a program. # The joints extracted take into account the rounding effect. from robolink import * # API to communicate with RoboDK from robodk import * # basic matrix operations import sys # Start the RoboDK API: RDK = Robolink() # Get the robot and the...
train_imagenet.py
#!/usr/bin/env python """Example code of learning a large scale convnet from ILSVRC2012 dataset. Prerequisite: To run this example, crop the center of ILSVRC2012 training and validation images and scale them to 256x256, and make two lists of space- separated CSV whose first column is full path to image and second colu...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import threading_helper from test.support import verbose, cpython_only from test.support.import_helper import import_module from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys import _thre...
test_sync.py
# Some simple queue module tests, plus some failure conditions # to ensure the Queue locks remain stable. import asyncio import concurrent.futures import queue import time import unittest import threading import janus QUEUE_SIZE = 5 def qfull(q): return q._parent._maxsize > 0 and q.qsize() == q._parent._maxsiz...
ipCamStream.py
import json import time import numpy as np import requests import ctypes import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import threading from Quaternion import * url = 'http://192.168.1.108:8080/sensors.json' def getData(url = 'http://192.168.1.108:8080/sensors.json'): s = requests.Session(...
logger.py
import io import threading import time class Logger: def __init__(self, sensor, controller, fridge, log_file_name): self.thread = threading.Thread(target=self._log) self.sensor = sensor self.controller = controller self.fridge = fridge self.log_file_name = log_file_name ...
spydist.py
from __future__ import print_function import os import rpyc import signal import threading import time import pytest from multiprocessing import Process import spytest from spytest.dicts import SpyTestDict import spytest.env as env import utilities.common as utils wa = SpyTestDict() wa.parse_logs = [] # new batch...
translation_train.py
from modules import * from loss import * from optims import * from dataset import * from modules.config import * import numpy as np import argparse import torch from functools import partial import torch.distributed as dist def run_epoch(epoch, data_iter, dev_rank, ndev, model, loss_compute, is_train=True): univer...
audio_alarm.py
from tkinter import * import pyaudio import wave import sys import threading is_playing = False my_thread = None def play_audio(): global is_playing global my_thread chunk = 1024 wf = wave.open('alarm_wav.wav', 'rb') p = pyaudio.PyAudio() stream = p.open( format = p...
multithread_novecs.py
from threading import Thread, Barrier #from parla.multiload import multiload_contexts import time import argparse import test.core as kokkos import numpy as np parser = argparse.ArgumentParser(description='Kokkos reduction') parser.add_argument('-m', metavar='m', type=int, help='Number of GPUs') ...
kill_a_process.py
import multiprocessing import time def foo(): print('Starting function') time.sleep(0.1) print('Finished function') if __name__ == '__main__': p = multiprocessing.Process(target=foo) # is_alive to track if alive or not print('Process before execution:', p, p.is_alive()) p...
cron.py
# Snafu: Snake Functions - Cron Connector import threading import time import os import configparser gcb = None def initinternal(function, configpath): connectconfig = None if not configpath: configpath = "snafu.ini" if not function: function = "snafu" if os.path.isfile(configpath): config = configparser.C...
websocket_client.py
import json import logging import socket import ssl import sys import traceback from datetime import datetime from threading import Lock, Thread from time import sleep from typing import Optional from vnpy.trader.setting import get_settings import websocket from vnpy.trader.utility import get_file_logger class Webs...
test_fork1.py
"""This test checks for correct fork() behavior. """ import _imp as imp import os import signal import sys import threading import time import unittest from test.fork_wait import ForkWait from test import support # Skip test if fork does not exist. if not support.has_fork_support: raise unittest.SkipTest("test ...
scheduler.py
import threading import time import logging logger = logging.getLogger(__name__) class Event: def __init__(self, callback, param): self.callback = callback self.param = param def trigger(self, *args): if self.param is None: self.callback(*args) else: self.callback(*args, self.param) def kill(...
test_random.py
import warnings import pytest 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 random import sys class TestSeed: def test_sca...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import unittest.mock import queue as pyqueue import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import struct import operator import pickle import weakr...
op_util.py
# Copyright 2017-2022 RStudio, PBC # # 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...
test_etcd3.py
""" Tests for `etcd3` module. ---------------------------------- """ import base64 import contextlib import json import os import signal import string import subprocess import tempfile import threading import time import grpc from hypothesis import given, settings from hypothesis.strategies import characters impor...
actor_factory.py
#!/usr/bin/env python # # Copyright (c) 2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # import itertools try: import queue except ImportError: import Queue as queue import time from enum import Enum from threading i...
transports.py
from .logging import exception_log, debug from .types import TCP_CONNECT_TIMEOUT from .types import TransportConfig from .typing import Dict, Any, Optional, IO, Protocol, Generic, List, Callable, Tuple, TypeVar, Union from contextlib import closing from functools import partial from queue import Queue import http impor...
RemotePers.pyw
from tkinter import * from tkinter import ttk from tkinter import filedialog from tkinter import messagebox from ftplib import FTP import telnetlib import threading filename = str(NONE) def get_filename(): global filename global filenameTK filename = filedialog.askopenfilename() filenameTK...
utils.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
shoplist.py
""" shoplist.py Copyright 2015 by Stefan Lehmann """ import time from threading import Thread from queue import Queue from .utils import green THREAD_COUNT = 5 def download_shopitems(q, res_q): while not q.empty(): shop, expression = q.get() # measure time of searching the shop t...
launcher.py
import logging from multiprocessing import Process from os import popen from time import sleep from lib.client import start apps = {'colony': start} if __name__ == '__main__': processes = {} def start_process(name: str): """ Starts a process if the name given is in the process list. ...
mainpy.py
''' 1.根据uploader数量建立线程 2.定时执行删除 3.只能让monitor自己获取相应的path了 ''' import dojson from threading import Thread import time import os import monitor import delete import reprint print = reprint.print def run_monitor(vup_name): print(vup_name) # os.system('python ' + monitor_path + ' %s' % (vup_name...
test.py
import os.path as p import random import threading import time import pytest from helpers.cluster import ClickHouseCluster from helpers.test_tools import TSV from helpers.client import QueryRuntimeException from helpers.network import PartitionManager import json import subprocess import kafka.errors from kafka impor...
pipeline_step.py
import datetime import json import os import threading import time import traceback from abc import abstractmethod from enum import Enum, IntEnum import pytz import idseq_dag.util.command as command import idseq_dag.util.log as log import idseq_dag.util.s3 import idseq_dag.util.count as count from idseq_dag.util.cou...
run.py
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University # ServerlessBench is licensed under the Mulan PSL v1. # You can use this software according to the terms and conditions of the Mulan PSL v1. # You may obtain a copy of Mulan PSL v1 at: # http://license.coscl.org.cn/M...
DistributedJobManager.py
import copy import os import logging import pickle import psutil import time import threading import typing from enum import Enum from math import ceil from multiprocessing import Pool, Queue, Manager, current_process from threading import Timer _logger = logging.getLogger(__name__) # used to save all PID of workers ...
multithread_dataiter_for_cross_entropy_v1.py
# -*- coding: utf-8 -*- import random import math import threading import time import logging import queue import cv2 import numpy from ChasingTrainFramework_GeneralOneClassDetection.image_augmentation.augmentor import Augmentor from ChasingTrainFramework_GeneralOneClassDetection.data_iterator_base.data_batch import D...
generate_breakpad_symbols.py
#!/usr/bin/env python # Copyright 2013 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. """A tool to generate symbols for a binary suitable for breakpad. Currently, the tool only supports Linux, Android, and Mac. Support f...
bot_processor.py
#!-*-coding:utf-8-*- # import json import threading # import redis import time from contents import replyMsg from processor.auto_replyer_v2 import Auto_replyer from processor.datastatis_ploty import line_plot # import redis from processor.qaProcessor import QaProcessor from wxbot import * reload(sys) sys.setdefaulte...
test_operator_gpu.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
runtests.py
#!/usr/bin/env python3 """ Testing dec2flt =============== These are *really* extensive tests. Expect them to run for hours. Due to the nature of the problem (the input is a string of arbitrary length), exhaustive testing is not really possible. Instead, there are exhaustive tests for some classes of inputs for which ...
main.py
import os import re import time import json import requests import threading from unshortenit import UnshortenIt unshortener = UnshortenIt() with open("settings.json") as fp: _settings = json.load(fp) try: th = int(os.environ["threads"]) except: th = int(_settings.get("threads")) try: wait = int(os.en...
docklog.py
#!/usr/bin/env python3 import argparse import docker import errno import os import random import re import sys import time from colorama import init, deinit, Back, Style from multiprocessing import Process from signal import signal, SIGPIPE, SIG_DFL # Handle SIGPIPE from kb interrupts while grepping, etc. signal(SIGPI...
pubsub_test.py
#! /usr/bin/env python from mock import Mock from json import dumps from logging import getLogger, WARNING from pika import BlockingConnection, URLParameters from Queue import Empty, Queue as PythonQueue from sys import exit from time import sleep from threading import Thread from traceback import print_exc from unitt...
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...
test_decimal.py
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for the Decim...
test_asyncio.py
import unittest import yappi import asyncio import threading from utils import YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io @asyncio.coroutine def async_sleep(sec): yield from asyncio.sleep(sec) class SingleThreadTests(YappiUnitTestCase): def test_issue58(self): @asyncio.coroutine ...
test_oauth.py
import unittest import random import time import base64 import json import requests from flask import Flask, jsonify, make_response, request, redirect from multiprocessing import Process import jose from server.common.config.app_config import AppConfig from server.test import FIXTURES_ROOT, test_server # This tests ...
core.py
# Copyright 2011-2014 James McCauley # # 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 ...
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...
measure.py
import tvm import signal import psutil import time import numpy as np try: import torch.multiprocessing as multi except ImportError: import multiprocessing as multi from flextensor.utils import to_tuple def kill_child_processes(parent_pid, sig=signal.SIGTERM): """kill all child processes recursively""" ...
test_client.py
# coding=utf-8 # Copyright 2018-2020 EVA # # 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 ...
core.py
import inspect import logging import sys import time from typing import Callable from threading import Thread import dill from clint.textui import puts, indent, colored from slack_sdk.rtm import RTMClient from machine.vendor import bottle from machine.dispatch import EventDispatcher from machine.plugins.base import ...
rpc_test.py
import concurrent.futures import contextlib import json import os import sys import threading import time from collections import namedtuple from functools import partial from threading import Event from threading import Lock from unittest import mock import torch import torch.nn as nn import torch.distributed as dis...
test_util.py
# Copyright 2015 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...
TweetRead.py
# TweetRead.py # Modified code obtained from LinkedIn # pip install tweepy ''' Multiple Streaming is not supported by twitter API, so you can use this code and start a local streaming server, then listen to it using your Spark Streaming Code and count the number of words, or hashtags, etc or whatever you are lookign...
file_server.py
######### # Copyright (c) 2013 GigaSpaces Technologies Ltd. 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...