source
stringlengths
3
86
python
stringlengths
75
1.04M
server.py
import itertools import numpy import threading import time import notification import commander delay = 1 low_delay = 1 / 24 board = numpy.matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) next_step = lambda x, i, j: x[i, j] isRunning = False def listener(): while True: m = raw_input() # type: str m =...
ImageLoader.py
# -*- coding: utf-8 -*- """ Created on Thu Feb 17 22:43:46 2022 """ import os from PIL import Image from PIL import ImageEnhance import numpy as np import random import threading class ImageLoader: ''' This image loader returns a generator that always load a portion of images from a image directory ...
main_window.py
#!/usr/bin/env python3 # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # 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 with...
x.py
import argparse import asyncio import importlib.util import logging import os import signal import traceback from multiprocessing import get_context from typing import List, Text, Optional, Tuple, Union, Iterable import aiohttp import ruamel.yaml as yaml import rasa.cli.utils as cli_utils import rasa.utils.io as io_u...
observers.py
"""Classes for observers in ``emanate``.""" import logging from threading import Thread from six.moves import queue from pika.exceptions import AMQPError, RecursionError from pikachewie.data import Properties from pikachewie.helpers import broker_from_config from pikachewie.publisher import BlockingJSONPublisher __me...
conftest.py
import pytest import torch from multiprocessing import Process import syft from syft import TorchHook @pytest.fixture() def start_proc(): # pragma: no cover """ helper function for spinning up a websocket participant """ def _start_proc(participant, kwargs): def target(): server = parti...
subproc_vec_env.py
import numpy as np from multiprocessing import Process, Pipe from . import VecEnv, CloudpickleWrapper from baselines.common.tile_images import tile_images def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() try: while True: cmd, data = remo...
utils.py
#!/usr/bin/env python3 # # Electron Cash - lightweight Bitcoin Cash client # Copyright (C) 2012 thomasv@gitorious # # This file is: # Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated document...
ddp.py
# DDP galicaster plugin # # Copyright (c) 2016 University of Sussex # # 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, co...
test_state.py
# -*- coding: utf-8 -*- ''' Tests for the state runner ''' # Import Python Libs from __future__ import absolute_import import errno import os import shutil import signal import tempfile import textwrap import yaml import threading from salt.ext.six.moves import queue # Import Salt Testing Libs from tests.support.case...
cognoclient.py
import cv2 import socket import time import pyaudio from playsound import playsound import wave import uuid from collections import deque import os import threading import RPi.GPIO as GPIO class AudioBuffer(): def __init__(self, dbpath, seconds=3): """ An audiobuffer that keeps the last few seconds...
progress.py
import sys import threading import time from timeit import default_timer from ..callbacks import Callback from ..utils import ignoring def format_time(t): """Format seconds into a human readable form. >>> format_time(10.4) '10.4s' >>> format_time(1000.4) '16min 40.4s' """ m, s = divmod(t...
test_helpers.py
import json import threading import time from django.db import connection from django.test import Client from rest_framework.authtoken.models import Token from rest_framework.test import APIClient from bullet_point.models import BulletPoint from discussion.models import Thread from hub.models import Hub from paper.mo...
client.py
__version__ = '0.0.1' import os.path import re import urlparse import urllib from threading import Thread, RLock import logging logger = logging.getLogger('onvif') logging.basicConfig(level=logging.INFO) logging.getLogger('suds.client').setLevel(logging.CRITICAL) import suds.sudsobject from suds.client import Client...
base.py
import csv import os import time import random as rand from shared import Instance from java.lang import Math import Queue import threading __all__ = ['initialize_instances', 'error_on_data_set', 'train', 'make_dirs', 'f1_score', 'write_to_file'] def printer(): while True: item = printqueue.ge...
utils.py
# XXX should consolidate this with lib import logging from os import path import subprocess import StringIO import hashlib import json import sys import os import stat import time import threading import Queue import urlparse import lib from genshi.template import NewTextTemplate LOG = logging.getLogger(__name__) c...
thorlabs_apt_moving_stage.py
######################################################################## # # This module contains classes for controlling and displying properties # of the APT Thorlabs moving stage # ######################################################################## import multiprocessing from consts import * ##############...
para_example.py
import multiprocessing import numpy as np def worker(i, return_dict): # return_dict[i] = np.random.normal(size=5) return_dict.append(np.random.normal(size=5)) if __name__ == '__main__': manager = multiprocessing.Manager() return_dict = manager.list() jobs = [] for i in range(5): p = mu...
shellController.py
import pyudev import re import subprocess from threading import Thread import sys from subprocess import Popen, PIPE, CalledProcessError class ShellController: def __init__(self): self.udev_context = pyudev.Context() self.local_dir = "/mnt/drive1/pisd_images/" self.usb_mnt_dir = "/media...
thread.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
interactive.py
import asyncio import logging import os import tempfile import textwrap import uuid from functools import partial from multiprocessing import Process from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union import numpy as np from aiohttp import ClientError from colorclass import Color from sanic imp...
TProcessPoolServer.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...
app_tracker.py
#!/usr/bin/env python3 from __future__ import print_function import os import sys import string from papirus import Papirus from PIL import Image from PIL import ImageDraw from PIL import ImageFont from time import sleep import RPi.GPIO as GPIO from datetime import datetime import threaded_get_gps_from_port as tggp i...
tests.py
from __future__ import unicode_literals import threading import warnings from datetime import datetime, timedelta from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections from django.db.models.fields import Field from django.db.m...
log_server.py
#!/usr/bin/env python3 ''' A UDP logging server. Received messages are written to sys.stdout and a file. It exits gracefully on SIGINT (Ctrl+C) signal. Note: it runs only on Python>=3.6. ''' import os import sys import signal import pickle import logging import threading import socketserver LOG_SERVER_HOST = '0.0...
data_io_chunks.py
import itertools import multiprocessing from csv import DictReader, DictWriter from multiprocessing import Queue STOP = 1 def grouper(n, iterable): it = iter(iterable) while True: chunk = tuple(itertools.islice(it, n)) if not chunk: return yield chunk class DataIOChunks:...
main.py
#import required librarys import logging import threading import time #ask the user how many threads to run while True: try: threadAmount = int(input("How many Threads? (1-8): ")) break except: print("Enter a number stupid") #define the number generating thread def thread_function(name...
test_socket.py
import queue import socket import threading import unittest import racetools.errors import racetools.telemetry.pcars.udp as pcars_udp class Socket(pcars_udp.Socket): def __init__(self): self._socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) self._socket.setsockopt(soc...
autoprn1.py
""" Project_name: AUTO PRN PROJECT Author: Rakesh Ranjan Jena Dept: IMS Company: BEST KOKI AUTOMOTIVE PVT. LTD. Start Date:02.03.2021 Implement Date: End Date: DESCRIPTION: This Project is for auto counting of OK NG Parts with Cycle time from each and every Machine. This is IIoT Prject to Monitor Productivity of Machin...
processRecords (3).py
#!/bin/python # -*- coding: utf-8 -*- # $Author: stevedrewe $ # $Date: 2016-12-16 14:34:16 +0000 (Fri, 16 Dec 2016) $ # $URL: http://svn.avox.national/svn/scripts/branches/TAS-544/linux/avoxpdb1/avoxuser/python2/data_ingestion/postToEndpoint.py $ # $Rev: 3107 $ # Standard Modules import random import sys import base...
fit.py
""" This module allows to execute flexible fitting procedures, with full control of the fitting method, variables, calculations and experimental data formats. # TODO - LMFIT library works on serial numerical approximations to obtain a jacobian, however, when the residual function is time expensive, the fitting p...
tcp.py
#!/usr/local/bin/python # coding: latin-1 # Someone is watchin' at the script... Don't worry, it's alright if u dont touch anything :) # - Retr0 """ ▒██ ██▒ █████▒▒█████ ██▀███ █ █░ ▒█████ ██▀███ ██ ▄█▀ ██████ ▒▒ █ █ ▒░▓██ ▒▒██▒ ██▒▓██ ▒ ██▒▓█░ █ ░█░▒██▒ ██▒▓██ ▒ ██▒ ██▄█▒ ▒██ ▒ ░░ █ ...
labutils.py
''' This software was created by United States Government employees at The Center for Cybersecurity and Cyber Operations (C3O) at the Naval Postgraduate School NPS. Please note that within the United States, copyright protection is not available for any works created by United States Government employees, pursuan...
hypothesis_test.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import copy import time from functools import partial, reduce from future.utils import viewitems, viewkeys from hypothesis import assume, given, settings import hypothesis.strategies as st im...
jitrebalance.py
#!/usr/bin/env python3 from math import ceil from pyln.client import Plugin, Millisatoshi, RpcError import binascii import hashlib import secrets import threading import time plugin = Plugin() def get_reverse_chan(scid, chan): for c in plugin.rpc.listchannels(scid)['channels']: if c['channel_flags'] != c...
single_process.py
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from ..args_provider import ArgsProvider import tqdm class SingleProcessRun: def __init__(self): ''' Initi...
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 events from test.test_asyncio import utils a...
bridge.py
#!/usr/bin/env python import sys import time import serial import queue import threading import re from sqlalchemy import * from sqlalchemy.orm import * from ..database import db class Bridge(): def __init__(self, from_hw_queue, device_id, sensors): # self.device = dev...
test_forward.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...
proc.py
#!/usr/bin/python3 -W ignore import os, requests, json, time, datetime, multiprocessing, datetime, subprocess from pprint import pprint #create date wise directories inside json and data directories to hold json dump and minute wise data dirname = datetime.datetime.now().strftime("%d%B") #ex: 27October #create direc...
test_httplib.py
import errno from http import client import io import itertools import os import array import re import socket import threading import warnings import unittest TestCase = unittest.TestCase from test import support from test.support import socket_helper here = os.path.dirname(__file__) # Self-signed cert file for 'lo...
newthreadscheduler.py
import logging import threading from .scheduler import Scheduler from .eventloopscheduler import EventLoopScheduler log = logging.getLogger('Rx') class NewThreadScheduler(Scheduler): """Creates an object that schedules each unit of work on a separate thread. """ def __init__(self, thread_factory=None):...
executor.py
"""Driver of the test execution framework.""" from __future__ import absolute_import import threading import time from . import fixtures from . import hook_test_archival as archival from . import hooks as _hooks from . import job as _job from . import report as _report from . import testcases from .. import config a...
main.py
from json.decoder import JSONDecodeError import discum_c844aef import time import multiprocessing import random import re import os from functools import cache from discum_c844aef.discum import Client if os.name == 'posix': import simplejson as json if os.name == 'nt': import json if os.name != 'nt' and 'posix': ...
server3.py
################################################################################ # # 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 ...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
events.py
import json import time import sseclient import threading import queue from . import curves, util from builtins import str class EventListener: def __init__(self, session, curve_list, start_time=None, timeout=None): self.curve_cache = {} ids = [] if not hasattr(curve_list, '__iter__') or...
dummy_joint_state_controller.py
#!/usr/bin/env python # Copyright (c) 2014, Kei Okada # 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 ...
__init__.py
"""Websocket API. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import collections import errno import fnmatch import glob import heapq import io import json import logging import os import re import sqlite3 imp...
dualkarsten.py
#!/usr/bin/python3 import os, sys import platform import humanize import psutil import requests import time #import threading #from threading import Thread from multiprocessing import Process #imports for Fritz.Box from fritzconnection.lib.fritzstatus import FritzStatus from fritzconnection.lib.fritzhosts import Frit...
test_responses.py
# -*- coding: utf-8 -*- import multiprocessing import os from unittest import TestCase import uvicorn from fastapi import FastAPI from fastapi.testclient import TestClient from projects.api.main import app, parse_args from projects.controllers.utils import uuid_alpha from projects.database import engine TEST_CLIENT ...
login.py
import os, time, re, io import threading import json, xml.dom.minidom import random import traceback, logging try: from httplib import BadStatusLine except ImportError: from http.client import BadStatusLine import requests from pyqrcode import QRCode from .. import config, utils from ..returnvalues import Ret...
PySplunkWhisperer2_remote.py
import sys, os, tempfile, shutil import tarfile import requests import SocketServer from SimpleHTTPServer import SimpleHTTPRequestHandler import argparse import threading requests.packages.urllib3.disable_warnings(category=requests.packages.urllib3.exceptions.InsecureRequestWarning) SPLUNK_APP_NAME = '_PWN_APP_' de...
serverAudio.py
from socket import socket, AF_INET, SOCK_STREAM from threading import Thread HOST = input("Enter Host IP\n") PORT = 4000 BufferSize = 4096 addresses = {} def Connections(): while True: try: client, addr = server.accept() print("{} is connected!!".format(addr)) ...
FuzzingInTheLarge.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # "Fuzzing in the Large" - a chapter of "The Fuzzing Book" # Web site: https://www.fuzzingbook.org/html/FuzzingInTheLarge.html # Last change: 2021-11-03 13:27:49+01:00 # # Copyright (c) 2021 CISPA Helmholtz Center for Information Security # Copyright (c) 2018-2020 Saarlan...
test_threading.py
# Very rudimentary test of threading module import test.support from test.support import verbose import random import re import sys import threading import _thread import time import unittest import weakref # A trivial mutable counter. class Counter(object): def __init__(self): self.value = 0 def inc(...
worker.py
import abc from copy import copy from dataclasses import dataclass, field import functools import multiprocessing from multiprocessing import synchronize import threading import time import typing as tp import stopit from pypeln import utils as pypeln_utils from . import utils from .queue import IterableQueue, Outpu...
main.py
from flask import render_template from flask import Flask from flask import request from pyowm.owm import OWM import requests import time import sched import datetime from uk_covid19 import Cov19API import threading import pyttsx3 import json import os app= Flask(__name__,template_folder='template') @app.route...
miniterm.py
#!/Users/pmorvay/Documents/Cisco/Devnet/nornir/venv/bin/python3.7 # # 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 imp...
light_reaper.py
# Copyright 2016-2018 CERN for the benefit of the ATLAS collaboration. # # 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...
train.py
#!/usr/bin/env python """Train models.""" import os import signal import torch import onmt.opts as opts import onmt.utils.distributed from onmt.utils.misc import set_random_seed from onmt.utils.logging import init_logger, logger from onmt.train_single import main as single_main from onmt.utils.parse import ArgumentPa...
test_util.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
test_worker.py
# -*- encoding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the ...
version.py
import subprocess import sys import logging import re import threading import time import os import requests logger = logging.getLogger(__name__) class VersionChecker: def __init__(self, name="cryptoadvance.specter"): self.name = name self.current = "unknown" self.latest = "unknown" ...
server.py
# Python 3.7 # Usage: python3 server.py server_port block_duration timeout # coding: utf-8 import sys from socket import * from datetime import datetime from threading import Timer, Condition, Thread from helper import retrieve_components, decorate_chat_msg, is_existing_user, username2password server_port = int(sys....
performance_metrics.py
from os import environ import psutil, threading, hashlib environ["PYTHONHASHSEED"] = '1234' def ratio(before, after): return 100 * (1 - (after / before)) # def integrity(before, after): # md5_before = None # md5_after = None # # Open,close, read file and calculate MD5 on its contents # with open(be...
experiments.py
from bokeh.io import export_png, output_file, show def _get_return(function, x, y, return_var): return_var.append(function(x, elapsed_time=y)) from tnetwork.DCD.analytics.dynamic_partition import * from nf1 import NF1 from sklearn.metrics import adjusted_rand_score,normalized_mutual_info_score import pandas as p...
NgentodFb.py
# -*- coding: utf-8 -*- import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize from multiprocessing.pool import ThreadPool try: import mechanize except ImportError: os.system('pip2 install mechanize') else: try: import requests except ImportEr...
net09_web_PWB4.py
"""PWB4.0 多进程静态web服务器""" ''' @Time : 2018/1/24 下午3:04 @Author : scrappy_zhang @File : net09_web_PWB4.py ''' import socket import re import multiprocessing SERVER_ADDR = (HOST, PORT) = '', 8888 # 服务器地址 VERSION = 4.0 # web服务器版本号 STATIC_PATH = './static/' class HTTPServer(): def __init__(self, server_addr...
test-socket.py
from threading import Thread from socketIO_client_nexus import SocketIO, LoggingNamespace def receive_events_thread(): socketIO.wait() def shit(*args): print args socketIO = SocketIO('http://192.168.43.168', 5001) camera_namespace = socketIO.define(LoggingNamespace, '/rekathon') camera_namespace.on('back...
engine.py
""" Main BZT classes Copyright 2015 BlazeMeter 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...
pool.py
import logging import os import random import sys import traceback from uuid import uuid4 import collections from multiprocessing import Process from multiprocessing import Queue as MPQueue from queue import Full as QueueFull, Empty as QueueEmpty from django.conf import settings from django.db import connection as dj...
Color_map.py
from Genetica import Genetica import numpy as np import random import matplotlib.pyplot as plt import threading import math class Color_map(Genetica): def __init__(self,prob_cruza=0.8,prob_mut=0.5,porcentaje_elite=0.1,poblacion=50,generaciones=100, fitness_min = 0.9,tam_x=8,tam_y=8): Genetica.__init__(self...
main.py
#!/usr/bin/env python from multiprocessing import Process import os from flask import Flask, jsonify, make_response from neomodel import config as neoconfig import yaml import unlocked import data import imports from common.model import Achievement, Game, Player, to_dict # create a new Flask object app = Flask(__...
threadJoin.py
import threading import time def ourThread(i): print("Thread {} Started".format(i)) time.sleep(i*2) print("Thread {} Finished".format(i)) def main(): thread = threading.Thread(target=ourThread, args=(1,)) thread.start() print("Is thread 1 Finished?") thread2 = threading.Thread(target=ourThread, args=(...
frame_server_impl.py
from ...config import config from ...scene import scene from ..gen import frameserver_pb2 from ..gen import frameserver_pb2_grpc from ..gen import renderserver_pb2 from ..gen import renderserver_pb2_grpc from concurrent import futures from google.protobuf import json_format from watchdog.events import LoggingEventHandl...
app.py
""" A REST API for Salt =================== .. py:currentmodule:: salt.netapi.rest_cherrypy.app .. note:: This module is Experimental on Windows platforms and supports limited configurations: - doesn't support PAM authentication (i.e. external_auth: auto) - doesn't support SSL (i.e. disable_ssl: Tru...
crawler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import calendar import datetime import json import logging import math import re import ssl import threading import urllib.request import urllib.parse from time import sleep, time from queue import Queue import requests from geopy import Point from geopy.distance import v...
train.py
# -------------------------------------------------------- # FCN # Copyright (c) 2016 RSE at UW # Licensed under The MIT License [see LICENSE for details] # Written by Yu Xiang # -------------------------------------------------------- """Train a FCN""" from fcn.config import cfg from gt_data_layer.layer import GtDat...
client.py
# -*-coding:utf-8-*- # Copyright (c) 2020 DJI. # # 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 in the file LICENSE.txt or at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
pre_commit_linter.py
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
dynamic.py
# encoding: utf-8 import atexit import threading import weakref import sys import math from functools import partial from marrow.mailer.manager.futures import worker from marrow.mailer.manager.util import TransportPool try: import queue except ImportError: import Queue as queue try: from concurrent imp...
hypervisor.py
""" HV (main, interactive commands) <-> IO, source code, nvm directives NVM (network, encoding, build tools) <-> network state, viz directives VIZ (viz) """ import sys, time import multiprocessing as mp import nvm class NotRunningError(Exception): pass class Hypervisor: def startup(self, period=1): se...
task.py
import logging import threading from abc import ABC, abstractmethod from ray.streaming.collector import OutputCollector from ray.streaming.config import Config from ray.streaming.context import RuntimeContextImpl from ray.streaming.runtime import serialization from ray.streaming.runtime.serialization import \ Pyth...
app_tests.py
import urllib2 import subprocess import unittest import os import signal import sys from threading import Thread from unittest import skip import requests from time import sleep import logging import shutil import xmlrunner sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from openport.services import ...
withdraw.py
import queue import threading import time rateLimit = [] rateLimitQueue = queue.Queue() def cooldown_add(user, cooldown_amount=86400): rateLimitQueue.put((user, time.time()+cooldown_amount)) rateLimit.append(user) def deleteLimit(): while True: if rateLimitQueue.empty == True: time.sleep...
os_interaction_tests.py
__author__ = 'jan' import os import sys import logging import threading sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import unittest import xmlrunner from services.osinteraction import OsInteraction, getInstance, is_windows import subprocess from time import sleep from services.logger_service import...
simulation.py
import argparse import emulation.GTAEventsReader import time import os import subprocess import sys from threading import Thread from threading import Lock from decimal import Decimal from common.constants import init_logger import logging SLAVE_NODE_SERVER_NAME_PREFIX = "slave_" MASTER_NODE_SERVER_NAME = "master_nod...
engine.py
"""""" import importlib import os import traceback from collections import defaultdict from pathlib import Path from typing import Any, Callable from datetime import datetime, timedelta from threading import Thread, Lock from queue import Queue from copy import copy from vnpy.event import Event, EventEngine, EVENT_TI...
main.py
import logging.config import logging.handlers import threading from typing import List import requests from flask import request from pubsub import pub from oet.event import topics from oet.mptools import ( EventMessage, MainContext, MPQueue, QueueProcWorker, default_signal_handler, init_signa...
microphone.py
""" ReSpeaker Python Library Copyright (c) 2016 Seeed Technology Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by a...
manager.py
import time from queue import Queue from threading import Thread, Lock from mivp_agent.const import KEY_ID from mivp_agent.const import KEY_EPISODE_MGR_REPORT, KEY_EPISODE_MGR_STATE from mivp_agent.bridge import ModelBridgeServer from mivp_agent.util.validate import validateAction from mivp_agent.util.parse import par...
tensorrec.py
import logging import numpy as np import os,sys import pickle import time import tensorflow as tf import threading, thread import multiprocessing import itertools from .errors import ( TfVersionException ) from .input_utils import create_tensorrec_iterator, get_dimensions_from_tensorrec_dataset from .loss_graphs i...
zktransaction.py
#!/usr/bin/python """ Distributed id and lock service for transaction support. """ import logging import re import sys import threading import time import urllib import kazoo.client import kazoo.exceptions class ZKTimeoutException(Exception): """ A special Exception class that should be thrown if a function is t...
pydoc.py
#!/usr/bin/env python # -*- coding: latin-1 -*- """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 "pydo...
test_nanny.py
import asyncio from contextlib import suppress import gc import logging import os import random import sys import multiprocessing as mp import numpy as np import pytest from tlz import valmap, first from tornado.ioloop import IOLoop import dask from distributed.diagnostics import SchedulerPlugin from distributed imp...
player.py
""" The MIT License (MIT) Copyright (c) 2015-present Rapptz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merg...
blockchain_processor.py
#!/usr/bin/env python # Copyright(C) 2011-2016 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 without limitation the rights to use, copy, ...
intercom-kun.py
#!/usr/bin/env python3 import cv2 import numpy as np import mod.snowboydecoder as snowboydecoder import sys import os import subprocess import uuid import logging import threading import requests import json import aiy.audio import aiy.cloudspeech import aiy.voicehat import aiy.i18n import mod.detect_intent_texts...
command.py
# Copyright (c) 2016-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import enum import json import logging import os import re import resource import signal import subprocess import threading from ab...