source
stringlengths
3
86
python
stringlengths
75
1.04M
client.py
import json import socket import time from threading import Thread import pygame class Client(object): def __init__(self, server_path, name): self.players_props = {} self.name = name self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.ip, self.port = server_path...
executor_service.py
# Copyright 2019, The TensorFlow Federated 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 applicable law o...
server.py
#!/usr/bin/env python3 import binascii import threading from time import * import socketserver from string import hexdigits from Crypto.Util.number import getPrime, inverse, bytes_to_long, long_to_bytes banner = """ Welcome to my supreme signing server! Send me a signed command, I will verify and do it for you, I wil...
deribit_interface.py
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_deribit_interface.ipynb (unless otherwise specified). __all__ = ['thread_decor', 'Deribit'] # Cell from websocket import create_connection import websocket from datetime import datetime import json import threading # Cell def thread_decor(my_func): def wrapper(*args, *...
MainScreen.py
__author__ = 'heroico' import os import logging import weakref import tkFileDialog import tkMessageBox import Tkinter from subprocess import call from threading import Thread import metax.MainScreenView as MainScreenView import metax.MetaXcanUITask as MetaXcanUITask import metax.Exceptions as Exceptions import MetaXca...
test_crud.py
# Copyright 2018 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, ...
threading_test.py
import threading import requests from queue import Queue request_lock = threading.Lock() q = Queue() dvds = [] def main(): titles = [ 'Ferdinand', 'Victoria. The complete second season', 'The man who invented Christmas', 'Black Panther', 'Star Wars. The last Jedi', ...
test_selenium.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ example.py ~~~~~~~~~ A simple command line application to run flask apps. :copyright: 2019 Miller :license: BSD-3-Clause """ # Known bugs that can't be fixed here: # - synopsis() cannot be prevented from clobbering existing # loaded modules. ...
02_v4l2_common_feed_pipes.py
#!/usr/bin/env python3 from flask import Flask, send_file, make_response, Response, g, request, stream_with_context from io import BytesIO import atexit import errno import os import subprocess import threading INPUT = '/dev/video0' FFMPEG = "/home/test/ffmpeg-nvenc/ffmpeg" app = Flask(__name__) @app.route('/pic') ...
base_crash_reporter.py
# Electrum - lightweight Bitcoin client # # 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, merge, # publish...
py3test_runners.py
# -*- coding: utf-8 -*- """ Testing connection observer runner API that should be fullfilled by any runner - submit - wait_for This integration tests check cooperation of the 3 players: connection_observer - runner - connection Main focus is on runner and it's correctness. """ __author__ = 'Grzegorz Latuszek' __copy...
multi_echo_server.py
import socket from multiprocessing import Process import time HOST = "localhost" PORT = 8001 BUFFER_SIZE = 1024 def main(): #create socket, bind and set to listening mode with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: # allow reused address s.setsockopt(socket.SOL_SOCKET, socke...
train.py
# Author: Bichen Wu (bichen@berkeley.edu) 08/25/2016 """Train""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from datetime import datetime import os.path import sys import time import math import numpy as np from six.moves import xrange import tensorf...
concurrent.py
#!/usr/bin/env python3 ########################################################################### ## ## Copyright (c) 2014 Adobe Systems Incorporated. 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 ma...
distributed_tuple_observation.py
from multiprocessing import Process import numpy as np from kiox.distributed.server import KioxServer from kiox.distributed.step_sender import StepSender from kiox.transition_buffer import FIFOTransitionBuffer from kiox.transition_factory import SimpleTransitionFactory def rollout(): sender = StepSender("localh...
main.py
import os import sys import random import requests from threading import Thread client = requests.Session() amount = 0 class astro: if os.name == "nt": os.system("cls") os.system("title Astro Massban") else: os.system("clear") terminal_title = f"Astro Massban" print(f'\...
windows.py
from ...third_party import WebsocketServer # type: ignore from .configurations import ConfigManager from .configurations import WindowConfigManager from .diagnostics import ensure_diagnostics_panel from .diagnostics_manager import is_severity_included from .logging import debug from .logging import exception_log from ...
example_test.py
import http.server import os import re import socket import ssl from threading import Thread import ttfw_idf from tiny_test_fw import DUT server_cert = '-----BEGIN CERTIFICATE-----\n' \ 'MIIDXTCCAkWgAwIBAgIJAP4LF7E72HakMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n'\ 'BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0Y...
userThread.py
#This thread handles user operations of only 1 user #, and is connected to the matchmaking thread and to the database thread #The list of operations is as follows: #userType: 0 for normal, 1 for facebook # ID | ARGUMENTS # 0 --- User signup | userType(fb or norma...
train_pg_f18.py
""" Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017 Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany """ import numpy as np import tensorflow as tf import gym import logz import os import time im...
ui_utils.py
# -*- coding: utf-8 -*- from logging import getLogger import os import platform import re import subprocess import sys import textwrap import threading import time import tkinter as tk import tkinter.font import traceback from tkinter import filedialog, messagebox, ttk from typing import Callable, List, Optional, Tuple...
electronic_control_unit.py
import logging import can from can import Listener import time import threading try: # Python27 import Queue as queue except ImportError: # Python35 import queue import j1939 logger = logging.getLogger(__name__) class ElectronicControlUnit(object): """ElectronicControlUnit (ECU...
mqtt_wss_example_test.py
from __future__ import unicode_literals import os import re import ssl import sys from builtins import str from threading import Event, Thread import paho.mqtt.client as mqtt import ttfw_idf from tiny_test_fw import DUT event_client_connected = Event() event_stop_client = Event() event_client_received_correct = Even...
14_edf_wait_die_Speak.py
# Author Emeka Ugwuanyi Emmanuel from functools import reduce from sys import * import numpy as np import random as r import ping_code as pc import socket import struct import subprocess as sp from threading import Thread import threading import ast import time import os import psutil import datetime as dt import getp...
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...
kaldi.py
# -*- coding: UTF-8 -*- from __future__ import absolute_import from gi.repository import GObject from threading import Thread from .decoder import DecoderPipeline import time import pyaudio # Provides Python bindings for PortAudio, the cross platform audio API import audioop # Operates on sound fragments consisting of...
pydoc.py
#!/usr/bin/env python # -*- coding: latin-1 -*- """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide online help. Calling help(thing) on a Python object documents the object. Or, at the shell command line outside of Python: Run "pydo...
pydoc.py
#!/usr/pkg/bin/python2.7 # -*- coding: latin-1 -*- """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide online help. Calling help(thing) on a Python object documents the object. Or, at the shell command line outside of Python: Run "p...
simulation_2.py
''' Created on Oct 12, 2016 @author: mwittie ''' import network_2 as network import link_2 as link import threading from time import sleep ##configuration parameters router_queue_size = 0 #0 means unlimited simulation_time = 3 #give the network sufficient time to transfer all packets before quitting if...
HelpSearch.py
import Utils import wx import os import io import sys import six import time import threading import traceback import webbrowser StringIO = six.StringIO from six.moves.urllib.request import url2pathname from six.moves.urllib.parse import urlparse from whoosh.index import open_dir from whoosh.qparser import QueryParser ...
User_Interface.py
import tkinter from tkinter import ttk import cv2 from PIL import Image, ImageTk import socket import json from vidgear.gears import NetGear import threading import os import webbrowser HOST = '10.0.0.8' PORT = 6005 class Menubar(ttk.Frame): def __init__(self, parent): """ Constructo...
base.py
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the ...
sl_network_dapp.py
from shadowlands.sl_dapp import SLDapp from shadowlands.sl_contract.sloader import SLoader, DappNotFound from pathlib import Path import threading import wget, zipfile, zipimport import sys, textwrap, os, types, importlib, re, shutil from subprocess import call, DEVNULL from shadowlands.utils import filehasher from sha...
test_create_collection.py
import pdb import copy import logging import itertools import time import threading from multiprocessing import Process import sklearn.preprocessing import pytest from utils.utils import * from common.constants import * uid = "create_collection" class TestCreateCollection: """ *******************************...
q12_Queue.py
import multiprocessing # 创建子队列函数 子进程,内存独立,相当于数据传递 def foo(subQueue): subQueue.put('zhangsan') if __name__ == "__main__": # 创建队列 q = multiprocessing.Queue() # 创建进程对象 p = multiprocessing.Process(target=foo, args=(q, )) # 开始进程 p.start() # 获取队列中的资源 print(q.get())
objective.py
import pika import pickle from multiprocessing import Process class Objective: """Base class for creating objective function objects. It provides functionalities for evaluate objective function via message broker. Parameters ---------- num : int The ordinal number of the objective functio...
sending_multiple_requests.py
# python3 send_tons_of_requests.py import requests import threading url = 'https://www.google.com' data = {} def send_a_ton (url, data): while True: # response = requests.post(url, data=data).text response = requests.get(url, data=data).text print(response) threads = [] # Fill the threa...
threads.py
# -*- coding: utf-8 -*- """ Created on Sat Mar 20 17:58:47 2021 @author: Clauber """ #Com este exemplo, podemos criar um teste de stress, scan simultaneo, ou seja, #envio de requisições #biblioteca para fazer o multiThread from threading import Thread import time #função para colocar dois carros de corrida que compet...
bilkent.py
from selenium import webdriver import time from selenium.webdriver.chrome.options import Options from colorama import init from termcolor import colored import json import os import threading import sys import itertools init() main_url = "https://stars.bilkent.edu.tr/" tab_url = "https://webmail.bilkent.edu.tr/" v...
stressTestServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
word2vec.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
test_thread.py
"""TestCases for multi-threaded access to a DB. """ import os import sys import time import errno from random import random DASH = '-' try: WindowsError except NameError: class WindowsError(Exception): pass import unittest from test_all import db, dbutils, test_support, verbose, ha...
process.py
import sys import time import shlex import atexit import subprocess from queue import Queue, Empty from threading import Thread from typing import List, Tuple, Callable, Optional, Generator, Union from .log import log def terminator(process: any, terminate_on_exit: bool=True) -> Callable[[], None]: """Creates a fun...
pimp3clock.py
#!/usr/bin/python from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate from subprocess import * from time import sleep, strftime from datetime import datetime from mpd import * import threading import signal import sys import os from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import json PLAY=0 PAUS...
geneticOptimization.py
import numpy as np from numpy import random from functools import reduce import Pucks import Gates import compare_func from checkFeasibility import * import repair import multiprocessing as mp import os import time import copy # from multiprocessing import Pro loopTime = 10000 populationSize = 500 crossPercent = 0.01 ...
run.py
#!/usr/bin/env python3 from cloudfoundry_client.client import CloudFoundryClient from sys import argv import os import time import subprocess import requests import threading import json import time from collections import OrderedDict from jinja2 import Environment, FileSystemLoader from flask import request, jsonify,...
test_gym.py
import pytest import gym import botbowl.ai from multiprocessing import Process, Pipe import numpy as np import multiprocessing import os envs = [ "botbowl-1-v3", "botbowl-3-v3", "botbowl-5-v3", "botbowl-7-v3", "botbowl-11-v3" ] @pytest.mark.parametrize("env", envs) def test_gym(env): env = gy...
ion_optics_manager.py
# =============================================================================== # Copyright 2012 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
trayicon.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ * UMSE Antivirus Agent Example * Author: David Alvarez Perez <dalvarezperez87[at]gmail[dot]com> * Module: System Try Icon * Description: This module is the System Try Icon. * * Copyright (c) 2019-2020. The UMSE Authors. All Rights Reserved. * Redistribu...
subprocess2.py
# coding=utf8 # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Collection of subprocess wrapper functions. In theory you shouldn't need anything else in subprocess, or this module failed. """ import...
psrdada_to_fits.py
#!/usr/bin/env python3 import sys import os import argparse import logging from multiprocessing import Process from time import sleep import numpy as np from arts_tools.constants import NTAB, NSB, SB_TABLE # check psrdada import as psrdada-python is not an explicit requirement in setup.py try: import psrdada ex...
Baru2.py
# -*- coding: utf-8 -*- #Vipro_Bot import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime from bs4 import BeautifulSoup from threading import Thread from googletrans import Translator from gtts import gTTS import time,random,sys,json,codecs,threading,glob,urllib,urllib2,urllib3,re,ast,os,s...
test_gateway.py
import functools import time from threading import Thread import numpy as np import pytest import requests from jina.flow import Flow from tests import JinaTestCase concurrency = 10 class MyTestCase(JinaTestCase): # @pytest.mark.skip('this tests hang up for unknown reason on github') def test_rest_gateway_...
runner_slurm.py
import os import time import signal import threading from popper import utils as pu from popper.cli import log as log from popper.runner_host import HostRunner from popper.runner_host import DockerRunner as HostDockerRunner from popper.runner_host import SingularityRunner as HostSingularityRunner class SlurmRunner(H...
test_interactions_builtin.py
import logging import time import unittest from random import randint from threading import Thread from slack_sdk.errors import SlackClientConfigurationError, SlackClientNotConnectedError from slack_sdk.socket_mode.request import SocketModeRequest from slack_sdk.socket_mode.client import BaseSocketModeClient from sl...
test_general.py
""" Collection of tests for unified general functions """ # global import os import math import time import einops import pytest import threading import numpy as np from numbers import Number from collections.abc import Sequence import torch.multiprocessing as multiprocessing # local import ivy import ivy.functional....
thread_test.py
import threading from queue import Queue import time lock = threading.Lock() #Print item pulled from queue def do_work(num): #Pretend to do work #time.sleep(0.1) with lock: print(num) print("Current thread:", str(threading.current_thread()).split(",")[0].split("-")[1]) #Prints just the thread number, not ident...
main_demo.py
import argparse import sys import os from utils import * import math import time import cv2 import numpy as np from age_gender_ssrnet.SSRNET_model import SSR_net_general, SSR_net import threading # ======robot package ====== # import imutils import speech_recognition as sr import pyaudio import wave # 讀音檔 使用mic可...
transport.py
# # 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. # import threading import logging import time import serial import serial.tools.list_ports import queue import socket import select from pydispatch impo...
hidapi_backend.py
# pyOCD debugger # Copyright (c) 2006-2020 Arm Limited # Copyright (c) 2021 Chris Reed # SPDX-License-Identifier: Apache-2.0 # # 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...
chat_room_client.py
""" 聊天室 1. 有人进入聊天室需要输入姓名,姓名不能重复 2. 有人进入聊天室时,其他人会收到通知: xxx进入了聊天室 3. 一个人发消息,其他人会收到: XXX:xxxxx 4. 有人退出聊天室,则其他人也会收到同志:XXX退出了聊天室 5. 扩展功能:服务器可以向所有用户发送公告:管理员消息:xxxxxx 技术分析 功能拆分和封装结构的决定 网络通讯协议设定 分功能逻辑讨论 架构 --> 框架 --> 逻辑结构模型 """ from socket import * from multiprocessing import * import sys class Client: ADDR = ("127.0.0....
routes.py
import hashlib import os import time from statistics import mean from threading import Thread import cv2 import imutils import numpy as np from flask import Flask, render_template, make_response from flask_restful import Api, Resource, reqparse from sklearn.externals import joblib from werkzeug.datastructures import F...
lambda_executors.py
import os import re import json import time import logging import threading import subprocess import six from multiprocessing import Process, Queue try: from shlex import quote as cmd_quote except ImportError: from pipes import quote as cmd_quote # for Python 2.7 from localstack import config from localstack.u...
logger.py
# importing the module import json import os import argparse import time import threading import requests import utils as ut from datetime import datetime,timezone openweather = False secrets = False warning = False if "secrets" in os.environ: if os.path.exists(os.environ["secrets"]): with open(os...
main.py
from test_process import test_process from agent import Agent from torch.utils.tensorboard import SummaryWriter import torch.multiprocessing as mp import gym import time #-----------------------------PARAMETERS----------------------------- HYPERPARAMETERS = { 'learning_rate': 0.003, 'gamma': 0.99, ...
test_chatcommunicate.py
import chatcommunicate import chatcommands from globalvars import GlobalVars import collections import io import os import os.path import pytest import threading import time from fake import Fake from unittest.mock import Mock, patch def test_parse_room_config(): chatcommunicate.parse_room_config("test/test_roo...
multithread_server.py
from socket import AF_INET, socket, SOCK_STREAM from threading import Thread from os import urandom from base64 import b64encode from encryption import * from time import gmtime, strftime import rsa,os,shutil KEY_LENGTH = 1024 BUFFER_SIZE = 8192 PORT = 5003 SYSTEM_MESSAGE_PREFIX = "SYSTEM" INVALID_NAME_MESSAGE = "The...
instance.py
"""CloudMan worker instance class""" import datetime as dt import json import logging import logging.config import threading import time from boto.exception import BotoServerError from boto.exception import EC2ResponseError from cm.services import ServiceRole from cm.services import ServiceType from cm.util import Ti...
h5storageserver.py
############################################################################### # Storage array data streamer # Urs Utzinger 2020 ############################################################################### ############################################################################### # Imports ###################...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
runtest-memorysize.py
from threading import Thread import subprocess mapnumber=3 antComAlgorithm=1 numAnts=25 mapMaxX =1600 mapMaxY =320 TEST="memorysize" def run_one_test(trial,mapnumber,antComAlgorithm,numAnts,mapMaxX,mapMaxY,TEST,antPositionMemorySize): print("map {} algrithm {} test {}: running..".format(mapnumber,antComA...
cleanup3db.py
import os import sys import time import argparse from glob import glob import os.path as path from datetime import datetime from multiprocessing import Process, Queue from sqlalchemy import create_engine from configparser import ConfigParser def config(filename='database.ini', section='cah_production'): # create a...
main.py
import random import requests from threading import Thread print("Loading nHentai Searcher...") url = "https://nhentai.net/" print("nHentai has Status", requests.head(url).status_code) codes = [] def start_searching(): while True: for i in range(9): s = "" for k in range(6): j = random.randrange(10) ...
cli_command_helpers.py
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import sys from glob import glob from pathlib import Path import click import colorclass import luigi import pkg_resources import json import terminaltables from jinja2 import Template from luigi import Lu...
client.py
import sys import socket import threading import struct import collections import configparser class Client: def __init__(self): self.message = None self.__init_socket() parser = configparser.ConfigParser() parser.read("client_settings.ini") self.port = int(parser.get("cl...
__init__.py
import requests import datetime import dateutil import logging import boto3 import gzip import io import csv import time import os import sys import json import hashlib import hmac import base64 import re from threading import Thread from io import StringIO import azure.functions as func sentinel_customer_id = os.en...
test.py
from threading import Thread import time, sys class val: val = 0 def printing(testing): while True: print(testing) time.sleep(1) def myDec(testing): def wtf(func): def func_wrapper(): try: print1 = Thread(target=printing, args=(testing,)) ...
app.py
import gevent.monkey gevent.monkey.patch_all() from flask import Flask, request, jsonify from utils import get_logger from extractor import ActivityExtractor, ActivityExtractorException from generator import ActivityGenerator from strava.generator import StravaActivityGenerator from strava.extractor import StravaActiv...
__init__.py
############################################################################### # DO NOT MODIFY THIS FILE # ############################################################################### import inspect import logging import sys import textwrap import time from coll...
state.py
import pygame import random import os from display.constants import * from display.characters import ZUCC, Human from display.background import Background from display.text import Text from display.projectiles import Projectile from display.menu import Menu from display.statecode import StateCode from display.projectil...
sand_clock.py
import time from tkinter import * from multiprocessing import Process import threading info = { 'total_time': 60 } flag = [False] def make_app(): _font = ['Arial', 25, 'bold'] app = Tk() Label(name='lb', text='sand clock', fg='yellow', bg='blue', font=_font).pack() Button(name='btn', text='start...
object_detection_visulization.py
#!/usr/bin/env python # -------------------------------------------------------- # 3D object detection train file # # ------------------------------------------------------- import pdb, traceback import argparse import math import h5py import numpy as np import tensorflow as tf import socket import time import os impo...
plugin.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import string,cgi,time from os import curdir, sep from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from SocketServer import ThreadingMixIn from urlparse import urlparse from cgi import parse_qs import simplejson as json import threading import fnmatch def up...
pyTest.py
#!/usr/bin/env python # -*- coding:utf-8 -*- # ---------- ---------- ---------- ---------- ---------- ---------- ---------- # # @file pyTest # # @author Hanno Sternberg <hanno@almostintelligent.de> # # ...
hypothesis_test.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import copy import time from functools import partial, reduce from future.utils import viewitems, viewkeys from hypothesis import assume, given, settings, HealthCheck import hypothesis.strate...
DPPO.py
""" A simple version of OpenAI's Proximal Policy Optimization (PPO). [http://adsabs.harvard.edu/abs/2017arXiv170706347S] 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 Deep...
hotkey.py
from enum import Enum from threading import Thread from typing import Dict, Callable, Optional import keyboard from playsound import playsound from fishy.helper import helper class Key(Enum): F9 = "f9" F10 = "f10" F8 = "f8" F7 = "f7" UP = "up" DOWN = "down" LEFT = "left" RIGHT = "rig...
email.py
#coding:utf-8 from threading import Thread from flask import current_app, render_template from flask_mail import Message from app import mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(to, subject, template, **kwargs): app = current_app._get_current_object() ...
consumers.py
import zmq from .sockets import ClientConnection from .constants import * import threading def consumer(address,callback,message_type): """ Creates a consumer binding to the given address pull messages. The callback is invoked for every reply received. Args: - address: the address to b...
test_pyiec61850.py
#!/usr/bin/python import sys import time import threading import traceback import signal import sys sys.path.append('..') import iec61850 def signal_handler(signal, frame): global running running = 0 print('You pressed Ctrl+C!') # sys.exit(0) signal.signal(signal.SIGINT, signal_handler) tcpPort = 8102 ...
git-csv-data.py
import re import random import io from threading import Thread import requests import json class CSVData: def __init__(self, msg="", id="", stars="", forks="", watchers=""): self.msg = str(msg); self.id = str(id); self.stars = str(stars); self.forks = str(forks); self.wat...
TimeHandler.py
import time import threading class TimeTracker: def __init__(self): self.running = True def check_elasped_time(self ,websocket): current_time = time.time(websocket) #only can be connected to the proxy #without stating who you are for 20 seconds! while self.running == Tr...
Semaphore_studikasus.py
import logging import threading import time import random LOG_FORMAT = '%(asctime)s %(threadName)-17s %(levelname)-8s %(message)s' logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) semaphore = threading.Semaphore(0) item = 0 def nasabah(): logging.info('Nasabah Menunggu nomor Antriannya dipanggil') ...
B.py
import sys import threading sys.setrecursionlimit(10**6+1) threading.stack_size(10**8) def solve(): [n_v,m_e,s] = list(map(int,input().split())) graph = {} s = s-1 for i in range(m_e): [u,v] = list(map(int,input().split())) if (u-1) in graph: graph[u-1].append(v-1) ...
inspector_websocket.py
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import logging import socket import threading import time from telemetry.core.backends.chrome import websocket class InspectorWebsocket(object...
zmirror.py
#!/usr/bin/env python3 # coding=utf-8 import os # noinspection PyUnresolvedReferences from itertools import count if os.path.dirname(__file__) != '': os.chdir(os.path.dirname(__file__)) import traceback import pickle from datetime import datetime, timedelta import re import base64 import zlib import random import ...
rdoclient.py
""" RANDOM.ORG JSON-RPC API (Release 1) implementation. This is a Python implementation of the RANDOM.ORG JSON-RPC API (R1). It provides either serialized or unserialized access to both the signed and unsigned methods of the API through the RandomOrgClient class. It also provides a convenience class through the Rand...
app.py
#!/app/env/bin/python import http.server import logging import socket from os import environ from threading import Thread from kubernetes import client from kubernetes import config logging.basicConfig( format='%(asctime)s %(levelname)s: %(message)s', level=logging.DEBUG, ) class AppHTTPHandler(http.server...
app_opencv.py
""" 通过实时截屏对比左侧8个指纹切片和右侧指纹图匹配度的方法 """ from winsound import Beep from PIL import ImageGrab import keyboard import threading import time import os import configparser import cv2 import numpy as np class FingerprinterHack: def __init__(self, mode="1"): effest = 3 self.__xOy = ( (481 + effe...
CameraDaemon.py
#!/usr/bin/python # To start the Camera Daemon: # python3 CameraDaemon.py start # # PiCamera documentation: http://picamera.readthedocs.io/en/release-1.10/api_camera.html import logging import time import socket import threading import os import datetime import io import atexit import argparse from picamera import...