source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
iotools_sparse.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import sys
import threading
import time
from uresnet.iotools.io_base import io_base
def get_particle_info(particle_v):
from larcv import larcv
num_particles = particle_v.size()
p... |
lambda_executors.py | import os
import re
import sys
import glob
import json
import time
import logging
import threading
import traceback
import subprocess
import six
import base64
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
from pipes import quote as cmd_quote # for Pyth... |
multigpuml.py |
# run as: python3 multigpu.py 0 and python3 multigpu.py 1 where 0 and 1 are GPU ids
import os
os.environ["TOKENIZER_PARALLELISM"] = "false"
import re
import sys
import time
import uuid
import clip
import torch
import queue
import shutil
import curses
import tarfile
import hashlib
import requests
import argparse
impor... |
client.py | """Micropede Client for Python"""
__version__ = '0.0.2'
import asyncio
import functools
import inspect
import json
import os
import platform
import time
import types
import random
import re
import urllib
import uuid
import threading
from threading import Timer, Thread
from jsonschema import valida... |
part2.py | """
File: part2.py
Created by Andrew Ingson (aings1@umbc.edu)
Date: 4/26/2020
CMSC 441 (Design and Analysis of Algorithms)
Notes: The only non-standard library used for this project would gmpy2. On windows you can use anaconda to get gmpy2
otherwise you'll need to run this program on linux so you can install gm... |
tabuadaqueue.py | import sys
import os
import time
from multiprocessing import Process, Value, Array, Pipe, Queue
argm = int(sys.argv[1])
q = Queue()
def func_tab(q):
ar2 = q.get()
for i in range(11):
sm = argm * i
ar2.append(sm)
q.put(ar2)
ar2 = []
newT = Process(target=func_tab, args=(q,))
... |
threading_local_connection_context_manager_demo.py | # -*- coding: UTF-8 -*-
from socket import socket, AF_INET, SOCK_STREAM
import threading
class LazyConnection:
def __init__(self, address, family=AF_INET, _type=SOCK_STREAM):
self.address = address
self.family = family
self._type = _type
self.local = threading.local()
def __e... |
bss_evaluate.py | import os
import glob
import re
import multiprocessing as mp
import numpy as np
import scipy.io.wavfile
import pandas as pd
import tqdm
from magnolia.utils.bss_eval import bss_eval_sources
def evaluate(input_path, output_csv_file, target_stype=None, eval_sr=8000, num_sources=2):
print('starting evaluation on dir... |
ai4e_service.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from threading import Thread
from os import getenv
import json
import requests
import traceback
from flask import Flask, abort, request, current_app, views
from flask_restful import Resource, Api
import signal
from task_manag... |
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... |
scheduler.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
USAGE = """
## Example
For any existing app
Create File: app/models/scheduler.py ======
from gluon.scheduler import Scheduler
def demo1(*args,**vars):
print 'you passed args=%s and vars=%s' % (args, vars)
return 'done!'
def demo2():
1/0
scheduler = Schedul... |
_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 subprocess
import struct
import operator
import p... |
executor.py | # -*- coding: utf-8 -*-
from fl_client_libs import *
from argparse import Namespace
import gc
from client import Client
from rlclient import RLClient
from concurrent import futures
import grpc
import job_api_pb2_grpc
import job_api_pb2
import io
import torch
import pickle
MAX_MESSAGE_LENGTH = 50000000
class Executo... |
udp_server.py | import json
import time
import asyncio
import threading
import uvloop
from .base import BaseServer
class KademliaUDPServer(BaseServer):
def start(self):
loop = uvloop.new_event_loop()
def starting_new_thread():
asyncio.set_event_loop(loop)
try:
address =... |
pyshell.py | #! /usr/bin/env python3
import sys
if __name__ == "__main__":
sys.modules['idlelib.pyshell'] = sys.modules['__main__']
try:
from tkinter import *
except ImportError:
print("** IDLE can't import Tkinter.\n"
"Your Python may not be configured for Tk. **", file=sys.__stderr__)
raise SystemExit(... |
main.py | from gensim.models import KeyedVectors
import numpy as np
from repository.csv_tools import get_documents
from models.naive_bayes_utils import NaiveBayes
from models.lda_utils import get_topic_keywords
from document import Document
from nltk import word_tokenize
import util.file_manager as fm
import click
import util.pr... |
Triggers.py |
# TRIGGERS.PY
import logging
import sys
import time
defaultDefault = object()
class TriggerFactory:
def __init__(self, tack):
self.tack = tack
self.kinds = { "timer" : TimerTrigger,
"process" : ProcessTrigger,
"globus" : GlobusTrigger,
... |
acl_compressor.py | import multiprocessing
import numpy
import os
import platform
import queue
import threading
import time
import signal
import sys
from itertools import chain
# This script depends on a SJSON parsing package:
# https://pypi.python.org/pypi/SJSON/1.1.0
# https://shelter13.net/projects/SJSON/
# https://bitbucket.org/Ante... |
genqueue.py | # genqueue.py
#
# Generate a sequence of items that put onto a queue
def genfrom_queue(thequeue):
while True:
item = thequeue.get()
if item is StopIteration:
break
yield item
def sendto_queue(items, thequeue):
for item in items:
thequeue.put(item)
... |
__init__.py | # -*- coding: utf-8 -*-
"""Miscellaneous helper functions (not wiki-dependent)."""
#
# (C) Pywikibot team, 2008-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, print_function, unicode_literals
__version__ = '$Id: 714f04777e8d22dd7444306a02784c639d28db80 $'
import col... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
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
import random
import ... |
progress_bar.py | import sys
sys.path.append('../../src')
from NeoViki_UI_Python import *
from tkinter import filedialog
import time
import threading
FILE_TYPES=[('PDF files', '.pdf'),
('JPG files', '.jpg'),
('PNG files', '.png'),
('Py files', '*.py'),
('all files', '.*')]
cb_thread=No... |
exposition.py | from __future__ import unicode_literals
import base64
from contextlib import closing
import os
import socket
import sys
import threading
from wsgiref.simple_server import make_server, WSGIRequestHandler, WSGIServer
from .openmetrics import exposition as openmetrics
from .registry import REGISTRY
from .utils import fl... |
__init__.py | import logging
import threading
# TODO: handle a failed connection
# Create Logger
LOGGER = logging.getLogger(__name__)
STOPPED = threading.Event()
def start():
LOGGER.debug("Running the preloop-function, saying hi.")
print("\n"
" ____ _ __ __ _ _ _ _____ _ _ _ ""\n"
... |
canRec.py | import can
import socket
import threading
import serial
import time
from queue import Queue, LifoQueue
from canSim import arbID
# CAN Interface data
interface = 'socketcan'
channel = 'vcan0'
# TCP client data
host = socket.gethostname()
port = 12345
# Initialise bus
bus = can.Bus(interface=interface, channel=channel... |
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... |
oes_md.py | import time
from copy import copy
from datetime import datetime
from gettext import gettext as _
from threading import Thread
# noinspection PyUnresolvedReferences
from typing import Any, Callable, Dict
from vnpy.api.oes.vnoes import MdsApiClientEnvT, MdsApi_DestoryAll, MdsApi_InitLogger, \
MdsApi_InitTcpChannel2,... |
main.py | import sys
import threading
from EventReader import EventReader
from SQLAdapter import SQLAdapter
from SystemLogger import SystemLogger
from env import log_interval
class App:
def __init__(self):
self.sql = SQLAdapter()
self.logger = SystemLogger(self.sql, log_interval)
self.reader = Eve... |
gunicorn_conf.py | # Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
ray.py | #! /usr/bin/env python
# Copyright (c) 2019 Uber Technologies, 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 a... |
client.py | from bittorrent.bdencoder.bdencoder import Bdecoder, Bencoder
from bittorrent.bdencoder.bdencoder import BdecodingError, BencodingError
from bittorrent.peers.peer import Peer, PEER_ID_SIZE
from bittorrent.torrent import Torrent, TorrentStatus
from bittorrent.request import httprequest, udprequest
from bittorrent.file... |
main.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import time
import importlib
import threading
from absl import app
from absl import flags
from pysc2 import maps
from pysc2.env import available_actions_printer
from pysc2.env import sc2_e... |
HiddenEye.py | #!/usr/bin/python3
#
#HiddenEye by Open Source Community
#
import multiprocessing
import gettext
from os import system,environ
import sys
import ssl
if(not environ.get('PYTHONHTTPSVERIFY',"") and getattr(ssl,'_create_unverified_context',None)):
ssl._create_default_https_context=ssl._create_unverified_context
f... |
utils.py | import subprocess
import multiprocessing as mp
from typing import Optional
import os
def run(ssh_cmd):
subprocess.check_call(ssh_cmd, shell=True)
def execute_remote(
cmd: str,
ip: str,
port: Optional[int] = 22,
username: Optional[str] = ""
) -> mp.Process:
"""Execute command line on remote ma... |
11.wait.py | import threading
from concurrent.futures import ThreadPoolExecutor, as_completed, wait
import time
# 参数times用来模拟网络请求的时间
def work(times):
time.sleep(times)
print("get page {}s finished".format(times))
return times
def manage():
tasks = [executor.submit(work, 3)]
print('manage is running0')
ti... |
TUI.py | """
TUI Class
"""
import sys
import os
import datetime
from copy import copy
from enum import IntEnum
from queue import Queue, Empty
from threading import Thread
from CommonLib.proto.ChatRoomMessage_pb2 import ChatRoomMessage
from .Client import *
from .KBHit import KBHit
class TuiState(IntEnum):
TUI = 0
... |
calculate.py | """
This module implements methods to calculate electron scattering based on an
AmsetData object.
Todo:
- Umklapp scattering (e.g. include scattering to additional G vectors)
- Interband scattering
"""
import copy
import logging
import math
import sys
import time
from multiprocessing import cpu_count, Process, Queu... |
try_case_func.py | # -*- coding: utf-8 -*-
# @Author : xiaoke
# @Email : 976249817@qq.com
import unittest
import threading
from time import sleep
# 第三种使用一个函数即可实现
def TestCaseMeta(parame):
parame = parame
global parame_global
parame_global = parame
class TestCase(unittest.TestCase):
@classmethod
... |
pickletester.py | import collections
import copyreg
import dbm
import io
import functools
import os
import math
import pickle
import pickletools
import shutil
import struct
import sys
import threading
import unittest
import weakref
from textwrap import dedent
from http.cookies import SimpleCookie
try:
import _testbuffer
except Impo... |
miniterm.py | #!/usr/bin/env python
# Very simple serial terminal
# (C)2002-2011 Chris Liechti <cliechti@gmx.net>
# Input characters are sent directly (only LF -> CR/LF/CRLF translation is
# done), received characters are displayed as is (or escaped trough pythons
# repr, useful for debug purposes)
import sys, os, serial, thread... |
interactive.py | import asyncio
import logging
import os
import tempfile
import textwrap
import uuid
from functools import partial
from multiprocessing import Process
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union
import numpy as np
from aiohttp import ClientError
from colorclass import Color
from sanic imp... |
okexGateway.py | # encoding: UTF-8
'''
vnpy.api.okex的gateway接入
注意:
1. 目前仅支持USD现货交易
'''
import os
import json
from datetime import datetime
from time import sleep
from copy import copy
from threading import Condition
from Queue import Queue
from threading import Thread
from time import sleep
from vnpy.api.okex import OkexSpotApi, CO... |
__init__.py | # -*- coding: utf-8 -*-
# pylint: disable=broad-except, bare-except, invalid-name
import base64
from datetime import datetime, timedelta
import json
import asyncio
import socket
import struct
import threading
import time
from .cloud import Cloud
from .block import Block
from .device import Device
from ... |
daemon.py |
import os
import signal
import time
from datetime import datetime, timedelta
from threading import Thread, Event
from django.db.models.query import QuerySet
from django.db.models import Model, CharField, DateTimeField, IntegerField
from norc import settings
from norc.core.constants import (Status, Request,
HEART... |
job.py | """apollo.job
Schedules jobs by creating a process for each one.
Functions:
schedule_show(Show) -> None
"""
from logging import INFO, basicConfig, info, error
from multiprocessing import Process
from os import chmod
from os.path import basename
from shutil import move
from typing import Tuple
from schedule impo... |
spawner.py | import socket
from threading import Thread
import logging
from traitlets import Unicode
from textwrap import dedent
from jupyterhub.spawner import Spawner
from mesos_spawner.scheduler import JupyterHubScheduler
class MesosSpawner(Spawner):
_scheduler = None
_scheduler_thread = None
_count = None
mes... |
start.py | # Copyright BigchainDB GmbH and BigchainDB contributors
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
import logging
import setproctitle
from abci import TmVersion, ABCI
import bigchaindb
from bigchaindb.lib import BigchainDB
from bigchaindb.core import App
from bi... |
elasticinterface.py | import requests
import json
import time
import threading
import hashlib, base64
import random
import sys
import queue
from collections import deque
from .ngramstream import NgramBase, NgramSources, NgramStream
class ElasticUtility(object):
def __init__(self, database_url, language, version):
database_ur... |
brownian.py | # Brownian motion -- an example of a multi-threaded Tkinter program.
from Tkinter import *
import random
import threading
import time
import sys
WIDTH = 400
HEIGHT = 300
SIGMA = 10
BUZZ = 2
RADIUS = 2
LAMBDA = 10
FILL = 'red'
stop = 0 # Set when main loop exits
def particle(canvas):
... |
test_pool.py | import collections
import random
import threading
import time
import weakref
import sqlalchemy as tsa
from sqlalchemy import event
from sqlalchemy import pool
from sqlalchemy import select
from sqlalchemy import testing
from sqlalchemy.engine import default
from sqlalchemy.testing import assert_raises
from sqlalchemy.... |
dash696.py | import os
import ttk
import Tkinter as tk
import ScrolledText
import multiprocessing
import struct
import time
import urllib
import socket
import StringIO
import pickle
from multiprocessing.reduction import ForkingPickler
import PIL.Image
import PIL.ImageTk
import cv2
import numpy as np
class Tcp_Tag:
# These co... |
contextutil.py | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
import os
import shutil
import signal
import sys
import tempfile
import threading
import time
import uuid
import zipfile
from contextlib import closing, contextmanager
from ... |
run_fuzz_windows10.py | # monitor
import subprocess
import os
import time
import datetime
import threading
import shutil
import argparse
import Dashboard
BROWSER_PATH = ''
METHOD = None
URL = "http://127.0.0.1:8080/flag?"
MODE1 = "--incognito" # 시크릿 모드
MODE2 = "--no-sandbox" # 샌드박스 비활성화
TIMEOUT = 300 # 5min
p = None
RUN_FLAG = False
de... |
block_test.py | import unittest
import sys
import os
sys.path.append(os.path.abspath(os.path.join(__file__, "../../python")))
from petitBloc import block
from petitBloc import chain
import threading
import Queue
import time
class MakeString(block.Block):
def __init__(self):
super(MakeString, self).__init__()
def ini... |
clock.py | import datetime
import re
import statistics
import subprocess
import threading
import traceback
import ivr
last_check = None
localtime_trusted = None
# Correct the local time when the difference from GPS time is large.
# The local time on the Raspberry Pi is often very wrong since it doesn't have an RTC.
def correct... |
contextutil.py | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
import os
import shutil
import signal
import sys
import tempfile
import threading
import time
import uuid
import zipfile
from contextlib import closing, contextmanager
from ... |
variable_scope.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... |
server_terminal.py | import threading
import socket
import time
server = socket.socket()
server.bind(('localhost' , 12451))
server.listen(5)
con , addr = server.accept()
def send_data():
while True:
send = raw_input(">>")
con.send(send)
time.sleep(5)
def recv_data():
while True:
data_recv = con.recv(1024)
print(data_recv)
... |
upnp.py | import logging
import threading
from queue import Queue
from typing import Optional
try:
import miniupnpc
except ImportError:
pass
log = logging.getLogger(__name__)
class UPnP:
thread: Optional[threading.Thread] = None
queue: Queue = Queue()
def __init__(self):
def run():
t... |
test.py | import json
import logging
import random
import threading
import os
import pytest
from helpers.cluster import ClickHouseCluster, ClickHouseInstance
import helpers.client
logging.getLogger().setLevel(logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler())
# Creates S3 bucket for tests and allows anon... |
backtester_vc_jj.py | import os
import sys
import sqlite3
import datetime
import pandas as pd
from matplotlib import gridspec
from matplotlib import pyplot as plt
from multiprocessing import Process, Queue
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from utility.setting import DB_STG, DB_TICK, DB_BACKTEST, G... |
ssh_all.py | #!/usr/bin/python
#-*- coding: utf-8 -*-
import sys
import paramiko
import threading
def ssh2(ip,port,username,cmd):
try:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip,port,username,timeout=5)
for m in cmd:
stdin, stdo... |
irc.py | # coding=utf-8
# irc.py - An Utility IRC Bot
# Copyright 2008, Sean B. Palmer, inamidst.com
# Copyright 2012, Elsie Powell, http://embolalia.com
# Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
#
# Licensed under the Eiffel Forum License 2.
#
# When working on core IRC protocol related features, consult protoc... |
turtle.py | #!/usr/bin/env python
import turtle as _turtle
import threading
import inspect
import queue
import math
from typing import Any, Union, Tuple
from PIL import Image, ImageTk
_key_events = {} # maps key to [raw handler, event[]]
def _add_key_event(key, event):
if key not in _key_events:
entry = [None, []]
... |
gcp_janitor.py | #!/usr/bin/env python
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
exemplo_02.py | from collections import deque
from time import sleep
def contador(name, stop):
cont = 1
while cont <= stop:
yield name, cont
cont += 1
sleep(.1)
def contador_regressivo(name, start):
while start >= 1:
yield name, start
start -= 1
sleep(1)
class Scheduler... |
test_cluster.py | #!/usr/bin/env python
'''
test_cluster.py - integration tests for a brozzler cluster, expects brozzler,
warcprox, pywb, rethinkdb and other dependencies to be running already
Copyright (C) 2016-2017 Internet Archive
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in co... |
findpi.py | """Uses brand new features of Python 3"""
import argparse
import threading
import psutil
from concurrent.futures import ThreadPoolExecutor
import os
import socket
import sys
import time
import platform
from getmac import get_mac_address
try:
from __version__ import __version__
except ModuleNotFoundError:
from f... |
testing.py | #############################################################################
#
# Copyright (c) 2004-2009 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS... |
edgebox_multiprocess_coco.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This sample demonstrates structured edge detection and edgeboxes.
Usage:
edgeboxes_demo.py [<model>] [<input_image>]
'''
import cv2 as cv
import numpy as np
import sys
from multiprocessing import Process
import os
import mmcv
import json
# path_prefi... |
listener.py | from __future__ import absolute_import
import logging
import threading
log = logging.getLogger("sqlalchemy_collectd")
def _receive(receiver):
while True:
try:
receiver.receive()
except Exception:
log.error("message receiver caught an exception", exc_info=True)
exc... |
agent.py | import socket
import time
import serial, time, struct
from WiiProxy import MultiWii
import threading
class Agent:
# =================================
def __init__(self, serialPort):
self.armed = False
self.disarmed = False
self.cmds = [1000,1000,1000,1000]
self.state = [1000,1... |
server.py | import socket
from threading import Thread
import threading
import math
class Server:
def __init__(self):
sock.bind(('localhost', 9090))
sock.listen(10)
print("Server was started on socket:", sock)
print("Wait for users...")
def get_socket(self):
while True:
... |
xmlstream.py | """
sleekxmpp.xmlstream.xmlstream
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module provides the module for creating and
interacting with generic XML streams, along with
the necessary eventing infrastructure.
Part of SleekXMPP: The Sleek XMPP Library
:copyright: (c) 2011 Nathanael C. Fritz
:... |
proknight.py | #Code By GogoZin
#Can Be A Skid But Don't Be A Theif
#-------------------------------#
# Improved Script performance #
# Added Local Proxy Checker #
# Auto select file(for skid) #
# By L330n123 #
#-------------------------------#
import time
import socket
import random
import requests
import... |
simulation.py | from threading import Thread
from detection.detection import detect_objects
from routes import get_route, get_directions
coordenada, destino = get_route()
t1 = Thread(target=detect_objects)
t2 = Thread(target=get_directions, args=(coordenada, destino))
t1.start()
t2.start()
t1.join()
t2.join()
|
classifiers.py | import yavalath_engine
from players.blue import common
from enum import Enum
import numpy
import itertools
import functools
import collections
import pickle
import time
import multiprocessing
import queue
import os
import pathlib
import logging
logger = logging.getLogger(__file__)
# TODO: More classification should a... |
bazel_external_repository_test.py | # pylint: disable=g-bad-file-header
# Copyright 2017 The Bazel 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
... |
test_setting.py | import threading
import unittest
from dongtai_agent_python.setting.setting import Setting
class TestSetting(unittest.TestCase):
def test_multithreading(self):
def test(name):
st1 = Setting()
st1.set_container({'name': name, 'version': '0.1'})
st1.incr_request_seq()
... |
invokers.py | #
# (C) Copyright IBM Corp. 2020
# (C) Copyright Cloudlab URV 2020
#
# 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 ap... |
stream.py | import logging
import random
from multiprocessing.dummy import Pool
import time
import grpc
import wav2letter_pb2
import wav2letter_pb2_grpc
import queue
import threading
logging.basicConfig(level=logging.INFO)
SERVER_URL = 'localhost:50051'
NUM_BYTES = 16384
def generate_msg(stub, audio_path):
def thread_func... |
TFTBot.py | import threading
from pyautogui import *
from pytesseract import *
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow, QCheckBox, QDesktopWidget, QMessageBox, QStatusBar
from PyQt5.QtGui import QFont
from qt_material import apply_stylesheet
import pyautogui
import pydirectinput
i... |
main.py | import asyncio
import functools
import logging
import os
import signal
import sys
from concurrent.futures import ThreadPoolExecutor
from functools import partial
from multiprocessing import Process
from pathlib import Path
from time import time
from typing import Any, Awaitable, Callable, Dict, Optional, Set, Tuple, Ty... |
thread-add-synch.py | "prints 200 each time, because shared resource access synchronized"
import threading, time
count = 0
def adder(addlock): # shared lock object passed in
global count
with addlock:
count = count + 1 # auto acquire/release around stmt
time.sleep(0.5)
with addlock:
... |
httpvisit.py | from urllib.parse import urlencode
import time
import pymysql
import pymysql.cursors
from pymysql.converters import escape_string
import requests
from json import loads
import os
import pandas as pd
from city_geo_data import *
import configparser
import threading
import re
# http header to crawler realto... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from .utils import xyxy2xywh, xywh2xyxy
help_url = 'htt... |
channel_inner_service.py | """Channel Inner Service."""
import json
import multiprocessing as mp
import signal
from asyncio import Condition
from collections import namedtuple
from concurrent.futures import ThreadPoolExecutor
from typing import Union, Dict, List, Tuple
from earlgrey import *
from pkg_resources import parse_version
from loopch... |
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... |
preparer.py | # -*- coding: utf-8 -*-
# Copyright European Organization for Nuclear Research (CERN) since 2012
#
# 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-... |
handler.py | import json
import os
import shutil
import subprocess
import signal
import platform
import traceback
import pathlib
import socket
import sys
from pathlib import Path
from threading import Thread, Lock
from time import sleep
import time as t
from datetime import datetime
from os.path import join
from flask import jsonif... |
bridge.py | """
bridge-like integrator for amuse
the bridge class provides a bridge like coupling between different
gravitational integrators. In this way a system composed of multiple
components can be evolved taking account of the self gravity of the whole
system self consistently, while choosing the most appropiate i... |
TincanInterface.py | # ipop-project
# Copyright 2016, University of Florida
#
# 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 rights
# to use, copy, modify, m... |
omxplayer-zmq.py | from pyomxplayer import OMXPlayer
import json
from time import sleep
from pprint import pprint
import threading
import zmq
import random
import sys
import time
if len(sys.argv) > 1:
playerID = int(sys.argv[1])
else:
raise RuntimeError("specify player id: omxplayer.py [id]")
player = False
playerstatus = "sta... |
test.py | #!/usr/bin/env python3
import os, sys, json, time, requests, copy, traceback, tempfile, threading, subprocess
from collections import OrderedDict
from subprocess import check_output
from multiprocessing import Pool
from contextlib import contextmanager
OLDIR = 'test-dir'
results = OrderedDict(... |
core.py | #!/usr/bin/env python
import subprocess
import os
import sys
import re
from threading import Thread
from functools import wraps
from collections import namedtuple
from Queue import Queue
from time import sleep
from gntp.notifier import GrowlNotifier
__version__ = (0, 0, 1, 1)
PID_PATH = os.path.join(os.path.dirname(... |
main.py | import os
import torch
import numpy as np
from torch.multiprocessing import SimpleQueue, Process, Value, Event, Barrier
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel
from algorithms.ppo.core import ActorCritic, PPOBuffer, count_vars
from algorithms.ppo.worker import worker
from ... |
backgroundbuffer.py | # coding: utf-8
import threading
import multiprocessing
import queue
import traceback
class BackgroundBuffer:
"""
Data buffer loading data at backgroud
"""
def __init__(self, data_iter, buf_size, timeout=None, mode='thread'):
"""
data_iter: iterator of data need to be l... |
clusterScaler.py | # Copyright (C) 2015-2018 Regents of the University of California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
g_camera.py | # Copyright(c) 2018 Kenji.Ogura
# License: Such as Unauthorized use is prohibited.
# mailto : kenji.ogura@jcom.zaq.ne.jp
import time
import multiprocessing as mp
def start_thread(Q, vs):
while True:
img = vs.read()
if Q.full(): Q.get()
Q.put(img)
class video_source:
def __init__(self,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.