source
stringlengths
3
86
python
stringlengths
75
1.04M
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...
30_3_multithread_rlock.py
from threading import Thread num = 0 def do_sth(): global num for i in range(1000000): num += 1 adda() addb() def adda(): global num num += 1 def addb(): global num num += 1 t1 = Thread(target=do_sth) t2 = Thread(target=do_sth) t1.start() t2.start() t1.join() t2.join()...
test_sliprequesthandler.py
# Copyright (c) 2017 Ruud de Jong # This file is part of the SlipLib project which is released under the MIT license. # See https://github.com/rhjdjong/SlipLib for details. import pytest import socket import socketserver import threading from sliplib import SlipRequestHandler, SlipSocket, END class DummySlipReques...
server.py
import logging import multiprocessing as mp import os import signal import socket import socketserver import threading import time from IPy import IP from daemon.daemon import change_process_owner from setproctitle import setproctitle from irrd import ENV_MAIN_PROCESS_PID from irrd.conf import get_setting from irrd.s...
connector_common.py
from markov_engine import MarkovTrieDb, MarkovFilters, MarkovGenerator from models.structure import StructureModelScheduler from common.nlp import CapitalizationMode from typing import Optional, List from multiprocessing import Process, Queue, Event from threading import Thread from queue import Empty from spacy.tokens...
onnxruntime_test_python.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -*- coding: UTF-8 -*- import unittest import os import numpy as np import onnxruntime as onnxrt import threading class TestInferenceSession(unittest.TestCase): def get_name(self, name): if os.path.exists(name...
run_dqn_ram.py
import argparse import gym from gym import wrappers import os.path as osp import random import numpy as np import tensorflow as tf import tensorflow.contrib.layers as layers from multiprocessing import Process from tensorflow.python import debug as tf_debug import dqn from dqn_utils import * from atari_wrappers import...
main.py
try: from dotenv import load_dotenv load_dotenv() except: pass from db import * from twitch import * from tt import * from utils import * import sys import time import schedule import threading def main(): # Variável que controla se o houve # modificações no dados do streamer modified = Fa...
sense_hat.py
# Copyright (c) 2018 Chen-Ting Chuang # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, di...
test_cuda.py
from itertools import repeat, chain, product from typing import NamedTuple import collections import contextlib import ctypes import gc import io import pickle import queue import sys import tempfile import threading import unittest import torch import torch.cuda import torch.cuda.comm as comm from torch.nn.parallel i...
swhear.py
""" The core SWHEar class for continuously monitoring microphone data. The Ear class is the primary method used to access microphone data. It has extra routines to audomatically detec/test sound card, channel, and rate combinations to maximize likelyhood of finding one that works on your system (all without requiring ...
manager.py
#!/usr/bin/env python3 import datetime import importlib import os import sys import fcntl import errno import signal import shutil import subprocess import textwrap import time import traceback from multiprocessing import Process from typing import Dict, List from common.basedir import BASEDIR from common.spinner imp...
stream_chart.py
#!/usr/bin/env python '''Show streaming graph of stock.''' from jinja2 import Template from flask import Flask, jsonify from six.moves.urllib.request import urlopen from six.moves.urllib.parse import urlencode from collections import deque from threading import Thread from time import time, sleep import csv import co...
ex2.py
import threading magic_number = 0 mutex = threading.Lock() def reverse(num): nr = 0 while num > 0: nr = nr*10 + (num % 10) num = int (num / 10 ) return nr def find_magic_number(min, max): global magic_number for i in range (min, max): rev = reverse(i) if rev == i...
test_worker.py
import json import logging import time import threading from multiprocessing import Queue try: from queue import Empty except ImportError: from Queue import Empty import boto3 from moto import mock_sqs from mock import patch, Mock from pyqs.worker import ( ManagerWorker, ReadWorker, ProcessWorker, BaseWor...
main.py
import os import threading import queue import time NO_LIGHTS = 0 NORMAL_LIGHTS = 1 FAIL_LIGHTS = 2 SUCCSSS_LIGHTS = 3 CONFETTI_LIGHTS = 4 q = queue.Queue() # Team 1 audioFiles = [ '', 'audio/intro.mp3', 'audio/seeThru.mp3', 'audio/vhs.mp3', 'audio/comet.mp3', 'audio/smell.mp3', 'audio/2Attempts.mp3', 'audio/1Attemp...
crawler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import calendar import datetime import geopy import geopy.distance import json import logging import math import os import requests import ssl import threading import urllib.request import urllib.parse from geopy.distance import vincenty from geopy.distance import Vincent...
devops_manager.py
#!/usr/bin/env python # title :devops_manager.py # description :Creating a DevOps like on Solaris # author :Eli Kleinman # release date :20181018 # update date :20191127 # version :0.9.0 # usage :python devops_manager.py # notes : # python_version :2.7.14 # ===...
iterators.py
import random import numpy as np import functools import Queue from itertools import izip def iterate_batches(data, batch_size, shuffle=False, fill_last=True, max_iter=None): """ Generates mini-batches from data. Parameters ---------- data : Indexable Data to generate ...
APC_client.py
import Pyro4 import threading import logging class DSS43K2Client(object): """ Simple DSS43K2Client that registers callbacks. Can only be used locally, not over ssh connection. """ def __init__(self, ns_host='localhost', ns_port=9090): self.logger = logging.getLogger(__name__) ns = P...
test_pika.py
# (c) Copyright IBM Corp. 2021 # (c) Copyright Instana Inc. 2021 from __future__ import absolute_import import os import pika import unittest import mock import threading import time from ..helpers import testenv from instana.singletons import tracer class _TestPika(unittest.TestCase): @staticmethod @mock....
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
dxl_reacher.py
# Copyright (c) 2018, The SenseAct Authors. # 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. import sys import time import copy import numpy as np import pickle as pkl import baselines.common.tf_util as U from bas...
wikimonitor.py
# Copyright 2021 Ringgaard Research ApS # # 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...
benchmark_ft.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Aug 29 09:59:18 2018 @author: saad """ import expLib as exp import multiprocessing import scsLib as scs import BenchParser as benp import os from datetime import datetime import BenchScs as ben import time ############################# Benchmark vars ...
check_projects.py
#!/usr/bin/env python # Copyright 2016 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
__init__.py
# # This file is part of the FFEA simulation package # # Copyright (c) by the Theory and Development FFEA teams, # as they appear in the README.md file. # # FFEA 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 ...
env_wrapper.py
""" Modified from OpenAI Baselines code to work with multi-agent envs """ from multiprocessing import Process, Pipe from typing import Optional, List, Union, Sequence, Type, Any import gym import numpy as np from stable_baselines3.common.vec_env import VecEnv, CloudpickleWrapper from stable_baselines3.common.vec_env.b...
test_cgo_engine.py
import os import threading import unittest import time import torch import torch.nn as nn from pytorch_lightning.utilities.seed import seed_everything from pathlib import Path import nni import nni.runtime.platform.test try: from nni.common.device import GPUDevice from nni.retiarii.execution.cgo_engine impor...
plot_server.py
from typing import Dict, Union, Tuple, Iterable, Callable, NoReturn, Optional, List, Sequence import geopandas as gpd import joblib as jl import numpy as np import shapely.geometry as sg from holoviews import Overlay, Element from holoviews.element import Geometry from seedpod_ground_risk.core.utils import make_bound...
utils.py
#!/usr/bin/env python """ mbed SDK Copyright (c) 2011-2021 ARM 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 applicable ...
layers.py
import math import torch import numpy as np import time import threading import concurrent.futures from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(se...
threads.py
import logging import socket from os import kill import signal from multiprocessing import Process, Queue from subprocess import Popen, STDOUT, PIPE from PyQt5.QtCore import QThread, pyqtSignal, pyqtSlot, QProcess, QObject from wifipumpkin3.core.packets.dhcpserver import DHCPProtocol from wifipumpkin3.core.utility.prin...
utils.py
import threading import numpy as np import jesse.helpers as jh from jesse.services import logger def store_candle_into_db(exchange: str, symbol: str, candle: np.ndarray, on_conflict='ignore') -> None: from jesse.models.Candle import Candle d = { 'id': jh.generate_unique_id(), 'symbol': symbo...
server.py
""" author: Noe Vasquez Godinez date: 24 - 05 - 2020 email: noe-x@outlook.com web: noevg.github.io about: This software create a TCP server to working communication between various clients, use threading to handle varios clients. -This software is necesary install from pip: -> pip install pyfiglet ...
tk_canvas.py
"""Neovim TKinter UI.""" # EXAMPLE FROM TATRRUIDA import sys from Tkinter import Canvas, Tk from collections import deque from threading import Thread # import StringIO, cProfile, pstats from neovim import attach from tkFont import Font SPECIAL_KEYS = { 'Escape': 'Esc', 'Return': 'CR', 'BackSpace': 'BS',...
function_exec_manager.py
#!/usr/bin/env python3 """ Imagine you have to run multiple functions within a deadline. Running them sequentially will be the easiest thing to do, but if one of them behaves badly and takes too much time, we are in trouble... This code, instead of runing functions sequentially, we run them all on separate threads in...
copy.py
# coding: utf-8 # Copyright 2013 The Font Bakery 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 re...
modbus2bridge.py
#!/usr/bin/python import binascii import struct import sys from threading import Thread, Lock import time import traceback from pyModbusTCP.client import ModbusClient from pyModbusTCP import utils import serial # some const SERVER_HOST = "192.168.1.99" SERVER_PORT = 502 # set vars th_lock = Lock() ts = 0 tm_1 = 0.0 ...
Venus-c.py
''' @desc:内网穿透客户端入口 @author: Martin Huang @time: created on 2019/6/21 16:34 @修改记录: 2019/07/12 => 优化输出 ''' import json from Utils.IOUtils import IOUtils from InternalMain import * #pycharm # from src.main.Utils.IOUtils import * # from src.main.InternalMain import * import multiprocessing if __name__ == '__main__': ...
run_enso.py
#! /usr/bin/env python import os import sys import time import threading import logging import pythoncom import win32gui import win32con from win32com.shell import shell, shellcon import enso from enso.messages import displayMessage from enso.platform.win32.taskbar import SysTrayIcon from optparse import OptionParser...
t_tcp.py
import socket import threading import time class Users(object): """docstring for Users""" def __init__(self, name, skt): self.name = name self.skt = skt def sendmsg(self, msg): self.skt.send(msg) def logout(self): self.skt.close() def tcplink(usr, addr): print ...
evaluators.py
import os import sys from threading import Thread from pyelectro import analysis import numpy import math import pprint pp = pprint.PrettyPrinter(indent=4) def alpha_normalised_cost_function(value,target,base=10): """Fitness of a value-target pair from 0 to 1 .. WARNING: I've found that this cost fu...
event_source.py
# -*- coding: utf-8 -*- # # Copyright 2017 Ricequant, 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 ...
edgetpu.py
import os import datetime import hashlib import multiprocessing as mp import numpy as np import pyarrow.plasma as plasma import tflite_runtime.interpreter as tflite from tflite_runtime.interpreter import load_delegate from frigate.util import EventsPerSecond, listen def load_labels(path, encoding='utf-8'): """Loads ...
ProcessSignal.py
import signal from threading import Lock, Thread from time import sleep import threading import pyzed.sl as sl import time import cv2 import numpy as np import imutils def load_image_into_numpy_array(image): ar = image.get_data() ar = ar[:, :, 0:3] (im_height, im_width, channels) = image.get_data().shape ...
api.py
from threading import Thread from flask import Flask, render_template, request, redirect, render_template_string import sys import os os.chdir(".") import src from src.plot import worker, get_script from src.database import Database, ReadException from src.outlier import OutlierDetector from src.plot import Plot ...
helpers.py
# -*- coding: utf-8 -*- ''' :copyright: © 2013-2017 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. tests.support.helpers ~~~~~~~~~~~~~~~~~~~~~ Test support helpers ''' # pylint: disable=repr-flag-used-in-string,wrong-import-order # Import...
index.py
from flask import Flask, render_template, request, session, redirect, url_for, flash from flask_mail import Mail, Message from threading import Thread from werkzeug.security import generate_password_hash, check_password_hash import sys app = Flask(__name__, template_folder='template') app.secret_key = "7|-|353(.-37|<...
test_worker.py
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import os import shutil import signal import subprocess import sys import time import zlib from datetime import datetime, timedelta from multiprocessing import Process from time import ...
process.py
"""System process utilities module.""" import time import signal import psutil import warnings import subprocess import platform import threading import functools from .timing import exponential_interval def _log_proc(msg, warn=False, output=None): if output is not None: try: output.write('...
config_viosl2.py
#!/usr/bin/env python3 # scripts/config_viosl2.py # # Import/Export script for vIOS. # # @author Andrea Dainese <andrea.dainese@gmail.com> # @copyright 2014-2016 Andrea Dainese # @license BSD-3-Clause https://github.com/dainok/unetlab/blob/master/LICENSE # @link http://www.unetlab.com/ # @version 20160719 import geto...
setup.py
import logging import os import shutil import threading from dredge_logger.gui import LogGUI __author__ = "Luke Eltiste" __copyright__ = "Luke Eltiste" __license__ = "MIT" _logger = logging.getLogger(__name__) def initialize(): from dredge_logger.config import config _logger.info("Initializing") desk...
test_create_organization.py
#!/usr/bin/python # Copyright 2017 Northern.tech AS # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
optimize_multiple_thresholds_compensation.py
import EncoderFactory from DatasetManager import DatasetManager import pandas as pd import numpy as np from sklearn.metrics import roc_auc_score from sklearn.pipeline import FeatureUnion import time import os import sys from sys import argv import pickle import csv from hyperopt import Trials, STATUS_OK, tpe, fmin,...
config.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Kvirt config class """ import base64 from datetime import datetime from fnmatch import fnmatch from jinja2 import Environment, FileSystemLoader from jinja2 import StrictUndefined as undefined from jinja2.exceptions import TemplateSyntaxError, TemplateError, TemplateNot...
mininet_tests.py
#!/usr/bin/env python3 """Mininet tests for FAUCET.""" # pylint: disable=too-many-lines # pylint: disable=missing-docstring # pylint: disable=too-many-arguments # pylint: disable=unbalanced-tuple-unpacking import binascii import collections import copy import itertools import ipaddress import json import os import r...
log_setup.py
""" This module is used to set up and manipulate the ``logging`` configuration for utilities like debug mode. Functionality overview ====================== By way of :class:`hutch_python.ipython_log.IPythonLogger`, log the following to ``{{LOG_DIR}}/year_month/user_timestamp.log``: * All IPython input * Any DEBUG me...
checker.py
import sys import time import threading def worker(): t = time.time() stay = True while(stay): if time.time() - t > 2.0: print "Tick %s" % t t = time.time() t = threading.Thread(target=worker) t.daemon = True t.start() stay = True while(stay): line = sys.stdin.readline().strip() if line == "": con...
save_file_dialog.py
import webview import threading """ This example demonstrates creating a save file dialog. """ def save_file_dialog(): import time time.sleep(5) print(webview.create_file_dialog(webview.SAVE_DIALOG, directory="/", save_filename='te...
build_pmfx.py
import os import sys import json import jsn import re import math import subprocess import platform import copy import threading import cgu import hashlib # paths and info for current build environment class BuildInfo: shader_platform = "" # hlsl, glsl, metal, spir-v...
base_events.py
"""Base implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a c...
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...
test_pytest_cov.py
import collections import glob import os import platform import re import subprocess import sys from itertools import chain import coverage import py import pytest import virtualenv import xdist from fields import Namespace from process_tests import TestProcess as _TestProcess from process_tests import dump_on_error f...
main_controller.py
import obs,parenty,socket_controller,threading def callObs(): obs.main() socket_controller.init_comm_file() t = threading.Thread(target = callObs, args=()) t.start()
alum_ase.py
# Universidad Nacional Autonoma de Mexico # Facultad de Ingenieria # Sistemas Operativos # # Desarrollador: # Hernandez Campuzano Ivan # Profesor: # Gunnar Wolf # Descripcion: # Este programa solo s...
remove.py
# -*- coding: utf-8 -*- # FLEDGE_BEGIN # See: http://fledge-iot.readthedocs.io/ # FLEDGE_END import aiohttp import platform import os import logging import json import asyncio import uuid import multiprocessing from aiohttp import web from fledge.common import logger from fledge.common.plugin_discovery import Plugin...
asyn.py
import asyncio import functools import inspect import re import sys import threading from .utils import other_paths from .spec import AbstractFileSystem # this global variable holds whether this thread is running async or not thread_state = threading.local() private = re.compile("_[^_]") def sync(loop, func, *args,...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import (verbose, import_module, cpython_only, requires_type_collecting) from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys import _thread import threading import...
ws.py
#!/usr/bin/env python3 # requires https://pypi.python.org/pypi/websocket-client/ from excepthook import uncaught_exception, install_thread_excepthook import sys sys.excepthook = uncaught_exception install_thread_excepthook() # !! Important! Be careful when adding code/imports before this point. # Our except hook is i...
__main__.py
import yaml import json import socket import argparse import logging import datetime import threading import queue from log import log_config from settings import ( HOST, PORT, BUFFERSIZE, ENCODING, ) host = HOST port = PORT buffersize = BUFFERSIZE encoding = ENCODING parser = argparse.ArgumentParser() parser.a...
tests.py
from __future__ import absolute_import, unicode_literals from datetime import datetime import threading from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError from django.db import connections, DEFAULT_DB_ALIAS from django.db.models.fields import Field, FieldDoesNotExist from djang...
C_1_Post_processing_log_new.py
import pandas as pd import numpy as np import ftfy import math from tqdm import tqdm from multiprocessing import Process def infer_ite_no_swype_case_sensitive(log_process, row): log_process = log_process.copy() thresholds_autocorr = [273,280,396,281,295,293,297,282,276,269,255,245,227,239,225,228,208,205,200,...
searcher.py
import multiprocessing import pickle import itertools import time import sys import copy from IPython.display import clear_output class GridSearcher: """ To Test model performance under different parameters configurations. This class must be used in the top level context or it would lose effect. """ ...
monitor.py
#!/usr/bin/env python3 import socket import sys import threading import mmonitor threading.Thread( target=mmonitor.Console).start() porta = int(input('Porta para ouvir sensores: ')) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) mmonitor.SOCKETUDP = s try: s.bind(('', porta)) except: print('# erro de b...
test_timeline_writer.py
# Standard Library import calendar import json import multiprocessing as mp import os import time from datetime import datetime from pathlib import Path # Third Party import pytest # First Party from smdebug.core.tfevent.timeline_file_writer import TimelineFileWriter from smdebug.profiler.profiler_config_parser impor...
app.py
#!/usr/bin/env python from importlib import import_module import os from flask import Flask, render_template, Response, send_from_directory from flask_cors import * # import camera driver from camera_opencv import Camera from camera_opencv import commandAct import threading # Raspberry Pi camera module (requires pica...
make.py
import os import glob import time import shutil import bpy import json import stat from bpy.props import * import subprocess import threading import webbrowser import arm.utils import arm.write_data as write_data import arm.make_logic as make_logic import arm.make_renderpath as make_renderpath import arm.make_world as ...
check_oracle.py
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys import string import time import datetime from subprocess import Popen, PIPE import MySQLdb import cx_Oracle import logging import logging.config logging.config.fileConfig("etc/logger.ini") logger = logging.getLogger("check_oracle") path='./include' sys.pat...
LucasExpress.py
import requests import threading from winsound import Beep from random import randint def req(d): r = requests.post("http://{}/{}".format(target, d)) status = r.status_code if status != 404: # print(f"\tpath=\"{d}\"\t{status=}") print(f"\t{status=}") def run(): with op...
MultiV1.py
import logging import threading import time result_T1=['vide',0,0,0] result_T2=['vide',0,0,0] result_T3=['vide',0,0,0] result_T4=['vide',0,0,0] def thread_function1(name): global result_T1 local_result_T1 = result_T1 logging.info("Thread %s: starting", name) for i in range (0,10000): for j in...
serial_comm.py
#!/usr/bin/python3 """ This file handle serial read and write Developed by - SB Components http://sb-components.co.uk """ import serial import logging import threading class SerialComm(object): """ Low level serial operations """ log = logging.getLogger("Fingerprint") log.addHandler(logging.Str...
calltop.py
#!/usr/bin/env python3 # Copyright 2019 Emilien GOBILLOT # # 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 l...
test_multiproc.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root # for license information. from __future__ import absolute_import, division, print_function, unicode_literals import psutil import pytest import sys import debugpy import tests from tests imp...
grpc.py
""" Utilities for running GRPC services: compile protobuf, patch legacy versions, etc """ from __future__ import annotations import os import threading from typing import NamedTuple, Tuple, Optional, Union, Any, Dict, TypeVar, Type, Iterator, Iterable import grpc from hivemind.proto import runtime_pb2 from hivemind...
server_fixtures.py
import asyncio import os import socket from multiprocessing import Process from time import sleep import pytest import uvicorn from hypercorn.asyncio import serve as hypercorn_serve from hypercorn.run import Config as HypercornConfig from .app_1 import app from .app_2 import app_2 from .app_3 import app_3 from .app_4...
ingest-multiWithSameSetOfTenantIDsAndMetricNames.py
#!/usr/bin/env python # Licensed to Rackspace under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # Rackspace licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use thi...
test_bentomaker.py
import os import sys import tempfile import shutil import os.path as op import mock import multiprocessing from bento.compat.api.moves \ import \ unittest from bento.core.node \ import \ create_base_nodes from bento.utils.utils \ import \ extract_exception from bento.commands.cont...
test_program.py
#!/usr/bin/env python3 """ Copyright 2018 Nordnet Bank AB Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
pdbutils.py
import datetime import queue from threading import Thread from panopuppet.pano.puppetdb import puppetdb class UTC(datetime.tzinfo): """UTC""" def utcoffset(self, dt): return datetime.timedelta(0) def tzname(self, dt): return str('UTC') def dst(self, dt): return datetime.ti...
AlienClient.py
import sys import six import time import socket import threading import random import datetime from MainWin import HeartbeatPort, NotifyPort from Utils import readDelimitedData from AutoDetect import GetDefaultHost DEFAULT_HOST = GetDefaultHost() from xml.dom.minidom import parseString CmdPort = 53161 testTags = ''...
ticktock.py
import time import threading from Queue import PriorityQueue qPriorityHigh = 0 qPriorityNormal = 1 qPriorityLow = 2 class qData (object): def __init__ (self, event_type, data=None): self.event_type = event_type self.event_data = data return def qController_tick (queue_controller): ...
tomato.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Pomodoro 番茄工作法 https://en.wikipedia.org/wiki/Pomodoro_Technique # ====== 🍅 Tomato Clock ======= # ./tomato.py # start a 25 minutes tomato clock + 5 minutes break # ./tomato.py -t # start a 25 minutes tomato clock # ./tomato.py -t <n> # start a <n> minutes...
sock.py
from typing import Any, Optional import json import logging import threading from pajbot.managers.redis import RedisManager log = logging.getLogger(__name__) class SocketManager: def __init__(self, streamer_name, callback): self.handlers = {} self.pubsub = RedisManager.get().pubsub() se...
lisp.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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...
huawei.py
""" import sys for line in sys.stdin: a = line.split() print(int(a[0]) + int(a[1])) """ def hex2ten(nums): k = { 'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14, 'F': 15, } res = [] for i in nums: i = i[2:] r = 0 for j in i: ...
zsmeif.py
#!/usr/bin/python # -*- coding: UTF-8 -*- """ AiSpeech/main.py ~~~~~ :copyright:facegood © 2019 by the tang. """ import os import sys import time from os.path import abspath, dirname, join import codecs import json # ******************************************* # *******************************************...
voiceServer.py
# -*- coding: utf-8 -*- # create time : 2020-12-30 15:37 # author : CY # file : voice_server.py # modify time: import socket import threading class Server: def __init__(self,port): self.ip = '127.0.0.1' while True: try: self.s = socket.socket(socket.AF_INET, soc...
test_sslkeylog.py
import sys import os import time import re import threading import socket import ssl from contextlib import closing import pytest from mock import Mock from six.moves import socketserver import sslkeylog SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) CERTFILE = os.path.join(SCRIPT_DIR, 'keycert.pem') ADDRE...
psc_manager.py
# # File: psc_manager.py # Created: 18/04/2015 # Author: VTT # # Description: # REST interface to PSC manager # import falcon import json import logging import sys import requests import urllib2 import subprocess from subprocess import check_output from psa_helper import PsaHelper # For PSA ...