source
stringlengths
3
86
python
stringlengths
75
1.04M
test_console_task.py
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os import thr...
Hiwin_RT605_ArmCommand_Socket_20190627194552.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
appjar.py
# -*- coding: utf-8 -*- """appJar.py: Provides a GUI class, for making simple tkinter GUIs.""" # Nearly everything I learnt came from: http://effbot.org/tkinterbook/ # with help from: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html # with snippets from stackexchange.com # make print & unicode backwards co...
14_mipmaps.py
import sys, os #get path of script _script_path = os.path.realpath(__file__) _script_dir = os.path.dirname(_script_path) pyWolfPath = _script_dir if sys.platform == "linux" or sys.platform == "linux2": print "Linux not tested yet" elif sys.platform == "darwin": print "OS X not tested yet" elif sys.platform ==...
bp35c0_sndrcv.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import sys sys.path.append("/home/pi/HomeRpi") import serial import datetime import locale import time import commands import ConfigParser import threading import echonet # 送信タスク event = threading.Event() def sndTask() : print('s...
dxl_tracker.py
# Copyright (c) 2018, The SenseAct Authors. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import time import copy import numpy as np import baselines.common.tf_util as U from baselines.trpo_mpi.trpo_mpi import...
total_threads.py
import threading import time import random def my_thread(i): print("Thread {}: started".format(i)) time.sleep(random.randint(1, 5)) print("Thread {}: finished".format(i)) def main(): for i in range(random.randint(2, 50)): thread = threading.Thread(target=my_thread, args=(i,)) thread....
wardz.py
# -*- coding: utf-8 -*- ''' © Warbot v`1 ''' from important import * from thrift.unverting import * from thrift.TMultiplexedProcessor import * from thrift.TSerialization import * from thrift.TRecursive import * from thrift import transport, protocol, server from random import randint from multiprocessing import Pool, P...
train_cv_multi_gpu.py
import dgl import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.multiprocessing as mp import dgl.function as fn import dgl.nn.pytorch as dglnn import time import argparse import tqdm import traceback from _thread import start_new_thread fro...
lisp-rtr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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...
KafkaEventConsumer.py
import json import sys import threading from kafka import KafkaConsumer class KafkaEventConsumer: def __init__(self, kafka_broker_url, topic): self.kafka_broker_url = kafka_broker_url self.topic = topic def register_kafka_listener(self, listener_func): # Poll kafka def poll(...
create_http.py
#cython: language_level=3 import lemon.libs.Date import config.config import lemon.libs.colors import threading import sys import lemon.libs.lemon HTTP_STATUS_CODES = { 100: "Continue", 101: "Switching Protocols", 102: "Processing", 103: "Early Hints", # see RFC 8297 200: "OK", 201: "Crea...
run_star_and_htseq.py
#!/usr/bin/env python import argparse import datetime import logging import os import re import subprocess import tarfile import multiprocessing as mp from collections import defaultdict import utilities.log_util as ut_log import utilities.s3_util as s3u import boto3 S3_LOG_DIR = 's3://jamestwebber-logs/star_logs...
SpartanKartAi.py
from mss import mss from PIL import Image, ImageTk from collections import deque from tkinter import ttk import tkinter as tk import threading, queue, time, sys, sdl2, pickle, json, os from JoystickInput import JoystickInput_SDL from DataViewer import DataViewerFrame from JoystickServer import JoystickServerFrame glo...
timeout_guard.py
# Copyright (c) 2016-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...
codec.py
# # Copyright (c) 2016-2017, The OpenThread 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 re...
daytimeSniffer.py
#!/usr/bin/env python3 # -.- coding: utf-8 #Section 0: Requirements try: import subprocess import os import sys import time import json import pyshark import sqlite3 import datetime import argparse import threading import traceback import concurrent.futures except Keyboar...
rdd.py
from base64 import standard_b64encode as b64enc import copy from collections import defaultdict from itertools import chain, ifilter, imap, product import operator import os import shlex from subprocess import Popen, PIPE from tempfile import NamedTemporaryFile from threading import Thread from pyspark import cloudpic...
agent.py
import random import string import threading import time import uuid from event_store_client import EventStoreClient, create_event def get_any_id(_entities, _but=None): """ Get a random id out of entities. :param _entities: The entities to chose from. :param _but: Exclude this entity. :return: T...
__init__.py
from abc import ABCMeta, abstractmethod from collections import defaultdict, OrderedDict import logging from multiprocessing import Process, Queue import numpy from picklable_itertools import chain, ifilter, izip from picklable_itertools.extras import equizip from six import add_metaclass, iteritems from fuel import ...
capture.py
from numpy import add, arange, average, abs, empty, fromstring, fft, int16, log10, multiply, ndarray, reshape, split from pyaudio import PyAudio, paInt16 from threading import Thread from .log import logger class AudioCapture: def __init__(self): self._bitrate = 48100 self._buffer_size = 8192 ...
processes.py
# encoding: utf-8 from multiprocessing import Process, Pool, Queue from os import getpid from random import randint, random from time import time, sleep # 使用多进程与不使用多进程对比 # 不使用多进程 # def download_task(filename): # print('开始下载%s...' % filename) # time_to_download = randint(5, 10) # sleep(time_to_download) # print(...
ssd_main.py
# Copyright 2018 Google. 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 agree...
miner.py
import copy import sys import time from multiprocessing import Process from operator import attrgetter from sys import getsizeof from typing import List, Optional, Set, Tuple import requests import utils.constants as consts from core import Block, BlockHeader, Chain, Transaction, TxIn, TxOut from utils.logger import ...
progress_queue.py
import time from multiprocessing import Process, Queue, Pool, Manager, Pipe # def producer(queue): # queue.put("a") # time.sleep(2) # # def consumer(queue): # time.sleep(2) # data = queue.get() # print(data) # # if __name__ == "__main__": # queue = Queue(10) # my_producer = Process(target=...
test_run_engine.py
from event_model import DocumentNames import threading import types import os import signal import sys from collections import defaultdict import time as ttime import pytest from bluesky.tests import requires_ophyd from bluesky.run_engine import (RunEngineStateMachine, TransitionError, I...
stream.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2017 Alibaba Group Holding 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-...
test_rand.py
from itertools import chain import multiprocessing as mp try: from multiprocessing import SimpleQueue as MPQueue except ImportError: from multiprocessing.queues import SimpleQueue as MPQueue import os import threading from ddtrace import Span from ddtrace import tracer from ddtrace.compat import PYTHON_VERS...
run_event_manager.py
import os import time from datetime import datetime from threading import Thread from watchdog.observers import Observer from shirp import event from shirp import handler observers = [] schedules = [] current_dir = os.path.dirname(os.path.realpath(__file__)) path_sep = os.sep def find_json(path): """Find Json...
multiple_component_runner.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import datetime from typing import Optional from multiprocessing import Process import absl import time from tfx.orchestration import data_types from tfx.orchestration import metadata from tfx.orchestration ...
test_execution.py
# Copyright 1999-2018 Alibaba Group Holding 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 a...
util.py
# # Copyright (C) 2012-2016 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import shutil import socket try: ...
windows.py
from ...third_party import WebsocketServer # type: ignore from .configurations import ConfigManager from .configurations import WindowConfigManager from .diagnostics import DiagnosticsCursor from .diagnostics import DiagnosticsWalker from .diagnostics import ensure_diagnostics_panel from .logging import debug from .lo...
core.py
#!/bin/env python import yaml import multiprocessing import math import os import tarfile import zipfile import time import fnmatch import zlib import logging import advancedSearch from termcolor import colored CONFIG = yaml.safe_load(open('config.yaml')) BASE64_CHARS = CONFIG['base64_chars'] PATH = './' ARCHIVE_TYPE...
dataset.py
"""Data fetching with pandas """ # MIT License # # Copyright (c) 2018 Yichun Shi # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the righ...
test_functools.py
import abc import collections from itertools import permutations import pickle from random import choice import sys from test import support import unittest from weakref import proxy try: import threading except ImportError: threading = None import functools py_functools = support.import_fresh_module('functoo...
syncmd.py
import sys import tempfile from subprocess import Popen, PIPE from threading import Thread try: from Queue import Queue, Empty except ImportError: from queue import Queue, Empty ON_POSIX = 'posix' in sys.builtin_module_names __STDOUTBUF__ = '' def exec_cmd(cmd): ret = {} stdout = tempfile.Temporar...
s3push.py
from hashlib import md5 import os from queue import Queue import threading from typing import Callable from typing import Optional from typing import Tuple import boto import boto.s3.connection from . import publishthing # noqa _WorkQueueItem = Optional[Tuple[str, str]] def s3_upload( thing: "publishthing.Pub...
Pub_Sub_client.py
import paho.mqtt.client as mqtt #import the client1 import time import sys import threading def takePatientInput(): while(1): patientName = input("Enter Patient Name: ") patientAge = input("Enter Patient Age: ") patientGender = input("Enter Patient Gender, M for Male, F for Female:...
tgbot.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # zoe-tgbot - https://github.com/rmed/zoe-tgbot # # Copyright (c) 2016 Rafael Medina García <rafamedgar@gmail.com> # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation f...
CustomRichPresence.py
from tkinter import * from tkinter import messagebox from PIL import ImageTk, Image as Image from Resources.AppResourceManager import AppResourceManager from TkinterCustomButton import TkinterCustomButton from pypresence import Presence from packaging import version from threading import Thread from pathlib import Path...
ps_drone.py
######### # ps_drone.py # (w)+(c) J. Philipp de Graaff, www.playsheep.de, drone@playsheep.de, 2012-2014 # Project homepage: www.playsheep.de/drone and https://sourceforge.net/projects/ps-drone/ # Dependencies: a POSIX OS, openCV2 for video-support. # Base-program of the PS-Drone API: "An open and enhanced API for unive...
test_https.py
import unittest import types import time import ssl import os from threading import Thread from http import server, client from .utils import set_ktls_sockopt from .config import ( CONFIG_PWD, CONFIG_CERT, CONFIG_KEY, CONFIG_CLIENT_CERT, CONFIG_CLIENT_KEY, CONFIG_CIPHER_SUITE) CURRENT_DIR = ...
base_scanner.py
# =============================================================================== # Copyright 2016 Jake Ross # # 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...
stock_bot.py
from threading import Thread from pyrabbit.api import Client from consumer import Consumer import time, yaml class StockBot: def __init__(self, host='localhost', port='15672', user='guest', passwd='guest'): self.host = host self.cli = Client('{}:{}'.format(host, port), user, passwd) self.qu...
timekeeper_feature.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #--------------------------------------------------------------------------------- # _____ _ _ ______ _ # (_____) | (_) (____ \ (_) # _ ____ _ | |_ ____ ___ ____) )_ ...
test_rest_tracking.py
""" Integration test which starts a local Tracking Server on an ephemeral port, and ensures we can use the tracking API to communicate with it. """ import mock from multiprocessing import Process import os import pytest import socket import shutil import time import tempfile import mlflow.experiments from mlflow.ent...
test_statestore.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...
metrics.py
import heapq import multiprocessing as mp import torch from torchvision import ops as tvops from matplotlib import pyplot as plt # The precision at each recall level r is interpolated by taking the maximum precision measured for a method for which the corresponding recall exceeds r # assigned to groundtruth objects s...
decorators.py
""" uWSGI decorators shipped with django-uwsgi in case if uWSGI installed system-wide, and django project runs in Emperor mode and using virtualenv, so uwsgidecorators module not importable. """ from functools import partial import sys from threading import Thread from . import uwsgi, pickle if uwsgi is None: ...
rnode.py
import re import os import queue import shlex import string import logging from logging import Logger import threading from threading import Event import contextlib from multiprocessing import Queue, Process from typing import ( Dict, List, Tuple, Optional, Generator, ) from docker.client import Do...
word2vec.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...
http1.py
import Queue import threading from http_common import * import simple_http_client class Http1Worker(HttpWorker): version = "1.1" def __init__(self, logger, ip_manager, config, ssl_sock, close_cb, retry_task_cb, idle_cb, log_debug_data): super(Http1Worker, self).__init__(logger, ip_manager, config, ...
process.py
from child import fava_child from contextlib import closing import multiprocessing as mp import socket import sys import argparse import shlex import threading import string import secrets from time import sleep def generate_secure_random_string(stringLength=10): """Generate a secure random string of letters, dig...
unit_test_Cache.py
import datetime import json import re import os import pytest import tempfile import time import random from unittest.mock import patch, call from collections import OrderedDict from multiprocessing import Process import synapseclient.core.cache as cache import synapseclient.core.utils as utils def add_file_to_cache...
mp3.py
import multiprocessing import time import os def whoami(name): print("I'm %s, in process %s" % (name, os.getpid())) def loopy(name): whoami(name) start = 1 stop = 1000000 for num in range(start, stop): print("\tNumber %s of %s. Honk!" % (num, stop)) time.sleep(1) if __name__ == "_...
__main__.py
# Copyright Jamie Allsop 2019-2019 # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) import sys import threading import platform import subprocess import re import os import six import psutil fr...
upload_expression_details.py
import json import logging import os from threading import Thread import time import traceback import boto from boto.s3.key import Key from sqlalchemy import create_engine from src.models import Base, DBSession, Dnasequenceannotation, Locusdbentity __author__ = 'tshepp' ''' For a set of loci, get expression deta...
iotclient.py
# -*- coding: utf-8 -*- ''' API handling for GREX iotserver Module Handler https://drive.google.com/open?id=0B71l1gP_zRPUZFZCcjNIN2RrSHM ''' __version__ = '0.0.30' __author__ = "Dietmar Millinger, GREX IT Services" import os import sys import requests import json import threading import re import importlib #fr...
check_public_headers.py
#!/usr/bin/env python # # Checks all public headers in IDF in the ci # # Copyright 2020 Espressif Systems (Shanghai) PTE 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...
test_cuda.py
# Owner(s): ["module: cuda"] from itertools import repeat, chain, product from typing import NamedTuple import collections import contextlib import ctypes import gc import io import pickle import queue import sys import tempfile import threading import unittest import torch import torch.cuda import torch.cuda.comm as...
nova.py
# -*- coding: utf-8 -*- """ Nova processing thread """ import re import json import time import xbmc import xbmcaddon import xbmcgui from Queue import Queue from threading import Thread from urlparse import urlparse from elementum.provider import append_headers, get_setting, log from parser.ehp import Html from prov...
eval_crackheat_surrogate2.py
import sys import os import os.path import csv import ast import copy import posixpath import subprocess import threading import multiprocessing import multiprocessing.dummy # Gives thread pools not process pools import itertools import numpy as np import pandas as pd from matplotlib import pyplot as pl from limatix.d...
bcy_single_climber.py
# !/usr/bin/env python # -*- coding:UTF-8 -*- __author__ = '__Rebecca__' __version__ = '0.0.2' import sys import os import json import time import datetime import requests import threading from bs4 import BeautifulSoup from threading_control import threading_control # 通过url下载半次元图片 class bcy_single_climber(object):...
test_bson.py
# -*- coding: utf-8 -*- # # Copyright 2009-present 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 applicab...
numpy3d_to_tfrecords.py
# -*- coding: utf-8 -*- """ Created on Thu Apr 26 2018 @author: MRegina, CTO at OrthoPred Ltd # TFRecords writer code for Numpy array data (specifically for 3D arrays with an additional channel dimension), # the interpret_npy_header function can be applied for any type of numpy array. # The source code is partially ...
multiThread.py
import sys import threading import time def bar(): time.sleep(2) print("abcdef") def foo(x): while True: bar() threading.Thread(target = lambda: foo(2), name="foo").start() foo(1)
test_asyncore.py
import asyncore import unittest import select import os import socket import sys import time import errno import struct import threading from test import support from io import BytesIO if support.PGO: raise unittest.SkipTest("test is not helpful for PGO") TIMEOUT = 3 HAS_UNIX_SOCKETS = hasatt...
base.py
import logging try: from Queue import Queue # PY2 except ImportError: from queue import Queue # PY3 from threading import Thread try: from urlparse import urljoin # PY2 except ImportError: from urllib.parse import urljoin # PY3 from six import iteritems from six.moves import range from .utils impo...
runtest.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import logging import os import re import setproctitle import string import subprocess import sys import threading import time from collections import defaultdict, namedtuple, OrderedDict import nu...
test_manager.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
materialize_with_ddl.py
import time import pymysql.cursors import pytest from helpers.network import PartitionManager import pytest from helpers.client import QueryRuntimeException from helpers.cluster import get_docker_compose_path, run_and_check import random import threading from multiprocessing.dummy import Pool from helpers.test_tools ...
multi_tan.py
# -*- mode: python; coding: utf-8 -*- # Copyright 2019-2021 the AAS WorldWide Telescope project # Licensed under the MIT License. """ Generate tiles from a collection of images on a common TAN projection. """ __all__ = """ MultiTanProcessor """.split() from astropy.wcs import WCS import numpy as np from tqdm import ...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
ddos.py
print("Welcome to ddos.py. This is only for education porposes\n") from asyncio import protocols from pstats import SortKey import sys import os try: import threading except: while True: o = input("you haven't install 'threading' it will be installed \nDo you want to continue? [Y/n] ") ...
gdbclientutils.py
import errno import os import os.path import threading import socket import lldb import binascii import traceback from lldbsuite.support import seven from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbtest_config def checksum(message): """ Calculate the GDB server protocol checksum of the me...
connection.py
import socket import threading import time from typing import Optional, List class Connection: def __init__(self, host:str, port: Optional[int] = 22) -> None: self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connected = False while not connected: try...
forecastserver.py
from wsgiref.simple_server import make_server import multiprocessing class ForecastServer: def __init__(self): self._httpd_process = None def start(self, webservice): if not self._httpd_process: httpd = make_server('localhost', 8000, webservice) self._httpd_process = ...
outputbox.py
##################################################################### # # # outputbox.py # # # # Copyright 2013, Christopher Billington...
test_thread.py
"""TestCases for multi-threaded access to a DB. """ import os import sys import time import errno import shutil import tempfile from pprint import pprint from random import random try: True, False except NameError: True = 1 False = 0 DASH = '-' try: from threading import Thread,...
process.py
import importlib import os import signal import struct import time import subprocess from abc import ABC, abstractmethod from multiprocessing import Process from setproctitle import setproctitle # pylint: disable=no-name-in-module import cereal.messaging as messaging import selfdrive.crash as crash from common.based...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Cerebralcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test cerebralcoind shutdown.""" from test_framework.test_framework import CerebralcoinTestFramework fr...
test_fligh_control_servicer.py
import threading import time from tiktorch.server.grpc import flight_control_servicer def test_shutdown_event_is_set_after_timeout(): evt = threading.Event() _ = flight_control_servicer.FlightControlServicer(kill_timeout=0.01, done_evt=evt) assert "WatchdogThread" in [t.name for t in threading.enumerate...
test3.py
from dronekit import * from pymavlink import mavutil #from ___future__ import print_function import time, math import socket import select import sys import csv from threading import Thread #Example documentation: http://python.dronekit.io/examples/guided-set-speed-yaw-demo.html def arm_and_takeoff(aTargetAltitude):...
test_cli_task.py
# Copyright 2013: Mirantis 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 b...
interface.py
# Copyright (c) 2016 Ansible by Red Hat, Inc. # # 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 Licen...
multiprocessing_simpleargs.py
import multiprocessing def worker(num): """thread worker function""" print('Worker:', num) if __name__ == '__main__': jobs = [] for i in range(5): p = multiprocessing.Process(target=worker, args=(i,)) jobs.append(p) p.start()
test_pin_thread.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...
certh.py
import ctypes import ctypes.util import time import os import sys import pika import threading import queue import cwipc.util _native_pcloud_receiver_dll_reference = None DEBUG=False DEBUG_MESSAGES=False def _native_pcloud_receiver_dll(libname=None): global _native_pcloud_receiver_dll_reference if _native_pc...
musicplayer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import fnmatch from tinytag import TinyTag import os, re, requests, sys import os.path from os import path import json import pygame import threading, random NEXT = pygame.USEREVENT + 1 os.environ["SDL_VIDEODRIVER"] = "dummy" class MuuzikPlayer: def __init__(self, con...
test_embedded_r.py
import gc import multiprocessing import os import pickle import pytest from rpy2 import rinterface import rpy2 import rpy2.rinterface_lib._rinterface_capi as _rinterface import signal import sys import subprocess import tempfile import time rinterface.initr() def is_AQUA_or_Windows(function): platform = rinterf...
webhook.py
# coding=utf8 """ webhook.py - Sopel GitHub Module Copyright 2015 Max Gurela Copyright 2019 dgw _______ __ __ __ __ | __|__| |_| |--.--.--.| |--. | | | | _| | | || _ | |_______|__|____|__|__|_____||_____| ________ __ __ __ | | | |.-----.| |--.| |--.-...
mitigate.py
#!/usr/bin/sudo python import collections import ctypes import dataclasses import datetime import ipaddress import math import os import random import socket import struct import threading import time import typing import zlib ACTION_ID_AUTO_ATTACK = 0x0007 ACTION_ID_AUTO_ATTACK_MCH = 0x0008 AUTO_ATTACK_DELAY = 0.1 S...
gentable.py
import dask.array as da import multiprocessing import numpy as np import os import random import sys import threading import zarr from collections import namedtuple from contextlib import contextmanager from numcodecs.blosc import Blosc from os import path FinishSignal = namedtuple("FinishSignal", []) def writer(q, ...
apiConnector.py
""" Created on Mär 18 10:31 2019 @author: nishit """ import datetime import time import json import threading from abc import abstractmethod from queue import Queue from random import randrange import requests from senml import senml from IO.MQTTClient import MQTTClient from utils_intern.messageLogger import Messag...
app_reveal.py
# -*- coding: utf-8 -*- """ In this example, we want to show you how you can take isolated blocks of code (featuring different kinds of Bokeh visualizations) and rearrange them in a bigger (encompassing) flask-based application without losing the independence of each example. This is the reason of some weirdness throug...
conftest.py
import asyncio import contextlib import os import ssl import threading import time import typing import pytest import trustme import uvicorn from mitmproxy import options, proxy from mitmproxy.tools.dump import DumpMaster from httpcore._types import URL PROXY_HOST = "127.0.0.1" PROXY_PORT = 8080 class RunNotify: ...
common.py
"""Test the helper method for writing tests.""" import asyncio from collections import OrderedDict from datetime import timedelta import functools as ft import json import os import sys from unittest.mock import patch, MagicMock, Mock from io import StringIO import logging import threading from contextlib import contex...
ffmpegmux.py
import os import random import threading import subprocess import sys from streamlink import StreamError from streamlink.stream import Stream from streamlink.stream.stream import StreamIO from streamlink.utils import NamedPipe from streamlink.compat import devnull, which class MuxedStream(Stream): __shortname_...
main.py
import sys import threading from claim_bonus import load_channel_points_context from exceptions import StreamerDoesNotExistException from login import check_login from pubsub import listen_for_channel_points from twitch_data import set_streamer_logins, get_channel_id, do_for_each_streamer from watch_minute impor...