source
stringlengths
3
86
python
stringlengths
75
1.04M
berkeleydb.py
import logging from os import mkdir from os.path import abspath, exists from threading import Thread from urllib.request import pathname2url from rdflib.store import NO_STORE, VALID_STORE, Store from rdflib.term import URIRef def bb(u): return u.encode("utf-8") try: from berkeleydb import db has_bsddb...
deferred.py
import sys import time import traceback from queue import Empty, Full, Queue from threading import Lock, Thread from ..lib import logger, reporter from ..lib.errors import ExpectedError from ..setup import is_same_package # A global queue that is used for the convenience methods provided below. _queue = Queue(maxsize...
test_runner.py
# Copyright 2013 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. """Runs perf tests. Our buildbot infrastructure requires each slave to run steps serially. This is sub-optimal for android, where these steps can run indepe...
01ThreadCounter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # ----------------------------------------------------------------------------------------------------------- # Name: 01ThreadCounter.py # Purpose: Simple thread counter # # Author: Gabriel Marti Fuentes # email: gabimarti at gmail dot com # Git...
pololu_ticcmd_wrapper.py
"""Pololu TIC Device.""" import subprocess import logging import asyncio from threading import Thread import ruamel.yaml from mpf.core.utility_functions import Util class TicError(Exception): """A Pololu TIC Error.""" class PololuTiccmdWrapper: """A Pololu TIC Device.""" def __init__(self, serial_n...
itestlib.py
# Copyright 2011, 2012 SRI International # See LICENSE for other credits and copying information # Integration tests for stegotorus - library routines. import difflib import errno import os import re import shlex import socket import subprocess import threading import time TIMEOUT_LEN = 5 # seconds # Helper: stick ...
language.py
# coding: utf8 from __future__ import absolute_import, unicode_literals import atexit import random import itertools from warnings import warn from spacy.util import minibatch import weakref import functools from collections import OrderedDict from contextlib import contextmanager from copy import copy, deepcopy from ...
pyManager.pyw
""" OneLiner GUI tool for launching Python OlxAPI apps through the OneLiner menu command Tools | OlxAPI App Laucher. Note: Full file path of this Python program must be listed in OneLiner App manager setting in the Tools | User-defined command | Setup dialog box """ __author__ = "ASPEN Inc." __copyright__ = ...
trainer.py
import copy import warnings from typing import Optional import numpy as np from tqdm import tqdm import os import torch import torch.distributed as dist import torch.multiprocessing as mp from torch.nn.parallel import DistributedDataParallel from torch.cuda.amp import GradScaler, autocast from cogdl.wrappers.data_wr...
example_client.py
#! /usr/bin/env python from __future__ import print_function import os import signal import sys import threading import time import actionlib import actionlib_msgs.msg as actionlib_msgs import rospy import gcloud_speech_msgs.msg as gcloud_speech_msgs GoalStatus = actionlib_msgs.GoalStatus def SpeechToTextSimpleExa...
join_thread.py
# coding: utf-8 ######################################################################### # 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> # # author yeeku.H.lee kongyeeku@163.com # # # # version 1.0 ...
local_service_handler.py
# Copyright (c) 2020 PaddlePaddle 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 appli...
async_tools.py
import asyncio import functools from threading import Thread, enumerate import concurrent.futures def start_event_loop_new_thread() -> asyncio.AbstractEventLoop: """ Creates and starts a new event loop in a new thread Returns ------- loop : asyncio.AbstractEventLoop The newly created loop...
mobile_server.py
#!/usr/bin/env python # # Cloudlet Infrastructure for Mobile Computing # # Author: Kiryong Ha <krha@cmu.edu> # Zhuo Chen <zhuoc@cs.cmu.edu> # # Copyright (C) 2011-2013 Carnegie Mellon University # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in com...
tieba_sign.py
#!/usr/bin/env python3 #coding=utf-8 import hashlib import json import os import prettytable as pt import pyzbar.pyzbar as pyzbar import requests import time from io import BytesIO from PIL import Image from random import choice from threading import Thread class Tieba(object): def __init__(self, us...
oversee.py
import sys import json import paramiko import time from threading import Thread, Lock stdout_lock = Lock() def suckPipe(chan): while not chan.exit_status_ready() or chan.recv_ready(): if chan.recv_ready(): data = chan.recv(1024) stdout_lock.acquire() sys.stdout.write(data) stdout_lock.rel...
settings.py
""" Django settings for sandbox project. Generated by 'django-admin startproject' using Django 2.2.3. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import loggi...
videocaptureasync.py
# file: videocaptureasync.py import threading import cv2 class VideoCaptureAsync: def __init__(self, src=0, width=640, height=480): self.src = src self.cap = cv2.VideoCapture(self.src) self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, width) self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height) ...
mesh_client_test.py
from __future__ import absolute_import, print_function from unittest import TestCase, main import random import signal import sys import threading import traceback from mesh_client import MeshClient, MeshError, default_ssl_opts from fake_mesh.server import make_server def print_stack_frames(signum=None, frame=None): ...
threading.py
import asyncio import threading import datetime from queue import Queue from random import randint import re import sys import traceback import inspect from datetime import timedelta import logging import iso8601 from appdaemon import utils as utils from appdaemon.appdaemon import AppDaemon class Threading: def ...
definining_a_thread.py
import threading def function(i): print("function called by thread {}\n".format(i)) return threads = [] for i in range(5): # Instantiate a thread t = threading.Thread(target=function, args=(i,)) threads.append(t) # Start running thread t.start() # Makes the calling thr...
ghost.py
#!/usr/bin/env python3 # Copyright 2015 The Chromium OS 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 argparse import binascii import codecs import contextlib import ctypes import ctypes.util import fcntl import hashlib import...
clminer.py
import options, time import pyopencl as cl import numpy as np import threading, queue # load config config = options.Get() config.read() opencl_hash_count = config.opencl_hash_count_conf opencl_timeout = config.opencl_timeout_conf opencl_thread_multiplier = config.opencl_thread_multiplier_conf opencl_disable_device =...
test_util.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
server.py
from flask import Flask, jsonify, request, send_file from detectron2.config import get_cfg from detectron2.data.detection_utils import read_image from predictor import VisualizationDemo import numpy as np import cv2 import io import requests from queue import Empty, Queue import threading import time import json impor...
threadingmixin.py
#!/usr/bin/env python import socket import threading import SocketServer class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler): def handle(self): data = self.request.recv(1024) cur_thread = threading.current_thread() response = "{}: {}".format(cur_thread.name, data) sel...
runner.py
#!/usr/bin/env python3 # Copyright 2020 Google LLC # # 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...
server.py
import os import json import base64 import socket import sqlite3 import datetime from time import time, sleep from dkv import demez_key_values as dkv from uuid import uuid4, UUID from threading import Thread from api2.ftp_server import FTPServerAPI from api2.listener import SocketListener from api2.dir_tools import Cr...
ProjE_sigmoid.py
import argparse import math import os.path import timeit from multiprocessing import JoinableQueue, Queue, Process import numpy as np import tensorflow as tf class ProjE: @property def n_entity(self): return self.__n_entity @property def n_train(self): return self.__train_triple.shap...
YTMC.py
from youtube_dl import YoutubeDL import threading from tkinter import ( Tk, Label, Button, Menu, PanedWindow, Entry, HORIZONTAL, X, Y, BOTH, END, LEFT, RIGHT, DISABLED, NORMAL, ) class Youtube_To_MP3_Converter: def __init__(self): self.main_wi...
controller.py
#!/usr/bin/env python2 # Copyright 2018-present University of Tuebingen, Chair of Communication Networks # # 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/...
pytest_log_handler.py
""" pytest_log_handler ~~~~~~~~~~~~~~~~~~ Salt External Logging Handler """ import atexit import copy import logging import os import pprint import socket import sys import threading import traceback try: from salt.utils.stringutils import to_unicode except ImportError: # This likely due to running backwards ...
client.py
import requests import rsa import pickle import base64 from threading import Thread import time class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[...
agent.py
import __future__ import zipfile import io from urllib import urlopen import struct, time, base64, subprocess, random, time, datetime from os.path import expanduser from StringIO import StringIO from threading import Thread import os import sys import trace import shlex import zlib import threading import BaseHTTPServe...
invest.py
import tinvest import pandas as pd import requests import yfinance as yf import numpy as np import copy import time import traceback import logging from dataclasses import dataclass from datetime import datetime, timedelta from pathlib import Path from typing import Optional, Union, List, Dict, Iterable from threading...
tello1.py
""" Low end drone with a raspberry pi to connect i """ import threading import socket # Create a UDP socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('', 9000)) tello_address = ('192.168.10.1', 8889) def recv(): while True: try: data, server = sock.recvfrom(1518) ...
utils.py
# -*- coding: utf-8 -*- import json from tabulate import tabulate import pandas as pd from . import constants import itertools import logging import coloredlogs import time from multiprocessing import Process, Manager import numpy import requests import ast import os coloredlogs.install(level=logging.INFO) class Req...
test_threading.py
# Very rudimentary test of threading module import test.test_support from test.test_support import verbose import random import sys import threading import thread import time import unittest # A trivial mutable counter. class Counter(object): def __init__(self): self.value = 0 def inc(self): s...
__init__.py
import json import logging import time from .config import Config from .publisher import Publisher from .consumer import Consumer from multiprocessing import Process from flask import Flask, request, jsonify from flask import Flask, request, Response logger = logging.getLogger('GW: RabbitMQ app') def create_app(): ...
lisp-core.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain...
trainer.py
""" This class watches for updated encodings .pickle file from from retraining process and loads the new encodings. """ import os import sys import time import threading import pickle import numpy import logging import multiprocessing as mp from imutils import paths as imutils_paths from functools import partial fr...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test blinkhashd shutdown.""" from test_framework.test_framework import BlinkhashTestFramework from tes...
test_fleet_private_function.py
# Copyright (c) 2020 PaddlePaddle 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 appli...
core.py
from __future__ import print_function import tensorflow as tf import numpy as np import uuid from scipy import linalg from scipy.stats import truncnorm from scipy.misc import factorial import tensorflow as tf import shutil import socket import os import re import copy import sys import time import logging from collecti...
decision3.py
#!/usr/bin/env python #-*- coding:UTF-8 -*- import math import pygame import time import sensor_msgs.point_cloud2 as pc2 from sensor_msgs.msg import PointCloud2 import rospy from geometry_msgs.msg import Twist import threading from nav_msgs.msg import Odometry # 定义全局变量:地图中节点的像素大小 CELL_WIDTH = 12 # 单元格宽度 CELL_HEIGHT =...
test_cig_planet_vs_player.py
# Copyright 2019 The PlaNet 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 applicable...
pool.py
# # Module providing the `Pool` class for managing a process pool # # multiprocessing/pool.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # # Modifications Copyright (c) 2020 Uber Technologies """ *Pools* are supported by Fiber. They allow the user to manage a pool of worker...
before.py
import random import subprocess import time from threading import Condition, Event, Thread try: from psonic import * #from mcpi import block as block except: pass BlocksList = [1,2,3,4,5,7,12,13,14,15,16,17,18,20,21,22,24,41,42,45,46,47,49] WoolList = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] def PixelArt(N...
run_new.py
# -*- coding: utf-8 -*- # @Time : 2020/5/8 10:43 # @Author : liudongyang # @FileName: run_new.py # @Software: PyCharm import sys import os import time import zipfile import datetime from readConfig import RunConfig, Setting config = RunConfig() settings = Setting() from task_schedule import main1, main8, main9 f...
crawler.py
#!/usr/bin/env python3 import os import re import bs4 import lxml import asyncio import requests import threading import tldextract from datetime import date requests.packages.urllib3.disable_warnings() R = '\033[31m' # red G = '\033[32m' # green C = '\033[36m' # cyan W = '\033[0m' # white Y = '\033[33m' # yellow u...
timeevent.py
import datetime from utilities.date import * from threading import Thread class Alarm: def __init__(self, timeStr, action, periodic=False): self.time = dayTime(parseTime(timeStr)) self.periodic = periodic self.action = action self.over = False self.thread = None self.state = "pending" def check(self, t...
openvpn.py
import os import time import winreg as reg import subprocess from pathlib import Path import sys from threading import Thread, currentThread import psutil import socket ADAPTER_KEY = r'SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}' OpenVpnPath = "C:\\Program Files\\OpenVPN\\bin\\openv...
fall_detection.py
import sys sys.path.append('../') sys.path.append('../TensorFlow-2.x-YOLOv3') from yolov3.configs import * from yolov3.utils import load_yolo_weights, image_preprocess, postprocess_boxes, nms, draw_bbox, read_class_names from yolov3.yolov4 import Create_Yolo import tensorflow as tf import numpy as np import os from we...
ptf_runner.py
#!/usr/bin/env python2 # Copyright 2013-present Barefoot Networks, Inc. # Copyright 2018-present Open Networking Foundation # # 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.a...
stereo_camera.py
from stereo_camera.network_agent import ImageReceiver from stereo_camera.image_proc_tools import compute_disparity, process_stereo_image from stereo_camera.errors import * import cv2 import numpy as np import os import glob import psutil import time import matplotlib.pyplot as plt from threading import Thread, Event fr...
adbutil.py
import subprocess import re import threading ATRACE_PATH="/android/catapult/systrace/systrace/systrace.py" class AdbError(RuntimeError): def __init__(self, arg): self.args = arg def am(serial, cmd, args): if not isinstance(args, list): args = [args] full_args = ["am"] + [cmd] + args _...
gui-web.py
#!/usr/bin/env python import sys, argparse, threading, time, math, random, json, os import SimpleHTTPServer, SocketServer, Queue import pylibopenflow.openflow as openflow import pylibopenflow.output as output import pylibopenflow.of.msg as of_msg import pylibopenflow.of.simu as of_simu from pinpoint import Pinpointer...
Main.py
from help_modules import * from motor_control import * import pyaudio import wave import numpy as np import time import matplotlib.pyplot as plt import speech_recognition as sr from scipy import signal import math import threading import multiprocessing as ms import os import cv2 from nanpy import (ArduinoApi, SerialMa...
views.py
# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug # Copyright: (c) <spug.dev@gmail.com> # Released under the AGPL-3.0 License. from django.views.generic import View from django.db.models import F from django.conf import settings from django.http.response import HttpResponseBadRequest from django_...
process_utils.py
from numpy.core.shape_base import stack from RobotTask import RobotTask import json from scipy.signal.ltisys import StateSpace from VisualTaskEnv import VisualTaskEnv from isaac import * import time import numpy as np from threading import Thread from utils import * import torch from PyController import PyController f...
sessions.py
"""Session classes for the :mod:`pytan` module.""" from builtins import str from builtins import object import json import logging import os import re import string import sys import threading import time from base64 import b64encode from datetime import datetime try: import xml.etree.cElementTree as ET except Ex...
afhmm_sac.py
from __future__ import print_function, division from warnings import warn import pandas as pd import numpy as np from nilmtk.disaggregate import Disaggregator from hmmlearn import hmm from collections import OrderedDict import cvxpy as cvx from collections import Counter import matplotlib.pyplot as plt import time f...
recorder.py
import matplotlib matplotlib.use('TkAgg') # THIS MAKES IT FAST! import numpy import scipy import struct import pyaudio import threading import pylab import struct class SwhRecorder: """Simple, cross-platform class to record from the microphone.""" def __init__(self): """minimal garb is executed when c...
test_browser.py
# coding=utf-8 # Copyright 2013 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. import argparse import json import multiprocessing imp...
servoTest_loop_thread.py
#from: http://www.toptechboy.com/tutorial/beaglebone-black-lesson-6-control-pwm-signals-on-gpio-pins-from-python/ import Adafruit_BBIO.PWM as PWM from time import sleep import threading #import Adafruit_BBIO.GPIO as GPIO #from Adafruit_BBIO.PWM import PWM #GPIO.setup("P8_13", GPIO.OUT) steps = 7 SERVO_1="P9_14" SERV...
nsca-helper-daemon.py
import os import sys import web import simplejson import utils from __exceptions__ import formattedException ''' Requires: web.py --> http://webpy.org/ ''' import threading __version__ = '1.0.0' import logging from logging import handlers __PROGNAME__ = os.path.splitext(os.path.basename(sys.a...
test_stream_roster.py
# -*- encoding:utf-8 -*- from __future__ import unicode_literals import unittest from sleekxmpp.exceptions import IqTimeout from sleekxmpp.test import SleekTest import time import threading class TestStreamRoster(SleekTest): """ Test handling roster updates. """ def tearDown(self): self.stre...
pika_consumer.py
# -*- coding: utf-8 -*- import logging import pika from flask import Flask import time import threading import atexit LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) ' '-35s %(lineno) -5d: %(message)s') LOGGER = logging.getLogger(__name__) class ExampleConsumer(object): """Th...
test_leaks.py
import unittest import sys import gc import weakref import greenlet import threading class ArgRefcountTests(unittest.TestCase): def test_arg_refs(self): args = ('a', 'b', 'c') refcount_before = sys.getrefcount(args) g = greenlet.greenlet( lambda *args: greenlet.getcurrent().pa...
hello.py
from flask import Flask, render_template, url_for, session, redirect, request from flask_bootstrap import Bootstrap from flask_script import Manager, Command, Shell from flask_moment import Moment from datetime import datetime from flask_wtf import Form from wtforms import StringField, BooleanField, SubmitField, Passwo...
upgrade_test.py
#!/usr/bin/env python3 from argparse import ArgumentParser, RawDescriptionHelpFormatter import glob import os from pathlib import Path import platform import random import shutil import stat import subprocess import sys from threading import Thread, Event import traceback import time from urllib import request import ...
athenad.py
#!/usr/bin/env python3 import base64 import hashlib import io import json import os import sys import queue import random import select import socket import threading import time from collections import namedtuple from functools import partial from typing import Any import requests from jsonrpc import JSONRPCResponseM...
test_dist_train.py
# Copyright (c) 2018 PaddlePaddle 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 app...
test.py
#!/usr/bin/env python # # Copyright 2008 the V8 project 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 # noti...
proc_multi.py
from multiprocessing import Process def f(name): print("hello", name) p = Process(target=f, args=("Bob",)) p.start() p.join()
test_mp_plugin.py
import sys from nose2 import session from nose2.plugins.mp import MultiProcess, procserver from nose2.plugins import buffer from nose2.plugins.loader import discovery, testcases from nose2.tests._common import FunctionalTestCase, support_file, Conn from six.moves import queue import multiprocessing import threading im...
run_ogusa.py
import ogusa import os import sys from multiprocessing import Process import time #OGUSA_PATH = os.environ.get("OGUSA_PATH", "../../ospc-dynamic/dynamic/Python") #sys.path.append(OGUSA_PATH) from ogusa.scripts import postprocess #from execute import runner # change here for small jobs from ogusa.scripts.execute_larg...
firedrop_script.py
import urllib2 import mechanize from bs4 import BeautifulSoup import cookielib import time import re import requests from requests import Request, Session from tqdm import tqdm from threading import Thread import Queue import argparse def run(enter_url,enter_filename,enter_pw): print 'Welcome to fir...
Simple_t.py
# system modules import cherrypy from cheroot.test import webtest from cherrypy import expose from multiprocessing import Process # WMCore modules from WMCore.REST.Auth import user_info_from_headers from WMCore.REST.Test import setup_dummy_server, fake_authz_headers from WMCore.REST.Test import fake_authz_key_file fro...
lab12_d.py
from sys import setrecursionlimit import threading setrecursionlimit(10 ** 9) threading.stack_size(3 * 67108864) def main(): def cover(): nonlocal i, j while i >= 0 and j >= 0 and j < m: moves = 0 for step in [[1, -2], [-2, 1], [-1, -2], [-2, -1]]: di, dj = s...
test_fft.py
import functools import numpy as np import pytest import cupy from cupy.fft import config from cupy.fft._fft import (_default_fft_func, _fft, _fftn, _size_last_transform_axis) from cupy import testing from cupy.testing._loops import _wraps_partial @pytest.fixture def skip_forward_backward...
sem_walk.py
#!/usr/bin/env python3 from ev3dev2.motor import MediumMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent, MoveSteering from ev3dev2.sound import Sound from ev3dev2.sensor import INPUT_1, INPUT_2, INPUT_3, INPUT_4 from ev3dev2.sensor.lego import InfraredSensor, ColorSensor, TouchSensor from time import sleep i...
MultiCast.py
# -- coding: utf-8 -- import sys import threading import msvcrt from ctypes import * sys.path.append("../MvImport") from MvCameraControl_class import * g_bExit = False # 为线程定义一个函数 def work_thread(cam=0, pData=0, nDataSize=0): stFrameInfo = MV_FRAME_OUT_INFO_EX() memset(byref(stFrameInfo), 0, sizeof(stFrame...
graphics.py
import numpy as np from PIL import Image import time import threading def save_image(x, path): im = Image.fromarray(x) im.save(path, optimize=True) return # Assumes [NCHW] format def save_raster(x, path, rescale=False, width=None): t = threading.Thread(target=_save_raster, args=(x, path, rescale, wid...
results.py
from toolset.utils.output_helper import log import os import subprocess import uuid import time import json import requests import threading import re import math import csv import traceback from datetime import datetime # Cross-platform colored text from colorama import Fore, Style class Results: def __init__(...
http.py
# -*- coding: utf-8 -*- """ This module contains some helpers to deal with the real http world. """ import threading import logging import select import socket import time import os import six import webob from six.moves import http_client from waitress.server import TcpWSGIServer def get_free_port(): s = socke...
eventloop.py
# Copyright 2021 Bluefog Team. 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...
JobRunner.py
import logging import os import signal import socket from multiprocessing import Process, Queue from queue import Empty from socket import gethostname from time import sleep as _sleep from time import time as _time import requests from clients.authclient import KBaseAuth from clients.execution_engine2Client import exe...
test_lookup_remote_table_op.py
# Copyright (c) 2018 PaddlePaddle 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 app...
test_gauge.py
"""Unit tests for gauge""" from collections import namedtuple import random import re import shutil import tempfile import threading import time import os import unittest from unittest import mock from http.server import HTTPServer, BaseHTTPRequestHandler import yaml import requests from requests.exceptions import ...
20xiechengyibu.py
# -*- coding:utf-8 -*- import time import threading # yield 关键字的作用挂起函数,并且将函数右面的返回 gen_model = None def new_long_io(): # 接受一个函数作为参数 def func(): """执行完线程的方法调用回调函数""" global gen_model print("开始耗时操作~~~~~~~~~~~~~") time.sleep(5) print("结束耗时操作~~~~~~~~~~~~~~") r...
server.py
#!/usr/bin/env python3 import logging import socket import threading from rfc5389stunserver.constants import MsgClass, MethodType, AttrType from rfc5389stunserver.parser import Parser from rfc5389stunserver.stun_header import STUNHeader logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) d...
lazy_process.py
import subprocess import threading import time class LazyProcess: """Abstraction describing a command line launching a service - probably as needed as functionality is accessed in Galaxy. """ def __init__(self, command_and_args): self.command_and_args = command_and_args self.thread_lo...
resourcedirectory_test.py
import unittest import threading import socket import re import random from time import sleep from coapthon.resource_directory.resourceDirectory import ResourceDirectory from coapthon.messages.response import Response from coapthon.messages.request import Request from coapthon import defines from coapthon.serializer im...
TServer.py
from six.moves import queue import logging import os import threading from thrift.protocol import TBinaryProtocol from thrift.transport import TTransport logger = logging.getLogger(__name__) class TServer(object): def __init__(self, *args): if (len(args) == 2): self.__initArgs__(args[0], args[1]...
timed_subprocess.py
""" For running command line executables with a timeout """ import shlex import subprocess import threading import salt.exceptions import salt.utils.data import salt.utils.stringutils class TimedProc: """ Create a TimedProc object, calls subprocess.Popen with passed args and **kwargs """ def __init...
get_data.py
import requests import csv import time import json from collections import * from api_scrape_util import * import threading import sys def get_data(slug, supress_output): tourn_info = get_tournament_info(slug) event_phases = tourn_info['phases_per_event'] phase_groups = tourn_info['groups_per_p...
test_integration_using_async_flow.py
import json import time from http import HTTPStatus from threading import Thread from typing import Union, List, Optional from unittest import TestCase from uuid import uuid4 import requests from requests.auth import HTTPBasicAuth from openbrokerapi import api, errors from openbrokerapi.catalog import ServicePlan fro...
concurrency.py
# -*- coding: utf-8 -*- # # Copyright (C) 2010-2018 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.org/wiki/TracLicense. # # This software consi...
ssd_model.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...