source
stringlengths
3
86
python
stringlengths
75
1.04M
geemap.py
"""Main module for interactive mapping using Google Earth Engine Python API and ipyleaflet. Keep in mind that Earth Engine functions use both camel case and snake case, such as setOptions(), setCenter(), centerObject(), addLayer(). ipyleaflet functions use snake case, such as add_tile_layer(), add_wms_layer(), add_mi...
sphereexe.py
""" This script is calls the main sphere-overburden routine from sphereresponse.py with the user determined values that are input in the widgets that are defined and created in options_menu.py This python file is compiled into an exe by calling Pyinstaller in a directory with sphereresponse.py and options_menu....
engine.py
# -*- coding: utf-8 -*- # # This file is part of the python-chess library. # Copyright (C) 2012-2018 Niklas Fiekas <niklas.fiekas@backscattering.de> # # 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 Software Foundat...
filesystemio_test.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...
gtagsExpl.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import vim import re import os import os.path import shutil import itertools import subprocess from .utils import * from .explorer import * from .manager import * if sys.version_info >= (3, 0): import queue as Queue else: import Queue #***************************...
coach.py
# Copyright (c) 2017 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 applicable law or agreed to i...
conftest.py
import pathlib from multiprocessing import Process import docker import pytest from testcontainers.compose import DockerCompose from .pact_provider import run_server @pytest.fixture(scope="module") def server(): proc = Process(target=run_server, args=(), daemon=True) proc.start() yield proc # Clean...
conftest.py
import builtins from multiprocessing import Process import sys import time import os import shutil import tempfile import pytest import torch import syft from syft import TorchHook from syft.generic.frameworks.hook import hook_args from syft.workers.websocket_client import WebsocketClientWorker from syft.workers.webs...
scanner.py
import ipaddress import os import socket import struct import sys import threading import time SUBNET = '192.168.1.0/24' MESSAGE = 'PYTHONRULES!' class IP: def __init__(self, buff=None): header = struct.unpack('<BBHHHBBH4s4s', buff) self.ver = header[0] >> 4 self.ihl = header[0] & 0xF ...
test_lib.py
#!/usr/bin/env python """A library for tests.""" from __future__ import division import codecs import datetime import email import functools import logging import os import pdb import platform import shutil import socket import sys import tempfile import threading import time import unittest from builtins import ran...
train.py
""" Written by Matteo Dunnhofer - 2017 models training on ImageNet """ import sys import os.path import time from models import alexnet import tensorflow as tf import train_util as tu import numpy as np import threading def train( epochs, batch_size, learning_rate, dropout, momentum, lmbda, resume...
multiprocessingexample.py
import multiprocessing as mp import os import random def squared(x, queue): module_name = __name__ parent_id = os.getppid() process_id = os.getpid() result = x * x print(f'module={module_name} : parent={parent_id} : process={process_id} : result={result}') queue.put(result) if __name__ == ...
test_c10d_nccl.py
# Owner(s): ["oncall: distributed"] import copy import math import os import random import signal import sys import tempfile import threading import time from contextlib import contextmanager from datetime import timedelta from itertools import product from unittest import mock import torch import torch.distributed a...
HPoolPPMineWidget.py
from PyQt5.QtWidgets import QWidget, QMessageBox from PyQt5.Qt import pyqtSignal, QTimerEvent from ui.HPoolPPMineWidget import Ui_HPoolPPMineWidget from PyQt5.QtCore import Qt from config import save_config, get_config from utils import size_to_str from datetime import datetime, timedelta import os from core import BAS...
sekal.py
# -*- coding: utf-8 -*- import time from threading import Thread class Track(object): def __init__(self, name, called): self.name = name self.called = called self.steps = {} self.tick_period_s = 0 def __getitem__(self, step_sec): step = int(step_sec / self.tick_period_...
audio_module.py
#!/usr/bin/env python3 """ This is the first version of the UFAL experiments to try using eye-traking to understand how humans process ambiguities during translation. """ import os import sys import threading import tempfile import queue import sounddevice as sd import soundfile as sf q = queue.Queue()...
process.py
# Python的os模块封装了常见的系统调用,其中就包括fork,可以在Python程序中轻松创建子进程 import os print('process (%s) start...' % os.getppid()) # pid = os.fork() # if pid == 0 : # print('I am child process (%s) and my parent is %s' % (os.getpid(), os.getppid())) # else: # print('I (%s) just created a child process (%s).' %(os.getpid(), pid)...
test_queues.py
# -*- coding: utf-8 -*- import time import socket from .utils import require_module, missing, LETTERS import logbook from logbook.helpers import u import pytest @require_module('zmq') def test_zeromq_handler(logger, handlers, subscriber): tests = [ u('Logging something'), u('Something with umla...
RamaNet2.py
#!/usr/bin/ python3 print('''\x1b[32m ██████╗ █████╗ ███╗ ███╗ █████╗ ███╗ ██╗███████╗████████╗ ██╔══██╗██╔══██╗████╗ ████║██╔══██╗████╗ ██║██╔════╝╚══██╔══╝ ██████╔╝███████║██╔████╔██║███████║██╔██╗ ██║█████╗ ██║ ██╔══██╗██╔══██║██║╚██╔╝██║██╔══██║██║╚██╗██║██╔══╝ ██║ ██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║...
meat.py
#!/usr/bin/env python3 """ NOTES: - Session.msg borrowed from statistics/msg/Session.msg it's possible to introduce this dependency (or leave it as is) - check statistics/StatsD.msg Will need to define association between source topics and type of result statistical data (whether it's event based or time...
vis_client_test.py
#!/usr/bin/env python from pylab import * import socket import time import threading import json from collections import deque from glider_icon import * from helper import lla2flatearth #init plot fig, ax = plt.subplots() ax.axis('equal') #init glider icon bp, lwp, rwp, ltp, rtp, vp, tp = addAndGetGliderIcon(ax, 0,0...
LaunchToRhythm.py
import sys import time import threading import json from pynput.keyboard import Key, Controller try: import launchpad_py as launchpad except ImportError: try: import launchpad #what the fuck bro except ImportError: sys.exit("error loading launchpad.py") #no why a try catch config = open("config.json") #Open th...
auto_power_off.py
import platform # For getting the operating system name import subprocess # For executing a shell command import sys import threading import time from time import sleep failCount = 0 routerAddress = "192.168.1.1" def ping(host): """ Returns True if host (str) responds to a ping request. Remember that a...
test_lock.py
""" Copyright (c) 2008-2014, Jesus Cea Avion <jcea@jcea.es> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of...
test_operator.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...
dma_timer.py
__author__ = "David Northcote (Modified from Craig Ramsay)" __organisation__ = "The Univeristy of Strathclyde" __support__ = "https://github.com/strath-sdr/rfsoc_radio" import time import threading import ipywidgets as ipw class DmaTimer(): """Class for scheduling periodic callbacks. Timer class for periodic...
websocket_client.py
import json import ssl import sys import traceback import socket from datetime import datetime from threading import Lock, Thread from time import sleep import time import websocket class WebsocketClient(object): """ Websocket API After creating the client object, use start() to run worker and ping thre...
multiprocess.py
# -*- coding: utf-8 -*- ''' Created on 2017年7月6日 @author: luzs ''' from multiprocessing import Process, Pool import os import time import random #子进程 def myProcess(name): print('Run child process %s (%s)' % (name, os.getpid())) # threadpool def long_time_task(name): print('Run task %s (%s)...
app.py
#!/usr/bin/env python from importlib import import_module import os from flask import Flask, render_template, Response from dotenv import load_dotenv from weather import Weather import json import threading load_dotenv() # import camera driver if os.environ.get('CAMERA'): Camera = import_module('camera_' + os.env...
pwm.py
import threading import time import RPi.GPIO as GPIO RED = 7 BLUE = 22 QUIT = 0 GPIO.setmode(GPIO.BOARD) GPIO.setup(BLUE, GPIO.OUT) GPIO.setup(RED, GPIO.OUT) b = GPIO.PWM(BLUE, 50) # channel=12 frequency=50Hz b.start(0) r = GPIO.PWM(BLUE, 50) # channel=12 frequency=50Hz r.start(0) def cycle_red(): print "in r...
util.py
# # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket try: import ssl ...
qt.py
# This file is part of the pyMOR project (http://www.pymor.org). # Copyright 2013-2016 pyMOR developers and contributors. All rights reserved. # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) """ This module provides a few methods and classes for visualizing data associated to grids. We us...
__init__.py
from collections import namedtuple from contextlib import contextmanager import os from multiprocessing import Manager, Queue, Process from multiprocessing.managers import ListProxy from multiprocess.progress_bar import progress_bar from multiprocess.signals import STOP from tqdm import tqdm def available_cores(): ...
pac.py
# coding=utf-8 """ PaC Adventure Creator A library for creating a text-based interactive story. """ import logging import pickle import threading import time import os import textwrap log = logging.getLogger(__name__) log.setLevel(logging.INFO) # Check for pygame try: from pygame import mixer except ImportError:...
remote.py
import RPi.GPIO as GPIO import threading from mpu6050_custom import mpu6050 from time import sleep import client class Remote: STOP = False data = [] def __init__(self, socket): self.socket = socket self.sensor = mpu6050(0x68) self.output_data_thread = threading.Thread(target=self.send_data) GPIO.setmode(...
manual_ai.py
from pathlib import Path from threading import Thread from typing import List from drivebuildclient.AIExchangeService import AIExchangeService from drivebuildclient.aiExchangeMessages_pb2 import SimulationID def _handle_vehicle(sid: SimulationID, vid: str, requests: List[str]) -> None: from drivebuildclient.aiEx...
asynchronous.py
# # 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. # import copy import time import torch import torch.multiprocessing as mp from salina import Agent from salina.workspace import Workspace,...
RUtils.py
import os import sys import threading import time from selenium.webdriver.support.color import Color, Colors import os class tool: """ 存放自定义的基础工具包 """ _instance = None def __init__(self): pass def __new__(cls, *args, **kwargs): if tool._instance==None: tool._instance=...
hsms_if.py
# _*_ coding: utf-8 _*_ #@Time : 2020/8/14 上午 08:26 #@Author : cherish_peng #@Email : 1058386071@qq.com #@File : hsms_if.py #@Software : PyCharm from .item import Item from .secsmessage import SecsMessage from .errsecsmsg import ErrSecsMsg import re from .systembytegenerator import SystemByteGenerator...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum_dash.util import bfh, bh2u, UserCancelled, UserFacingException from electrum_dash.bip32 import BIP32Node from electrum_dash import constants from elect...
http.py
import base64 import json import sys import threading import web import nia as NIA urls = ( '/', 'index', '/get_steps', 'get_steps' ) # global scope stuff nia = None nia_data = None class index: def GET(self): render = web.template.render("templates/") return render.index() class get_ste...
test_h5store.py
# Copyright (c) 2018 The Regents of the University of Michigan # All rights reserved. # This software is licensed under the BSD 3-Clause License. import os import sys import pytest import random import string import subprocess import platform from itertools import chain from array import array from contextlib import co...
minicap.py
# -*- coding: utf-8 -*- from Banner import Banner from queue import Queue import socket import threading #from itsdangerous import bytes_to_int class Stream(object): __instance = None __mutex = threading.Lock() def __init__(self, ip="127.0.0.1", port=1313, queue=Queue()): self.IP = ip ...
astra.py
import argparse import base64 import json import requests import time import ast import utils.logger as logger import utils.logs as logs from urllib.parse import urlparse import hashlib import webbrowser import re from core.zapscan import * from core.parsers import * from utils.logger import * from core.login import A...
problem_20_3_synchronize_two_threads.py
from threading import Lock, Thread, Event lock = Lock() event = Event() def is_odd_turn(event_state): return event_state is False def is_even_turn(event_state): return event_state is True def switch_to_even(event_object): event_object.set() def switch_to_odd(event_object): event_object.clear()...
keras_rl.py
# -*- coding: utf-8 -*- import os import sys import gym import numpy as np import random import keras from keras.models import Sequential from keras.layers import Dense, Embedding, LSTM, Bidirectional from keras.optimizers import Adam from collections import deque from src.coreutils_gym_env import CoreutilsEnv, Coreu...
data_provider.py
import Queue import random import threading import numpy __all__ = [ 'DataProvider', 'Disk', 'Batch', ] class DataProvider(object): def get(self, size): raise NotImplemented class Memory(DataProvider): def __init__(self, filename, max_epoch=None, shuffle=False): ...
process_parallel.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2016-10-08 # @Author : Anh Hoang (anhhoang.work.mail@gmail.com) # @Project : FSCognitive # @Version : 1.0 from multiprocessing import Process class ProcessParallel(object): """ To Process the functions parallely """ def __init__(self, *job...
ImageRunSockets_v3_B.py
import argparse import logging import csv from tf_pose import common import cv2 import numpy as np from tf_pose.estimator import TfPoseEstimator from tf_pose.networks import get_graph_path, model_wh import os import threading import subprocess import face_recognition from PIL import Image from struct import unpack imp...
utils.py
# Copyright 2020 Red Hat, 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 ...
browser.py
#!/usr/bin/python3.7 from selenium.webdriver import Firefox,FirefoxProfile from selenium.webdriver.firefox.options import Options from user_agent import generate_user_agent from core.color import * from core.module_utils import * from core import Settings import os, pickle, json, time, threading, functools, traceback ...
test_currentthreadscheduler.py
import pytest import unittest import threading from datetime import timedelta from time import sleep from rx.scheduler import CurrentThreadScheduler from rx.internal.basic import default_now class TestCurrentThreadScheduler(unittest.TestCase): def test_currentthread_singleton(self): scheduler = [ ...
filerapp.py
""" Module implementing simple application for a simple P2P network. """ import sys import threading import random import tkinter as tk from btfiler import * class BTGui(tk.Frame): def __init__(self, serverhost, serverport, firstpeer=None, hops=2, maxpeers=5, master=None): tk.Frame.__init__(self, master)...
_keyhandler.py
import asyncio import string import sys import threading from itertools import chain from precept._tools import is_windows class Key: # pragma: no cover def __init__(self, value, clean=None): self.value = value self.clean = clean def __str__(self): return self.clean or self.value ...
mainwindow.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Spyder, the Scientific Python Development Environment ===================================================== Developed and maintained by the Spyder Proj...
s3.py
from io import BytesIO from threading import Thread from django.conf import settings try: from minio import Minio, S3Error from minio.deleteobjects import DeleteObject from urllib3 import PoolManager except ImportError: # Enforce settings.S3_BUCKET = None _client = None def client(): if not...
test.py
import asyncio import time import re import json import sys import threading from queue import Queue from multiprocessing import Process from pyppeteer.launcher import connect from threading import Thread from lib.RedisUtil import RedisConf,RedisUtils # from bs4 import BeautifulSoup as bs from lib.headlesscrower import...
main.py
import sys import os curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(os.path.split(rootPath)[0]) print(sys.path) from src.analysis.QQZoneAnalysis import QQZoneAnalysis from src.spider.QQZoneSpider import QQZoneSpider from src.util.constant import WEB_SPIDER_INFO...
launcher.py
# Copyright 2022 joetjo https://github.com/joetjo/MarkdownHelper # # 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 requir...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import queue as pyqueue 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 test.support import test.support.script_...
app.py
# coding=utf-8 from __future__ import print_function import inspect import logging import numbers import os import six import sys import threading import time import warnings import numpy as np from os.path import isfile from phi.data.fluidformat import Scene, write_sim_frame from phi import struct from phi.physics.f...
baby-a3c.py
# Baby Advantage Actor-Critic | Sam Greydanus | October 2017 | MIT License from __future__ import print_function import torch, os, gym, time, glob, argparse, sys import numpy as np from scipy.signal import lfilter # from scipy.misc import imresize # preserves single-pixel info _unlike_ img = img[::2,::2] import cv2 i...
slotmachine_GUI.py
import kivy import time import threading from random import randint from kivy.app import App from kivy.base import Builder from kivy.properties import NumericProperty from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.uix.gridlayout import GridLayout from kivy.uix.textinput im...
miniterm.py
#!/usr/bin/python3 # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause import codecs import os import sys import threading import serial from serial.tools.list_ports import ...
wifi_scanner.py
#!/anaconda3/bin/python import socket import re import subprocess, os import platform from ipaddress import ip_network, IPv4Network, IPv4Address, ip_address import time from threading import Lock, Thread from getmac import get_mac_address def scan_network(target_net: IPv4Network): active_hosts = [] # all activ...
MainApplication.py
# Author: Moises Henrique Pereira # this class handle the interface and the dash application (if needed) import sys from PyQt5 import QtWidgets # from Dash.DashApp import dashApp # import threading from .MainApplicationWindow import MainApplicationWindow class MainApplication(): def __init__(self): ...
sigfinder.py
#!/usr/bin/python3 import argparse import concurrent.futures import json import logging import os import socket import subprocess import threading import time import bjoern import falcon import jinja2 import pandas as pd import requests import schedule from prometheus_client import Counter from prometheus_client impor...
bot.py
# -*- coding:utf-8 -*- from utils.logging.logger import logger import os import time import random import traceback from threading import Thread, Timer from beem.comment import Comment from steem.settings import settings from steem.comment import SteemComment from steem.account import SteemAccount from steem.writer ...
sensor_multi.py
""" A MultiSensorDevice represents a single device with multiple sensors. This allows one interface to the device to be written and that device to then expose multiple Sensor objects to the feed. This works by a MultiSensorDevice returning a collection of ChildSensors, starting any of those sensors just passes the com...
ssh_utils.py
#!/usr/bin/env python2 # # Copyright (c) Greenplum Inc 2008. All Rights Reserved. # # This file contains ssh Session class and support functions/classes. import cmd import os import sys import socket import threading from gppylib.commands.base import WorkerPool, REMOTE from gppylib.commands.unix import Hostname, Echo ...
executor.py
import asyncio import logging from threading import Thread import aiojobs from rssant_common.attrdict import AttrDict from .client import ActorClient, AsyncActorClient from .context import ActorContext from .helper import auto_restart_when_crash, unsafe_kill_thread from .message import ActorMessage from .prometheus i...
stratum-miner.py
# Copyright (c) 2019, The Monero Project # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of ...
event.py
# -*- coding: utf-8 -*- ''' tests.integration.modules.event ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` :copyright: © 2012 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. ''' # Import python libs ...
websocket_manager.py
import json import time from threading import Thread, Lock from queue import Queue from typing import Callable from gzip import decompress from websocket import WebSocketApp from confluent_kafka import Producer class WebsocketManager(): _CONNECT_TIMEOUT_S = 5 def __init__(self, url: str, subscribe: Callable, ...
test.py
import os.path as p import random import threading import time import pytest from helpers.cluster import ClickHouseCluster from helpers.test_tools import TSV from helpers.client import QueryRuntimeException import json import subprocess import kafka.errors from kafka import KafkaAdminClient, KafkaProducer, KafkaConsu...
asset_info.py
#!/usr/bin/env python # coding: utf8 ''' @author: qitan @contact: qqing_lai@hotmail.com @file: asset_info.py @time: 2017/3/30 15:33 @desc: ''' from deploy.saltapi import SaltAPI from devops import settings import threading asset_info = [] def GetInfoDict(r, arg): try: result = '' for k in r[arg]:...
test_bio_membuf.py
#!/usr/bin/env python """Unit tests for M2Crypto.BIO.MemoryBuffer. Copyright (c) 2000 Ng Pheng Siong. All rights reserved.""" import os import multiprocessing try: import unittest2 as unittest except ImportError: import unittest from M2Crypto.BIO import MemoryBuffer class TimeLimitExpired(Exception): ...
__init__.py
# -*- coding: utf-8 -*- ''' Set up the Salt integration test suite ''' # Import Python libs from __future__ import print_function import os import re import sys import copy import json import time import errno import signal import shutil import pprint import atexit import logging import tempfile import subprocess imp...
test_state.py
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import os import shutil import sys import tempfile import textwrap import threading import time # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.h...
bot.py
#Twitch chat bot code by Steven Anderson. #Code is written in Python and is still being developed. #If you use this code for a chat bot, please only change the variables that you need to change. #If you want to add/remove commands and do not understand Python, please ask Steven. #Each section of the code should have co...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
unlogger.py
#!/usr/bin/env python3 import argparse import os import sys import zmq import time import signal import multiprocessing from uuid import uuid4 from collections import namedtuple from collections import deque from datetime import datetime from cereal import log as capnp_log from cereal.services import service_list from...
job.py
# Copyright (c) 2019 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...
h2o_cloud.py
import time, os, stat, json, signal, tempfile, shutil, datetime, inspect, threading, getpass import requests, argparse, sys, unittest, glob import urlparse, logging, random import psutil, requests import h2o_sandbox # used in shutil.rmtree permission hack for windows import errno # For checking ports in use, using net...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file license.txt 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 im...
main.py
# -*- coding: utf-8 -*- from gevent import monkey monkey.patch_all() import sys sys.path.append("Src") import time import signal from threading import Thread from Log import LogManager from Web import WebManager from Forward.ForwardManager import ForwardHttp from Manager.ProxyFetch import ProxyFetch from Schedule....
queue_demo.py
''' 使用queue实现生产者-消费者模式 ''' import threading import time import queue # 消费者 def consume(thread_nume, q): while True: time.sleep(2) product = q.get() print('%s consume %s' % (thread_nume, product)) # 任务处理结束后,调用task_done, q.task_done() # 生产者 def produce(thread_name, q): ...
solrjmeter.py
#!/usr/bin/env python """An assistant for measuring MontySolr releases performance. This script will run jmeter, distill performance characteristics and graph them in somewhat meaningful way Here are the assumptions under which we work: - we contact solr over HTTP - the INSTDIR already exists - results are...
linux_adapter.py
import array import fcntl import socket import struct import threading from bleson.core.hci.constants import * from bleson.core.hci.type_converters import AdvertisingDataConverters, parse_hci_event_packet, hex_string from bleson.core.types import Device, BDAddress from bleson.interfaces.adapter import Adapter from ble...
test_tune_restore.py
# coding: utf-8 import signal from collections import Counter import multiprocessing import os import shutil import tempfile import threading import time from typing import List import unittest import ray from ray import tune from ray._private.test_utils import recursive_fnmatch from ray.exceptions import RayTaskError...
pipes.py
import struct import msgpack import threading class RemoteError(Exception): def __init__(self, name, human_msg, human_traceback): Exception.__init__(self) self.name = name self.msg = human_msg self.traceback = human_traceback def __str__(self): return f"{self.name}: {...
midi2cv.py
# midi2cv.py # # https://github.com/schollz/midi2cv # # convert incoming midi signals to a calibrated voltage # # run 'python3 midi2cv.py --tune' to generate a calibraiton # run 'python3 midi2cv.py --play' to listen to midi # import sys import threading import time import os import json import math from subprocess impo...
__init__.py
import re, threading, time, traceback from .DouYu import DouYuDanMuClient from .Panda import PandaDanMuClient from .ZhanQi import ZhanQiDanMuClient from .QuanMin import QuanMinDanMuClient from .Bilibili import BilibiliDanMuClient from .HuoMao import HuoMaoDanMuClient from .log import set_logging from ....
test_base_events.py
"""Tests for base_events.py""" import errno import logging import math import os import socket import sys import threading import time import unittest from unittest import mock import asyncio from asyncio import base_events from asyncio import constants from asyncio import test_utils try: from test import support...
scrape_bittrex.py
# core import os import gc import re import time from datetime import datetime from threading import Thread # installed import pandas as pd import requests import psycopg2 as pg from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT # for writing to sql with pandas from sqlalchemy import create_engine PG_UNAME =...
603_Python_multiprocessingUsingLockAndSharedMemory.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 7 19:21:34 2019 @author: yangyutu123 """ # a good source: https://pymotw.com/2/multiprocessing/basics.html # Here we show how to use Queue to store results from individual processes. import multiprocessing as mp import time # here d is the type ...
detect_video.py
import time import json from absl import app, flags, logging from absl.flags import FLAGS import cv2 import tensorflow as tf from yolov3_tf2.models import ( YoloV3, YoloV3Tiny ) from yolov3_tf2.dataset import transform_images from yolov3_tf2.utils import draw_outputs from centroidtracker import Centroi...
remote.py
# # 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. # import copy import time import torch import torch.multiprocessing as mp from salina import Agent from salina.workspace import Workspace,...
a-lot-of-parallel-tasks.py
#!/usr/bin/env python """ More complex demonstration of what's possible with the progress bar. """ from __future__ import unicode_literals import random import threading import time from prompt_toolkit2 import HTML from prompt_toolkit2.shortcuts import ProgressBar def main(): with ProgressBar( title...
test_issue_701.py
import asyncio import collections import logging import os import threading import time import unittest import pytest from integration_tests.env_variable_names import SLACK_SDK_TEST_CLASSIC_APP_BOT_TOKEN from integration_tests.helpers import async_test, is_not_specified from slack_sdk.rtm import RTMClient from slack_...