source
stringlengths
3
86
python
stringlengths
75
1.04M
chsmonitor.py
""" Fetch the Companies House company registry using the streaming API. """ import json import requests import sling import sling.flags as flags import sling.crawl.chs as chs import sys import time import traceback from threading import Thread from queue import Queue flags.define("--chskeys", help="Compa...
manager.py
import argparse import webbrowser import json import traceback import socket import threading import signal import os from pathlib import Path from lyrebird import log from lyrebird import application from lyrebird.config import Rescource, ConfigManager from lyrebird.mock.mock_server import LyrebirdMockServer from lyre...
gamepad_ns_gpio.py
""" Demonstrate use of the NSGamepad class with GPIO pins. nsgamepad_usb must be run first to create the USB gadget. $ sudo apt update $ sudo apt install gpiozero Must be run as root like this: $ sudo ./ns_gamepad_usb $ cd Code $ sudo python3 gamepad_ns_gpio.py """ import time import threading import signal from gpio...
timer_queue.py
# Copyright 2016 Splunk, Inc. # SPDX-FileCopyrightText: 2020 2020 # # SPDX-License-Identifier: Apache-2.0 """ A simple thread safe timer queue implementation which has O(logn) time complexity. """ try: import queue as Queue except ImportError: import Queue import logging import threading import traceback fro...
parallel_validation.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 import multiprocessing as mp from collections import defaultdict from multichaindb import App, MultiChainDB from m...
androidServiceModule.py
from ircBase import * from bottle import route, run, template import apTrackingModule import time import datetime import ConfigParser from multiprocessing import Process config = ConfigParser.SafeConfigParser() config.read('configs/ircBase.conf') CONST_DB_USER = config.get('MySql', 'username') CONST_DB_PASSWORD = con...
Interface.py
import socket import struct import threading import netifaces import ipaddress import traceback from fcntl import ioctl from abc import ABCMeta, abstractmethod SIOCGIFMTU = 0x8921 class Interface(metaclass=ABCMeta): def __init__(self, interface_name, recv_socket, send_socket, vif_index): self.interface_n...
train.py
#!/usr/bin/env python """ Main training workflow """ import configargparse import os import signal import torch import onmt.opts as opts import onmt.utils.distributed from onmt.utils.logging import logger from onmt.train_single import main as single_main def parse_args(): parser = configargparse.ArgumentPa...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest import unittest.mock from test import support from test.support import import_helper from test.support import os_helper from test.support import socket_helper from test.support import threading_helper from test.support import warnings_helper import sock...
rpc.py
""" an XML-RPC server to allow remote control of PyMol Author: Greg Landrum (glandrum@users.sourceforge.net) Created: January 2002 $LastChangedDate$ License: PyMol Requires: - a python xmlrpclib distribution containing the SimpleXMLRPCServer module (1.0 or greater should be ...
client.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import os import select import socket import threading import warnings from urllib.parse import urlunparse from .constants import SAMP_STATUS_OK, SAMP_STATUS_WARNING from .hub import SAMPHubServer from .errors import SAMPClientError, SAMPWar...
ionosphere.py
from __future__ import division import logging import os from os import kill, getpid, listdir from os.path import join, isfile from sys import version_info # @modified 20191115 - Branch #3262: py3 # try: # from Queue import Empty # except: # from queue import Empty from time import time, sleep from threading ...
dark2.3.py
# -*- coding: utf-8 -*- import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize from multiprocessing.pool import ThreadPool try: import mechanize except ImportError: os.system('pip2 install mechanize') else: try: import requests except ImportEr...
service.py
# # This code is a modified version of the django_windows_tools/service.py # file located at https://github.com/antoinemartin/django-windows-tools/ # # FastCGI-to-WSGI bridge for files/pipes transport (not socket) # # Copyright (c) 2012 Openance SARL # All rights reserved. # # Redistribution and use in source and binar...
Enqueuer.py
from __future__ import absolute_import import threading import time from abc import abstractmethod try: import queue except ImportError: import Queue as queue class SequenceEnqueuer(object): """Base class to enqueue inputs, borrowed from Keras. The task of an Enqueuer is to use parallelism to speed ...
monitor.py
#!/usr/bin/env python # Copyright (c) 2020-2021 VMware, Inc. All Rights Reserved. # SPDX-License-Identifier: BSD-2 License # The full license information can be found in LICENSE.txt # in the root directory of this project. """ -App for Resource Monitoring. -Collects System CPU/Memory as well as AXON CPU/ Memory. """ im...
custom_commands.py
from threading import Thread import json import logging from silviux.config.keys.command import vocab from ezmouse.run import run_ezmouse from vim_server.server import VimServer logger = logging.getLogger(__name__) vim_server = VimServer() #Custom commands config is for simple mappings of grammar to executor side e...
test_sys.py
import builtins import codecs import gc import locale import operator import os import struct import subprocess import sys import sysconfig import test.support from test import support from test.support import os_helper from test.support.script_helper import assert_python_ok, assert_python_failure from test.support imp...
VideoGet.py
from threading import Thread import cv2 class VideoGet: """ Class that continuously gets frames from a VideoCapture object with a dedicated thread. """ def __init__(self, src=0): self.stream = cv2.VideoCapture(src) (self.grabbed, self.frame) = self.stream.read() self.stoppe...
test_general.py
""" Collection of tests for unified general functions """ # global import os import math import time import einops import pytest import threading import numpy as np from numbers import Number from collections.abc import Sequence import torch.multiprocessing as multiprocessing # local import ivy import ivy.functional....
flask_helper.py
# Copyright (c) Microsoft Corporation # Licensed under the MIT License. from flask import Flask from .environment_detector import build_environment from .environments.credentialed_vm_environment import CREDENTIALED_VM from .environments.public_vm_environment import PUBLIC_VM import socket import threading import atex...
mirage.py
import logging try: from Queue import Empty except: from queue import Empty # from redis import StrictRedis from time import time, sleep from threading import Thread from collections import defaultdict # @modified 20190522 - Task #3034: Reduce multiprocessing Manager list usage # Use Redis sets in place of Mana...
test.py
from threading import Thread, Lock import time, os, sys, shutil import imutils import cv2 import numpy as np sys.path.append('.') import tensorflow as tf import detect_face_detection import urllib.request import zerorpc import send_notifications import image_upload url='http://172.25.97.64:8080/shot.jpg' dir_path...
background_thread.py
from typing import Callable from threading import Thread class BackgroundThread(object): _thread = None def __init__(self, target): # type: (Callable) -> None self._thread = Thread(target=target) self._thread.daemon = True def is_alive(self): # type: () -> bool re...
main.py
import copy import datetime import json from PIL import Image, ImageTk import queue import logging import socket import sys import time import threading import tkinter as tk from tkinter.font import Font import accProtocol def load_images() -> dict: with open("./cars.json", "r") as fp: car_data = json.l...
master.py
#!/usr/bin/env python """Data master specific classes.""" import socket import threading import urlparse import urllib3 from urllib3 import connectionpool import logging from grr.lib import config_lib from grr.lib import rdfvalue from grr.lib import utils from grr.server.data_server import constants from grr.ser...
__init__.py
import threading import os import pty def create_dummy_port(responses): def listener(port): # continuously listen to commands on the master device while 1: res = b'' while not res.endswith(b"\r"): # keep reading one byte at a time until we have a full line ...
waiting_for_processes.py
#!/usr/bin/env python # encoding: utf-8 import multiprocessing import time import sys def daemon(): print 'Starting:', multiprocessing.current_process().name time.sleep(2) print 'Exiting :', multiprocessing.current_process().name def non_daemon(): print 'Starting:', multiprocessing.current_process()....
test_dag_serialization.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...
__init__.py
import threading import sys import traceback import socket import time import subprocess import uuid import fs_helper as fh from functools import partial from os import remove logger = fh.get_logger(__name__) def run(cmd, debug=False, timeout=None, exception=False, show=False): """Run a shell command and return...
build.py
## @file # build a platform or a module # # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> # Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License #...
task_notifier.py
import sys, datetime, threading, json from django.utils import timezone from django.conf import settings from django.core.mail import send_mail from django.template import loader import requests def send_email_via_trustifi(subject, html_body, recipient): payload = { "recipients": [ { ...
__init__.py
# a multithreading m3u8 download module and the number of threads can decide by yourself # author: walkureHHH # last modify: 2020/06/17 import requests from threading import Thread from threading import Lock import os import shutil from tqdm import tqdm class thread_num_ERROR(Exception): pass class mod_E...
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 ...
suggest.py
from flask import request from flask import jsonify from flask_cors import cross_origin import threading from autosuggest import AutoSuggestor def load_in_background(nlp, app, queries_path, stops_path): suggester = AutoSuggestor( queries_path=queries_path, stops_path=stops_path, b...
worker.py
"""Activity task polling and execution. You can provide you're own workers: the interface to the activities is public. This module's worker implementation uses threading, and is designed to be resource-managed outside of Python. """ import json import uuid import time import socket import traceback import typing as T...
tasks.py
######## # Copyright (c) 2019 Cloudify Platform 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 b...
w2.py
#!/usr/bin/env python3 from __future__ import print_function import sys import os import errno import subprocess import time import calendar import json import select import signal import threading import queue # networking import requests import socket import http.server import socketserver # 'compact' format jso...
GenInt.py
from .Polynomial import * from .Sbox import * from .Term import * from .Vector import * from multiprocessing import Process, Lock from threading import Thread #from pudb import set_trace; set_trace() class GenInt(object): def __init__(self, values, inputLength, outputLength ): self.probability_bit = 0 ...
common_snmp_actions.py
''' Copyright 2017, Fujitsu Network Communications, 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 w...
data_io.py
########################################################## # pytorch-kaldi v.0.1 # Mirco Ravanelli, Titouan Parcollet # Mila, University of Montreal # October 2018 ########################################################## import numpy as np import sys from utils import compute_cw...
integration_test.py
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. """ Script for testing comp...
ManagerTask.py
#!/usr/bin/python3 # -*- coding: UTF-8 -*- '''BlendNet ManagerTask Description: Task used by Manager to control jobs ''' import os import time import threading import subprocess import statistics # Calculate good remaining time from .TaskBase import TaskConfig, TaskState, TaskBase class ManagerTaskConfig(TaskConfig...
__init__.py
from collections import defaultdict import inspect import time import threading class TransitionWithoutOverloadException(Exception): pass nop = lambda *a, **kw: None class Transition: def __init__(self, next=None, check=None, watch=[]): if next is not None: self.next = next self.w...
utility.py
import os import math import time import datetime from multiprocessing import Process from multiprocessing import Queue import argparse import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import imageio import torch import torch.optim as optim import torch.optim.lr_scheduler as...
test_main.py
import os import threading import time import unittest from OpenDrive.client_side import file_changes_json as c_json from OpenDrive.client_side import interface from OpenDrive.client_side import main from OpenDrive.client_side import paths as client_paths from OpenDrive.server_side import paths as server_paths from te...
dework.py
from configparser import ConfigParser from multiprocessing import Process, Queue import pygame from core.data_retriever import DataRetriever from core.data_presenter import DataPresenter from core.logging_filters import create_logger from scripts.create_db import create_db_if_not_present CONFIG_FILE = 'config.ini' ...
game.py
import math import os import re import threading from datetime import datetime from typing import Dict, List, Optional, Union from kivy.clock import Clock from katrain.core.constants import ( HOMEPAGE, OUTPUT_DEBUG, OUTPUT_INFO, STATUS_ANALYSIS, STATUS_INFO, STATUS_TEACHING, PLAYER_AI, ) f...
rpdb2.py
#! /usr/bin/env python """ rpdb2.py - version 2.4.8 A remote Python debugger for CPython Copyright (C) 2005-2009 Nir Aides 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;...
test_itertools.py
import unittest from test import support from itertools import * import weakref from decimal import Decimal from fractions import Fraction import operator import random import copy import pickle from functools import reduce import sys import struct import threading import gc maxsize = support.MAX_Py_ssize_t minsize = ...
statusAudioPlayer.py
# Copyright (C) 2017 Next Thing Co. <software@nextthing.co> # # 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 License, or # (at your option) any later version. # #...
tftp.py
import errno import logging import socket from pathlib import Path, PurePosixPath from threading import Thread from typing import List, NewType, Tuple, Union, Dict logger = logging.getLogger('tftpd') BLOCK_SIZE = 512 BUF_SIZE = 65536 TIMEOUT = 0.5 MAX_RETRIES = 10 class TFTPOpcodes: """Class containing all the ...
create_vocab_proto.py
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
cOS.py
import os import time import sys import subprocess import glob import collections import shutil from distutils import dir_util import re import fnmatch import Queue import threading import getpass import platform import multiprocessing if sys.platform.startswith('win'): import _winreg try: from win32com.client impo...
test_table_count.py
import random import pdb import pytest import logging import itertools from time import sleep from multiprocessing import Process from milvus import Milvus from utils import * from milvus import IndexType, MetricType dim = 128 index_file_size = 10 add_time_interval = 5 class TestTableCount: """ params mean...
start_method_test.py
# coding: utf-8 ######################################################################### # 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> # # author yeeku.H.lee kongyeeku@163.com # # # # version 1.0 ...
simple_processing.py
import multiprocessing as mp import time def suma(r): pid = mp.current_process().name; print("{} is working with {}".format(pid, r)) res = q.get() for i in r: res += i q.put(res) if __name__ == '__main__': # sequential processing: t = time.time() result = 0 suma(range(100_000_000)) print(...
run.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ fMRI preprocessing workflow ===== """ import os import os.path as op import logging import sys import gc import uuid import warnings from argparse import ArgumentParser from argparse import RawTextHelpFormatter from multiprocessing import cpu_count from time import st...
video_read.py
from threading import Thread from os.path import expanduser import numpy as np import cv2 from pathlib import Path from PIL import Image from .config import config class VideoReader: footage_path = config.CONFIG['footage_path'] footage_files = config.CONFIG['footage_files'] width = config.CONFIG['width']...
task.py
""" Backend task management support """ import itertools import json import logging import os import re import sys from copy import copy from enum import Enum from multiprocessing import RLock from operator import itemgetter from tempfile import gettempdir from threading import Thread from typing import Optional, Any, ...
server.py
import socket import threading HEADER = 64 PORT = 8080 SERVER = socket.gethostbyname(socket.gethostname()) FORMAT = 'utf-8' DISCONNECT_MESSAGE = "!DISCONNECT" ADDR = (SERVER, PORT) server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind(ADDR) def handle_client(conn, addr): print(f"[NEW CONNECTION...
emobdh.py
#!/usr/bin/python import logging import time from threading import Thread from subsystems.emgps import emGps from subsystems.emimu import emImu from subsystems.emtelemetry import emTelemetry from sensors.emaltitude import emAltitudeGet from sensors.empressure import emPressureGet from sensors.emsealevelpressure impo...
main.py
import os #import logging #logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG) ############ Magic Configs target_fps = 30 size = (500,200) # half of is 100 for nice midpoint font_path = "Pixel LCD-7.ttf" font_size = 40 # 140 for big mid screen, 40 for fudge_factor = 1 line_width = 7 vert_...
authenticate.py
import smtplib, time, threading from models.wash import cprint, cinput, cgpass from models.data_generate import connInfo from utils.verifyEmail import REGEX from_ = cinput("Enter your email account: ", "lightwhite") #inputs for the email account from which the intended user wants to send the message FROM = REGE...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
pytorch.py
import logging from dataclasses import dataclass from pathlib import Path from subprocess import Popen from threading import Thread from typing import Any, List, Optional, Union import torch import torch.nn as nn from nni.experiment import Experiment, TrainingServiceConfig from nni.experiment.config import util from n...
server3.py
import socket import csv import traceback import threading s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) usrpass={} def openfile(): filename="login_credentials.csv" with open(filename,'r')as csvfile: csv_file = csv.reader(csvfile, delimiter=",") for col in csv_file: usrpas...
contact.py
from common.models import Tag from .client import SalesforceClient import json import requests import threading ''' Contributor model maps to the Contact object in Salesforce ''' client = SalesforceClient() def run(request): response = SalesforceClient().send(request) def save(contributor: object): data = {...
remote.py
import os import time import signal import logging import subprocess import concurrent from threading import Thread import multiprocessing as mp from distributed import Client from .ssh_helper import start_scheduler, start_worker __all__ = ['Remote'] logger = logging.getLogger(__name__) class Remote(Client): L...
test_payload.py
# -*- coding: utf-8 -*- ''' :codeauthor: Pedro Algarvio (pedro@algarvio.me) tests.unit.payload_test ~~~~~~~~~~~~~~~~~~~~~~~ ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import time import errno import threading import datetime # Import Salt Testing li...
pool.py
# coding: utf-8 import gevent from gevent import monkey monkey.patch_all() # support for greenlet import time import pymysql from threading import Lock import config class TooManyConnection(Exception): """ when too many connection """ class MySQLPool(object): def __init__(self): self.pool = []...
utils.py
def test_concurrently(times): """ Add this decorator to small pieces of code that you want to test concurrently to make sure they don't raise exceptions when run at the same time. E.g., some Django views that do a SELECT and then a subsequent INSERT might fail when the INSERT assumes that the data ...
hmkit.py
#!/usr/bin/env python """ The MIT License Copyright (c) 2014- High-Mobility GmbH (https://high-mobility.com) 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...
klee_conc_explorer.py
import ConfigParser import multiprocessing import subprocess32 as subprocess import os import sys import utils import signal from utils import bcolors def se_info(s): print bcolors.HEADER+"[KleeConc-Info]"+bcolors.ENDC," {0}".format(s) class ConcExplorer: def __init__(self, config, target): self.jobs...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
executors.py
__author__ = "Johannes Köster" __copyright__ = "Copyright 2015-2019, Johannes Köster" __email__ = "koester@jimmy.harvard.edu" __license__ = "MIT" import os import sys import contextlib import time import datetime import json import textwrap import stat import shutil import shlex import threading import concurrent.futu...
test.py
# -*- coding: utf-8 -*- import redis import unittest from hotels import hotels import random import time from RLTest import Env from includes import * from common import getConnectionByEnv, waitForIndex, toSortedFlatList # this tests is not longer relevant # def testAdd(env): # if env.is_cluster(): # rais...
topic_watcher.py
""" This utility watches the "announce" topic on the Kafka broker and launches logging consumers when a new announcement is made. This utility also is responsible for maintaining the metadata database, which keeps track of the different runs. Additionally, this tool reaps dead experiments - and marks them as complete ...
test_rest_tracking.py
""" Integration test which starts a local Tracking Server on an ephemeral port, and ensures we can use the tracking API to communicate with it. """ import mock from multiprocessing import Process import os import pytest import socket import time import tempfile from click.testing import CliRunner import mlflow.exper...
schedule_job_old.py
from src.platform.coldfusion.interfaces import CINTERFACES from src.platform.coldfusion.authenticate import checkAuth from src.module.deploy_utils import _serve, waitServe, parse_war_path, killServe from threading import Thread from os.path import abspath from re import findall from time import sleep from log import LO...
assistant.py
#!/usr/bin/python import threading from time import sleep import re from core.twitterc import TwitterC from core.voicerecognition import VoiceRecognition from core.voicesynthetizer import VoiceSynthetizer from modules.voicemail import VoiceMail from modules.clock import Clock from modules.identification import Ident...
Resource.py
import RNS import os import bz2 import math import time import threading from .vendor import umsgpack as umsgpack from time import sleep class Resource: """ The Resource class allows transferring arbitrary amounts of data over a link. It will automatically handle sequencing, compression, coordination a...
mian.py
from subprocess import run import sys,Ui_FormUi,Excel,threading from PyQt5.QtWidgets import QApplication, QFileDialog, QMainWindow def get_file(): name = QFileDialog.getOpenFileName(None,"选择文件", "/", "xlsx files (*.xlsx);;xls files (*.xls);;all files (*)") if name[0] != "": global path ...
executor.py
#!/usr/bin/env python # hook for virtualenv # switch to the virtualenv where the executor belongs, # replace all the path for modules import sys, os.path P = 'site-packages' apath = os.path.abspath(__file__) if P in apath: virltualenv = apath[:apath.index(P)] sysp = [p[:-len(P)] for p in sys.path if p.endswith...
cachingFileStore.py
# Copyright (C) 2015-2018 Regents of the University of California # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
registry.py
import logging import threading import time from typing import List from brownie import Contract, chain, web3 from joblib import Parallel, delayed from web3._utils.abi import filter_by_name from web3._utils.events import construct_event_topic_set from yearn.events import create_filter, decode_logs, get_logs_asap from ...
test_logics.py
# -*- coding: utf-8 -*- import unittest from unittest.mock import patch, MagicMock from asterisk_mirror.logics import AsteriskLogic, MorseLogic, YearLogic from asterisk_mirror.stepper import Stepper import time from threading import Thread from datetime import datetime class TestAsteriskLogic(unittest.TestCase): ...
agent.py
#!/usr/bin/python from flask import Flask from flask import make_response from flask import abort from flask import request from threading import Thread from bson import json_util import json import sys import os import helperapi as helper import confparser as cp query_results = [] app = Flask(__name__) @app.route(...
function.py
import time from lib.core.evaluate import ConfusionMatrix,SegmentationMetric from lib.core.general import non_max_suppression,check_img_size,scale_coords,xyxy2xywh,xywh2xyxy,box_iou,coco80_to_coco91_class,plot_images,ap_per_class,output_to_target from lib.utils.utils import time_synchronized from lib.utils import p...
multi-threading_test.py
from threading import Thread import time def timer(name, delay, repeat): print "Timer: " + name + " Started" while repeat > 0: time.sleep(delay) print name + ": " + str(time.ctime(time.time())) repeat -= 1 print "Timer: " + name + " Completed" def Main(): t1 = Thread(target=ti...
cube.py
import argparse import asyncio import logging from queue import Queue import signal import sys import threading import traceback import uvloop from biofeedback_cube.buffer import buffer from biofeedback_cube import config from biofeedback_cube import display from biofeedback_cube import exceptions from biofeedback_cu...
threadwatcher_parallel_cosa2.py
#!/usr/bin/env python3 import argparse import signal import subprocess import sys import time import os ## Non-blocking reads for subprocess ## https://stackoverflow.com/questions/375427/non-blocking-read-on-a-subprocess-pipe-in-python import sys from subprocess import PIPE, Popen from threading import Thread ON_P...
cloud.py
"""Cloud satellite manager Here we use dotcloud to lookup or deploy the satellite server. This also means we need dotcloud credentials, so we get those if we need them. Most of this functionality is pulled from the dotcloud client, but is modified and organized to meet our needs. This is why we pass around and work wi...
core_ui.py
import tkinter as tk from tkinter import messagebox from tkinter import filedialog import seabreeze from seabreeze.spectrometers import Spectrometer import matplotlib.pyplot as plt import matplotlib from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import laser_control import random import pandas as pd im...
test_gearman.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...
test_pdb.py
# A test suite for pdb; not very comprehensive at the moment. import doctest import os import pdb import sys import types import unittest import subprocess import textwrap from contextlib import ExitStack from io import StringIO from test import support # This little helper class is essential for testing pdb under do...
oddeye.py
import glob import os import sys import time import logging import threading from lib.daemon import Daemon import lib.upload_cached import lib.run_bash import lib.pushdata import lib.puylogger import lib.getconfig import gc sys.path.append(os.path.dirname(os.path.realpath("__file__"))+'/checks_enabled') sys.path.appen...
stress_test_streaming.py
from stress_test import * import time ITERATION = 10 def push_to_redis_stream(image_dicts): for image in image_dicts: start_time = time.time() DB.xadd(settings.IMAGE_STREAMING, image) print("* Push to Redis %d ms" % int(round((time.time() - start_time) * 1000))) def stress_test_stream(i...
host.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyright (c) 2012 University Of Minho # (c) Copyright 2013 Hewlett-Pa...
mpi_job_client.py
# Copyright 2021 The Kubeflow 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...