source
stringlengths
3
86
python
stringlengths
75
1.04M
proxy.py
# Copyright 2017 EasyStack, Inc # Authors: Claudio Marques, # David Palma, # Luis Cordeiro, # Branty <jun.wang@easystack.cn> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obt...
Client.py
import socket import struct import threading from colorama import Fore, Style from datetime import datetime import getch from scapy.arch import get_if_addr class Client: MAGIC_COOKIE = 0xfeedbeef TYPE = 0x2 UDP_PORT = 13117 def __init__(self, team_name1, port1, timeout1): self.port = port1 ...
cfuc_examples.py
from time import sleep import ucan_cfuc from can import Message import threading c = ucan_cfuc.CFUC("COM50") m = Message(0,0x11223344,True,False,False,None,5,bytearray(b'\x01\x02\x03\x04\x05'),False,False,False,None,False) c.send(m,None) def rx_function(caninterface): retry = 0 while retry < 60: ...
ZermeloSim.py
from ZermeloSim.ZermeloAgent import Agent from ZermeloSim.ZermeloEnvironment import Env from threading import Thread from queue import Queue import multiprocessing def _run_agent(agent, env): # Initialise the success flag for the agent success = False # Initialise the distance cost d = 0 # Initial...
uturn_test.py
import serial import time import math import threading # for test, main ์ฝ”๋“œ์—์„œ๋Š” ๋ฉ€ํ‹ฐ ํ”„๋กœ์„ธ์‹ฑ ์‚ฌ์šฉํ•˜๋Š” ๊ฒŒ ๋ชฉํ‘œ์•ผ. # CONSTANTS for _read(), related with encoder DISTANCE_PER_ROTATION = 54.02 * math.pi # Distance per Rotation [cm] PULSE_PER_ROTATION = 100. # Pulse per Rotation DISTANCE_PER_PULSE = DISTANCE_PER_ROTATION / PULSE_PER_R...
check_rabbitmq.py
#!/usr/bin/env python3 """ RabbitMQ Error Shovel Service Given a particular RabbitMQ instance and extractor name, this will check the error queue of that extractor for messages. - If the dataset or file in the message exists, send the message back to the main queue. - If it does not exist, generate a log entry and de...
main.py
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) from dataclasses import dataclass from flask import Flask, request from flask_restful import Resource, Api import logging import threading from json import JSONDecodeError from queue import Queue from typing import Optional fro...
main.py
from tkinter import * import tkinter.messagebox import threading import requests from datetime import datetime import json import threading # add some new features class Bitcoin(): def __init__(self,root): self.root=root self.root.title("Bitcoin price - Opening & Closing") self.root.geomet...
brute_form.py
#!/usr/bin/python #coding=utf-8 import urllib import urllib2 import cookielib import threading import sys import Queue from HTMLParser import HTMLParser from dir_bruster import build_wordlist thread_count = 10 target_url = 'http://192.168.99.196/wordpress/wp-login.php' target_post = 'http://192.168.99.196/wordpress/w...
httpclient-threading.py
#!/usr/bin/env python3 import http import threading import time import http.client def print_report(total_count, total_time_ms): print("Total time for {} requests = {} ms.".format( total_count, total_time_ms)) print("Avg time per request = {} ms.\n".format( total_time_ms / total_count)) pr...
GenerateFlows.py
from P2P_CONSTANTS import * from Packet import * from Flow import * import multiprocessing as MP import socket ## module to read all the files in the data folder of the ## project, build flow data and store it in a file def generateFlow(filename): sem.acquire() inputfile = open(filename) data = [line.strip() fo...
container.py
import threading from functools import wraps from abc import ABC, abstractmethod import cv2 import numpy as np __all__ = [ "Container", "check_ready" ] def check_ready(method): """Decorator for Container's methods""" @wraps(method) def wrapper(self, *args, **kwargs): if not self._ready: ...
amber.py
from __future__ import absolute_import import os import time import pytraj as pt import threading from .base import BaseMD class AmberMD(BaseMD): # TODO: doc ''' Unstable API Examples -------- >>> from nglview.sandbox.amber import AmberMD >>> amber_view = AmberMD(top='./peptide.top', rest...
test_threading.py
# Very rudimentary test of threading module import test.support from test.support import verbose, strip_python_stderr, import_module from test.script_helper import assert_python_ok import random import re import sys _thread = import_module('_thread') threading = import_module('threading') import time import unittest ...
training.py
from django.shortcuts import render from django.http import HttpResponse from django.conf import settings from rest_framework import permissions from rest_framework.views import APIView from rest_framework.response import Response from django.views.decorators.csrf import csrf_exempt # from rest_framework.decorators im...
VESC.py
from typing import Any, Dict, List from pyvesc.protocol.interface import encode_request, encode, decode from pyvesc.VESC.messages import * import time import threading # because people may want to use this library for their own messaging, do not make this a required package try: import serial except ImportError: ...
logging.py
"""Logging utilities.""" import asyncio from asyncio.events import AbstractEventLoop from functools import partial, wraps import inspect import logging import threading import traceback from typing import Any, Callable, Coroutine, Optional class HideSensitiveDataFilter(logging.Filter): """Filter API password call...
artifacts.py
import hashlib import json import mimetypes import os from six.moves.urllib.parse import quote from copy import deepcopy from datetime import datetime from multiprocessing import RLock, Event from multiprocessing.pool import ThreadPool from tempfile import mkdtemp, mkstemp from threading import Thread from time import ...
__init__.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright 2011-2020, Nigel Small # # 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 # # Unle...
sh.py
""" http://amoffat.github.io/sh/ """ # =============================================================================== # Copyright (C) 2011-2020 by Andrew Moffat # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to de...
test_sys.py
import unittest, test.support from test.support.script_helper import assert_python_ok, assert_python_failure import sys, io, os import struct import subprocess import textwrap import warnings import operator import codecs import gc import sysconfig import locale # count the number of test runs, used to create unique #...
flaskwebgui.py
__version__ = "0.3.3" import os import sys import time from datetime import datetime import logging import tempfile import socketserver import subprocess as sps from inspect import isfunction from threading import Lock, Thread logging.basicConfig(level=logging.INFO, format='flaskwebgui - [%(levelname...
mbtiles_reader.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim: ts=2 sw=2 et ai ############################################################################### # Copyright (c) 2012,2020 Andreas Vogel andreas@wellenvogel.net # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and ...
test.py
# vim: sw=4:ts=4:et import logging import os, os.path import pickle import re import shutil import signal import tarfile import tempfile import threading import unittest import uuid from multiprocessing import Queue, cpu_count, Event from queue import Empty import saq, saq.test from saq.analysis import RootAnalysis,...
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...
ThermoStoichWizardServer.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...
scheduler.py
"""Distributed Task Scheduler""" import os import pickle import logging from warnings import warn import multiprocessing as mp from collections import OrderedDict from .remote import RemoteManager from .resource import DistributedResourceManager from ..core import Task from .reporter import * from ..utils import AutoG...
pluspy.py
# Author: Robbert van Renesse, 2020 import os import random import traceback pluspypath = ".:./modules/lib:./modules/book:./modules/other" def exit(status): sys.stdout.flush() os._exit(status) # When compiling and running into an identifier, it should be clear # exactly what that identifier refers to. It c...
mp_server.py
import multiprocessing import os import Queue import signal import socket import sys from multiprocessing import Manager import time # Process 1 print "Start PID: ", os.getpid() host = '' port = 443 i = 0 def connect_s(): global s try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except...
beta.py
import os, time from functools import wraps, partial, lru_cache from logging import exception, root import multiprocessing import multiprocessing.queues from strict_functions import overload from threading import Thread from multiprocessing import Process from time import sleep from atexit import register from gc impor...
keyfilter.py
import sys import os import re import threading from queue import Queue from pprint import pprint event_sink = None output_queue = Queue() key_buffer = [] subsitution_table = {} modifer_key_set = set() modifer_key_set.add("leftctrl") modifer_key_set.add("rightctrl") modifer_key_set.add("leftalt") modifer_key_set.add(...
REThread.py
'''Enhanced Thread with support for return values and exception propagation.''' # Copyright (C) 2007 Canonical Ltd. # Author: Martin Pitt <martin.pitt@ubuntu.com> # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free ...
parse_query.py
# Copyright 2018 Comcast Cable Communications Management, 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
tester.py
#!/usr/bin/python # # tester.py # # This source file is part of the FoundationDB open source project # # Copyright 2013-2018 Apple Inc. and the FoundationDB project 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 ob...
ws_connector.py
import json import queue import time import websocket from threading import Thread, Timer from tools import logger class Connection: def __init__(self, host, port, orders_queue, output_queue, bot=None): self.stop = [False] self.host = host self.port = port self.logger = logger.ge...
test_comms.py
from __future__ import print_function, division, absolute_import from functools import partial import os import sys import threading import warnings import pytest from tornado import gen, ioloop, locks, queues from tornado.concurrent import Future from distributed.compatibility import PY3 from distributed.metrics i...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from collections import OrderedDict import _thread import importlib.machinery import importlib.util import os import pickle import random import re import subprocess impo...
fluffchat-server.py
import socket from threading import Thread # server's IP address SERVER_HOST = "0.0.0.0" SERVER_PORT = 5002 # port we want to use # initialize list/set of all connected client's sockets client_sockets = set() # create a TCP socket s = socket.socket() # make the port as reusable port s.setsockopt(socket....
reset_job_test.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...
subscriber.py
#!/usr/bin/env python # Copyright 2016 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...
test_tcp.py
import asyncio import asyncio.sslproto import gc import os import select import socket import unittest.mock import uvloop import ssl import sys import threading import time import weakref from OpenSSL import SSL as openssl_ssl from uvloop import _testbase as tb class MyBaseProto(asyncio.Protocol): connected = No...
cKDTree_MP.py
""" A Parallelised Implementation of K-D Trees Code extended from http://folk.uio.no/sturlamo/python/multiprocessing-tutorial.pdf """ __author__ = 'Ajay Thampi' import numpy as np import multiprocessing as mp import ctypes from scipy.spatial import cKDTree def shmem_as_nparray(shmem_array): """ Function that ...
pydsm.py
from multiprocessing import Process from multiprocessing import Lock import os import time import random import numpy as np import SharedArray as sa import fcntl import errno import signal import sys class Cluster: def __init__(self, numThread = None): if numThread == None: numThread = os.cpu...
serialize.py
import uuid import datetime import collections from itertools import chain from functools import singledispatch from threading import current_thread from threading import Thread as _Thread from django.db import connection from django.contrib.contenttypes.models import ContentType from django.utils.functional import Sim...
ws_thread.py
import sys import websocket import threading import traceback import ssl from time import sleep import json import decimal import logging from market_maker.settings import settings from market_maker.auth.APIKeyAuth import generate_expires, generate_signature from market_maker.utils import log from market_maker.utils.ma...
test_image_embedding.py
# coding : UTF-8 import sys sys.path.append("../../tests") import time import threading from towhee import pipeline from common import common_func as cf data_path = "images/" class TestImageEmbeddingInvalid: """ Test case of invalid embedding interface """ def test_embedding_no_parameter(self, pipeline_name)...
test_gc.py
import unittest from test.support import (verbose, refcount_test, run_unittest, strip_python_stderr, cpython_only, start_threads, temp_dir, requires_type_collecting, TESTFN, unlink) from test.support.script_helper import assert_python_ok, make_script import sys impor...
application.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. """ Basic script which allows local human keyboard input to talk to a trained model. ## Examples ```shell pa...
server.py
"""Setup for CANARIE talk. This is a server that communicates with SuperCollider for interacting with a MIDI controller. It handles all the logic for figuring out when to turn on/off the bass notes. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from a...
router.py
# # -*- coding: utf-8 -*- """Router - handle message router Manage backend sender. """ import logging import threading from typing import Dict, Optional from typing import TYPE_CHECKING import uuid from six.moves import queue from wandb.proto import wandb_internal_pb2 as pb if TYPE_CHECKING: from six.moves.que...
admin.py
#! /usr/bin/env python ## NB: not all commands work ## """Cascaded queue administration. londiste.py INI pause [NODE [CONS]] setadm.py INI pause NODE [CONS] """ import optparse import os.path import queue import sys import threading import time import skytools from skytools import UsageError, DBError from pgq.ca...
__init__.py
import json import logging import threading import time import sh from sh import ErrorReturnCode, TimeoutException from subprocess import PIPE from subprocess import Popen from wait_for import wait_for, TimedOutError log = logging.getLogger(__name__) logging.getLogger("sh").setLevel(logging.CRITICAL) # Resource ty...
mock_server.py
"""Mock server only emulates CB rest endpoints but has no functionality""" import socket import threading import requests import re import json import sys from urllib.parse import urlparse from http.server import HTTPServer, BaseHTTPRequestHandler class RequestHandler(BaseHTTPRequestHandler): def do_GET(self): ...
test.py
import json import os.path as p import random import socket import threading import time import logging import io import string import ast import avro.schema import avro.io import avro.datafile from confluent_kafka.avro.cached_schema_registry_client import CachedSchemaRegistryClient from confluent_kafka.avro.serialize...
demo_server.py
from http_classes.http_classes import Request, Response, HTTPError, MAX_HEADERS, MAX_LINE, ConnStatus from http_classes.base_classes import TokenConn, ChatGroups, Reciever, TokensConn, Users, ChatGroup from email.parser import Parser import psycopg2 from psycopg2 import pool import socket import logging from _collecti...
researchon_backgroundcontrolling routerpsloit.py
""" if not os.path.exists(self.history_file): open(self.history_file, 'a+').close() readline.read_history_file(self.history_file) readline.set_history_length(self.history_length) atexit.register(readline.write_history_file, self.history_file) readline.parse_and_bind('set enable-keypad on') readline.set_completer...
samuraithread.py
import threading import time import samuraithread from solutionthread import * threadTime = time.time() sayi=0 sayi2=0 topleft = [] topright = [] bottomleft = [] bottomright = [] middle = [] def vektorel(A, B): return [a+b for a in A for b in B] rakamlar= '123456789' satir= 'ABCDEFGHI' ...
server.py
# Copyright (c) 2015 Uber Technologies, Inc. # # 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, publ...
main.py
# !/usr/bin/env python # coding=utf-8 import logging import os import sys import getopt import threading import utils import glob from job import * from monitor import * opts, args = getopt.getopt(sys.argv[1:], "e:", "env=") env = 'test' for opt, value in opts: if opt == '--env': env = value elif opt =...
generate-dataset-canny.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # python3 # Author : Hongzhuo Liang # E-mail : liang@informatik.uni-hamburg.de # Description: # Date : 20/05/2018 2:45 PM # File Name : generate-dataset-canny.py import numpy as np import sys import pickle from dexnet.grasping.quality import PointGraspMe...
router.py
import zmq import threading import queue import time import random class Router(): """ Router Limited to localhost """ def __init__(self, routes, CURVE=False): self.routes = routes # self.connectionTimeout = 2000 self.connectionTimeout = 1800 self.protocol = 'tcp' ...
bruteforcer.py
import os import time import json import queue import threading import itertools class Bruteforcer(object): def __init__(self, number_threads, variables_dict, attempt_fx, stop_on_success=False, successful_attempts_filename="successful_attempts.txt"): super(Bruteforcer, self).__init__() self.number_threads = nu...
test_queue.py
# Some simple queue module tests, plus some failure conditions # to ensure the Queue locks remain stable. import Queue import time import unittest from test import test_support threading = test_support.import_module('threading') QUEUE_SIZE = 5 # A thread to run a function that unclogs a blocked Queue. class _TriggerT...
__main__.py
#!/usr/bin/env python # 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 argparse import json import logging import random import sys import time from multiprocessing import Process, current_process ...
pjit_test.py
# Copyright 2021 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, ...
__init__.py
import json import os, sys import threading import time if sys.platform == 'win32': local = os.getenv('LOCALAPPDATA') CONFIG_PATH = os.path.join(local, 'steam-vr-wheel', 'config.json') else: CONFIG_PATH = os.path.expanduser(os.path.join('~', '.steam-vr-wheel', 'config.json')) DEFAULT_CONFIG =...
autosabaki.py
#!/usr/bin/env python3 import io import re import os import pip import sys import time import atexit import base64 import shutil import zipfile import tempfile import threading import subprocess import http.server import socketserver try: import websocket_server except: pip.main(["install", "websocket-server"...
common.py
import inspect import json import os import random import subprocess import ssl import time import requests import ast import paramiko import rancher import pytest from urllib.parse import urlparse from rancher import ApiError from lib.aws import AmazonWebServices from copy import deepcopy from threading import Lock fr...
kafka_msg_handler.py
# # Copyright 2021 Red Hat Inc. # SPDX-License-Identifier: Apache-2.0 # """Kafka message handler.""" import itertools import json import logging import os import re import shutil import tempfile import threading import time import traceback from tarfile import ReadError from tarfile import TarFile import requests from...
t_system.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ .. module:: t_system :platform: Unix :synopsis: the top-level submodule of A.V.A.'s.augmented that contains the classes related to A.V.A.'s simple if-else struct of Augmented abilities. .. moduleauthors:: Cem Baybars Gรœร‡Lรœ <cem.baybars@gmail.com> """ import time ...
scatterplot.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 use ...
test_loop_2_fun_behavior.py
# DO NOT MODIFY THIS FILE!!! from unittest import TestCase from unittest.mock import patch from threading import Thread from .print_util import print_calls_contain_output from lab_questions import Loop2fun as l2 # Checks if the required functions are created # Checks for expected output, given example input, for th...
bank_account_test.py
import sys import threading import time import unittest from bank_account import BankAccount def adjust_balance_concurrently(account): def transact(): account.deposit(5) time.sleep(0.001) account.withdraw(5) # Greatly improve the chance of an operation being interrupted # by threa...
dlfuncs.py
import os import shutil import json import threading import time from xml.dom.minidom import parseString from instagram_private_api import ClientConnectionError from instagram_private_api import ClientError from instagram_private_api import ClientThrottledError from instagram_private_api_extensions import live from i...
station_B_framework.py
from opentrons.types import Point import json import os import math import threading from time import sleep metadata = { 'protocolName': 'Station B RNA Extraction', 'author': '', 'apiLevel': '2.3' } """ Here is where you can define the parameters of your protocol: NUM_SAMPLES: Number of samples to proce...
client.py
import http.client import logging import os import random import re import socket import ssl import threading import time import webbrowser from datetime import datetime, timedelta from http.server import BaseHTTPRequestHandler, HTTPServer from pathlib import Path from typing import Dict, Optional, Union from urllib.pa...
udp_listen.py
#!/usr/bin/python3 # import socket import threading import socketserver class MyUDPHandler(socketserver.BaseRequestHandler): def handle(self): data = self.request[0].strip() socket = self.request[1] print(f'client {self.client_address}\n\twrote {data}\n\tto {self.server.server_address}') ...
test_events.py
"""Tests for events.py.""" import collections.abc import concurrent.futures import functools import io import os import platform import re import signal import socket try: import ssl except ImportError: ssl = None import subprocess import sys import tempfile import threading import time import errno import uni...
base.py
import json import multiprocessing import os import sys import traceback import uuid from base64 import b64decode import psutil import swf.actors import swf.exceptions from simpleflow import format, logger, settings from simpleflow.dispatch import dynamic_dispatcher from simpleflow.download import download_binaries f...
feedback.py
import threading from telegram import ParseMode from telegram.chataction import ChatAction from telegram.ext.dispatcher import run_async from Brain.Modules.help import get_help from Brain.Utils.dbfuncs import user_collect, feedback_collect, command_collect from Brain.Utils.strings import HELPER_SCRIPTS from server im...
pyExecUtil.py
#!/usr/bin/env python # -*- Coding: utf-8 -*- # # Copyright (C) 2017 hidenorly # # 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 r...
dag_processing.py
# -*- coding: utf-8 -*- # # 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 #...
run.py
import threading import uvicorn from main import app original_callback = uvicorn.main.callback def callback(**kwargs): from celery.contrib.testing.worker import start_worker import tasks with start_worker(tasks.task, perform_ping_check=False, loglevel="info"): original_callback(**kwargs) uvico...
onnxruntime_test_python.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -*- coding: UTF-8 -*- import unittest import os import numpy as np import onnxruntime as onnxrt import threading class TestInferenceSession(unittest.TestCase): def get_name(self, name): if os.path.exists(name...
execute_optimization.py
# -*- coding: utf-8 -*- # Copyright (c) 2021 Intel Corporation # # 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 applicab...
spy.py
import os from socket import socket, AF_INET, SOCK_STREAM from threading import Thread from .exceptions import ParserError import logging import warnings from uuid import uuid4 from .proto import spy_pb2 from .command import * from ctypes import cdll, c_char_p class WeChatSpy: def __init__(self, parser=None, key:...
test_nanny.py
import asyncio import gc import logging import os import random import sys import multiprocessing as mp import numpy as np import pytest from toolz import valmap, first from tornado import gen from tornado.ioloop import IOLoop import dask from distributed.diagnostics import SchedulerPlugin from distributed import Na...
multi_echo_server.py
#!/usr/bin/env python3 import socket from multiprocessing import Process # CONSTANTS INBOUND_HOST = "" # Listen for all possible hosts INBOUND_PORT = 8001 INBOUND_BUFFER_SIZE = 1024 def echo(conn, addr): print("Connected by:", str(addr[0]) + ":" + str(addr[1])) with conn: # Accepted connec...
webserver.py
import json import mimetypes import pathlib import re import socket import socketserver import sys import threading import time import urllib.parse from http.server import BaseHTTPRequestHandler from io import BytesIO try: from pyretree import pyretree except ImportError: # Gross way to import from the reposi...
common.py
#!/bin/env python3 # Imports # ------------------------------------------- import yaml import threading import time import logging logger = logging.getLogger(__name__) # Main classes # ------------------------------------------- class Controller(): """This object hold the whole resolving logic""" timer = 1...
scheduler.py
import time, threading class Scheduler: def __init__(self, interface=None, timer=10, timer_measurement="seconds"): self.time_measurement_conv_table = {"seconds": 1, "minutes": 60, "hours": 3600} self.interface = interface self.waiting_time = int(timer) * self.time_measurement_conv_table[tim...
test_send_recv_two_workers.py
import asyncio import multiprocessing import os from distributed.comm.utils import from_frames, to_frames from distributed.protocol import to_serialize from distributed.utils import nbytes import cloudpickle import numpy as np import pytest import rmm import ucp from utils import more_than_two_gpus cmd = "nvidia-smi...
app_utils.py
# import the necessary packages from threading import Thread import datetime import cv2 class FPS: def __init__(self): # store the start time, end time, and total number of frames # that were examined between the start and end intervals self._start = None self._end = None se...
resourceDisk.py
# Microsoft Azure Linux Agent # # Copyright 2014 Microsoft Corporation # # 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 b...
ThreadSafePrint.py
# -*- coding:utf-8 -*- from __future__ import print_function import pprint import argparse import re import sys import os import time import threading import re #ๆ— ็ผ“ๅ†ฒ่พ“ๅ‡บ๏ผŒ้€‚ๅˆJenkins buf_arg = 0 if sys.version_info[0] == 3: os.environ['PYTHONUNBUFFERED'] = '1' buf_arg = 1 sys.stdout = os.fdopen(sys.stdout.fileno(),...
a3c_continuous.py
""" Asynchronous Advantage Actor Critic, A3C + RNN in continuous action space (https://arxiv.org/abs/1602.01783) with Generalized Advantage Estimation, GAE (https://arxiv.org/abs/1506.02438) Actor and Critic share similarities with the DDPG architecture (https://arxiv.org/abs/1509.02971) Special thanks to the followin...
noasync.py
import asyncio from . import high_level def train(*args, **kwargs): return asyncio.run(high_level.train(*args, **kwargs)) train.__doc__ = ( high_level.train.__doc__.replace("await ", "") .replace("async ", "") .replace("asyncio.run(main())", "main()") .replace(" >>> import asyncio\n", "") ...
_openbts.py
"""A library for simulating a user's phone. Copyright (c) 2016-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same di...
fast_sync_GUI.py
#!/usr/bin/env python3 from email.mime import image import tkinter as tk from tkinter import ttk from tkinter import messagebox import tkinter.font as tkFont from PIL import Image, ImageTk import threading import ipaddress import socket import os, sys import ssh_comms class heliumUpdateGUI(tk.Tk): colors = { ...
sync.py
import argparse import asyncio import logging import os from collections import namedtuple from multiprocessing import Process import sqlite3 from elasticsearch import AsyncElasticsearch from elasticsearch.helpers import async_bulk from lbry.wallet.server.env import Env from lbry.wallet.server.coin import LBC from lbr...