source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
webtransport_h3_server.py | # mypy: allow-subclassing-any, no-warn-return-any
import asyncio
import logging
import os
import ssl
import threading
import traceback
from urllib.parse import urlparse
from typing import Any, Dict, List, Optional, Tuple
# TODO(bashi): Remove import check suppressions once aioquic dependency is resolved.
from aioquic... |
console.py | import SociaLite
import sys
from SociaLite import SociaLiteException
from impSocialite import SocialiteImporter
import __builtin__
from code import InteractiveConsole
import org.python.util.PythonInterpreter as PythonInterpInJava
class PythonInterpAdapter(PythonInterpInJava):
def __init__(self, socialite):
... |
harness.py | import random
import signal
import string
import sys
import time
import threading
from datetime import datetime
from kafka.errors import NoBrokersAvailable
from kafka import KafkaProducer
sys.path.insert(1, 'protocols/src/generated/main/python/')
from kafka_topic_pb2 import KafkaTopicRequest
from kafka_user_pb2 impor... |
matplotlib_testing.py | import numpy as np
import matplotlib
from matplotlib.patches import Circle, Wedge, Polygon
from matplotlib.collections import PatchCollection
import matplotlib.pyplot as plt
from SDAWithVectorField import *
from MovingObstacleSimulator import *
import matplotlib.patches as patches
from datetime import datetime
import s... |
power_map_editor.py | # ===============================================================================
# Copyright 2013 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/licens... |
02_simple_thread.py | '''
Simple threading implemented,
the time taken to make 10 calls of do_something()
is took around 2 seconds
'''
import time
import threading
start = time.perf_counter()
def do_something(seconds):
print(f'Sleeping {seconds} second...')
time.sleep(1)
print(f'Done Sleeping...{seconds}')
threads = []
for ... |
train_svm.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import multiprocessing as mp
import sys
from argparse import Namespace
from typing import Any, List
import numpy as np
from hydra.experimental import compose, initialize_config_module
from vissl.hooks import default_hook_generator
f... |
parallelbar.py | import os
from functools import partial
import multiprocessing as mp
from threading import Thread
from tqdm.auto import tqdm
from .tools import get_len
class ProgressBar(tqdm):
def __init__(self, *args, step=1, **kwargs):
super().__init__(*args, **kwargs)
self.step = step
self._value = ... |
__init__.py | #!/usr/bin/env python3
import argparse
import functools
import logging
import os
import queue
import re
import signal
import sys
import threading
from typing import (
Any,
Callable,
Dict,
Iterable,
Iterator,
List,
Optional,
TypeVar,
Union,
)
import boto3 # type: ignore
import fabr... |
__init__.py | """
Yay! It's NOT IDA!!!1!!1!one!
"""
import os
import re
import sys
import time
import queue
import string
import hashlib
import logging
import itertools
import traceback
import threading
import collections
import envi
import envi.exc as e_exc
import envi.bits as e_bits
import envi.common as e_common
import envi... |
resource_api.py | from flask import Blueprint, request
from flask_jwt_extended import jwt_required, get_jwt_identity
from models.node_tags import NodeTags
from models.scheduler import Scheduler
from models.container_image_registry import RegistryCredential
from models.user import User, Role
from flask import current_app
from utils.respo... |
app.py | import json
import shlex
from os import _exit, chdir, getcwd
from re import compile as re_compile
from re import findall, match
from sys import exc_info, path
from traceback import print_exception
from libs.config import custom_get, gget, gset, order_alias, set_namespace, color
from libs.readline import LovelyReadline... |
sensors.py | import serial
from threading import Thread
import rospy
from collections import deque
class SEN0233:
def __init__(self):
physicalPort = '/dev/ttyS0'
self.serialPort = serial.Serial(physicalPort)
self.buff = deque(maxlen=4)
def read_most_recent_data(buff: deque):
while ... |
util_parallel.py | # -*- coding: utf-8 -*-
"""
Module to executes the same function with different arguments in parallel.
"""
from __future__ import absolute_import, division, print_function
import multiprocessing
from concurrent import futures
# import atexit
# import sys
import signal
import ctypes
import six
import threading
from six... |
termination_criterion.py | import threading
from abc import ABC, abstractmethod
from jmetal.core.observer import Observer
from jmetal.core.quality_indicator import QualityIndicator
"""
.. module:: termination_criterion
:platform: Unix, Windows
:synopsis: Implementation of stopping conditions.
.. moduleauthor:: Antonio Benítez-Hidalgo <a... |
foo.py | # Python 3.3.3 and 2.7.6
# python fo.py
from threading import Thread
# Potentially useful thing:
# In Python you "import" a global variable, instead of "export"ing it when you declare it
# (This is probably an effort to make you feel bad about typing the word "global")
i = 0
def incrementingFunction():
glob... |
process.py | from abc import ABC, abstractmethod
import itertools
import logging
import multiprocessing
import os
import signal
import time
from typing import Any, AsyncGenerator, List, NamedTuple, Optional, Tuple # noqa: F401
from lahja import BroadcastConfig, ConnectionConfig
from lahja.base import EndpointAPI
from lahja.tools.... |
external.py | from __future__ import unicode_literals
import os.path
import re
import subprocess
import sys
import time
import websocket
from threading import Thread
from docs.conf import templates_path
from .common import FileDownloader
from ..compat import (
compat_setenv,
compat_str,
)
from ..postprocessor.ffmpeg import... |
scanning.py | """Multidimensional Simple Scan method for Minimization."""
from threading import Thread as _Thread
import numpy as _np
class SimpleScan:
"""."""
@property
def ndim(self):
"""."""
return self._ndim
@ndim.setter
def ndim(self, value):
"""."""
self._ndim = value
... |
CameraHandler.py | import time
from picamera import PiCamera
from picamera.array import PiRGBArray
import threading
import multiprocessing
import struct
from Queue import Queue
from datetime import datetime
import logging
import numpy as np
import os
class CameraHandler(multiprocessing.Process):
m = multiprocessing.Manager()
q... |
generic_dos.py | #!/usr/bin/python3
# author Diego Rodríguez Riera
# from https://github.com/riera90/scripts
# licenced under BSD 3-Clause License
# date 18/02/19
# Intended to use on websites, what else would you use this for...
import requests
import re
import json
import threading
import time
import os
########################... |
context.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... |
infeed_outfeed_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... |
utils.py | """
Utility classes to support testing the ODIN framework
Tim Nicholls, STFC Application Engineering Group
"""
import sys
import time
import threading
import logging
import os
from tempfile import NamedTemporaryFile
if sys.version_info[0] == 3: # pragma: no cover
from configparser import ConfigParser
impor... |
test_decimal.py | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
"""
These are the test cases for the Decim... |
positive.py | import numpy as np
import pandas as pd
import multiprocessing as mp
from tqdm import tqdm
class positive():
__chrom_set = ["chr"+str(i) for i in range(1, 23)] + ["chrX", "chrY"]
def __init__(self, filename="grasp_sub_w_annot.txt"):
self.cores = mp.cpu_count()
self.grasp_w_annotation = pd.read_... |
common.py | import logging
import time
from contextlib import contextmanager
from queue import Empty
from queue import PriorityQueue
from queue import Queue
from threading import Condition
from threading import Event
from threading import Thread
from typing import Any
from typing import Collection
from typing import Generator
from... |
__init__.py | import cv2
from maragi import Client
from time import time, sleep
import threading
class Microservice():
def __init__(self, fps=1, ip='127.0.0.1', port='9999'):
self.fps = fps
self.client = Client(ip=ip, port=port)
def _transmit_loop(self):
cap = cv2.VideoCapture(0)
while ... |
fixtures.py | # -*- coding: utf-8 -*-
"""
This file contains all jobs that are used in tests. Each of these test
fixtures has a slighty different characteristics.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import time
import signal
import sys
import su... |
ECS_manager.py | from time import sleep
from threading import Thread
import paho.mqtt.client as mqtt
MQTT_ADDRESS = "localhost"
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc) + "\n")
def on_message(client, ... |
Network.py | import asyncore
import threading
from network.ntypes import AsyncServer, AsyncClient
def calc_time(since, until):
"""
simple function to calculate time passage
:param since: the start of the moment
:type since: time.struct_time
:param until: the end of the moment
:type until: time.struct_tim... |
train.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
from transformers import BertConfig
import distributed
from models import data_loader, model_builder
from models.data_loader import load_... |
benchmark_incr.py | """Benchmark cache.incr method.
"""
from __future__ import print_function
import json
import multiprocessing as mp
import shutil
import time
import diskcache as dc
from .utils import secs
COUNT = int(1e3)
PROCS = 8
def worker(num):
"Rapidly increment key and time operation."
time.sleep(0.1) # Let other... |
qt.py | # This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
#
# Contributors: Andreas Buhr <andreas@andreasbuhr.de>
# Michael Schaefer <michael.schaefer@uni-muen... |
server.py | import socket
import threading
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ['CUDA_VISIBLE_DEVICES'] = ''
try:
import tflite_runtime.interpreter as tflite
except:
from tensorflow import lite as tflite
import argparse
import operator
import librosa
import numpy as np
import math
import time
fr... |
test_sync_with_master.py | from radical.entk.utils.sync_initiator import sync_with_master
import pika
from radical.entk import Task, Stage, Pipeline
import radical.utils as ru
import os
from threading import Thread
MLAB = 'mongodb://entk:entk123@ds143511.mlab.com:43511/entk_0_7_4_release'
def syncer(obj, obj_type, queue1, logger, profiler):
... |
JanggiCoach.py | import logging
import os
import torch
import sys
from collections import deque
from pickle import Pickler, Unpickler
from random import shuffle
import struct
import numpy as np
from tqdm import tqdm
from JanggiArena import JanggiArena
from JanggiMCTS import JanggiMCTS
import torch.multiprocessing as mp
from torch.m... |
dmm.py | # -*- coding: utf-8 -*-
import re, os
import threading
import time
from jinja2 import PackageLoader,Environment
from bs4 import BeautifulSoup
from queue import Queue
#from lxml import etree
from app.utils.requests import get_html_jp,get_html_jp_html
from app.utils.loadini import read_config
from selenium import webdri... |
tool.py | #!/usr/bin/env python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import difflib
import logging
import multiprocessing
import os
import time
from queue import Empty
from typing import... |
serve.py | # Most of this code is:
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# The server command includes the additional header:
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/C... |
mp_benchmarks.py | #
# Simple benchmarks for the multiprocessing package
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
import time
import multiprocessing
import threading
import queue
import gc
_timer = time.perf_counter
delta = 1
#### TEST_QUEUESPEED
def queuespeed_func(q, c, iterations):
a = '0' * 256
c.... |
ffmpegmux.py | import os
import random
import threading
import subprocess
import sys
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__ = "muxed-stream"
def __init__(... |
test_uws.py | #!/usr/bin/env python3
# vim: sts=4 sw=4 et
import http.client
import os
import pytest
import threading
import urllib.request
from tll import asynctll
from tll.channel import Context
class Test:
def setup(self):
self.ctx = Context()
self.ctx.load(os.path.join(os.environ.get("BUILD_DIR", "build"),... |
force-appindicator.py | import pathlib, sys, time, threading
# Make the example find UltraSystray relative to itself
sys.path.append(str(pathlib.Path(__file__).parent.parent))
# Use default implementation for platform
#from UltraSystray import SystrayIcon
# Choose specific implementation
from UltraSystray.appindicator import SystrayIcon
i... |
reservation.py | # Copyright 2017 Yahoo Inc.
# Licensed under the terms of the Apache 2.0 license.
# Please see LICENSE file in the project root for terms.
"""This module contains client/server methods to manage node reservations during TFCluster startup."""
from __future__ import absolute_import
from __future__ import division
from _... |
workflow.py | """Implementation of the workflow for demultiplexing sequencing directories."""
import collections
import csv
import glob
import gzip
import itertools
import json
import logging
import os
import shutil
import subprocess
import sys
from threading import Thread, Lock
import tempfile
import xml.etree.ElementTree as ET
f... |
runtime.py | from concurrent.futures import Future, ThreadPoolExecutor
from functools import lru_cache, partial, wraps
import inspect
import threading
import uuid
import sublime
import sublime_plugin
MYPY = False
if MYPY:
from typing import Any, Callable, Dict, Iterator, Literal, Optional, Tuple, TypeVar
T = TypeVar('T')... |
utils.py | import asyncio
from asyncio import TimeoutError
import atexit
from collections import deque, OrderedDict, UserDict
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager
import functools
from hashlib import md5
import html
import inspect
import json
import logging
import multiprocessing... |
tests.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import errno
import os
import shutil
import sys
import tempfile
import time
import unittest
from datetime import datetime, timedelta
try:
import threading
except ImportError:
import dummy_threading as threading
from django.core.cache import cach... |
imgaug.py | from __future__ import print_function, division, absolute_import
from abc import ABCMeta, abstractmethod
import random
import numpy as np
import copy
import numbers
import cv2
import math
from scipy import misc
import six
import six.moves as sm
"""
try:
xrange
except NameError: # python3
xrange = range
"""
A... |
pickles_main_mp.py | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 2 08:59:30 2020
@author: T1Sousan
"""
#Libraies
from io import StringIO
import time
from bs4 import BeautifulSoup
from tika import parser
import pandas as pd
from collections import Counter
import pandas as pd
import sys
import multiprocessing
sys.path.insert(0, 'H:/Git... |
environment_process_wrapper.py | from tensorforce.environments import Environment
from multiprocessing import Process
from multiprocessing import Pipe
def worker(environment, conn2):
while True:
# Receive the environment method's name, and (optional) arguments
(name, *args, kwargs) = conn2.recv()
attr = object.__getattri... |
huluxiaThirdflood_api.py | #!/usr/bin/python3
# encoding: utf-8
"""
@author: m1n9yu3
@license: (C) Copyright 2021-2023, Node Supply Chain Manager Corporation Limited.
@file: huluxiaThirdflood_api.py
@time: 2021/4/26 19:03
@desc:
"""
import os
import requests
import time
import json
import threading
from urllib import parse
# 操作文件 api
def mkdi... |
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... |
pesapi_test.py | import sys
sys.path.append('..')
import unittest
import threading
import socket
import logging
import settings
from pprint import pprint
from interfaces import pesapi
from tornado import ioloop
class APITestCase(unittest.TestCase):
def setUp(self):
self.api = pesapi.PESAPIInterface(settings.pes_api_ba... |
FUS_Helper.py | import threading
import warnings
import util.io as io
import traceback
import sdk.pga as FUS
import multiprocessing
import os
#TODO: Actually record this information somewhere as a log
# class Listener(FUS.FUSListener):
# def onConnect(self):
# print("*** CONNECTED ***")
# def onDisconnect(self, reaso... |
__init__.py | """
Create ssh executor system
"""
import base64
import binascii
import copy
import datetime
import getpass
import hashlib
import logging
import multiprocessing
import os
import re
import subprocess
import sys
import tarfile
import tempfile
import time
import uuid
import salt.client.ssh.shell
import salt.client.ssh.w... |
ZipCrack.py | import zipfile
import threading
def extractFile(zFile, password):
try:
zFile.extractall(pwd=password)
print("Found Passwd : ", password)
return password
except:
pass
def main():
zFile = zipfile.ZipFile('unzip.zip')
passFile = open('dictionary.txt')
for line in passF... |
copy_db_dialog.py | #!/usr/bin/env python
#
# Copyright 2019 DFKI GmbH.
#
# 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, merg... |
sim_encounters.py | # ------------------------------------- #
# Python Package Importing #
# ------------------------------------- #
# Importing Necessary System Packages
import sys, os, math
import numpy as np
import matplotlib as plt
import time as tp
import random as rp
from optparse import OptionParser
import glob
# Imp... |
OLD_SociaLite.py | import socialite.engine.LocalEngine as LocalEngine
import socialite.engine.ClientEngine as ClientEngine
import socialite.tables.QueryVisitor as QueryVisitor
import socialite.tables.Tuple as Tuple
import socialite.util.SociaLiteException as SociaLiteException
import socialite.type.Utf8 as Utf8
import sys
import java.uti... |
ibvs2airsim.py | #!/usr/bin/env python
import cv2
import math
import threading
import time
import yaml
import rospy
from cv_bridge import CvBridge, CvBridgeError
from std_msgs.msg import Bool
from sensor_msgs.msg import Image
from geometry_msgs.msg import TwistStamped
import airsim
class IBVS_To_AirSim():
def __init__(self):
... |
__init__.py | from __future__ import annotations
import collections
from datetime import datetime
from decimal import Decimal
from functools import wraps
import operator
import os
import re
import string
from typing import (
TYPE_CHECKING,
Callable,
ContextManager,
Counter,
Iterable,
)
import warnings
import nu... |
bot.py | import datetime as dt
import logging
import os
import sys
from threading import Thread
from dotenv import load_dotenv
from logbook import Logger, StreamHandler
from logbook.compat import redirect_logging
from telegram import (
ForceReply,
InlineKeyboardButton,
InlineKeyboardMarkup,
MessageEntity,
P... |
pewmaster.py | #!/usr/bin/env/python
# -*- coding: utf-8 -*-
import urllib.request
import urllib.parse
from threading import Thread
import time
import base64
import json
def sanitize(url):
return base64.b64encode(urllib.parse.quote(url).encode("utf-8")).decode()
def desanitize(url):
return urllib.parse.unquote(base64.b64... |
03-threading_join.py | #!/usr/bin/env python3
# As per the previous example, the thread started as `daemon`
# will not block the other threads as well as the main program.
# Hence, the main program and other threads will not wait for the
# daemon thread to exit, before exiting themselves. This may not
# be always good, depending on the requ... |
ib_gateway.py | """
IB Symbol Rules
SPY-USD-STK SMART
EUR-USD-CASH IDEALPRO
XAUUSD-USD-CMDTY SMART
ES-202002-USD-FUT GLOBEX
SI-202006-1000-USD-FUT NYMEX
ES-2020006-C-2430-50-USD-FOP GLOBEX
"""
from copy import copy
from datetime import datetime
from queue import Empty
from threading import Thread, Condition
from typing impor... |
utils.py | # Copyright 2015-2017 Yelp 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 to in writin... |
qt.py | from .tc_plugins import TCPlugin
from .tools import TOS, HandlerTwoFactor
from .tc_requests import tc_requests
import os
import sys
import threading
from functools import partial
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import (QVBoxLayout, QLabel, QGridLayout, QHBoxLayout, QRadioButton, QCheckBox, QLineEd... |
exact_test_sampler.py | import attr
import cffi
from collections import defaultdict, namedtuple
import itertools
from multiprocessing.pool import Pool
import pickle
import queue
import random
import os
import secrets
import threading
import time
from cffi_util import read_stripped_header
# Don't force a dependency on gRPC just for testing.
... |
logger_manager.py | #! /usr/bin/env python3
"""
"""
import datetime
import getpass # to get username
import logging
import multiprocessing
import os
import signal
import socket # to get hostname
import sys
import threading
import time
from importlib import reload
from os.path import dirname, realpath
# Add the openrvdas components ont... |
test_browser.py | # coding=utf-8
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import argparse
import json
import multiprocessing
imp... |
choose_tools.py | import npyscreen
import threading
import time
from vent.api.actions import Action
from vent.api.menu_helpers import MenuHelper
from vent.helpers.meta import Tools
class ChooseToolsForm(npyscreen.ActionForm):
""" For picking which tools to add """
tools_tc = {}
def repo_tools(self, branch):
""" S... |
EventServer.py | from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
import threading
from wpwithin.WPWithinCallback import Client
from wpwithin.WPWithinCallback import Processor
class CallbackHandler:
d... |
upahomqtt.py | # This is a stripped down version of paho-mqtt intended for MicroPython.
# https://github.com/ElliottWaterman/upaho-mqtt
import time # utime as time
from time import sleep #, sleep_ms
import threading
from sys import platform as sys_platform, implementation as sys_implementation
import struct # ustruct as struct
impo... |
parallel_runner.py | from envs import REGISTRY as env_REGISTRY
from functools import partial
from components.episode_buffer import EpisodeBatch
from multiprocessing import Pipe, Process
import numpy as np
import torch as th
# Based (very) heavily on SubprocVecEnv from OpenAI Baselines
# https://github.com/openai/baselines/blob/master/bas... |
httpserver.py | # Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import BaseHTTPServer
import httplib
import json
import logging
import threading
_STOP_EVENT = '/fakeserver/__stop__'
class Handler(BaseHTTPSe... |
ironpython_agent.py | import json
import struct
import base64
import subprocess
import random
import time
import datetime
import os
import sys
import zlib
import threading
import http.server
import zipfile
import io
import types
import re
import shutil
import socket
import math
import stat
import numbers
from os.path import expanduser
from ... |
reset_job_test_alone.py | # Copyright (c) 2018 PaddlePaddle 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 app... |
dppo.py | """
A simple version of OpenAI's Proximal Policy Optimization (PPO). [https://arxiv.org/abs/1707.06347]
Distributing workers in parallel to collect data, then stop worker's roll-out and train PPO on collected data.
Restart workers once PPO is updated.
The global PPO updating rule is adopted from DeepMind's paper (DPP... |
server.py | #-----------------------------------------------------------
# Threaded, Gevent and Prefork Servers
#-----------------------------------------------------------
import datetime
import errno
import logging
import os
import os.path
import platform
import psutil
import random
if os.name == 'posix':
import resource
els... |
TCP_echo_server.py | #!/usr/bin/env python
#
# 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
# ... |
control.py | __all__ = ['Interface']
# FIXME:如果您是项目开发者,请在项目调试中注释掉以下的monkey插件
exec("from gevent import monkey\nmonkey.patch_all()")
import csv
import multiprocessing
import os
from BusinessCentralLayer.coroutine_engine import vsu, PuppetCore
from BusinessCentralLayer.middleware.subscribe_io import FlexibleDistribute
from Business... |
test_py_reader_using_executor.py | # Copyright (c) 2018 PaddlePaddle 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 appli... |
httpserver.py | ###
# Copyright (c) 2011, Valentin Lorentz
# 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,
# this list of conditi... |
bridge.py | """
This module contains the Bridge class.
"""
import socket
import ssl
from multiprocessing import Process
from struct import unpack
from threading import Thread
from typing import Tuple
from config import Config
CONNECTION_TIMEOUT = 15
HEADER_SIZE = 6
MAX_PACKET_SIZE = 1024
class Bridge(Process):
"""
A si... |
test_socket.py | import unittest
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform... |
test_worker.py | from __future__ import absolute_import
import sys
import time
import threading
try:
import _thread as thread
except ImportError:
import thread # py3
from tests.utils import check_leaked_workers
from ufork import Arbiter
def suicide_worker():
def die_soon():
time.sleep(2)
thread.interru... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
from electrum.bitcoin import TYPE_ADDRESS
from electrum.storage import WalletStorage
from electrum.wallet import Wallet, InternalAddressCorruption
from electrum.paymentrequest import InvoiceStore
fr... |
__init__.py | # The MIT License (MIT)
#
# Copyright (c) 2014 Richard Moore
#
# 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, mod... |
recognizer.py | import sys
import threading
from lang_recognizer import LangEngine
from image_recognizer import ImageEngine
def lang(cmd):
print('start LangEngine')
le = LangEngine()
le.main(cmd)
def image():
print('start ImageEngine')
ie = ImageEngine()
while not event_stop.is_set():
ie.main()
if __... |
game_generator.py | import numpy as np
import random
import uuid
import os
import time
import multiprocessing as mp
from os.path import join as pjoin
# Set of fake words
with open("vocabularies/fake_words.txt") as f:
FAKE_WORDS = f.read().lower().split("\n")
FAKE_WORDS = set(FAKE_WORDS)
# set of all entities/objects
with open("voca... |
oandav20store.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import collections
import threading
import copy
import json
import time as _time
from datetime import datetime, timezone
import v20
import backtrader as bt
from backtrader.metabase import MetaParams
from back... |
treehopper_usb.py | import threading
from time import sleep
from typing import List
import usb.core
import usb.util
from treehopper.api.device_commands import DeviceCommands
from treehopper.api.i2c import HardwareI2C
from treehopper.api.pin import Pin, SoftPwmManager
from treehopper.api.pwm import HardwarePwm
from treehopper.api.pwm imp... |
controller_wrappers.py | import logging
import threading
from abc import ABC
from abc import abstractmethod
from time import sleep
from typing import Optional
from typing import Union
from kubernetes.client import V1beta1PodDisruptionBudget
from kubernetes.client import V1DeleteOptions
from kubernetes.client import V1Deployment
from kubernete... |
async_runner.py | import logging
import os
import traceback
from collections import namedtuple
from queue import Empty
from threading import Thread
from task_processing.interfaces.runner import Runner
EventHandler = namedtuple('EventHandler', ['predicate', 'cb'])
log = logging.getLogger(__name__)
class AsyncError(Exception):
pa... |
environment.py | # -*- coding: utf-8 -*-
import argparse
import hashlib
import json
import logging
import os
import sys
import platform
import random
import re
import time
import copy
import shutil
import traceback
import difflib
import networkx as nx
import numpy as np
import spacy
import functools
from itertools im... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
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
i... |
worker.py | import asyncio
import signal
import sys
from multiprocessing import Process
from api import events, invoices
from api import settings as settings_module
from api import tasks
from api.ext import backups as backup_ext
from api.ext import configurator as configurator_ext
from api.ext import tor as tor_ext
from api.ext i... |
main.py | from multiprocessing import Process, Manager
import os,webbrowser,requests,json,time,re
from bs4 import BeautifulSoup as bs
from collections import OrderedDict
from flask import Flask, redirect, render_template
from pystray import MenuItem as item
import pystray
from PIL import Image
class Croler:
runingObjects =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.