source
stringlengths
3
86
python
stringlengths
75
1.04M
__init__.py
import datetime import copy import json import os import threading import time import pkg_resources from sqlalchemy.exc import IntegrityError import anchore_engine.clients.services.common import anchore_engine.common # anchore modules import anchore_engine.common.helpers import anchore_engine.common.images import an...
client.py
from socketIO_client import SocketIO, LoggingNamespace #import webbrowser import webview import threading socketIO = SocketIO('f237c8a0.ngrok.io', 80, LoggingNamespace) def on_connect(): print("Connected.") def on_thing(data): if data["devHand"] == True: print("Received message from Google Assistant"...
main.py
import time import asyncio import threading import click import sys import os # Python imports will be the end of us all sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) from raccoon_src.utils.coloring import COLOR, COLORED_COMBOS from raccoon_src.utils.exceptions import RaccoonExc...
pyserver.pyw
# -*- coding: utf-8 -*- ########################################################################### ## Python code generated with wxFormBuilder (version Oct 26 2018) ## http://www.wxformbuilder.org/ ## ## PLEASE DO *NOT* EDIT THIS FILE! ########################################################################### impor...
hdf_to_influxdb.py
from datetime import datetime import time import h5py import pandas as pd from pathlib import Path from influxdb_client.client.write_api import SYNCHRONOUS, PointSettings from influxdb_client import InfluxDBClient, WritePrecision from config_secret import bucket, org, token from multiprocessing import Process df_heade...
test_orm_symbols_facts.py
#------------------------------------------------------------------------------ # Unit tests for Clorm ORM SymbolPredicateUnifer and unify function. # # Note: I'm trying to clearly separate tests of the official Clorm API from # tests of the internal implementation. Tests for the API have names # "test_api_XXX" while n...
rl_helper.py
import os import time import copy import numpy as np from setproctitle import setproctitle import visdom from pycrayon import CrayonClient import torch import torch.multiprocessing as mp from rl import EvalResult from utils import set_random_seed def build_env(game_type, args, **params): game_type = game_type...
p2000.py
#!/usr/bin/env python3 """RTL-SDR P2000 Receiver for Home Assistant.""" # See README for installation instructions import calendar import configparser import fnmatch import json import os import re import subprocess import sys import threading import time from datetime import datetime import requests VERSION = "0.0....
train.py
import sys, time, threading from time import sleep import torch from torchvision import datasets, transforms, models from torch import nn from torch import optim from get_input_args_train import get_input_args_train from workspace_utils import active_session from get_transforms import get_test_transforms, get_train_t...
node_client.py
import os import subprocess import threading import time import json import sublime import sublime_plugin import time from .logger import log from . import json_helpers from . import global_vars # queue module name changed from Python 2 to 3 if int(sublime.version()) < 3000: import Queue as queue else: import...
log.py
#!/usr/bin/env python """ Copyright (c) 2014-2019 Miroslav Stampar (@stamparm) See the file 'LICENSE' for copying permission """ import os import signal import socket import SocketServer import sys import threading import time import traceback from core.common import check_whitelisted from core.common import check_s...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
ctfd.py
#!/usr/bin/env python2 from halo import Halo from cloudscraper import create_scraper from threading import Thread, Lock from requests import session from argparse import Namespace, ArgumentParser from bs4 import BeautifulSoup from shutil import make_archive import logging as log import requests, json import sys, os imp...
roadblock.py
#!/usr/bin/python3 '''Roadblock is a synchronization and message passing utility which relies on redis for communication''' import argparse import datetime import time import calendar import socket import signal import hashlib import json import uuid import threading import logging import sys from dataclasses import...
websocket.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: leeyoshinari import os import json import logging import traceback from threading import Thread from shell.models import Servers from channels.generic.websocket import WebsocketConsumer from .ssh import SSH logger = logging.getLogger('django') class WebSSH(Web...
main.py
#!/usr/bin/env python3 """Implement a remote shell which talks to a MicroPython board. This program uses the raw-repl feature of the pyboard to send small programs to the pyboard to carry out the required tasks. """ # Take a look at https://repolinux.wordpress.com/2012/10/09/non-blocking-read-from-stdin-in-pyt...
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 threading import time import errno import unittest from unitt...
__main__.py
##################################################################### # # # __main__.py # # # # Copyright 2013, Monash University ...
vnrpc.py
# encoding: UTF-8 import threading import traceback import signal import zmq from msgpack import packb, unpackb from json import dumps, loads import cPickle pDumps = cPickle.dumps pLoads = cPickle.loads # 实现Ctrl-c中断recv signal.signal(signal.SIGINT, signal.SIG_DFL) ################################################...
trustedcoin.py
#!/usr/bin/env python # # Electrum - Lightweight SmartCash Client # Copyright (C) 2015 Thomas Voegtlin # # 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 witho...
tune_vitis.py
import os, sys, re, time, json from options import options import uptune as ut import threading, random, subprocess from collections import OrderedDict import argparse from multiprocessing import Process platform = "/opt/xilinx/platforms/xilinx_u280_xdma_201920_1/xilinx_u280_xdma_201920_1.xpfm" design = "optical_flow...
start.py
#!/usr/bin/python3 import os import glob import shutil import multiprocessing import logging as log import sys from podop import run_server from socrate import system, conf log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) def start_podop(): os.setuid(100) url = "http://" + ...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
processes.py
# -*- coding: utf-8 -*- import atexit import heapq import sys import time from threading import Thread from plumbum.lib import IS_WIN32, six if sys.version_info >= (3,): from io import StringIO from queue import Empty as QueueEmpty from queue import Queue else: from cStringIO import StringIO from ...
Checker.py
import requests, socket import time import gevent import threading from Utils.redisdb import RedisClient from Valid_check.Headers import headers from proxy_spider.proxyspider import run_spider from gevent import monkey;monkey.patch_all() requests.adapters.DEFAULT_RETRIES = 5 #设置最大重连次数 socket.setdefaulttimeout(20...
application.py
import logging from threading import Thread, Lock import time import socket from units import format_bits_as_measure, format_bits_as_measure_per_second class Application: def __init__(self, port, interval, log_format, verbose, is_json): self.port = port self.interval = interval self.log_fo...
speedtest.py
# -*- coding: utf-8 -*- """ Perform a bandwidth test with speedtest-cli. Configuration parameters: button_share: mouse button to share an URL (default None) format: display format for this module *(default "speedtest[\?if=elapsed&color=elapsed_time " "{elapsed_time}s][ [\?color=download ↓{down...
test_main.py
# -*- coding: utf-8 -*- import msvcrt from time import sleep import sys import threading import os def pwd_input(): chars = [] while True: try: newChar = msvcrt.getch().decode(encoding="utf-8") except: return input("你很可能不是在cmd命令行下运行,密码输入将不能隐藏:") if newChar in '...
gam.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # GAM # # Copyright 2015, LLC 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/LICE...
fibbo.py
#!/usr/bin/env python3 # Hardware simulation of fibbo # Author Malcolm Davis from queue import Queue import threading import sys ck = Queue() ak = Queue() fk = Queue() bk = Queue() dk = Queue() ek = Queue() cont = True if(len(sys.argv)>1): max = int(sys.argv[1]) else: max = 10000 def addMod(): while(cont):...
scheduler.py
import logging import os import signal import time import traceback from datetime import datetime from multiprocessing import Process from .job import Job from .queue import Queue from .registry import ScheduledJobRegistry from .utils import current_timestamp, enum from .logutils import setup_loghandlers from redis ...
livereload_tests.py
#!/usr/bin/env python import contextlib import email import io import os import sys import threading import time import unittest from pathlib import Path from unittest import mock from mkdocs.livereload import LiveReloadServer from mkdocs.tests.base import tempdir class FakeRequest: def __init__(self, content):...
depthai_record.py
#!/usr/bin/env python3 from pathlib import Path from multiprocessing import Queue from threading import Thread import depthai as dai from enum import Enum import cv2 class EncodingQuality(Enum): BEST = 1 # Lossless MJPEG HIGH = 2 # MJPEG Quality=97 (default) MEDIUM = 3 # MJPEG Quality=93 LOW = 4 # H265...
test_stuff.py
from multiprocessing import Process, Manager from random import randrange def f(): for _ in range(99999): print(d[randrange(0,25)]) if __name__ == '__main__': # Init #manager = Manager() #d = manager.dict() # Copy from pickle dict to manager dict #d[1] = '1' #d['2'] = 2 d = {i...
engine.py
""" """ import logging import smtplib from abc import ABC from datetime import datetime from email.message import EmailMessage from queue import Empty, Queue from threading import Thread from typing import Any from vnpy.event import Event, EventEngine from .app import BaseApp from .event import ( EVENT_TICK, ...
sublist3r.py
#!/usr/bin/env python # coding: utf-8 # Sublist3r v1.0 # By Ahmed Aboul-Ela - twitter.com/aboul3la # modules in standard library import re import sys import os import argparse import time import hashlib import random import multiprocessing import threading import socket import json from collections import Counter # e...
test_dota_base_q.py
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import tqdm import argparse from multiprocessing import Queue, Process from utils import...
multi_lead_autoencoder.py
""" Creates a determinsitic autoencoder for dimension reduction of 4-lead ECG signals. Saves the encoded and reconstructed signals to the data folder. """ import numpy as np import os import threading from tensorflow import keras from tensorflow.keras.layers import Dense, Flatten, Reshape, Input, InputLayer, Dropout f...
test_index.py
""" For testing index operations, including `create_index`, `get_index_info` and `drop_index` interfaces """ import logging import pytest import time import pdb import threading from multiprocessing import Pool, Process import numpy import sklearn.preprocessing from milvus import IndexType, MetricType from utils imp...
app_one_views.py
# -*- coding: utf-8 -*- import datetime import redis from flask import Blueprint, request, session, make_response, current_app, redirect, url_for from threading import Thread from flask_mail import Mail, Message from flask_restx import Api, Resource from server.api.api_server import api_server from server.config.conf...
test_exception.py
# coding=utf-8 import threading from qrpc.client import RpcClient from qrpc.server import Server def test_fault_exception(): from qrpc.exceptions import RPCFaultException HOST_PORT = ('127.0.0.1', 8080) zero_division_error = RPCFaultException( code=99, message="ZeroDivisionError: integer ...
result_detail.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # IkaLog # ====== # Copyright (C) 2015 Takeshi HASEGAWA # # 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/l...
test.py
import pytest import random import threading import time from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster from helpers.test_tools import TSV transient_ch_errors = [23, 32, 210] cluster = ClickHouseCluster(__file__) s0r0 = cluster.add_instance( "s0r0", main_confi...
test_asyncore.py
import asyncore import unittest import select import os import socket import sys import time import warnings import errno import struct from test import support from test.support import TESTFN, run_unittest, unlink from io import BytesIO from io import StringIO try: import threading except ImportError: thread...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import queue as pyqueue import contextlib import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import struct import operator import weakref import test.su...
headphones.py
from flask import jsonify, render_template, json, send_file from maraschino import app, logger, WEBROOT, RUNDIR from maraschino.tools import requires_auth, get_setting_value from threading import Thread import StringIO import urllib import urllib2 import base64 def headphones_http(): if get_setting_value('headpho...
utils_test.py
import asyncio import collections import gc from contextlib import contextmanager import copy import functools from glob import glob import io import itertools import logging import logging.config import os import queue import re import shutil import signal import socket import subprocess import sys import tempfile imp...
decision_loop.py
from __future__ import annotations import asyncio import contextvars import datetime import json import uuid import random import logging import threading from asyncio.base_futures import CancelledError from asyncio.events import AbstractEventLoop from asyncio.futures import Future from asyncio.tasks import Task from ...
parallel.py
''' Created on Aug 22, 2014 @author: David Zwicker <dzwicker@seas.harvard.edu> This module contains convenience functions for scanning multiple mouse videos in parallel. ''' import os import multiprocessing as mp import time from .simple import scan_video from .algorithm.data_handler import load_any_video from vide...
sorted.py
import os from queue import Queue from threading import Thread import pandas as pd import tensorflow as tf import collections import args import tokenization import modeling import optimization # os.environ['CUDA_VISIBLE_DEVICES'] = '1' class InputExample(object): """A single training/test example for simple s...
MinecraftSkinDownloader_ttkbootstrap.py
''' 作品名:MinecraftSkinDownloader Github仓库地址:https://github.com/NewbieXvwu/MinecraftSkinDownloader Gitee仓库地址:https://gitee.com/NewbieXvwu/MinecraftSkinDownloader 关于本程序:这是一个可以简单地下载任何Minecraft正版玩家的皮肤的软件,使用Python编写,由NewbieXvwu维护。 作者:NewbieXvwu ''' version_int=2.4#程序主版本号 ispreview=False#程序是否是预览版 previewversion="0"#预览版本号(不自动更...
hello.py
import os from threading import Thread from flask import Flask, render_template, session, redirect, url_for from flask_bootstrap import Bootstrap from flask_moment import Moment from flask_wtf import FlaskForm from wtforms import StringField, SubmitField from wtforms.validators import DataRequired from flask_sqlalchemy...
parameter_server.py
""" Utility functions to retrieve information about available services and setting up security for the Hops platform. These utils facilitates development by hiding complexity for programs interacting with Hops services. """ import os from hops import hdfs as hopshdfs from hops import tensorboard from hops import devi...
__main__.py
import argparse import logging import multiprocessing import sys from saq.worker import check_health, start def main(): parser = argparse.ArgumentParser(description="Start Simple Async Queue Worker") parser.add_argument( "settings", type=str, help="Namespaced variable containing worke...
scheduler.py
from datetime import datetime from multiprocessing import Pipe, Process from multiprocessing.connection import Connection from threading import Thread from typing import Optional import schedule from schedule import default_scheduler class OneTimeJob(schedule.Job): # Override schedule.Job._schedule_next_run to a...
my_library.py
#!/usr/bin/env python2.7 # my_library.py - This Module is for the most used classes and methods # URL: https://github.com/engdan77/otis_service # Author: Daniel Engvall (daniel@engvalls.eu) __version__ = "$Revision: 20190123.1251 $" import SocketServer import sys import threading import smbus import time def get_d...
silksuit.py
#!/usr/bin/python3 """A basic threading example | rzfeeser@alta3.com""" # Make a thread that simulates a NASA count down # waits a 1 seconds at the bottom of each loop ## Python standard library import threading ## py standard library import time def groundcontrol(): for i in range(10, -1, -1): print(i)...
sensor.py
"""Sensor to monitor incoming/outgoing phone calls on a Fritz!Box router.""" from __future__ import annotations from datetime import datetime, timedelta import logging import queue from threading import Event as ThreadingEvent, Thread from time import sleep from fritzconnection.core.fritzmonitor import FritzMonitor i...
presubmit_support.py
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Enables directory-specific presubmit checks to run at upload and/or commit. """ from __future__ import print_function __versio...
catalogizer.py
from collections import defaultdict from datetime import datetime from os import path, unlink import logging import threading from dal.configuration.tags import AUDIO_TAG_PATTERNS, IMAGE_TAG_PATTERNS, SUBTITLE_TAG_PATTERNS, TAG_ANY, \ TAG_ANY_PATTERN, TAG_END_SEPARATOR, TAG_START_SEP...
save_tiles_hdf5_dense.py
#!/usr/bin/env python import multiprocessing from subprocess import call import csv try: import mapnik2 as mapnik except: import mapnik import sys, os, random as rd import tensorflow as tf, cv2 import numpy as np import h5py # Define some parameters # layers = ['complete','amenity', 'barriers','bridge','buil...
word2vec_optimized.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
test_athenad.py
#!/usr/bin/env python3 import json import os import requests import tempfile import time import threading import queue import unittest from multiprocessing import Process from pathlib import Path from unittest import mock from websocket import ABNF from websocket._exceptions import WebSocketConnectionClosedException ...
parallel_autobalancing.py
import signal import os import logging #from multiprocessing_logging import install_mp_handler from multiprocessing import Process, cpu_count from subprocess import call from docopt import docopt # Workflow: # Start Mongo # Launch high level python controller script # Launch external processes # Wait for controller...
process.py
# -*- coding: utf-8 -*- # Import python libs import logging import os import time import sys import multiprocessing import signal # Import salt libs import salt.utils log = logging.getLogger(__name__) HAS_PSUTIL = False try: import psutil HAS_PSUTIL = True except ImportError: pass try: import system...
sideinputs.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
oec_main.py
from tkinter import * from tkinter.ttk import * import dialog as dlg from interface import * from syncutil import SrcPath import threading import logging from random import randint from tkinter import messagebox import tempfile from subprocess import call from typing import List import webbrowser import os EDITOR = os...
ducoapi.py
########################################## # Duino-Coin API Module # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2021 ########################################## import ast from requests import get import requests import socket import json import hashlib import urllib...
test_gc.py
import unittest from test.test_support import verbose, run_unittest import sys import time import gc import weakref try: import threading except ImportError: threading = None ### Support code ############################################################################### # Bug 1055820 has several tests of lo...
runner_enumerative_z3_only.py
# Run enumerative model counting with Z3. # Get model count at every minute until timeout. import argparse as ap import sys import os import re import math import multiprocessing import time from allSat import get_models from utils.Shell import Shell from utilities import get_abc_result_line from z3 import * parser =...
tensorboard.py
"Provides convenient callbacks for Learners that write model images, metrics/losses, stats and histograms to Tensorboard" from ..basic_train import Learner from ..basic_data import DatasetType, DataBunch from ..vision import Image from ..vision.gan import GANLearner from ..callbacks import LearnerCallback from ..core i...
ctpDataPublisher.py
'''A data feed engine for CTP bridge. ''' ''' Copyright (c) 2017, WinQuant Information and Technology Co. Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must r...
msg.py
from utlis.rank import setrank ,isrank ,remrank ,setsudos ,remsudos ,setsudo,IDrank,GPranks from utlis.send import send_msg, BYusers, sendM,Glang,GetLink from handlers.delete import delete from utlis.tg import Bot, Ckuser from handlers.ranks import ranks from handlers.locks import locks from handlers.gpcmd import...
views.py
# project/users/views.py # IMPORTS from flask import render_template, Blueprint, request, redirect, url_for, flash, Markup, abort from sqlalchemy.exc import IntegrityError from flask_login import login_user, current_user, login_required, logout_user from itsdangerous import URLSafeTimedSerializer from threading import...
test_admission_controller.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 u...
test.py
import cv2 import time import socket import threading import numpy as np import os import face_recognition import playsound import logging # todo: Add GUI for Camera def estop(): send("emergency") speaktext(0) while True: send("emergency") def speaktext(tc=0): os.chdir("text to speak") i...
test_threaded_import.py
# This is a variant of the very old (early 90's) file # Demo/threads/bug.py. It simply provokes a number of threads into # trying to import the same module "at the same time". # There are no pleasant failure modes -- most likely is that Python # complains several times about module random having no attribute # randran...
http1_tests.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...
tasks.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python from collections import OrderedDict, namedtuple, deque import errno import functools import importlib import json import logging import os import shutil import stat import tempfile import time import traceback from distutils.di...
compute.py
# Copyright (c) 2015 SONATA-NFV and Paderborn University # 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 re...
MirrorDevices.py
# This Macro allows sending the state of the robots from this computer to remote computers # More information about the RoboDK API here: # https://robodk.com/doc/en/RoboDK-API.html # For more information visit: # https://robodk.com/doc/en/PythonAPI/robodk.html#robolink-py from robodk.robolink import * # API to communi...
asyn.py
import asyncio import asyncio.events import functools import inspect import os import re import sys import threading from contextlib import contextmanager from glob import has_magic from .callbacks import _DEFAULT_CALLBACK from .exceptions import FSTimeoutError from .spec import AbstractFileSystem from .utils import P...
responder.py
""" Copyright (c) 2016-2020 Keith Sterling http://www.keithsterling.com 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, m...
chat_client.py
import time from threading import Thread import pat import patl from enum import Enum, auto import logging from chat_protocol import ChatClient, TEXT from patutils import LENGTH, MIN_VALUE, MAX_VALUE, ReturnCode paired = False silence = True # Not needed, playing other frequency chat_client: ChatClient = None clas...
callbacks.py
# -*- coding: utf8 -*- ### # Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2014, James McCoy # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must...
pimongame.py
#importing necessary library import RPi.GPIO as GPIO import threading import time import random import os from time import sleep # green, White, Yellow, RED LIGHTS = [13, 26, 19, 6] #in BCM mode #GPIO Pin for button Press #Corresponding button FOr Led As Above BUTTONS = [17, 22, 27, 4] #in BCM mode # values you ...
devtools_browser.py
# Copyright 2017 Google Inc. All rights reserved. # Use of this source code is governed by the Apache 2.0 license that can be # found in the LICENSE file. """Base class support for browsers that speak the dev tools protocol""" import glob import gzip import logging import os import re import shutil import subprocess im...
utils.py
import signal import sys from threading import Thread, Event #http://code.activestate.com/recipes/578231-probably-the-fastest-memoization-decorator-in-the-/ def memoize(f): """ Memoization decorator for functions taking one or more arguments. """ class memodict(dict): def __init__(self, f): ...
server.py
import sys import socket import argparse from threading import Thread, Event from getch import getch from time import sleep MESSAGE = "Hello, World!" """ Message protocol (x[7] . x[0:7]) . yyyyzzzzzzzzzzzzzzzzz x - packet type y - size of data segment z - message data Possible packet types (x[...
lock.py
import threading class Lock: """ Represents a lock object which has one-to-one correspondence with a Mysql connection. A lock is held by a connection. """ def __init__(self, locker, name): """ :param locker: Instance of Locker which will be used to generate new mysql connections. ...
test_fx.py
# Owner(s): ["oncall: fx"] import builtins import contextlib import copy import functools import inspect import math import numbers import operator import os import pickle import sys import torch import traceback import typing import types import warnings import unittest from math import sqrt from torch.multiprocessin...
asyncio_client_generator.py
from ib_tws_server.codegen.generator_utils import GeneratorUtils from ib_tws_server.api_definition import * from ib_tws_server.codegen.generator_utils import * import inspect def forward_method_parameters_dict_style(params: List[inspect.Parameter]) -> str: return ",".join([ f"{v.name} = {v.name}" for v in params ]...
tcp.py
#!/usr/bin/env python import socket import threading import sbs TCP_IP = '10.0.0.198' TCP_PORT = 30003 BUFFER_SIZE = 1024 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((TCP_IP, TCP_PORT)) def listen(arg1, stop_event): while (not stop_event.is_set()): data = s.recv(BUFFER_SIZE) ...
simulator.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: simulator.py # Author: Yuxin Wu <ppwwyyxxc@gmail.com> import tensorflow as tf import multiprocessing as mp import time import threading import weakref from abc import abstractmethod, ABCMeta from collections import defaultdict, namedtuple import numpy as np import ...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. """Test defid shutdown.""" from test_framework.test_framework import DefiTestFramework from test_framework.uti...
proxy_manager.py
from bs4 import BeautifulSoup import time from concurrent.futures import ThreadPoolExecutor from concurrent.futures import as_completed import requests import threading import queue import atexit class ProxyManager: def __init__(self): self.proxy_stack = [] self.psm_queue = queue.Queue() t ...
sc.py
#!/usr/bin/env python3 import tempfile import plumbum from plumbum.cmd import losetup, mkfs, mount, umount import os import parted from multiprocessing import Process, Value import signal import time # Nothing here is thread safe, but will be process safe! run = Value('b', True) class BlockDevice(object): def ...
youtube-dl-server.py
import json import subprocess from queue import Queue import time from bottle import run, Bottle, request, static_file, response, redirect, template, get from threading import Thread from bottle_websocket import GeventWebSocketServer from bottle_websocket import websocket from socket import error class WSAddr: de...
__init__.py
import sys import io import time import json import threading import traceback import collections import bisect try: import Queue as queue except ImportError: import queue # Patch urllib3 for sending unicode filename from . import hack from . import exception __version_info__ = (1, 0) __version__ = '.'.join...
process.py
"""JupyterLab Server process handler""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import atexit import logging import os import re import signal import subprocess import sys import threading import time import weakref from shutil import which as _which from ...