source
stringlengths
3
86
python
stringlengths
75
1.04M
synced_enforcer.py
import threading import time from casbin.enforcer import Enforcer from casbin.util.rwlock import RWLockWrite class AtomicBool(): def __init__(self, value): self._lock = threading.Lock() self._value = value @property def value(self): with self._lock: return self._valu...
common.py
# Copyright 2021 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. from enum import Enum from functools import wraps from pathlib import...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "<h1>HOST PAGE</h1><p>Your bot is running now<p>" def run(): app.run(host="0.0.0.0",port=8080) def keep_alive(): t = Thread(target=run) t.start()
request_connector.py
# Copyright 2020. ThingsBoard # # 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 applicabl...
tpu_estimator.py
# Copyright 2017 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...
compare_Wchain_sgd_5layers.py
import qiskit import numpy as np import sys sys.path.insert(1, '../') import qtm.base, qtm.constant, qtm.nqubit, qtm.fubini_study, qtm.encoding import importlib import multiprocessing importlib.reload(qtm.base) importlib.reload(qtm.constant) importlib.reload(qtm.onequbit) importlib.reload(qtm.nqubit) importlib.reload(q...
test_reorg_detector.py
# -*- coding: utf-8 -*- from http.server import HTTPServer from multiprocessing import Process from time import sleep from django.core.cache import cache from django.test import TestCase from eth_tester import EthereumTester from hexbytes import HexBytes from web3 import HTTPProvider from web3.providers.eth_tester imp...
logging.py
"""Cyberjunky's 3Commas bot helpers.""" import json import logging import os import queue import threading import time from logging.handlers import TimedRotatingFileHandler as _TimedRotatingFileHandler import apprise class NotificationHandler: """Notification class.""" def __init__(self, prog...
Background.py
from PyQt5.QtCore import QObject, pyqtSignal from threading import Thread from time import sleep from _socket import error from paramiko import SSHClient, AutoAddPolicy try: QString = unicode except NameError: # Python 3 QString = str class Connection(QObject): clear_all = pyqtSignal() reset_time...
myapp.py
from os import path, makedirs from threading import Thread from time import sleep from re import match, sub from base64 import b64decode, b64encode from binascii import b2a_hex from locale import getpreferredencoding from platform import system from pprint import pprint from random import choice, randint, sample from s...
PGManager.py
from psycopg2 import pool import mybatis_mapper2sql import traceback import pandas as pd class PGManager(object): def __new__(self): if not hasattr(self, 'instance'): self.instance = super(PGManager, self).__new__(self) self.__connection_pool = None return self.instance ...
test_dispatcher.py
import multiprocessing import os import platform import shutil import subprocess import sys import threading import warnings import inspect import pickle import weakref from itertools import chain from io import StringIO import numpy as np from numba import njit, jit, generated_jit, typeof from numba.core import type...
manager.py
"""Local development server manager.""" import logging import os import socket import sys import threading from grow.common import colors from grow.common import timer from grow.preprocessors import file_watchers from grow.sdk import updater from grow.server import main as main_lib from werkzeug import serving loggin...
cfbridge.py
#!/usr/bin/env python """ Bridge a Crazyflie connected to a Crazyradio to a local MAVLink port Requires 'pip install cflib' As the ESB protocol works using PTX and PRX (Primary Transmitter/Receiver) modes. Thus, data is only received as a response to a sent packet. So, we need to constantly poll the receivers for bidi...
futurespy.py
from sys import stdout import time import pandas as pd import websocket import requests import urllib import json import hmac import hashlib import threading ''' That library have got just a part of Documentation If you want to know what does certain function use can find more on ! ! ! https:...
__init__.py
""" Yay! It's NOT IDA!!!1!!1!one! """ import os import re import sys import time import Queue import string import struct import weakref import hashlib import itertools import traceback import threading import collections from binascii import hexlify from StringIO import StringIO from collections import deque from...
test_state.py
import glob import logging import os import shutil import threading import time import pytest from tests.support.case import SSHCase from tests.support.pytest.helpers import temp_state_file from tests.support.runtests import RUNTIME_VARS SSH_SLS = "ssh_state_tests" SSH_SLS_FILE = "/tmp/salt_test_file" log = logging....
5pro.py
# -*- coding: utf-8 -*- import KRIS from KRIS.lib.curve.ttypes import * from datetime import datetime import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile from bs4 import BeautifulSoup from urllib import urlopen import r...
test_connections.py
import socket import threading import ssl import OpenSSL import pytest from unittest import mock from mitmproxy import connections from mitmproxy import exceptions from mitmproxy.net import tcp from mitmproxy.net.http import http1 from mitmproxy.test import tflow from mitmproxy.test import tutils from .net import tser...
camera_pi.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # camera_pi.py # # NOT MY SCRIPT this was used from https://www.hackster.io/ruchir1674/video-streaming-on-flask-server-using-rpi-ef3d75 # Look at the above link to get the documentation for the following script. import time import io import threading import...
test_elasticsearch.py
# Copyright The OpenTelemetry 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 applicable law or agreed to in ...
utilities.py
# -*- coding: utf-8 -*- from __future__ import with_statement import gc import pickle import logging import threading import os import operator from itertools import count from math import sqrt from random import random, choice from scipy import where, array, exp, zeros, size, mat, median __author__ = 'Tom Schaul,...
smbrelayx.py
#!/usr/bin/python3 # SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved. # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # SMB Relay Module # # Author: # Alberto Solino (@agsolin...
keytet.py
from matrix import * import LED_display as LMD import threading import random import keyboard #sudo pip3 install keyboard import time import copy import os NowRoad=[10,10,10,10,10,10,10,10,0,0,0,0,0,0,0,0,10,10,10,10,10,10,10,10] NList=[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] #모든 방향은 LED Matrix 출...
multi_node_dcn_2node_8gpu.py
from hugectr import Session, solver_parser_helper, get_learning_rate_scheduler from mpi4py import MPI import threading import sys def session_impl_test(json_file): solver_config = solver_parser_helper(seed = 0, batchsize = 40960, batchsize_eva...
TCP.py
import os import socket import random import threading import ctypes import sys gray = '\033[1;30;40m' red = '\033[1;31;40m' green = '\033[1;32;40m' yellow = '\033[1;33;40m' blue = '\033[1;34;40m' magenta = '\033[1;35;40m' cyan = '\033[1;36;40m' white = '\033[1;37;40m' def bypass(): bypass = True ...
installwizard.py
import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electrum_deeponion import Wallet, WalletStorage from electrum_deeponion.util import UserCancelled, InvalidPassword from electrum_deeponion.base_wizard import BaseWizard, HWD_...
training.py
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import import warnings import copy import time import numpy as np import multiprocessing import threading import six try: import queue except ImportError: import Queue as queue from .topology import Container from ....
tests.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
election.py
import time from threading import Lock, Thread from queue import Queue from raftnode import cfg, logger from raftnode.store import Store from raftnode.transport import Transport class Election: def __init__(self, transport: Transport, store: Store, queue: Queue): self.timeout_thread = None self.st...
server.py
#server import sys import player import threading import traceback from socket import * import gameserver as gs from random import randint import securedsocket as ss import configurationmanager as cm PORT = randint(0,5000) # starts from a random port def get_new_socket(player_socket): global PORT...
iris_realtime.py
#!/usr/bin/env python #Must install sox: 'sudo apt install sox' # import necessary packages import rospy import cv2 as cv import queue, threading import numpy as np import dlib from std_msgs.msg import String,Int32 from math import hypot #import matplotlib.pyplot as plt import time from geometry_msgs.msg import Twist...
UsePytdxImportToH5Thread.py
# coding:utf-8 # # The MIT License (MIT) # # Copyright (c) 2010-2017 fasiondog/hikyuu # # 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 r...
controlsd.py
#!/usr/bin/env python3 import os import math import requests import threading from numbers import Number from cereal import car, log from common.numpy_fast import clip from common.realtime import sec_since_boot, config_realtime_process, Priority, Ratekeeper, DT_CTRL from common.profiler import Profiler from common.par...
cracker.py
# -*- coding: utf-8 -*- # # Enteletaor - https://github.com/cr0hn/enteletaor # # 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 con...
app.py
# [Basic EE Ex SW Project] Electronic Engineering Software Project 19-2(xix_ii) # 0.0.0va, 19.08.21. First tested, last update 19.08.23. # written by acoustikue(SukJoon Oh) # # ____ __ __ ____ __ # / __/_ __/ /____ / /__ ___ ___ / __ \/ / # _\ \/ // / '_/ // / _ \/ _ \/ _ \ / /_...
consumer_example.py
import time import sys import json import logging import threading logging.basicConfig(level=logging.INFO) sys.path += [".."] from test_bed_adapter.options.test_bed_options import TestBedOptions from test_bed_adapter import TestBedAdapter class ConsumerExample: @staticmethod def main(): options_file =...
_common.py
from wrapt import ObjectProxy import threading import requests from .utility import Utility from ._base import white_list, simple_types __all__ = [ 'is_proxy_allowed', 'safe_requests_post_run_async' ] def is_proxy_allowed(x): if not isinstance(x, ObjectProxy): if isinstance(x, dict) or isinstanc...
k_means.py
from models import * import traceback import time from datetime import datetime import sys from django.db import models import numpy as np import math_functions.cyclical_math as cm from Queue import Queue from threading import Thread import math_functions.normalization as norm from django.forms.models import model_to_d...
messenger.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...
core.py
""" Core logic (uri, daemon, proxy stuff). Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net). """ from __future__ import print_function, division import inspect import re import logging import sys import ssl import os import time import threading import uuid import base64 import warnings...
scheduler.py
from subprocess import call, Popen, run import time import threading import queue import os from pynvml.pynvml import * import time # start_time = time.time() # call(["python", "main.py", "--train=./train.py" , "--batch_size=10", "--spatial_epochs=100", "--temporal_epochs=100", "--train_id=default", "--dB=SAMM_CASME_O...
main.py
# Sheen Patel # u/SbubbyBot for the the mods of r/Sbubby import threading # to be able to run in threads import praw # all the reddit i/o import os # to get enviroment variables containing secrets import psycopg2 # used for postgresql database stuff from datetime import datetime # need to get current time for mul...
energies.py
#!/usr/bin/env python """ This program set up and run MCCE step 3 in multiple threads. Usage examples: 1. Run step 3 with 6 threads energies.py -p 6 [-e mcce] 2. Run step 3 to recreate head3.lst energies.py -r [-e mcce] 3. Run partial conformers. conformer 1 to 100 energies.py -c 1, 100 [-e mcce] -p nu...
datasets.py
# Dataset utils and dataloaders import glob import logging import math import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool from pathlib import Path from threading import Thread import cv2 import numpy as np import torch import torch.nn.functional ...
rdd.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...
backend.py
import logging import threading from .handler import CaptureRequestHandler, create_custom_capture_request_handler from .server import ProxyHTTPServer log = logging.getLogger(__name__) DEFAULT_BACKEND = 'default' def create(addr='127.0.0.1', port=0, options=None): """Create a new proxy backend. The type of...
test_gc.py
import unittest from test.support import (verbose, refcount_test, run_unittest, strip_python_stderr, cpython_only, start_threads, temp_dir, requires_type_collecting, TESTFN, unlink, import_module) from test.support.script_helper import assert...
identifying_threads.py
import threading import time def my_thread(): print("Thread {} starting".format(threading.currentThread().getName())) time.sleep(10) print("Thread {} ending".format(threading.currentThread().getName())) for i in range(4): threadName = "Thread-" + str(i) thread = threading.Thread(name=threadName,...
main.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys sys.path.append('.') from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from example.Features import Client from example.ttypes import FeaturesResult import os from timeit import time impor...
crabrave.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import logging import threading import time import json import hashlib import ffmpeg from uuid import uuid4 from urllib import parse from flask import Flask, request, send_file, abort from waitress import serve from colorlist import FFMPEG_COLORS from filter impo...
v2_serving.py
# Copyright 2018 Iguazio # # 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 writing, softwa...
tests.py
import random import string import threading import time import unittest from os.path import abspath from PythonExtensions.Files import * from PythonExtensions.Images import ImageObject from PythonExtensions.Json import * from PythonExtensions.Logging import * from PythonExtensions.Threads import * from PythonExtensio...
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.util import bfh, bh2u, UserCancelled, UserFacingException from electrum.bip32 import BIP32Node from electrum import constants from electrum.i18n import...
datacollector.py
from multiprocessing import Process, Queue def get_dates(queue, start_date='2010/07/17', end_date='2023/01/07'): from bs4 import BeautifulSoup #module for web scraping install by pip install beautifulsoup4 import requests #for requesting html. install by pip install requests from requests.adapters import HTTPAdapter...
__main__.py
"""Main entry point for deployment or simulation""" from cph.konfig import Konfig def deploy_main(app_py: str, conf: Konfig) -> None: from cph import deploy_irl device_map = deploy_irl.get_device_map() print("Discovered devices:\n" + '\n'.join([str(d) for d in device_map])) # TODO Logging # TODO U...
iterable_subprocess.py
from subprocess import Popen, PIPE from threading import Thread def iterable_subprocess(program, input_chunks, chunk_size=65536): write_exception = None with Popen(program, stdin=PIPE, stdout=PIPE) as proc: # Send to process from another thread... def pipe_to(): nonlocal write_exc...
__init__.py
from queue import Queue from threading import Thread import numpy as np import tensorflow as tf from . import modeling, tokenization from ..bert_model import tokenization as bert_tokenization from ...base import * class AlbertModel(BaseModel): def __init__(self, **kwargs): super().__init__(**kwargs) ...
client.py
import socket import os import subprocess import threading import pickle import sys from menu import menu class Client: def __init__(self, port, host, nick=''): self.port = port self.host = host self.nick = nick self.threads = [] self.s = socket.socket() self.s.con...
delicious.py
import logging import os import random import threading from datetime import datetime import numpy as np from scipy import sparse from utils import Indexer, create_sparse, timestamp_delta_generator censoring_ratio = 0.5 # fraction of censored samples to all samples def extract_features(contact_sparse, save_sparse...
cmd_controller.py
""" Provides cmd controller class which prints debug information and can handle user input. """ from threading import Thread from observer import Observer from src.beans import node_information_from_json from src.node_manger import NodeManger from src.handshake import NEW_ENTERING_NODE from src.vote_strategy import VO...
launchnotebook.py
"""Base class for notebook tests.""" from __future__ import print_function from binascii import hexlify from contextlib import contextmanager import errno import os import sys from threading import Thread, Event import time from unittest import TestCase pjoin = os.path.join try: from unittest.mock import patch ...
koriru1.2C-GUI.pyw
#分割1时大概会在20~40列,其它数字大概在80~100列 from PIL import Image import numpy as np import os,sys,time import progressbar import copy as cp import requests import json,base64 import tkinter.filedialog import tkinter as tk import threading wid=['[',progressbar.Timer(),']',progressbar.Bar(),'(',progressbar.ETA(),')',] def check_do...
ipfs_channel.py
# -*- coding: utf-8 -*- # # Robonomics information channels support node. # from robonomics_msgs.msg import Demand, Offer, Result, AddedOrderFeedback, AddedPendingTransactionFeedback from robonomics_msgs.messageValidator import convertMessage from robonomics_msgs.robonomicsMessageUtils import offer2dict, demand2dict, ...
modbus_server_mock.py
#!/usr/bin/env python ''' Pymodbus Asynchronous Server Example -------------------------------------------------------------------------- The asynchronous server is a high performance implementation using the twisted library as its backend. This allows it to scale to many thousands of nodes which can be helpful for ...
trainer.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
power_gadget.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ Python wrapper of Intel(R) Power Gadget, a software-based power estimation tool enabled for 2nd Generation Intel(R) Core(TM) processors or later. The software data can be logged from the command line (without running the GUI app) using PowerLog. """ __all__ = [ "PowerGa...
stress_tester.py
import argparse import statistics import threading import urllib.parse from http.client import HTTPConnection elapsed_list = [] def test_server(number: int, request_number: int): params = urllib.parse.urlencode({'number': number, 'perf': 1}) path = f'/prime?{params}' conn = HTTPConnection('localhost', 8...
usage.py
import uuid import time import hashlib import os import getpass import json import logging import socket import sys import platform import multiprocessing as mp from parsl.version import VERSION as PARSL_VERSION logger = logging.getLogger(__name__) def async_process(fn): """ Decorator function to launch a funct...
fileset.py
""" This module contains classes to handle datasets consisting of many files. Created by John Mrziglod, June 2017 """ import atexit from collections import Counter, defaultdict, deque, OrderedDict from copy import deepcopy from datetime import datetime, timedelta import gc import glob from itertools import tee import...
pipeline.py
# -*- coding: utf-8 -*- # Copyright (c) 2016, The Bifrost Authors. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, t...
runner.py
#!/usr/bin/env python3 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
journal.py
# Copyright (c) 2015 OpenStack Foundation # 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 ...
video.py
# ---------------------------------------------------------------------------- # - Open3D: www.open3d.org - # ---------------------------------------------------------------------------- # The MIT License (MIT) # # Copyright (c) 2018-2021 www.open3d.org # # Permission i...
main.py
import os import sys import threading import SimpleHTTPServer import SocketServer import shutil import enaml from enaml.qt.qt_application import QtApplication from PyQt4.QtCore import QFileSystemWatcher from atom.api import Atom, Unicode, observe, Typed, Property, Int from btsync import BTSync import logging logger ...
test_utils.py
# -*- coding: utf-8 -*- import json import os import shutil import tempfile import time import zipfile import multiprocessing import contextlib from unittest import mock from django import forms from django.conf import settings from django.forms import ValidationError from django.test.utils import override_settings ...
a_sync.py
"""A module exploring some python asyncio interactions.""" # [ Imports ] # [ -Python ] import asyncio import contextlib import enum import functools import select import sys import termios import threading from concurrent import futures from typing import Any, Callable, Generator, List, Optional, Union # [ -Third Par...
WebcamVideoStream.py
from threading import Thread, Lock import cv2 class WebcamVideoStream: def __init__(self, src=0, width=320, height=240): self.thread = Thread(target=self.update, daemon=True, args=()) self.stream = cv2.VideoCapture(src) self.stream.set(cv2.CAP_PROP_FRAME_WIDTH, width) self.stream.s...
subprocess_environment.py
from typing import * import copy import numpy as np import cloudpickle from mlagents.envs import UnityEnvironment from multiprocessing import Process, Pipe from multiprocessing.connection import Connection from mlagents.envs.base_unity_environment import BaseUnityEnvironment from mlagents.envs import AllBrainInfo, Uni...
BlinkApp.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' BlinkApp.py Pygame BlinkApp extends ThreadingProp. ''' from constants import * from ThreadingProp import ThreadingProp from PropData import PropData import os, threading, time if USE_GPIO and os.path.isfile('/opt/vc/include/bcm_host.h'): import RPi.GPIO as GPIO i...
screengear.py
""" This library is forked from abhiTronix's vidgear, and modified for easy use. Go to https://github.com/abhiTronix/vidgear/issues if you have any issues, questions, bug reports or feature requests. """ # import the necessary packages import cv2 import time import queue import numpy as np import logging as log from...
profile_sessions.py
# Copyright 2010 New Relic, 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 writ...
manage.py
"""Openstack manage component of PG Sandman. .. module:: manage :synopsis: Module containing the OpenstackManage class. .. moduleauthor: PG Sandman """ import logging import threading import uuid import networkx as nx import chain_api import json import random from emuvim.api.openstack.resources import Net, Port...
consumer.py
import logging from multiprocessing import Process, Queue, Lock, Manager try: # Python 3 import queue except ImportError: import Queue as queue import time import random import boto3 from botocore.exceptions import ClientError from .exceptions import RETRY_EXCEPTIONS log = logging.getLogger(__name__) cla...
presubmit_support.py
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Enables directory-specific presubmit checks to run at upload and/or commit. """ from __future__ import print_function __versio...
complete_lvq.py
# LVQ for the Ionosphere Dataset from random import seed from random import randrange from random import shuffle from csv import reader from math import sqrt import numpy as np import os import sys import time import threading import itertools # def animate(): # for c in itertools.cycle(['|', '/', '-', '\\']): # if...
zeromq.py
# -*- coding: utf-8 -*- ''' Zeromq transport classes ''' # Import Python Libs from __future__ import absolute_import import logging import os import errno import hashlib import weakref from random import randint # Import Salt Libs import salt.auth import salt.crypt import salt.utils import salt.utils.verify import sa...
test_unix_events.py
"""Tests for unix_events.py.""" import collections import gc import errno import io import os import pprint import signal import stat import sys import threading import unittest import unittest.mock if sys.platform == 'win32': raise unittest.SkipTest('UNIX only') from asyncio import events from asyncio import f...
test_python_server_image_builder.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...
postgresql.py
import logging import os import psycopg2 import time import shlex import subprocess import shutil import threading from urllib.parse import urlparse logger = logging.getLogger(__name__) class Postgresql: CONN_OPTIONS = { 'connect_timeout': 3, 'options': '-c statement_timeout=2000', } ...
main.py
import requests import os import time import server import utils import routine from threading import Thread from replit import db from datetime import datetime from matplotlib import pyplot as plt routine.delete_logs() WEBHOOKS_EBK = os.getenv('WEBHOOKS_EBK').split(',') USERNAME_EBK = 'ebk' WEBHOOKS_MISFIT = os.get...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import queue as pyqueue import contextlib import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import struct import operator import weakref import test.su...
test_connection.py
# Copyright 2009-2012 10gen, 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 writing,...
mutiscript.py
import signal import curses import multiprocessing from blinker import Signal import sys import functools class BaseProcess(object): def __init__(self, new_func=None, total_count=None, *args, **kwargs): self.func = new_func self.total_count = total_count self.count = 0 self.task_qu...
hanging_threads.py
# The MIT License (MIT) # --------------------- # # Copyright (C) 2014 Nicco Kunzmann # # https://gist.github.com/niccokunzmann/6038331 # # 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 witho...
compareDQMOutput.py
#!/bin/env python3 import os import sys import glob import argparse import subprocess from threading import Thread COMPARISON_RESULTS = [] def collect_and_compare_files(base_dir, pr_dir, output_dir, num_procs, pr_number, test_number, release_format): files = get_file_pairs(base_dir, pr_dir) threads = [] ...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import unittest.mock 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 subprocess import struct import operator import p...
tests.py
# -*- coding: utf-8 -*- # Unit and doctests for specific database backends. from __future__ import absolute_import, unicode_literals import datetime import threading from django.conf import settings from django.core.management.color import no_style from django.core.exceptions import ImproperlyConfigured from django.d...
cachesim.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # cachesim.py # # Copyright 2021 Dadmin <dadmin@Destroyer> # # 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 Foundation; either version 2 of the Lice...
conftest.py
import time import os import logging from datetime import datetime, timedelta from threading import Thread from six.moves.queue import Queue, Empty import pytest import psycopg2 from psycopg2 import sql logger = logging.getLogger(__name__) def create_database(db_name): dsn = os.environ.get( "RS_TEST_DSN...