source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
testAutoCloseWindow.py | import threading, time, ctypes, ctypes.wintypes, math
WM_CLOSE = 0x0010
MB_OK = 0
# def worker(title,close_until_seconds):
# time.sleep(close_until_seconds)
# wd=ctypes.windll.user32.FindWindowA(0,title)
# ctypes.windll.user32.SendMessageA(wd,0x0010,0,0)
# return
def find_messagebox(title, threadid... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import functools
import os
import re
import sys
import copy
import time
import types
import signal
import random
import fnmatch
import logging
import ... |
Blender.py | # TODO
# way to dynamically add actuators & controllers
# http://www.blender.org/api/blender_python_api_2_60_6/bpy.ops.logic.html
import bge # blender game engine
import bpy # blender python interface
import math
import mathutils
import sys
from os.path import expanduser
import socket
import threading
import socketser... |
hypertag.py | import os
import re
from typing import Set
from shutil import rmtree, move
import sqlite3
import urllib
import json
from multiprocessing import Pool
from pathlib import Path
import fire # type: ignore
from tqdm import tqdm # type: ignore
import rpyc # type: ignore
from pywebcopy import WebPage, config # type: ignor... |
agent_state_manager.py | #! /usr/bin/env python
# _*_ coding:utf-8 _*_
import threading
# from server import STATE_UPDATE_INTERVAL, AgentState
from .agent_state import *
from common import event_manager, CommonEvent
def singleton(cls):
_instance = {}
def _singleton(*args, **kargs):
if cls not in _instance:
_insta... |
test_fx.py | import builtins
import contextlib
import copy
import functools
import inspect
import math
import numbers
import operator
import os
import pickle
import sys
import torch
import traceback
import typing
import types
import warnings
import unittest
from math import sqrt
from torch.multiprocessing import Process
from torch.... |
ssh.py | #!/usr/bin/python
import getopt
import sys
from threading import Thread
from datetime import datetime
import uuid
sys.path = [".", "lib"] + sys.path
from platform_utils.remote.remote_util import \
RemoteMachineShellConnection
import TestInput
import logging.config
logging.config.fileConfig("scripts.logging.conf"... |
overlap.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
import math
import json
import threading
import numpy as np
import tensorflow as tf
import util
import coref_ops
import conll
import metrics
import optimization
from bert import tokeniz... |
lanscan.py | import netifaces
from scapy.all import *
import socket
import netaddr
import ipaddress
from tqdm import tqdm
import socket
import os
import pandas as pd
import threading
def get_own_ip():
own_ip = netifaces.ifaddresses('en0')[netifaces.AF_INET][0]['addr']
return own_ip
def get_broadcastaddr():
broadcasta... |
fn_api_runner.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... |
application.py | # 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.
# pyre-strict
import argparse
import json
import logging
import os
import subprocess
import tempfile
import threading
from pathlib import Pat... |
parallel.py | """Classes and methods to run predictions in parallel."""
# stdlib
import os
import math
import time
from threading import Thread
from Queue import Queue as ThreadQueue
from multiprocessing import Process, Semaphore, cpu_count, Queue as ProcessQueue
# local
from .methods import Predictor
from ..microarraydata import M... |
terminal.py | import sys
import pyte
import operator
import threading
from contextlib import contextmanager
import time
import os
if sys.platform.startswith("win"):
import winpty
else:
import ptyprocess
__all__ = ["PtyProcess", "Screen", "ByteStream", "Terminal"]
if sys.platform.startswith("win"):
ParentPtyProcess =... |
task.py | from .debug import Logger
from threading import Thread
mylog = Logger()
class Task(object):
def __init__(self, function=None):
"""
Base Async Task Object
Base constructor
"""
self.name = "Task"
self.function = function
def delay(self, *args):
... |
test_atom.py | import copy
import gc
import os
import random
import time
from multiprocessing import Process, Queue
from threading import Thread
import numpy as np
import pytest
import redis
from atom import AtomError, Element, MetricsLevel, SetEmptyError
from atom.config import (
ATOM_CALLBACK_FAILED,
ATOM_COMMAND_NO_ACK,
... |
15-oxygen-2.py | import sys
import unittest
from intcode_threaded import Machine
from queue import Queue
import threading
import os
import time
import numpy as np
from colorama import Fore, Back, Style
#Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET.
#Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RE... |
__init__.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
__all__ = ['ToastNotifier']
# #############################################################################
# ########## Libraries #############
# ##################################
# standard library
... |
launch_conversation.py | #!/usr/bin/env python3
# Author: Jacob Schofield <jacob@helpsocial.com>
# Copyright (c) 2017 HelpSocial, Inc.
# See LICENSE for details
import multiprocessing as mp
import os
import re
import sys
import webbrowser
try:
import ujson as json
except ImportError:
import json
from argparse import ArgumentParser
... |
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... |
sources.py | import asyncio
import copy
import csv
import math
import queue
import threading
import uuid
import warnings
from datetime import datetime
from typing import List, Optional, Union, Callable, Coroutine, Iterable
import pyarrow.parquet as pq
import pandas
import pytz
from .dtypes import _termination_obj, Event, legal_ti... |
test_search.py | import time
import pdb
import copy
import threading
import logging
from multiprocessing import Pool, Process
import pytest
import numpy as np
from milvus import DataType
from utils import *
dim = 128
segment_row_count = 5000
top_k_limit = 2048
collection_id = "search"
tag = "1970-01-01"
insert_interval_time = 1.5
nb ... |
start.py | #!python
"""
Entrypoint for starting the application.
"""
import os
import logging
import time
import threading
from contextlib import contextmanager
is_nt = os.name == 'nt'
if not is_nt:
import daemon as pydaemon
import pid
else:
pydaemon = pid = None
import click
from coilmq.config import config as ... |
transfer_manager.py | """
Manage transfers from arbitrary URLs to temporary files. Socket interface for
IPC with multiple process configurations.
"""
import json
import logging
import os
import socket
import subprocess
import threading
from six.moves import shlex_quote
from galaxy.util import listify, sleeper
from galaxy.util.json import... |
run_object_detection_service.py | import pathlib
import subprocess
import time
import os
import sys
import logging
import threading
from service import registry
logging.basicConfig(level=10, format="%(asctime)s - [%(levelname)8s] - %(name)s - %(message)s")
log = logging.getLogger("run_object_detection")
def main():
root_path = pathlib.Path(__f... |
AbstractUI.py | import wx
import multiprocessing as mp
import time
from . import process
import abc
#define an abstract UI class which contains code to interact with server.
#Note that each demo MUST derive its own subclass of this class (in *demo_name*_UI.py), and modify existing/add new methods to customise the GUI to the demo'... |
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",
... |
workflow.py | import datetime
import json
import os
import tempfile
import threading
import time
from hashlib import md5
from pathlib import Path
import sseclient
from girder_client import GirderClient
class InstanceStatus:
LAUNCHING = 0
RUNNING = 1
ERROR = 2
def md5sum(filename, buf_size=8192):
m = md5()
# ... |
basic_germanim_test.py | from behave import *
from time import sleep
import os
import re
import threading
from germanium.static import *
from features.steps.asserts import *
use_step_matcher("re")
URL_MATCHER=re.compile(r"^(https?://)(.*?)(/.*)$")
def instantiate_germanium_webdriver():
browser = "firefox"
if 'TEST_BROWSER' in o... |
loop.py | import obspython as _obs
import threading
import traceback
from . import data as _data
from . import _helper
class Future:
_NOTSET = object()
_EXCEPTION = object()
_INTERRUPT = object()
_WAITING = []
def __init__(self):
self._result = self._NOTSET
self._exception = None
se... |
pacu.py | #!/usr/bin/env python3
import copy
import importlib
import json
import os
import platform
from queue import Queue
import random
import re
import shlex
import string
import subprocess
import sys
import threading
import time
import traceback
from http.server import BaseHTTPRequestHandler, HTTPServer
try:
import requ... |
wof.py | from __future__ import absolute_import
from collections import namedtuple
from contextlib import closing
from cStringIO import StringIO
from datetime import datetime
from edtf import parse_edtf
from operator import attrgetter
from psycopg2.extras import register_hstore
from shapely import geos
from tilequeue.tile impor... |
subproc.py | # --- built in ---
import os
import sys
import enum
import time
import logging
import multiprocessing
from typing import Union
# --- 3rd party ---
import gym
import numpy as np
import cloudpickle
# --- my module ---
from unstable_baselines.lib import utils as ub_utils
from unstable_baselines.lib.envs.vec import base... |
utils.py | import web3
import solc
import time
import threading
import hashlib
import os
w3 = None
cache = {}
def connect():
global w3
if w3 is None or not w3.isConnected:
# large request timeout require for performance tests
w3 = web3.Web3(web3.HTTPProvider('http://127.0.0.1:8545', request_kwargs={'tim... |
dbdlml.py | '''
Encoding image analyzing errors: Add the numbers below to 8 to encode all types of errors (so status=9...23 is reserved to describe the errors)
- general exception: 1
- bad format: 2
- image too big: 4
- image too small: 8
- any combination of above
'''
import gc
import os
import ssl
import sys
import time
imp... |
test_worker.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import json
import os
import shutil
import signal
import subprocess
import sys
import time
import zlib
from datetime import datetime, timedelta, timezone
from multiprocessing import Pro... |
multithread.py | # -*- coding: utf-8 -*-
"""
Example of multithreading by releasing the GIL through ctypes.
"""
from __future__ import print_function, division, absolute_import
from timeit import repeat
import threading
from ctypes import pythonapi, c_void_p
from math import exp
import numpy as np
from numba import jit, void, double
... |
network.py | # Electrum - Lightweight Bitcoin Client
# Copyright (c) 2011-2016 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rig... |
vsnp_build_tables.py | #!/usr/bin/env python
import argparse
import multiprocessing
import os
import queue
import re
import pandas
import pandas.io.formats.excel
from Bio import SeqIO
# Maximum columns allowed in a LibreOffice
# spreadsheet is 1024. Excel allows for
# 16,384 columns, but we'll set the lower
# number as the maximum. Some... |
test_socket.py | import unittest
from test import support
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import array
import contextlib
from weakref import proxy
import signal
import math
import pickle
import struct
... |
miniterm.py | #!C:\Users\reesj2\Downloads\WinPython-64bit-3.4.4.4Zero\python-3.4.4.amd64\python.exe
#
# Very simple serial terminal
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C)2002-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
import codecs
import os
import sys
... |
client2.py | import socket
import datetime
import threading
import pytz
import time
from lib.MyUtils import TimeBuilder, ClientIncrementBuilder, get_time_server_delay
def set_time_from_server(raw_timestamp):
datetime_updated = TimeBuilder(
datetime.datetime.fromtimestamp(raw_timestamp))
if datetime_updated.get_ti... |
core.py | #! /usr/bin/python3
#
# Copyright (c) 2018 Sébastien RAMAGE
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
from binascii import hexlify
import traceback
from time import (sleep, strftime, time)
import logging
import json
import os
from s... |
test_pooler.py | import asyncio
import os
import signal
import ssl
from multiprocessing import Process
from random import randint
from time import sleep
from unittest.mock import Mock
import aiohttp
import pytest
import requests
from proxypooler import config
from proxypooler.pooler import ProxyPooler
from proxypooler.ext import ser... |
extensions.py | import sqlalchemy
from flask_sqlalchemy import SQLAlchemy
from config import *
from sqlalchemy.orm import sessionmaker,scoped_session
import os
# url = 'mysql+pymysql://{0}:{1}@{2}'.format(USER, PASSWORD, HOST)
url = os.getenv("DB_URL")
engine = sqlalchemy.create_engine(url) # connect to server
engine.execute("CREATE... |
ixcp.py | #!/usr/bin/env python
# Copyright 2013-16 Board of Trustees of Stanford University
# Copyright 2013-16 Ecole Polytechnique Federale Lausanne (EPFL)
#
# 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 S... |
02_a3c_grad.py | #!/usr/bin/env python3
import os
import gym
import ptan
import argparse
from tensorboardX import SummaryWriter
import torch
import torch.nn.utils as nn_utils
import torch.nn.functional as F
import torch.optim as optim
import torch.multiprocessing as mp
from lib import common
GAMMA = 0.99
LEARNING_RATE = 0.001
ENTROP... |
rate_processing.py | import os
import re
import sqlite3
import time
import logging
import requests
import threading
from bs4 import BeautifulSoup
logging.basicConfig(level=logging.WARNING)
class RateProcessing:
"""
Инициализация класса
"""
def __init__(self, upd_time: int):
self.currencies_ref_dict = {
... |
project_files_monitor_test.py | # 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.
# pyre-unsafe
import os
import socket
import tempfile
import threading
import unittest
from unittest.mock import MagicMock, patch
from .. im... |
debug_ext.py | import json
import os
import re
import shlex
import subprocess
import sys
import threading
import time
from threading import Thread
from typing import Any, Dict, List
from idf_py_actions.errors import FatalError
from idf_py_actions.tools import ensure_build_directory
PYTHON = sys.executable
def action_extensions(ba... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin 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 witho... |
console.py | from src.parse import args as arguments
from threading import Thread
import pathlib as pl
import code
import time
import sys
Off = '\033[0m' # Text Reset
Black = '\033[1;90m' # Black
Red = '\033[1;91m' # Red
Green = '\033[1;92m' # Green
Yellow = '\033[1;93m' # Yellow
Blue = '\033[1;94m' ... |
update_config.py | #!/usr/bin/env python2
# Copyright 2013-present Barefoot Networks, Inc.
# SPDX-License-Identifier: Apache-2.0
import argparse
from time import sleep
import grpc
from p4.v1 import p4runtime_pb2
from p4.config.v1 import p4info_pb2
from p4.tmp import p4config_pb2
import google.protobuf.text_format
import struct
import ... |
http-server.py | #!/usr/bin/env python
# put into netscan2
from __future__ import division, print_function
import multiprocessing as mp
import time
import bjoern
from jinja2 import Environment
import os
from roku import discover
# try to grab simplejson, if not fall back to the built in json
try:
import simplejson as json
excep... |
app.py | #
# This file is:
# Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com>
#
# MIT License
#
import os
from oregano_gui.ios_native.monkeypatches import MonkeyPatches
from oregano.util import set_verbosity
from oregano_gui.ios_native import ElectrumGui
from oregano_gui.ios_native.utils import call_later, get_use... |
1.thread.py | '''
说明: 多线程并发执行任务,比单线程要节约时间
'''
import time
from queue import Queue
from threading import Thread
def req1(param):
time.sleep(1)
return param
def main1():
return [req1(1), req1(2)]
def req2(param, res_value: Queue):
time.sleep(1)
res_value.put(param)
def main2():
res_value = Queue()
t... |
generate.py | import argparse
import datetime
import glob
import logging
import os
import random
import signal
import sys
import threading
import time
import faker
from typing import List, Union
import yaml
from jsonschema import validate, ValidationError
fake = faker.Faker()
class Generator:
"""
Generator class for log c... |
collections_drop_recreate_rebalance.py | import threading
import time
import json
from Cb_constants import CbServer
from collections_helper.collections_spec_constants import MetaCrudParams
from bucket_collections.collections_base import CollectionBase
from membase.api.rest_client import RestConnection
from bucket_utils.bucket_ready_functions import BucketUti... |
camera_setting.py | import logging
import threading
import subprocess
import numpy as np
import cv2
USB_GSTREAMER = True
def add_camera_args(parser):
"""Add parser augument for camera options."""
parser.add_argument('--file', dest='use_file',
help='use a video file as input (remember to '
... |
frame.py | try:
import requests
except:
requests = None
import io
import os
import re
import sys
import json
import zlib
import time
import hmac
import queue
import shutil
import base64
import hashlib
import tempfile
import traceback
import threading
import tkinter
import inspect
import zipfile
import itertools
import ur... |
dhcp.py | #!/usr/bin/python3
import time
import threading
import struct
import queue
import collections
import traceback
import random
import socket
from listener import *
def get_host_ip_addresses():
return gethostbyname_ex(gethostname())[2]
class WriteBootProtocolPacket(object):
message_type = 2 # 1 for client -> ... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import threading
import traceback
import asyncore
import weakref
import platform
imp... |
Py_chat_server.py | import socket
import threading
HOST = ''
PORT = 8888
ADDR = (HOST, PORT)
buff_size = 1024
clients = {}
addresses = {}
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(ADDR)
def handle_connection():
while True:
client, client_address = s.accept()
client.send(bytes('welcome', 'utf8'))... |
cm_logger.py | #! /usr/bin/python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
import errno
import logging
import multiprocessing
import os
import select
import time
import traceback
import serial
_spec_queue = None
def _spec_open_one(spec):
if isinstance(spec, str):
descr = seri... |
test_zeromq.py | """
:codeauthor: Thomas Jackson <jacksontj.89@gmail.com>
"""
import ctypes
import multiprocessing
import os
import threading
import time
from concurrent.futures.thread import ThreadPoolExecutor
import salt.config
import salt.exceptions
import salt.ext.tornado.gen
import salt.ext.tornado.ioloop
import salt.log.set... |
test_multithreads.py | import traceback
import threading
import multiprocessing
import numpy as np
from numba import cuda
from numba.cuda.testing import skip_on_cudasim, CUDATestCase
import unittest
try:
from concurrent.futures import ThreadPoolExecutor
except ImportError:
has_concurrent_futures = False
else:
has_concurrent_futu... |
get_url.py | import time
import gevent
import urllib2
import simplejson as json
import threading
import gevent.monkey
gevent.monkey.patch_socket()
THREAD_NUM = 150
COUNT = 100000
def fetch(pid):
start = time.time()
response = urllib2.urlopen('http://sdiehl.github.io/gevent-tutorial/')
result = response.read()
#j... |
host_callback_test.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
detect_doublepulsar_smb.py | #!/usr/bin/python
import binascii
import socket
import argparse
import struct
import threading
# Packets
negotiate_protocol_request = binascii.unhexlify("00000085ff534d4272000000001853c00000000000000000000000000000fffe00004000006200025043204e4554574f524b2050524f4752414d20312e3000024c414e4d414e312e30000257696e646f777... |
server.py | from concurrent.futures import thread
import socket
# from sqlite3 import connect
import threading
#threading is an essential for creating multiple thread
HEADER = 64
PORT = 5050
SERVER = socket.gethostbyname(socket.gethostname())
FORMAT= 'utf-8'
DISCONNECT_MSG = "!DISCONNECT"
#SERVER = "10.252.1.144"
# print("SERVER... |
KBParallelTestModuleServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
test_functionality.py | import os
import sys
import time
import yappi
import _yappi
import utils
import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6
if sys.version_info < (2, 7): # use unittest2 for < Py2.7
import unittest2 as _unittest
else:
import unittest as _unittest
class BasicUsag... |
test_query.py | import unittest
import threading
import pg8000
from .connection_settings import db_connect
from six import u
from sys import exc_info
import datetime
from distutils.version import LooseVersion
from warnings import filterwarnings
# Tests relating to the basic operation of the database driver, driven by the
# pg8000 c... |
cross_device_ops_test.py | # Copyright 2018 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... |
dumping_callback_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... |
lisp-etr.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 ... |
main_thread.py | import os
import colorama
import multiprocessing
from dotenv import load_dotenv
from threading import Thread, current_thread
from model.sequencer import Sequencer
from utils.db_connection_db import DatabaseConnection
from utils.db_connection_mock import DatabaseConnectionMock
load_dotenv()
def show_id(seq: Sequencer... |
test_sync.py | import asyncio
import threading
import time
from concurrent.futures import ThreadPoolExecutor
from functools import wraps
from unittest import TestCase
import pytest
from asgiref.sync import async_to_sync, sync_to_async
@pytest.mark.asyncio
async def test_sync_to_async():
"""
Tests we can call sync function... |
JointD+ATT.py | #coding:utf-8
import numpy as np
import tensorflow as tf
import os
import time
import datetime
import ctypes
import threading
import json
ll1 = ctypes.cdll.LoadLibrary
lib_cnn = ll1("./init_cnn.so")
ll2 = ctypes.cdll.LoadLibrary
lib_kg = ll2("./init_know.so")
class Config(object):
def __init__(self):
self.in... |
test_system.py | # Copyright 2016 Google LLC 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 ag... |
inter_thread_communication.py | # import time module
import time
# import threading module
import threading
class product:
def buyer(self):
print('John consumer is wait for product')
print('...............')
event_object.wait()
print('got product')
def seller(self):
time.sleep(5)
print('T... |
timeline.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import contextlib
import itertools
import threading
from debug... |
main.py | # -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: main.py
Description : 运行主函数
Author : JHao
date: 2017/4/1
-------------------------------------------------
Change Activity:
2017/4/1:
---------------------------------... |
main.py | import atexit
import os
import re
import sys
import threading
import time
import traceback
import yaml
import requests
import datetime
@atexit.register
def _end():
end_time = time.time()
print(to_log("INFO", "执行结束", "执行耗时{:.3f}s".format(end_time - start_time)))
def get_shopid():
"""
获取 shopid, 如果网... |
server_multi.py | import socket
import sys
import threading
import time
from queue import Queue
NUMBER_OF_THREADS = 2
JOB_NUMBER =[1,2]
queue = Queue()
all_connections = []
all_addressess = []
# Create a socket ( connects two computer )
def create_socket():
try:
global host
global port
global s
host... |
test_capture.py | import contextlib
import io
import os
import subprocess
import sys
import textwrap
from io import UnsupportedOperation
from typing import BinaryIO
from typing import cast
from typing import Generator
from typing import TextIO
import pytest
from _pytest import capture
from _pytest.capture import _get_multicapture
from ... |
helper.py | import asyncio
import functools
import json
import math
import os
import random
import re
import sys
import threading
import time
import uuid
import warnings
from argparse import ArgumentParser, Namespace
from datetime import datetime
from itertools import islice
from types import SimpleNamespace
from typing import (
... |
test_server_collect.py | import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
from synchrophasor.frame import *
from synchrophasor.pmu import Pmu
from synchrophasor.pmuGen import *
from time import sleep
import threading
SLEEP_TIME = 1.0/100
def test_client_single_pmu():
pmu = create_pmu(9006)
pmu.... |
test_app.py | import queue
import threading
from chatbot.speakeasy.app import App
# if __name__ == "__main__":
# app = App()
# while True:
# question = input("Ask:")
# threads = []
# q = queue.Queue()
# try:
# t = threading.Thread(target=app.get_response, args=(question, q,))
# ... |
repositories.py | import datetime
import pandas as pd
import re
import time
import threading
from flask import make_response, send_file
from flask_restful import Resource, reqparse
from repocollector.github import GithubRepositoriesCollector
def is_ansible_dir(path: str) -> bool:
"""
Check whether the path is an Ansible direc... |
plugin.py | import os
import time
import threading
import json
import sys
import atexit
import logging
import BaseHTTPServer
import SocketServer
import maya.cmds
import assetexchange_shared
class ThreadingHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
"""Handle requests in a separate thread."""
_http_s... |
std_stream_redirector.py | #!/usr/bin/env python3
# Copyright (c) 2019, Alchemy Meister
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# ... |
Translator.py | import asyncio
import hashlib
import json
import threading
import urllib.parse
import requests
from parsimonious import ParseError, VisitationError
from pyseeyou import format
from Util import Configuration, GearbotLogging, Emoji, Utils
LANGS = dict()
LANG_NAMES = dict(en_US= "English")
LANG_CODES = dict(English="en... |
remote.py | #
# 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 copy
import time
import torch
import torch.multiprocessing as mp
from salina import Agent
from salina.workspace import Workspace,... |
vehicle.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 25 10:44:24 2017
@author: wroscoe
"""
import time
from statistics import median
from threading import Thread
from .memory import Memory
from prettytable import PrettyTable
class PartProfiler:
def __init__(self):
self.records = {}
... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
run.py | import pafy
import vlc
import time
import multiprocessing
from datawatts import datassette
from datawatts import watts
from datawatts import menu
wattsurl = next(watts.get_url())[1]
dataurl = next(datassette.get_url())
dataname = dataurl[0].split(':')[1].strip()
dataurl = dataurl[1]
video = pafy.new(wattsurl)
best ... |
run_end_to_end_test.py | #!/usr/bin/env python3
#
# end to end tests of fetch-ledger
#
# This is achieved by using available fetch APIs to spin up a network locally
# and test it can handle certain conditions (such as single or multiple
# node failure)
import sys
import os
import argparse
import yaml
import io
import random
import datetime
i... |
app.py | import json
import logging
import subprocess
import os
import sys
import urllib.parse
from flask import abort, Flask, jsonify, request, Response
from flask_cors import CORS, cross_origin
from logging.config import dictConfig
from threading import Thread
dictConfig({
'version': 1,
'formatters': {'default': {
... |
process_threads_and_tasks_autoscale.py | # -*- coding: utf-8 -*-
#
# Author: Daniel Garcia (cr0hn) - @ggdaniel
#
import aiohttp
import asyncio
import random
from threading import Thread, Event, BoundedSemaphore, currentThread
from multiprocessing import Process
class ConcurrentManager:
def __init__(self, n_process=2, n_threads=5, n_taks=10, daemon=Fals... |
test_advanced.py | # coding: utf-8
from concurrent.futures import ThreadPoolExecutor
import json
import logging
import random
import sys
import threading
import time
import numpy as np
import pytest
import ray
import ray.cluster_utils
import ray.test_utils
from ray.test_utils import RayTestTimeoutException
logger = logging.getLogger(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.