source
stringlengths
3
86
python
stringlengths
75
1.04M
tcp_echo_server_multi.py
import socket from sys import argv import re from threading import Thread, Lock def connection_manager_thread(addr, conn): print('Client: {}'.format(addr)) toggle = True while True: data = conn.recv(1024) if not data: break if bool(re.search('^\[STOP\]', data.decode('utf...
sketcher.py
import sys import os.path import argparse from threading import Thread import WonderPy.core.wwMain from WonderPy.core.wwConstants import WWRobotConstants from WonderPy.util import wwSVG from WonderPy.util import wwPath # a few example SVG files. # all the paths in the chosen file will be drawn. # see sketcher.md for ...
test.py
import os import sys import unittest import time import urllib import threading import six from six.moves.urllib import request as urllib_request from six.moves.urllib import parse as urllib_parse sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) TEST_DEFAULTS = { 'ROOT_URLCONF': 'j...
xla_device_utils.py
# Copyright The PyTorch Lightning team. # # 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 i...
manager.py
#!/usr/bin/env python3 import datetime import os import signal import subprocess import sys import traceback from multiprocessing import Process from typing import List, Tuple, Union import cereal.messaging as messaging import selfdrive.sentry as sentry from common.basedir import BASEDIR from common.params import Para...
monte_carlo_tools.py
############################################################################## # Some functions to make Monte-Carlo simulations smoother # Authored by Ammar Mian, 29/10/2018 # e-mail: ammar.mian@centralesupelec.fr ############################################################################## # Copyright 2018 @CentraleS...
tests.py
import threading from datetime import datetime, timedelta from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections, models from django.db.models.manager import BaseManager from django.db.models.query import EmptyQuerySet, QuerySet...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2020 The Fujicoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test multiwallet. Verify that a fujicoind node can load multiple wallet files """ from decimal import...
handlers.py
# Copyright 2001-2015 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
ik_joint.py
import os, inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) print ("current_dir=" + currentdir) os.sys.path.insert(0,currentdir) import math import numpy as np import multiprocessing import time import random # ros imports import sys import rospy from hand_service.srv imp...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import json import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CH...
firmware.py
##################################################### # # firmware.py # # Copyright 2009 Hewlett-Packard Development Company, L.P. # # Hewlett-Packard and the Hewlett-Packard logo are trademarks of # Hewlett-Packard Development Company, L.P. in the U.S. and/or other countries. # # Confidential computer software. Valid ...
helper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import lzma import os import threading import asyncio import websockets from aiohttp import web class MockInsServer(): def __init__(self, port): self.loop = asyncio.new_event_loop() self.port = port self.symbols_dir = os.path.join...
mockpi.py
"""Mocks a pypi server""" import io import os from contextlib import contextmanager, redirect_stderr, redirect_stdout from enum import Enum from functools import partial from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer from pathlib import Path from threading import Thread from typing import Genera...
alert_vm_disk_read_bandth.py
''' Test about monitor trigger on vm disk reading bandwidth in one minute @author: Songtao,Haochen ''' import os import test_stub import random import threading import time import zstacklib.utils.ssh as ssh import zstackwoodpecker.test_util as test_util import zstackwoodpecker.operations.resource_ope...
lazy.py
import contextvars import copy import functools import importlib import importlib.machinery # pylint: disable=no-name-in-module,import-error import importlib.util # pylint: disable=no-name-in-module,import-error import inspect import logging import os import re import sys import tempfile import threading import time ...
sl2m_net.py
############################################################################# ############################# Network library ############################### ############################################################################# # # Copyright (C) 2019 by Alexander Nagy - https://bitekmindenhol.blog.hu/ # import th...
handler.py
import queue import threading from watch import Watch from gi.repository import Gtk class Handler: def __init__(self, lbl_time): self.q = queue.Queue() self.lbl_time = lbl_time self.watch = Watch(self.q, 1) def convert(self, t): m = int(t / 60) s = int(t % 60) ...
Eiger.py
from .Detector import Detector, SoftwareLiveDetector, TriggeredDetector, BurstDetector from ..recorders.Hdf5Recorder import Link from ..environment import env import time import numpy as np import os import requests import json import zmq from threading import Thread from base64 import b64encode, b64decode class Eige...
utility_classes.py
from collections import OrderedDict import logging import fnmatch import queue import time import threading import sys FIFO_DEBUG = 5 logging.addLevelName(FIFO_DEBUG, "FIFO_DEBUG") class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cl...
debug_with_video.py
import cv2 from queue import Queue import threading from fellbeast.camera import Camera from fellbeast.drone import Drone from fellbeast.routines import follow_person q = Queue() from multiprocessing import Process, Pipe def display_pipe(p_output): print("Start Displaying") cv2.namedWindow("detected_face")...
connection_tester.py
#!/usr/bin/env python from __future__ import print_function from __future__ import division from __future__ import absolute_import from __future__ import unicode_literals import time import threading import sys import datetime import argparse import json # parse args parser = argparse.ArgumentParser() parser.add_argu...
test_util.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...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum.util import bfh, bh2u, UserCancelled, UserFacingException from electrum.bip32 import BIP32Node from electrum import constants from electrum.i18n import...
loader.py
# Copyright (c) 2017-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
redfishMockupServer.py
# Copyright Notice: # Copyright 2016-2019 DMTF. All rights reserved. # License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Mockup-Server/blob/master/LICENSE.md # redfishMockupServer.py # tested and developed Python 3.4 import re import sys import argparse import time import collecti...
worker.py
#!/usr/bin/python3 # Copyright 2021. FastyBird s.r.o. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
multi_open_test.py
import multiprocessing from multiprocessing import Pool import threading import time import os task_list = [ ["/home/vikas/blob_mnt/mount.sh", 251], ["/home/vikas/blob_mnt/blobfuse.log1", 39834954] ] file_size_0 = 0 file_size_less = 0 file_size_correct = 0 def worker(num): global file_s...
pow_tests.py
# # Pow Default Tests # # # runtest script. # runs test with respect to some paramters # currently only os import sys import pytest # possible sys.platform results: # http://stackoverflow.com/questions/446209/possible-values-from-sys-platform MODELNAME = "pow_test_model" class TestClass: @pytest.mark.notonosx ...
browser.py
import asyncio import pyppeteer import random import time import string import requests import logging from threading import Thread # Import Detection From Stealth from .stealth import stealth from .get_acrawler import get_acrawler async_support = False def set_async(): global async_support async_support =...
__init__.py
# -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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 appl...
convert.py
import collections import os import sys import multiprocessing from multiprocessing import Semaphore from typing import Union import re import s3fs import numpy as np import zarr from netCDF4 import Dataset region = os.environ.get('AWS_DEFAULT_REGION') or 'us-west-2' # Some global that may be shared by different met...
main.py
#!/usr/bin/python # -*- coding: utf-8 -*- import argparse import getpass import json import os import re import struct import sys import time from datetime import datetime import requests from geopy.exc import GeocoderTimedOut, GeocoderServiceError from geopy.geocoders import GoogleV3 from google.protobuf.internal im...
training_manager.py
from app.ml.training.config_parsing import parse_config_for_training from multiprocessing.context import Process from app.db.syncdb import create_sync_db from app.workspace_management_api.workspace_data_source import WorkspaceDataSource from app.ml.training.trainer import Trainer from bson.objectid import ObjectId from...
0307_semaf_barrera.py
#!/usr/bin/python3 # *-* Encoding: utf-8 from threading import Semaphore, Thread from random import random from time import sleep num_hilos = 5 cuenta = 0 mutex = Semaphore(1) barrera = Semaphore(0) def mitrabajo(id): global cuenta sleep(random()) mutex.acquire() cuenta = cuenta + 1 if cuenta == ...
osmedeus.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import time import argparse from multiprocessing import Process from lib.core import utils from lib.client import config from lib.sender import auth from lib.sender import initial from lib.mode import routine ############# # Osmedeus - One line to r...
CatBot_Protect.py
# -*- coding: utf-8 -*- #Cat_Bot import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time,random,sys,json,codecs,threading,glob,re,ast,os,subprocess,wikipedia,goslate import bs4 import ast import requests,json,urllib import html5lib from random import randint from bs4 import Beau...
onlinedisplay.py
''' ____ __ __ __ __ _ __ /_ / ___ _/ / ___ ___ ___________ / /__ / /__/ /_____(_) /__ / /_/ _ `/ _ \/ _ \/ -_) __/___/ -_) / -_) '_/ __/ __/ / '_/ /___/\_,_/_//_/_//_/\__/_/ \__/_/\__/_/\_\\__/_/ /_/_/\_\ Copyright 2021 ZAHNER-elektrik I. Zahner-Schiller GmbH & C...
multithred_annotation.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import argparse import cv2 from maskrcnn.config import cfg from predictor import COCODemo from maskrcnn.structures.keypoint import PersonKeypoints import time import torch import pyzed.sl as sl import numpy as np import math from threading import...
passive.py
import threading import typing import urllib.parse import uuid # third-party import numpy import pandas # type: ignore[import] import paramiko import pyarrow # type: ignore[import] import typing_extensions from ck import exception from ck import clickhouse from ck import connection from ck import iteration class ...
conftest.py
import array import functools import logging import os import signal import subprocess import sys import threading import time import uuid from types import SimpleNamespace import pytest import caproto as ca import caproto.asyncio # noqa import caproto.benchmarking # noqa import caproto.threading # noqa from capro...
main.py
#!/usr/bin/env python3 import argparse import operator import threading from time import sleep import cv2 import depthai as dai import socket from common import target_finder from common.config import NN_IMG_SIZE from pipelines import object_detection, object_tracker_detection, object_edge_detection import logging ...
Bot.py
import urllib.request, urllib.parse, json, ssl, threading, socket, Telegram_Update, Telegram_API from http.server import BaseHTTPRequestHandler, HTTPServer from socketserver import ThreadingMixIn f = open("config.json", "r", encoding="utf_8") dic = json.load(f) f.close() TOKEN = dic["TOKEN"] PORT = int(dic["PORT"]) ...
test_ssession.py
# # Copyright (c) 2015 Cossack Labs Limited # # 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 i...
pbkdf2_cracker.py
#!/usr/bin/env python3 #-*- coding: UTF-8 -*- """ NAME: pbkdf2_cracker.py VERSION: 1.0.0 AUTHOR: Jesse Leverett (CyberThulhu) STATUS: Building Initial code framework DESCRIPTION: Brute Force and/or Check passwords against Redhat's 389-ds PBDKD2_SHA256 hashes TO-DO: Clean Code; Add Error Handling; Add Output Function; ...
e6v3.py
#!/usr/bin/env python ''' Use threads and Netmiko to connect to each of the devices in DB. Execute 'show version' on each device. Record the amount of time required to do this. ''' from netmiko import ConnectHandler from datetime import datetime from net_system.models import NetworkDevice, Credentials import django im...
multi_echo_server.py
#!/usr/bin/env python3 import socket from multiprocessing import Process import time HOST = "" PORT = 8001 BUFFER_SIZE = 1024 def handle_echo(conn,addr): with conn: print(conn) full_data = b"" while True: data = conn.recv(BUFFER_SIZE) if not data: break ...
email.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from . 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() msg = Messag...
ForkedFutures.py
""" Lazy Evaluation for Python - main package with primary exports Copyright (c) 2004, Georg Bauer <gb@murphy.bofh.ms>, Copyright (c) 2011, Alexander Marshalov <alone.amper@gmail.com>, except where the file explicitly names other copyright holders and licenses. Permission is hereby granted, free of charge, to any p...
gstreamer.py
# Copyright 2019 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, ...
process_crawler.py
import multiprocessing import time import threading import urllib from mongo_cache import MongoCache from mongo_queue import MongoQueue from downloader import Downloader DEFAULT_DELAY = 5 DEFAULT_AGENT = 'wswp' DEFAULT_RETRY = 1 DEFAULT_THREAD = 10 DEFAULT_TIMEOUT = 60 SLEEP_TIME = 1 def threaded_crawler(seed_url,...
utils.py
"""Utilities module for the textbook "What Can Be Computed?" (WCBC) This "utils" module provides various supporting functions for use with the programs provided is online materials for the textbook "What Can Be Computed?" (WCBC). (For an overview of the entire collection of programs, see the file README.txt in this di...
installwizard.py
from functools import partial import threading from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform from kivy...
tello.py
import socket import threading import time from queue import Queue class Tello: class Decorators(object): # This is a Decorator class that hold Decorators for the Tello Class @staticmethod def make_queueable(command_func): # Adds command functions to a Queue to run concurrently...
server.py
import socket from threading import Thread def send(message, sender): for client in clients: if sender != client: client.send(message) def listen(client): while True: message = client.recv(1024) send(message, client) conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM...
grpc_student_code_dummy.py
################################################################## # Copyright 2021 Lockheed Martin Corporation. # # Use of this software is subject to the BSD 3-Clause License. # ################################################################## import time import grpc import viz_pb2 as viz_con...
test_prefabs.py
#!/usr/bin/env python """ Module to do basic healthcheck test for prefab modules The test will do the following: 1. Load all the prefab modules registred in the j.tools.prefab.local hook, only the core module will be skipped 2. For each module, build, instal, start, stop methods will be called if exist 3. Collect and r...
cli.py
# -*- coding: utf-8 -*- import configparser import random import sys import time from pathlib import Path from threading import Thread from urllib.parse import urlparse import click from . import __codename__ from . import __version__ from .controllers import CastState from .controllers import setup_cast from .contro...
server.py
import Queue import inspect import socket import ssl import threading import time from smp import SMProtocol class Server: def __init__(self, smprotocol, port, external=False, smp_args=(), ssl_args=None): if inspect.isclass(smprotocol): self.smprotocol = smprotocol else: r...
client.py
""" Tacview client methods. Results are parsed into usable format, and then written to a postgres database. """ import asyncio from asyncio import IncompleteReadError from functools import partial import logging from multiprocessing import Process import time from typing import Optional from pathlib import Path import...
SpriteBase.py
import threading from random import choice, randint import pygame from pygame.sprite import Sprite """ 所有动画精灵的基类,所有动的东西都可以派生自这个类,这个方法提供了最本的精灵操作 """ class SpriteBase(Sprite): def __init__(self, screen, image_paths, location, size=0, speed=1, image_index=0): """ 精灵初始化 :param screen:要将精灵绘制到...
userevent.py
import json import threading import logging import redis logger = logging.getLogger(__name__) class CannotReadUserEventsException(Exception): """ Exception raised if user events cannot be read. """ class UserEventBuilder(object): """ Defines a helper class for constructing UserEvent and UserEventListener in...
test_eap_proto.py
# EAP protocol tests # Copyright (c) 2014-2015, Jouni Malinen <j@w1.fi> # # This software may be distributed under the terms of the BSD license. # See README for more details. import binascii import hashlib import hmac import logging logger = logging.getLogger() import select import struct import threading import time...
runRobotModes.py
from lineFollower import LineFollower from peopleDetection import personFollower from threading import Thread # from ble_robot import main import config as cfg isLineFollowerRunning = False isPeopleDetectionRunning = False MODE_EXIT = 0 MODE_LINE_FOLLOWER = 1 MODE_PERSON_FOLLOWER = 2 STOP_CURRENT_MODE = 3 lineFollo...
execute.py
import os import sys from flask import Flask import requests as r import time import json from signal import signal, SIGINT import threading from datetime import datetime import numpy as np import math ##globals## threads = 8 threadL = [] orderAddr = [] order = [] startTimes = [] mainThread = None ...
server.py
import socket import threading import pickle import time import traceback import json import mysql.connector HEADER = 64 PORT = input("Type a port >> ") if PORT == "": PORT = 49001 #Default port try: PORT = int(PORT) except: print("Not a valid port. running on default port...") SERVER = "0.0.0.0" ADDR = (...
DB_tools.py
import json import logging import queue import threading import bs4 import requests from sqlalchemy import Column, ForeignKey, Integer, String, create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker # config THREAD_COUNT = 20 SCHEDULE_API = 'mntes' # 'irctc' or 'm...
magma_upserts.py
import copy import threading import time from Cb_constants.CBServer import CbServer import json as Json from magma_basic_crud import BasicCrudTests from remote.remote_util import RemoteMachineShellConnection from sdk_client3 import SDKClient class BasicUpsertTests(BasicCrudTests): def test_update_n_times(self): ...
results_watcher.py
#!/usr/bin/python3 ''' * Copyright (C) 2019-2020 Intel Corporation. * * SPDX-License-Identifier: BSD-3-Clause ''' import json import time import sys from threading import Thread WATCHER_POLL_TIME = 0.01 class ResultsWatcher: def __init__(self, filename, sleep_time=WATCHER_POLL_TIME): self.filename = filen...
tests_tflite.py
import numpy as np from includes import * ''' python -m RLTest --test tests_tflite.py --module path/to/redisai.so ''' def test_run_tflite_model(env): if not TEST_TFLITE: env.debugPrint("skipping {} since TEST_TFLITE=0".format(sys._getframe().f_code.co_name), force=True) return con = get_con...
StorageServer.py
############################################################################## # # Copyright (c) 2001, 2002, 2003 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...
mag3110_calibrate.py
#!/usr/bin/env python import math import time import threading import Queue import termios, fcntl, sys, os from ctypes import * #cdll.LoadLibrary("./bcm2835.so") sensor = CDLL("./sensor.so") class mag3110: def __init__(self): self.x_off = -565 self.y_off = 700 self.z_off = 0 if (0 == sensor.bcm2835_ini...
class.py
import time import threading class Singleton(object): _instance_lock = threading.Lock() # 线程安全 def __init__(self): time.sleep(1) @classmethod def instance(cls, *args, **kwargs): if not hasattr(Singleton, "_instance"): with Singleton._instance_lock: if not ha...
test_worker.py
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import json import os import psutil import shutil import signal import subprocess import sys import time import zlib from datetime import datetime, timedelta, timezone from multiprocess...
slp_graph_search.py
""" Background search and batch download for graph transactions. This is used by slp_validator_0x01.py. To generate proto files use the following command: python3 -m grpc_tools.protoc --proto_path=lib/ --python_out=lib/ --grpc_python_out=lib/ lib/slp_graphsearchrpc.proto """ import sys import time import threading...
test_util.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
ipcontrollerapp.py
#!/usr/bin/env python # encoding: utf-8 """ The IPython controller application. Authors: * Brian Granger * MinRK """ #----------------------------------------------------------------------------- # Copyright (C) 2008 The IPython Development Team # # Distributed under the terms of the BSD License. The full licen...
workload.py
# Copyright 2014-2019 ARM Limited # # 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 w...
TestServerInterface.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------- # Copyright (c) 2010-2021 Denis Machard # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # ...
Hiwin_RT605_ArmCommand_Socket_20190627181316.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
main.py
""" Main function for training and evaluating agents in traffic envs @author: Tianshu Chu """ import argparse import configparser import logging import tensorflow as tf import threading # from envs.test_env import GymEnv from envs.small_grid_env import SmallGridEnv, SmallGridController from envs.large_grid_env import ...
bokeh.py
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------------------------------------------...
serial_buffer.py
#!/usr/bin/env python3 # # Copyright © 2020 Google LLC # # 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...
qtum_transaction_receipt_origin_contract_address.py
#!/usr/bin/env python3 from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from test_framework.script import * from test_framework.mininode import * from test_framework.address import * import threading def waitforlogs(node, contract_address): logs = node.cli.waitforlo...
event_worker.py
# -*- coding: utf-8 -*- # import threading from multiprocessing import Process, Value import time from Queue import Queue from yaml_parse import event_parser from utils import get_event_type, my_log def worker(event_queue, runflag): ep = event_parser() while runflag.value: # blocking here if there is ...
train.py
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
emailproxy.py
"""A simple IMAP/SMTP proxy that intercepts authenticate and login commands, transparently replacing them with OAuth 2.0 SASL authentication. Designed for apps/clients that don't support OAuth 2.0 but need to connect to modern servers.""" __author__ = 'Simon Robinson' __copyright__ = 'Copyright (c) 2021 Simon Robinson...
pipeline.py
import inspect import os import sys from threading import Thread from typing import Callable, List # noinspection PyProtectedMember from pyshrimp._internal.pipes.async_function import _AsyncFunctionPipelineElement from pyshrimp.exception import IllegalStateException, IllegalArgumentException from pyshrimp.execution_pi...
test_server.py
import unittest import json from mock import MagicMock, patch from result import Ok import time import threading import urllib2 from protector.proxy import request_handler from protector.proxy import server class MockHTTPResponse(object): HTTP_10 = 10 HTTP_11 = 11 def __init__(self, status, reason, msg=...
health_manager.py
from inventory import belt from pather import Location import cv2 import time import keyboard from utils.custom_mouse import mouse from utils.misc import wait from logger import Logger from screen import grab import time from config import Config from ui import view, meters from ui_manager import detect_screen_object, ...
main.py
import socketserver from socketserver import BaseRequestHandler from datetime import datetime, timedelta import threading host = '172.x.x.x' #Your host IP-address here class HTTPSERVER(BaseRequestHandler): def handle(self): rec = self.request.recv(1024) if rec: try: pr...
app.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
carla_ros_scenario_runner_node.py
#!/usr/bin/env python # # Copyright (c) 2020 Intel Corporation. # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # """ Execute scenarios via ros service Internally, the CARLA scenario runner is executed """ import os try: import queue except Im...
LaunchAndMeasureDataTask.py
__author__ = 'python cookbook' import time import resource from DistributedStorageBenchmarkTool.DataTask import DataTask from threading import Thread, Event class LaunchAndMeasureDataTask: def __init__(self, log, sock, clientName, chunkSize, maxFileSize, dataThreadName, countDownStoppedEvent): self._runnin...
player_cache.py
import json import urllib2 from directories import userCachePath import os import time from PIL import Image import atexit import threading import logging from uuid import UUID import httplib import base64 import datetime import traceback log = logging.getLogger(__name__) class ThreadRS(threading.Thread): # This...
scheduler_job.py
# pylint: disable=no-name-in-module # # 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, Versio...
basic01.py
""" GIL 全局解释器锁 --- 多线程在**python解释器**的作用下,抢锁的行为 1- windows的QQ.exe不能安装到linux系统上,C语言把代码通过编译器变成二进制给linux识别 2- Python解释器,也成为虚拟机,就是自己安装的python 3.7 interpreter解释器的意思,python文件运行在这个虚拟的运行环境 3- C语言通过不同的编译器运行在不同的系统下,是一种编译性语言,说完5分钟,才开始翻译,浪费了大量的编译时间,省去运行时间 4- Python通过一个python解释器虚拟环境运行在不同操作系统下,是一种解释性语言,类似于同声传译,翻译...
simulator.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import tensorflow as tf import multiprocessing as mp import time import threading from abc import abstractmethod, ABCMeta from collections import defaultdict import six from six.moves import queue import zmq from tensorpack.models.common import disable_layer_logging from...
remote_access.py
""" * Implementation of remote access Use localhost.run ssh remote port forwarding service by running a ssh subprocess in PyWebIO application. The stdout of ssh process is the connection info. * Strategy Wait at most one minute to get stdout, if it gets a normal out, the connection is successfully established. Othe...
test_util.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...