source
stringlengths
3
86
python
stringlengths
75
1.04M
server.py
import io import logging import time from threading import Lock, Thread import msgpack import torch import zmq from ptgnn.baseneuralmodel import AbstractNeuralModel from torch import nn from .data import ModelSyncData LOGGER = logging.getLogger(__name__) class ModelSyncServer: """A server storing the latest mo...
main.py
#!/usr/bin/env pybricks-micropython from threading import Thread from ev3_d4 import EV3D4 ev3_d4 = EV3D4() Thread(target=ev3_d4.color_sensor_loop).start() Thread(target=ev3_d4.touch_sensor_loop).start() ev3_d4.main_switch_loop()
client.py
import socket import threading import tkinter # -- tkinter による GUI の初期化 root = tkinter.Tk() root.title("nayutari chat") root.geometry("400x300") scrl_frame = tkinter.Frame(root) scrl_frame.pack() listbox = tkinter.Listbox(scrl_frame, width=40, height=15) listbox.pack(side=tkinter.LEFT) scroll_bar = t...
infeed_test.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, ...
py_vthread.py
class pool: import time,queue,traceback,builtins,functools from threading import Thread,RLock,current_thread,main_thread orig_func = {} _org_print = print lock = RLock() class KillThreadParams(Exception): pass _monitor = None _monitor_run_num = {} _pool_queue = {} _pool_func_num ...
main_gan_L2_regularized_yelp.py
import datetime import numpy as np import tensorflow as tf import threading import os from ganrl.common.cmd_args import cmd_args from ganrl.experiment_user_model.data_utils import Dataset from ganrl.experiment_user_model.utils import UserModelLSTM, UserModelPW def multithread_compute_vali(): global vali_sum, va...
async_api_multi-threads_multi-requests.py
#!/usr/bin/env python3 import cv2 import os import sys import time import numpy as np from openvino.inference_engine import IENetwork, IEPlugin from multiprocessing import Process, Queue import multiprocessing import threading import queue def async_infer_worker(exe_net, request_number, image_queue, input_blob, out...
SwiftRoute.py
#!/usr/bin/env python """ @author Jesse Haviland """ import swift as sw import websockets import asyncio from threading import Thread import webbrowser as wb import json import http.server import socketserver from pathlib import Path import os from queue import Empty from http import HTTPStatus import urllib def sta...
POPListener.py
import logging import sys import os import threading import SocketServer import ssl import socket from . import * EMAIL = """From: "Bob Example" <bob@example.org> To: Alice Example <alice@example.com> Cc: theboss@example.com Date: Tue, 15 January 2008 16:02:43 -0500 Subject: Test message Hello Alice. This is a te...
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 sys import os try: import queue...
multi_thread.py
import time from threading import Thread CONTADOR = 50000000 def contagem_regressiva(n): while n > 0: n -= 1 t1 = Thread(target=contagem_regressiva, args=(CONTADOR//2,)) t2 = Thread(target=contagem_regressiva, args=(CONTADOR//2,)) inicio = time.time() t1.start() t2.start() t1.join() t2.join() fim = tim...
vlcoutput.py
""" allows playing of audio media files via the VLC command line """ from __future__ import absolute_import from __future__ import unicode_literals import os import subprocess import threading _MACOSX_VLC_PATH = '/Applications/VLC.app/Contents/MacOS/VLC' _VLC_PARAMS = ['-I', 'rc', '--play-and-exit'] _DEVNULL = open(o...
measure.py
import tvm import os import sys import shutil import tvm._ffi import numpy as np import random import multiprocessing import multiprocessing.pool import psutil import signal import queue from pebble import concurrent from concurrent.futures import TimeoutError from pebble import ProcessPool, ProcessExpired from ..utils...
gui1_support.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Support module generated by PAGE version 4.18 # in conjunction with Tcl version 8.6 # Nov 11, 2018 03:57:06 PM CET platform: Windows NT import sys, gui1, subprocess, threading, time, psutil, base64, re MEMORY_LIMIT_PERCENT=60 CPU_LIMIT_PERCENT=30 thread_limit=...
imageService.py
import asyncio import time import base64 import requests from threading import Thread, Lock from time import sleep from apps.Config.config import config class ImageService: groundstation_url = ( config.values["groundstation"]["ip"] + ":" + config.values["groundstation"]["port"] ) ...
pool_2.py
from multiprocessing import Process def f(name): print('hello', name) if __name__ == '__main__': p = Process(target=f, args=('bob',)) p.start() p.join()
test_process.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import, print_function, unicode_literals import io import os import sys import threading import time import signal import multiprocessing import functools import datetime import warnings # Import Salt Testing libs from tests.support.unit imp...
child.py
"""Child worker process module.""" import os import sys import time import pickle import signal import socket import shutil import inspect import logging import argparse import platform import threading import subprocess def parse_cmdline(): """Child worker command line parsing""" parser = argparse.ArgumentP...
virus.py
import shutil import os import hashlib import ctypes import subprocess, re import socket import time from multiprocessing import Process main_file_directory = os.getcwd() user_name = os.getenv('username') destination_directory = "C://Users//" + user_name executable_file_directory = destination_directory + "virus.exe"...
pydoc.py
#!/usr/bin/env python3 """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 "pydoc <name>" to show documen...
test_transactional.py
# STANDARD LIB import threading # THIRD PARTY from google.appengine.runtime import DeadlineExceededError # DJANGAE from djangae.db import transaction from djangae.db.caching import DisableCache from djangae.contrib import sleuth from djangae.test import TestCase class TransactionTests(TestCase): def test_repeat...
picamera.py
#!/usr/bin/python2.7 # # Copyright (C) 2016 by meiraspi@gmail.com published under the MIT License # # display pygame window from picamera # # http://www.pyimagesearch.com/2015/12/28/increasing-raspberry-pi-fps-with-python-and-opencv/ # https://www.snip2code.com/Snippet/979508/OpenCV-VideoCapture-running-on-PyGame-on # ...
quiet-scan-threaded.py
#!/usr/bin/env python3 import subprocess import sys, getopt, os import threading import argparse cwd = os.getcwd() path = cwd + "/port_scanner_files/" ip_list_file = path + "input/IP_list.txt" nmap_output_file = path + "temp_output/nmap_output" #the scorchedearth option runs every nmap scan that doesn't require an ad...
main.py
from threading import Timer, Thread import time import os import sys def kill(): print("TLE") exit(1) testCases = int(sys.argv[1]) timeLimit = int(sys.argv[2]) def runCode(timeout): if os.system("javac /source/code.java > /source/out/compile_out.txt 2> /source/out/compile_error.txt") != 0: print(...
lidar.py
from rplidar import RPLidar import time from multiprocessing import Pipe from threading import Thread, Event class LidarController(object): """ Asynchronous controller for the rplidar. """ def __init__(self, port='/dev/ttyUSB0'): self.lidar = RPLidar(port) print('LidarController:', sel...
test_threading.py
### ### This is a verbatim copy of the "test_threading" regression tests from ### the standard Python distribution (svn revision 77924 to be precise) with ### some simple changes to make it run using threading2: ### ### * "import threading" => "import threading2 as threading" ### * "from test import lo...
__init__.py
#f2_dsp class # Last modification by Marko Kosunen, marko.kosunen@aalto.fi, 14.11.2018 11:44 import numpy as np import scipy.signal as sig import tempfile import subprocess import shlex import time from thesdk import * from f2_util_classes import * from f2_decimator import * import signal_generator_802_11n as sg80211...
async_checkpoint.py
# Copyright 2018 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...
run1.py
import datetime import threading import time import paho.mqtt.publish as publish import requests from flask import Flask from grove.gpio import GPIO from grove.grove_ultrasonic_ranger import GroveUltrasonicRanger import logging # Connect the GroveUltrasonicRanger to D5 & D16 ultrasonic_ranger_1 = GroveUltrasonicRange...
Methods.py
from threading import Thread import socket from time import sleep from sys import byteorder from Config import Config import configparser from Row import Row import os import sys from random import randrange def bell_indicators(MAX_BELLS, INDICATE_BELL_NUMBER_SHIFT, INDICATE_BEL...
simulation_1.py
#Laura Sullivan-Russett and Grace Walkuski #CSCI 466 #PA3 #November 2, 2018 import network_1 import link_1 import threading from time import sleep ##configuration parameters router_queue_size = 0 #0 means unlimited simulation_time = 1 #give the network sufficient time to transfer all packets before quitti...
command.py
import threading from typing import Optional from paramiko.channel import ChannelStdinFile, ChannelFile, ChannelStderrFile class RemoteCommand: """ RemoteCommand wraps the IO pipes of a paramiko command. It is with-able and uses threads to guarantee easy IO. Note that upon exit of the with-statement, ...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
main.py
import json import crawlKoreaData_All as crawl1 import crawlKoreaData_Gyeonggi as crawl2 import crawlKoreaData_Seoul as crawl3 import LED_Display as LMD import threading from datetime import date, timedelta today = date.today() a = str(today) def LED_init(): thread=threading.Thread(target=LMD.main, ar...
parallel_proc_runner_base.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # https://github.com/cquickstad/parallel_proc_runner # Copyright 2018 Chad Quickstad # # 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 # # ...
multi-planet.py
import os import multiprocessing as mp import sys import subprocess as sub import mmap import argparse import h5py import numpy as np from bigplanet import CreateHDF5,merge_data,load,save,CreateMasterHDF5 from collections import OrderedDict # -----------------------------------------------------------------...
utils_v5.py
"""" Miscellaneous function to run OpenCV DNN YoloV5 """ import cv2 as cv import time import sys import numpy as np class prepDetect: """ Variables that will have an initial values that will be updated will be created in the class""" frame=None conf_thresh, NMS_THRESHOLD,score_thresh=0.4, 0.4,0.25 ...
tests.py
# -*- coding: utf-8 -*- # Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. from __future__ import unicode_literals import os import re import copy import shutil import tempfile import threading import time import unittest import warnings from django.conf import settings ...
__init__.py
# -*- coding: utf-8 -*- """Radio module""" import sys import os import subprocess import threading from radioLib import wsgiserver from Radio import app import logger from pithos import pithos from apscheduler.scheduler import Scheduler FULL_PATH = None RUNDIR = None ARGS = None DAEMON = False PIDFILE = None VERBOSE ...
tos.py
import sys, os, time rootPath = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.split(os.path.split(rootPath)[0])[0]) import RTool.util.importer as imp exec(imp.ImportHandler( ["win32api", "win32con", "win32gui", "win32ui"])) #import win32api, win32con, win32gui, win32ui from threading import ...
determine_vacant_spectrum.py
''' Summary: ''' import sqlite3 from sqlite3 import Error #from interval import Interval, IntervalSet #from interval import Interval, IntervalSet import intervals as interval #requires: pip install python-intervals import threading import time from time import gmtime, strftime ''' Global constants ''' #databases sp...
statistics_service.py
import time import traceback import dataclasses from dataclasses import dataclass from abc import ABCMeta, abstractmethod from collections import deque from datetime import datetime from threading import Thread, Lock from typing import Optional, TypeVar, Generic, Deque, Type, Callable, Dict, Any, TYPE_CHECKING from b...
servercmds.py
import tkinter as tk import multiprocessing as mp import threading class ServerCommandLineUI: def __init__(self, command_handler, pipe, frame = None, default_title = 'Server Command Line'): self.command_handler = command_handler self.pipe = pipe self.frame = frame self.default_title...
pick_three.py
""" This simple program generates random 3-value sets, and assumes that the order of the values in the set are not important. 2 graphs are displayed: The first graph shows a plotting of all possible sets that could exist. The second graph shows the output of function randomly_sample. The graphs...
yoosee.py
import socket import time from threading import Thread class Yoosee(): def __init__(self, host): self.host = host self.port = 554 self.connected = False self.ticks = None self.client = None def ptz(self, cmd): cmd = cmd.upper() if ['UP', 'DOWN', 'LE...
repository.py
import atexit import os import re import subprocess import tempfile import threading import time from contextlib import contextmanager from pathlib import Path from typing import Callable, Dict, Iterator, List, Optional, Tuple, Union from urllib.parse import urlparse from tqdm.auto import tqdm from huggingface_hub.co...
main.py
import argparse import github3 import toml import json import re import functools from . import comments from . import utils from .parse_issue_comment import parse_issue_comment from .auth import verify as verify_auth from .utils import lazy_debug import logging from threading import Thread, Lock, Timer import time imp...
wuhan.py
#!/usr/bin/env python3.8 # -*- coding: utf-8 -*- """ Visualize Wuhan Corona Virus Stats """ import datetime as dt import inspect import io import math import os import platform import random import string import sys import threading import time import cufflinks as cf import dash import dash_core_components as dcc impo...
differential_cryptanalysis.py
from collections import namedtuple, defaultdict from FEAL import FEAL, XOR, round_function from multiprocessing import Process, Queue import itertools import os DifferentialPair = namedtuple('DifferentialPair', ['m1', 'm2', 'c1', 'c2']) def gen_random_bytes(length): return map(ord, os.urandom(length)) def make_dif...
client.py
import socket #import socket module import time import inputs import threading def receiveData(client): while(True): data = client.recv(1024).decode() #print(data) def sendData(client): while(True): try: events = inputs.get_gamepad() sendString = "connected:1:b...
athenad.py
#!/usr/bin/env python3 import base64 import hashlib import io import json import os import sys import queue import random import select import socket import threading import time from collections import namedtuple from functools import partial from typing import Any import requests from jsonrpc import JSONRPCResponseM...
test_eider.py
# Copyright 2017 Semiconductor Components Industries LLC (d/b/a "ON # Semiconductor") # # 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...
test_graphdata_distributed.py
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
depthai_combination.py
""" Spatial AI demo combining Spectacular AI VIO with Tiny YOLO object detection accelerated on the OAK-D. Requirements: pip install opencv-python matplotlib To download the pre-trained NN model run following shell script (Git Bash recommended on Windows to run it): ./depthai_combination_install.sh Plug in...
bot.py
# coding=utf-8 # Copyright 2008, Sean B. Palmer, inamidst.com # Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> # Copyright 2012-2015, Elsie Powell, http://embolalia.com # # Licensed under the Eiffel Forum License 2. from __future__ import unicode_literals, absolute_import, print_function, division import col...
manager.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...
rot2prog.py
"""This is a python interface to the Alfa ROT2Prog Controller. """ import logging import serial import time from threading import Lock, Thread class ReadTimeout(Exception): """A serial read timed out. """ pass class PacketError(Exception): """A received packet contained an error. """ pass class ROT2Prog:...
high_level.py
""" High level abstraction interfaces to DFFML. These are probably going to be used in a lot of quick and dirty python files. """ import asyncio import pathlib from typing import Optional, Tuple, List, Union, Dict, Any, AsyncIterator from .record import Record from .df.types import DataFlow, Input from .df.memory impo...
http_drain_method_steps.py
# Copyright 2015-2016 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...
Semaphore.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 consumer(): global item logging.info('Consumer is waiting') semap...
test.py
import logging from . import util from . import SerialInterface, BROADCAST_NUM from pubsub import pub import time import sys import threading from dotmap import DotMap """The interfaces we are using for our tests""" interfaces = None """A list of all packets we received while the current test was running""" receivedP...
pickletester.py
import collections import copyreg import dbm import io import functools import os import math import pickle import pickletools import shutil import struct import sys import threading import unittest import weakref from textwrap import dedent from http.cookies import SimpleCookie try: import _testbuffer except Impo...
queue.py
##################################################################### # # # /queue.py # # # # Copyright 2013, Monash University ...
launch_servers.py
from multiprocessing import Process import time import argparse import socket import os from utils import check_ports_avail ap = argparse.ArgumentParser() ap.add_argument("-n", "--number-servers", required=True, help="number of servers to spawn", type=int) ap.add_argument("-p", "--ports-start", required=True, help="th...
zeromq.py
# -*- coding: utf-8 -*- ''' Zeromq transport classes ''' # Import Python Libs from __future__ import absolute_import import logging import os import errno import hashlib import weakref from random import randint # Import Salt Libs import salt.auth import salt.crypt import salt.utils import salt.utils.verify import sa...
lora_sync_layer.py
from wifi_link_layer import Wifi_Link_Layer from lora_feed_layer import Lora_Feed_Layer import os import math import time import _thread import threading import json import crypto import feed import binascii import event import pcap import sys from struct import unpack class Lora_Sync_Layer: def __init__(self,...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2021 The Danxome 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 danxomed node can load multiple wallet files """ from decimal import D...
TWCManager.py
#! /usr/bin/python3 ################################################################################ # Code and TWC protocol reverse engineering by Chris Dragon. # # Additional logs and hints provided by Teslamotorsclub.com users: # TheNoOne, IanAmber, and twc. # Thank you! # # For support and information, please re...
match_details.py
"""This module pulls matches from the matches table and gets detailed information on them and saves it in the database. TODO: Fix the sql schema, season isn't included. And also store all the data about the player such as item, level, abilities whatever etc. """ import urllib.request import urllib.parse import json i...
A5.py
#!/usr/bin/env python import rvo2 import matplotlib.pyplot as plt import numpy as np import random import rospy import time import threading import math import sys from utils import * from nav_msgs.msg import Odometry import A5easyGo as easyGo rospy.init_node('A5_mvs', anonymous=False) SIMUL_HZ = 10.0 sim = rvo2.P...
krang.py
import numpy as np import threading import time import socket import swarmNet import os import math import senseControl def krangServer(ip): print(' - - -- starting the drone center command') global running global started global state global started backlog = 1 # how many conn...
task.py
""" Backend task management support """ import itertools import json import logging import os import re import sys import warnings from copy import copy from datetime import datetime from enum import Enum from multiprocessing import RLock from operator import itemgetter from tempfile import gettempdir from threading im...
_unit_testing.py
import os from threading import Thread from time import time, sleep from winsound import Beep import numpy as np from rx.operators import take_until_with_time try: from neurosky.utils import KeyHandler from neurosky._connector import Connector from neurosky._processor import Processor from neurosky._ne...
cli.py
""" Command line entry """ import os import sys import time import threading from os import getpid import psutil # from .web import Webserver from ..models import WebserverArgs from ..core.driver import (Driver, DriverEvents) from ..core.device_context import DeviceContext from ..core.tunnel_base import TunnelEvents ...
portscan.py
import socket import threading import queue import random random_time = random.randint(2 ** 16, 2 ** 64 - 1).to_bytes(8, 'big') udp_to_send = b'\x13' + b'\0' * 39 + random_time def define_proto(data): if len(data) > 4 and data[:4] == b'HTTP': return ' HTTP' if b'SMTP' in data: ...
__init__.py
""" # an API for Meshtastic devices Primary class: SerialInterface Install with pip: "[pip3 install meshtastic](https://pypi.org/project/meshtastic/)" Source code on [github](https://github.com/meshtastic/Meshtastic-python) properties of SerialInterface: - radioConfig - Current radio configuration and device setting...
email.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @File : email.py # @Author : Hython # @Date : 公元 2020/01/14 22:51 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.s...
proxier.py
import atexit from concurrent import futures from dataclasses import dataclass import grpc import logging from itertools import chain import json import socket import sys from threading import Lock, Thread, RLock import time import traceback from typing import Any, Callable, Dict, List, Optional, Tuple import ray from...
lxc_executor.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import logging from vmchecker.generic_executor import Host,VM _logger = logging.getLogger('vm_executor') from threading import Thread import time class LXCHost(Host): def getVM(self, bundle_dir, vmcfg, assignment): return LXCVM(self, bundle_dir, vmcfg...
paralel_neuman_new0.py
import numpy as np import scipy.sparse as sp from ...common_files.common_infos import CommonInfos import multiprocessing as mp from ...solvers.solvers_scipy.solver_sp import SolverSp from ...solvers.solvers_trilinos.solvers_tril import solverTril import time class masterNeumanNonNested: def __init__(self, data_i...
polybeast_learner.py
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
parameterize_simple.py
import copy import argparse import time import numpy as np from io import StringIO import itertools import os import sys from jax.config import config as jax_config # this always needs to be set jax_config.update("jax_enable_x64", True) from scipy.stats import special_ortho_group import jax import rdkit from rdkit im...
test_httplib.py
import errno from http import client import io import itertools import os import array import socket import unittest TestCase = unittest.TestCase from test import support here = os.path.dirname(__file__) # Self-signed cert file for 'localhost' CERT_localhost = os.path.join(here, 'keycert.pem') # Self-signed cert fil...
cli_session.py
from __future__ import absolute_import import sys from threading import Thread try: from Queue import Queue, Empty except ImportError: from queue import Queue, Empty # python 3.x ON_POSIX = 'posix' in sys.builtin_module_names class CliSession(): def __init__(self, process): self.process = pr...
threads.py
import time from threading import Thread def carro(velocidade, piloto): trajeto = 0 while trajeto <= 100: trajeto += velocidade time.sleep(0.5) print('Piloto: {} Km: {} \n' .format(piloto, trajeto)) t_carro1 = Thread(target=carro, args=[1, 'Mauricio']) t_carro2 = Thread(target=carro,...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from electrum_trc.bitcoin import TYPE_ADDRESS from electrum_trc.storage import WalletStorage from electrum_trc.wallet import Wallet, InternalAddressCorruption from electrum_trc.paymen...
multiproc04.py
from multiprocessing import Process, Pipe def f(conn): conn.send([42, None, 'hello']) conn.close() if __name__ == '__main__': parent_conn, child_conn = Pipe() p = Process(target=f, args=(child_conn,)) p.start() print(parent_conn.recv()) # prints "[42, None, 'hello']" p.join()
camera.py
#!/usr/bin/env python # coding:utf-8 import os import cv2 import time import utils import threading import collections import requests import numpy as np import argparse import random import os #from profilehooks import profile # pip install profilehooks class Fps(object): def __init__(self, buffer_size=15): ...
zipkinStubServer.py
from bottle import post, Bottle, request import json import socket, struct import queue from threading import Thread import server class Span: def __init__(self): self.id = -1 self.name = '' self.timestamp = -1 self.traceId = '' self.duration = '' self.parentId = '' ...
test_BlackBull.py
from http import HTTPStatus import ssl import pathlib from blackbull.logger import get_logger_set # Library for test-fixture from multiprocessing import Process import asyncio import pytest # Test targets from blackbull import BlackBull, Response, WebSocketResponse from blackbull.utils import Scheme, HTTPMethods # f...
driver.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyright (c) 2012 Univer...
views.py
from threading import Thread from channels.layers import get_channel_layer from asgiref.sync import async_to_sync from django.contrib.auth.models import User from django.contrib.auth import get_user_model from django.utils import timezone from django.http import Http404, HttpResponse, FileResponse from urllib.parse i...
assessment_process.py
""" User Management Assesment process / daemon This is being developed for the MF2C Project: http://www.mf2c-project.eu/ Copyright: Roi Sucasas Font, Atos Research and Innovation, 2017. This code is licensed under an Apache 2.0 license. Please, refer to the LICENSE.TXT file for more information Created on 27 sept. 2...
Task.py
# # Task.py -- Basic command pattern and thread pool implementation. # # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # from __future__ import absolute_import, print_function from ..util import six from ..util.six.moves import map import sys import time impo...
word2vec.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Author: Gensim Contributors # Copyright (C) 2018 RaRe Technologies s.r.o. # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """ Introduction ============ This module implements the word2vec family of algorithms, using highly optimized C routin...
tui.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os import time import random import textwrap import re import socket import curses import string import inspect import threading import math from queue import Queue from .messages import msg # for putty connections we need the following env os.environ['NCURSE...
asyncfin-v1.py
""" Correct tasks finalization. Variant 1. Do it by SIGTERM interception. """ import asyncio import multiprocessing import random import signal import time class Client(object): def __init__(self): self.running = True @asyncio.coroutine async def test(self, i): while self.running: ...
comparison-request-gunicorn-dynamic.py
#!/usr/bin/env python # coding: utf-8 # In[1]: import os import threading from queue import Queue import requests # In[2]: def run_parallel_in_threads(target, args_list): globalparas = [] result = Queue() def task_wrapper(*args): result.put(target(*args)) threads = [threading.Thread(tar...
6.py
# -*- coding: utf-8 -*- import LINETCR #import wikipedia from LINETCR.lib.curve.ttypes import * #from ASUL.lib.curve.ttypes import * from datetime import datetime # https://kaijento.github.io/2017/05/19/web-scraping-youtube.com/ from bs4 import BeautifulSoup from threading import Thread from googletrans import Transla...
_strkick_process.py
import subprocess, threading, sys, os, time ### class Launcher(object): def __init__(self, startcmd, stopcmd): self.StartCmd = startcmd self.StopCmd = stopcmd self.SubProcess = None self.Output = [] def CleanUp(self): self.Stop() def AssignButtons(self, startbtn, stopbtn, restartbnt): self.Start...