source
stringlengths
3
86
python
stringlengths
75
1.04M
estimators.py
""" This is an estimator based on the DFASAT library developed at the University of Luxembourg """ import numpy as np import scipy as sp import numbers from sklearn.base import BaseEstimator import flexfringe.lib.flexfringe as flexfringe import flexfringe.eval as e import sys from multiprocessing import Process, cpu_co...
slave_test.py
#!/usr/bin/env python # Copyright (c) 2017 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. import os import shutil import SocketServer import subprocess import tempfile import threading import time import unittest CONFIG...
system_main.py
# -*- coding: utf-8 -*- #想要加中文注释就必须将字符编码格式设置为utf8 #作者:郭开 import numpy as np import os import cv2 import cv2.cv as cv from skimage import transform as tf from PIL import Image, ImageDraw import threading from time import ctime,sleep import time import sklearn import matplotlib.pyplot as plt import skimage caffe_root =...
msgcenter.py
#!/usr/bin/env python # -*- coding: utf-8 -* # Copyright: [CUP] - See LICENSE for details. # Authors: Guannan Ma (@mythmgn), """ :descrition: msg center related module """ import abc import time import socket import threading from cup import log from cup.net.async import conn from cup.net.async import msg as asyn...
server.py
#!/usr/bin/python import os import socket import signal import sys import stat import json import base64 import time from argparse import ArgumentParser import hashlib from collections import OrderedDict from threading import Lock, Thread from copy import deepcopy import rpyc from cryptography.fernet import Fernet, I...
agent_harness.py
# # Copyright 2016 CognitiveScale, 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 wr...
mutilmodel.py
from speech_to_text import speech_to_text from threading import Thread import cv2 import time from text_to_speech import * from test import * from price import * import pandas as pd from similary import * INPUT_FILE = 'e.png' OUTPUT_FILE = 'predicted.jpg' LABELS_FILE = 'yolo-coco/coco.names' CONFIG_FILE = 'yolo-coco/y...
grab_api.py
# coding: utf-8 from copy import deepcopy import six from tests.util import build_grab, temp_file from tests.util import BaseGrabTestCase from tests.util import reset_request_counter from grab import GrabMisuseError, GrabError class GrabApiTestCase(BaseGrabTestCase): def setUp(self): self.server.reset()...
__init__.py
""" homeassistant ~~~~~~~~~~~~~ Module to control the lights based on devices at home and the state of the sun. """ import time import logging import threading from collections import defaultdict, namedtuple from datetime import datetime logging.basicConfig(level=logging.INFO) ALL_EVENTS = '*' DOMAIN_HOMEASSISTAN...
pythread.py
import concurrent.futures import threading import logging import time sema = threading.BoundedSemaphore(2) def thread_function(name): with sema: logging.info("Thread %s: starting:", name) time.sleep(2) logging.info("Thread %s: stopping:", name) if __name__ == "__main__": threads = list() format ...
notifications.py
# # notifications.py # # (c) 2017 by Andreas Kraft # License: BSD 3-Clause License. See the LICENSE file for further details. # # This sub-module defines the end-point and server for notifications as well # support functions. # """ This sub-module defines the end-point and server for notifications as well as support f...
camera.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # # Rpi script for imbedded systems project. # # @author: Mikael Andersson <man16057@student.mdh.se> ### Imports ### import os, time, socket, threading, random, sys import RPi.GPIO as GPIO from picamera import PiCamera ### Global Variables ### ## Connectivity ## SKT_U ...
__init__.py
# The domain of your component. Should be equal to the name of your component. import logging, time, hmac, hashlib, random, base64, json, socket, requests, re, threading, hashlib, string import voluptuous as vol import asyncio from datetime import timedelta from datetime import datetime from homeassistant.helpers.ent...
high_availability.py
# # Copyright 2022 The AI Flow 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 w...
reqgenerator.py
# dependencies # pip install requests cachecontrol beautifulsoup4 from datetime import datetime import random import requests import sys import time from threading import Thread from bs4 import BeautifulSoup from cachecontrol import CacheControl # note, when using localhost and port, cache never filled. URL = 'http:/...
tb_device_mqtt.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 applicable law ...
restful_webapi.py
import web import json import threading urls = ('/(.*)', 'API') app = web.application(urls, globals()) db = {} nextid = 0 # Very simple REST API application built with web.py class API(): def GET(self, id=None): global db, nextid if(len(id) == 0): return json.dumps(db) elif(i...
test_runner_local.py
import os import threading import time from unittest import TestCase import psutil from galaxy import job_metrics from galaxy import model from galaxy.jobs.runners import local from galaxy.util import bunch from ..tools_support import ( UsesApp, UsesTools ) class TestLocalJobRunner(TestCase, UsesApp, UsesTo...
models.py
# -*- coding: utf-8 -*- from __future__ import annotations import json import logging import multiprocessing import uuid from enum import Enum from typing import TYPE_CHECKING from typing import Union, List import yaml from django.contrib.auth.models import Group, User from django.contrib.contenttypes.fields import G...
serverctx.py
#!/usr/bin/env python3 # # Server contexting # import sys import endurox as e from threading import Thread # thread func def run(ctxt, data): e.tpinit() e.tpsrvsetctxdata(ctxt) e.tpreturn(e.TPSUCCESS, 0, data) e.tpterm(); class Server: def tpsvrinit(self, args): e.userlog('Server start...
utils.py
import random import requests from threading import Thread, Event import time import numpy as np from config import * def random_parameter_combination(num_parameters): arr = [] for i in range(num_parameters): _parameter = random.uniform(0, 1) arr.append(_parameter) return arr def reque...
worker_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
persistence.py
__title__ = "playground" __author__ = "murlux" __copyright__ = "Copyright 2019, " + __author__ __credits__ = (__author__, ) __license__ = "MIT" __email__ = "murlux@protonmail.com" from queue import Queue import threading import time import pandas as pd from datetime import datetime as dt from typing import Any, Dict, ...
Interpreter.py
from Parser import * from graphviz import Graph import math from functools import reduce import gmpy2 import subprocess from threading import Thread from queue import Queue, Empty """pg.c('set terminal jpeg') pg.c('set output "plot.jpeg"')""" class NodeVisitor: def visit(self, node): method_name = 'visit...
server.py
import math import multiprocessing import os import queue import sys import threading import time import uuid from collections import namedtuple from concurrent.futures import ThreadPoolExecutor from threading import Event as ThreadingEventType from time import sleep from typing import NamedTuple import grpc from dags...
email.py
# coding=utf-8 from threading import Thread from flask import current_app,render_template from flask.ext.mail import Message from . import mail def send_async_email(app,msg): with app.app_context(): mail.send(msg) def send_email(to,subject,template,**kwargs): app = current_app._get_current_object() msg = Messa...
subproc_vec_env.py
""" subprocess vectorized environment class """ import multiprocessing as mp import os import torch import numpy as np from baselines.common.vec_env.vec_env import VecEnv from baselines.common.vec_env.utils import obs_space_info, obs_dict_to_tensor from baselines.common.misc_util import numpy_to_torch, dtype_to_to...
test_tracer.py
# -*- coding: utf-8 -*- """ tests for Tracer and utilities. """ import contextlib import gc import logging import multiprocessing import os from os import getpid import threading from unittest.case import SkipTest import weakref import mock import pytest import six import ddtrace from ddtrace.constants import AUTO_KE...
uncloud.py
import sys if sys.version_info[0] == 3: import configparser as ConfigParser elif sys.version_info[0] == 2: import ConfigParser if sys.version_info[0] == 3: import queue as Queue elif sys.version_info[0] == 2: import Queue import os import json import filecmp import shutil import getpass import socket im...
runner.py
#!/usr/bin/env python2 # 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 ...
ssd_cache.py
import os from logger import logger, timed from os.path import join from functools import partial import cv2 import shutil # from collections import deque from threading import Condition import multiprocessing as mp import queue from thread_pool import ThreadPool import logging from threading import Lock import time fr...
_exploit_routine_dfs.py
import pickle import os import time import datetime import angr import colorama import pwnlib import time from IPython import embed from multiprocessing import Process, Pool, Queue class ExploitRoutineDFSMixin: def _smash(self, start_good_disclosure_state_idx): """ try all candidate smash gadget ...
sensors.py
import atexit import multiprocessing import signal from TSL2561 import TSL2561 from MCP9808 import MCP9808 import datetime import time class Sensors(object): ''' Class for reading and reporting sensor values ''' def __init__(self, read_interval=1): self._child_pipe, self._pipe = multiprocessing.Pipe(...
server.py
# -*- coding: utf-8 -*- # Python module: ModbusServer class (ModBus/TCP Server) from . import constants as const from .utils import test_bit, set_bit import socket import struct from threading import Lock, Thread # for python2 compatibility try: from socketserver import BaseRequestHandler, ThreadingTCPServer exc...
test_backfill_job.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...
account.py
#!/usr/bin/python3 import json import threading from getpass import getpass from pathlib import Path from typing import Any, Dict, Iterator, List, Optional, Tuple, Union import eth_account import eth_keys from hexbytes import HexBytes from brownie._config import CONFIG, _get_data_folder from brownie._singleton impor...
specter_desktop.py
from PyQt5.QtGui import QIcon, QCursor, QDesktopServices from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMenu, QAction, \ QDialog, QDialogButtonBox, QVBoxLayout, QRadioButton, QLineEdit, \ QFileDialog, QLabel, QWidget from PyQt5.QtCore import QRunnable, QThreadPool, QSettings, QUrl, \ Qt, pyqtSi...
vnrpc.py
# encoding: UTF-8 import threading import traceback import signal import zmq from msgpack import packb, unpackb from json import dumps, loads import cPickle pDumps = cPickle.dumps pLoads = cPickle.loads # 实现Ctrl-c中断recv signal.signal(signal.SIGINT, signal.SIG_DFL) ################################################...
cancel_util.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...
transaction.py
#!/usr/bin/env python3 # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 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 withou...
test_index_remote.py
import os import time import multiprocessing as mp from pathlib import Path import pytest import numpy as np from jina.flow import Flow from jina.helper import random_port from jina.peapods.pod import GatewayPod from jina.enums import FlowOptimizeLevel from jina.parser import set_gateway_parser from jina.executors.in...
daemon.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
test_ffi.py
import sys, py from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC class Test__ffi(BaseTestPyPyC): def test__ffi_call(self): from rpython.rlib.test.test_clibffi import get_libm_name def main(libm_name): try: from _rawffi.alt import CDLL, types ...
slack.py
import json import logging import random import re import requests import sys import time import traceback from markdownify import MarkdownConverter from will import settings from .base import IOBackend from will.utils import Bunch, UNSURE_REPLIES, clean_for_pickling from will.mixins import SleepMixin, StorageMixin f...
cc.py
#!/usr/bin/python3 #Coded by Leeon123 import socket import socks import time import random import threading import sys import ssl print (''' ____ ____ _ _ _ _ / ___/ ___| / \ | |_| |_ __ _ ___| | __ | | | | _____ / _ \| __| __/ _` |/ __| |/ / | |__| |__|_____/ ___ \ |_| || (_| | (__...
thread.py
import threading def runfunc(func): threading.Thread(target=func).start()
test_stream.py
# Copyright © 2020 Interplanetary Database Association e.V., # BigchainDB and IPDB software contributors. # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 # # Stream Acceptance Test # This test checks if the event stream works correctly. The basic idea of this # test is...
parameter_server.py
import argparse import os from threading import Lock # Links to refer for hacks # https://github.com/pytorch/examples/pull/842/files # https://github.com/pytorch/examples/issues/780 # https://github.com/pytorch/examples/blob/1a6ba0c5197264f41b3aa79a7623cad6c1b44b3a/distributed/rpc/parameter_server/rpc_parameter_server...
evaluator.py
import time from datetime import datetime import json from collections import OrderedDict import os from multiprocessing import Process, Pipe from ai2thor.controller import Controller from pycocotools.cocoeval import COCOeval from pycocotools.coco import COCO import numpy as np import torch from pipeline.tester impor...
wsdump.py
#!/Users/lroth/Documents/hackPHS-2018/hackerbot/bin/python3.5 import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding = getattr(sys....
attach_server.py
# Python Tools for Visual Studio # Copyright(c) Microsoft Corporation # 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 #...
SpotifyCharts.py
import json import threading import re from queue import Queue from .crawler_base import SpotifyChartsBase from .compute_dates import returnDatesAndRegions from .compute_dates import whatDates from .log_config import logger from .write_to_outputs import writeToCSV from .write_to_outputs import writeToSQLTa...
c4Solver.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 13 18:50:06 2018 @author: Arpit """ import requests, yaml, os, random, threading from cache import cached from functools import lru_cache from threading import Thread FIFO = "games/c4solver67-pipe-in" FIFO_OUT = "games/c4solver67-pipe-out" FILE = "...
websocketconnection.py
import threading import websocket import gzip import ssl import logging from urllib import parse import urllib.parse from binance_d.base.printtime import PrintDate from binance_d.impl.utils.timeservice import get_current_timestamp from binance_d.impl.utils.urlparamsbuilder import UrlParamsBuilder from binance_d.impl.u...
lab13.py
""" This file compiles the code in Web Browser Engineering, up to and including Chapter 11 (Keeping Data Private), without exercises. """ import argparse import dukpy import functools import socket import ssl import time import threading import tkinter import tkinter.font from lab10 import request class Timer: de...
gui.py
#!/usr/bin/env python3 import sys import os import threading import requests from bs4 import BeautifulSoup from time import sleep from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt from PyQt5.QtGui import QIcon class MainWindow(QWidget): def __init__(self, parent=None): super(MainWindow, self).__...
alert_host_disk_read_bandth.py
''' Test about monitor trigger on host disk reading bandwidth in one minute @author: Songtao,Haochen ''' import os import time import test_stub import random import threading import zstacklib.utils.ssh as ssh import zstackwoodpecker.test_util as test_util import zstackwoodpecker.operations.resource_o...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
test_partition.py
import threading import logging import time from multiprocessing import Pool, Process import pytest from utils import utils as ut from common.constants import default_entities, default_fields from common.common_type import CaseLabel TIMEOUT = 120 default_nb = ut.default_nb default_tag = ut.default_tag class TestCrea...
main.py
# This file includes threading :) # python3 -m pip install paramiko termcolor import paramiko, termcolor, sys, os, socket from threading import Thread import time password_found = False if __name__ == '__main__': # some default values so I didn't have to retype them the whole time host = "192.168.1.121" user...
functional_tests.py
#!/usr/bin/env python """ This script cannot be run directly, because it needs to have test/functional/test_toolbox.py in sys.argv in order to run functional tests on repository tools after installation. The install_and_test_tool_shed_repositories.sh will execute this script with the appropriate parameters. """ import ...
main.py
#!/usr/bin/env python3 import subprocess import sys if 'linux' not in sys.platform: raise Exception('Somente Linux') import os import json import time import trayIcon import askPass import webbrowser import threading import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk from subprocess imp...
data_reader.py
from __future__ import print_function import sys import time import serial import threading import signal class DataReader(serial.Serial): ResetSleepDt = 1.5 Baudrate = 115200 ThreadYieldDt = 0.005 def __init__(self,port,timeout=10.0): param = {'baudrate': self.Baudrate, 'timeout': timeout} ...
config_reader.py
import copy import multiprocessing as mp def process_configs(target, arg_parser): args, _ = arg_parser.parse_known_args() ctx = mp.get_context('fork') for run_args, _run_config, _run_repeat in _yield_configs(arg_parser, args): p = ctx.Process(target=target, args=(run_args,)) p.start() ...
custom.py
# pylint: disable=too-many-lines # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------...
utils.py
import threading import time import numpy as np import pandas as pd import sys import config as cng from typing import List import math import os import aniso8601 def print_html(html_test): '''To print html containers returned by beautifulsoup4''' try: strhtml = str(html_test.prettify()) except...
stl_loader.py
# This Python file uses the following encoding: utf-8 from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from opengl_drawing_tools import * from World_Components import * import numpy as np # this comment is on both repo import struct import threading class Loaded_Model(Mounted_Component): ...
play.py
#!/usr/bin/env python from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from utils import take_screenshot, prepare_image from utils import XboxController import tensorflow as tf import model import threading from termcolor import cprint PORT_NUMBER = 8082 # Start session sess = tf.InteractiveSession() se...
tests.py
"""Tests related to django.db.backends that haven't been organized.""" import datetime import threading import unittest import warnings from django.core.management.color import no_style from django.db import ( DEFAULT_DB_ALIAS, DatabaseError, IntegrityError, connection, connections, reset_queries, transaction,...
pystocktrader.py
import sys import psutil import logging import subprocess from PyQt5.QtTest import QTest from multiprocessing import Process, Queue from trader.trader_upbit import TraderUpbit from trader.trader_kiwoom import TraderKiwoom from trader.strategy_coin import StrategyCoin from trader.strategy_stock import StrategyStock from...
main.py
from Modules.Runtime.environment import SAT if SAT: from Modules.Magnetometer import magnetometer_factory from Modules.Magnetorquer.hBridge import hBridge from Modules.DataHub.remote import DataHub import time import math import threading if SAT: sensor = magnetometer_factory.initialize() actuator =...
ars.py
import socket from multiprocessing import Process, Value import TrboDataSvc.util as util import logging class ArsConsts(): ARS_ID_MISMATCH = -1 ARS_UNDEF = 0 ARS_HELLO = 1 ARS_BYE = 2 ARS_PING = 3 ARS_PONG = 4 class ArsOpByte(): ARS_HELLO = b'\xf0' ARS_BYE = b'\x31' ARS_PING = b'\x...
smtclient.py
# Copyright 2017,2020 IBM Corp. # # 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 agr...
virtual_mirror_node_test.py
#!/usr/bin/env python from cv_bridge import CvBridge, CvBridgeError from sensor_msgs.msg import CompressedImage, Image import rospy import cv2 import io import numpy as np import threading class VirtualMirrorTestNode(object): def __init__(self): self.node_name = "Virtual Mirror Test" self.bridge = CvBridge() se...
wrapper.py
"""This module implements the TrainedModelWrapper class.""" import os import os.path import importlib from threading import Thread from typing import Optional, Iterable, Callable, Dict from ml_rest_api.settings import get_value WrapperCallableType = Optional[Callable] class TrainedModelWrapper: """TrainedModelWr...
lbf_forwarder.py
# SPDX-License-Identifier: Apache-2.0-only # Copyright (c) 2019-2022 @kiranmak @bhaskar792 @shashank68 # This program sends New-IP, LBF contract, Legacy IP or Ping contract packet # from the source to the destination provider by the users # by default it sends New-IP packet # mixed flow traffic with multiple sender an...
compute_resources.py
# 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 applicable law or agreed to ...
test_base.py
import pytest import time from contextlib import contextmanager from multiprocessing import Process from redis_rpc import (Client, Server, RemoteException, RPCTimeout, call_queue_name, response_queue_name) from unittest.mock import Mock @contextmanager def rpc_server(redis, func_map, kind=None,...
views.py
from django.shortcuts import render, redirect, get_object_or_404, HttpResponse from django.utils import timezone, dateparse from django.utils.datastructures import MultiValueDictKeyError from django.core import serializers import time from django.template.defaultfilters import slugify # importing path to project from...
keyframe_extractor.py
import os from os.path import join from pathlib import Path import logging import collections import threading import time import threading from queue import Queue import click from tqdm import tqdm import cv2 as cv from PIL import Image from vframe.settings import vframe_cfg as cfg from vframe.utils import im_utils,...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] # # Imports # import sys import th...
mirror.py
#!/usr/bin/env python from __future__ import print_function import argparse from functools import partial from hammock import Hammock import logging import os import os.path from queue import Queue, Empty from subprocess import check_output from threading import Thread def ensure_dir(*path_pieces): path = os.pat...
test_renderers.py
import json import sys import base64 import threading import time import pytest import requests import numpy as np import plotly.graph_objs as go import plotly.io as pio from plotly.offline import get_plotlyjs if sys.version_info >= (3, 3): import unittest.mock as mock from unittest.mock import MagicMock els...
test_single_exception.py
""" All tests should fail. """ from threading import Thread def test_reraise(reraise): def run(): with reraise: assert False Thread(target=run).start() def test_exception(reraise): assert False
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. import sys from test import test_support import _testcapi for name in dir(_testcapi): if name.startswith('test_'): test = getattr(_testcapi, name) if...
__version__.py
# pylint: disable=C0415,C0413 __version__ = '0.0.18' def check_version(): def _check_version(): import re from distutils.version import LooseVersion as V import httpx try: resp = httpx.get( 'https://mirrors.aliyun.com/pypi/simple/botoy/', timeout=10 ...
experiment.py
import os, sys, inspect sys.path.insert(1, os.path.join(os.path.abspath(os.path.dirname(__file__)), '../../')) # import some common libraries import numpy as np import torch import matplotlib.pyplot as plt import os, gc, time, json, cv2, random, sys, traceback from experiments.detection.utils import * from core.bounds ...
server.py
#!/usr/bin/env python import json import unicornhat as unicorn import threading import time import math from time import sleep from datetime import datetime from gpiozero import CPUTemperature from flask import Flask, jsonify, make_response, request from random import randint blinkThread = None globalRed = 0 globalG...
invokers.py
# # (C) Copyright IBM Corp. 2019 # Copyright Cloudlab URV 2020 # # 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 applic...
xbox_controller.py
# An xbox controller can be connected to a Mac by putting the xbox controller in sync mode, # then through Apple - System Preferences - Bluetooth from inputs import get_gamepad import math import threading class XboxController(object): MAX_TRIG_VAL = math.pow(2, 8) MAX_JOY_VAL = math.pow(2, 15) def __in...
light_reaper.py
# -*- coding: utf-8 -*- # Copyright European Organization for Nuclear Research (CERN) since 2012 # # 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-...
utils.py
from bitcoin.rpc import RawProxy as BitcoinProxy from btcproxy import BitcoinRpcProxy from collections import OrderedDict from decimal import Decimal from ephemeral_port_reserve import reserve from lightning import LightningRpc import json import logging import lzma import os import random import re import shutil impo...
test_model_logging.py
"""InVEST Model Logging tests.""" import time import threading import unittest import tempfile import shutil import socket import urllib import os import logging from pygeoprocessing.testing import scm import numpy.testing import Pyro4 import mock SAMPLE_DATA = os.path.join( os.path.dirname(_...
window.py
import os import sys import threading import time import cv2 import sounddevice as sd from PIL import ImageGrab from PyQt5 import * from PyQt5.Qt import * from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * import recorder # options widget class optWidget(QWidget): ...
portable_runner.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...
testing_utils.py
import logging import os import platform import subprocess import tempfile from threading import Thread from typing import Callable, List, Optional from collections import namedtuple from subprocess import Popen, PIPE, TimeoutExpired from queue import Queue import shutil import psutil # type: ignore IS_WINDOWS = pl...
test_token_refresh.py
import os import unittest from time import sleep, time from threading import Thread from datetime import datetime, timedelta from lusid.utilities import ApiConfigurationLoader from lusid.utilities.proxy_config import ProxyConfig from lusid.utilities import RefreshingToken from parameterized import parameterized from ...
deformer.py
#!/usr/bin/python import multiprocessing as mp import numpy as np from scipy.ndimage.filters import gaussian_filter as gauss from scipy.ndimage.interpolation import map_coordinates as mapcoords def transform(img, scale, sigma, cval=0, ret_trans=False): ''' Transforms a single 2D image ''' trans = np.in...
scalene_profiler.py
"""Scalene: a scripting-language aware profiler for Python. https://github.com/plasma-umass/scalene See the paper "docs/scalene-paper.pdf" in this repository for technical details on an earlier version of Scalene's design; note that a number of these details have changed. by Emery Berger http...
scheduler.py
#!/usr/bin/env python """Multi-threaded jobs """ # This file is part of PASTA and is forked from SATe # PASTA like SATe 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 3 of the License, or # ...