source
stringlengths
3
86
python
stringlengths
75
1.04M
tool.py
#!/usr/bin/env python3 ## # 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 ...
tests.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
BasicHttpAgent.py
# pip3 install requests Flask from ..IOAgent import IOAgent from abc import ABC from http.server import HTTPServer, BaseHTTPRequestHandler from http.client import HTTPSConnection, HTTPConnection from base64 import b64encode import sseclient import requests import threading import platform import subprocess import ...
takana.py
import sublime, sublime_plugin, time, os.path, json, threading, sys, socket, time from threading import Thread try: import socketserver except ImportError: import SocketServer as socketserver VERSION = "Takana plugin v0.4" DEBUG = False TAKANA_SERVER_PORT = 48628 st_ver = 3000 ...
waitingbar.py
#!/usr/bin/env python3 import sys import threading import time from itertools import cycle class WaitingBar(object): ''' This class prints a fancy waiting bar with Greek chars and spins. It uses a thread to keep printing the bar while the main program runs Usage: THE_BAR = WaitingBar('Your Mes...
environment.py
import threading from wsgiref import simple_server from handlers import app from config import session from repo import Repo def clear_database(): with session() as db: repo = Repo(db) repo.clear_database() db.commit() def before_all(context): context.host = 'localhost' context....
mailer.py
from flask import render_template from flask_mail import Message from threading import Thread from app import mail from app import webapp from app.decorators import async from premailer import Premailer, transform from app.models import Utils class Mailer(): @staticmethod def send_async_mail(webapp, email): ...
Rabbit_Base.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2017 In-Q-Tel, Inc, 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.or...
test_isp.py
# -*- coding: utf-8 -*- """ Alle in isp befindlichen Klassen und Funktionen prüfen. Alle Laufzeit Fehlermeldungen sind bei der Testausführung gewollt Nach der Ausführung steht am Ende OK wenn alle Tests durchgefürt wurden. Bei Fehlern in den Überprüfungen steht am Ende:: =====================================...
test_basic.py
# -*- coding: utf-8 -*- """ tests.basic ~~~~~~~~~~~~~~~~~~~~~ The basic functionality. :copyright: 2010 Pallets :license: BSD-3-Clause """ import re import sys import time import uuid from datetime import datetime from threading import Thread import pytest import werkzeug.serving from werkzeug.ex...
newdes.py
import threading import time import altair import numpy as np from IPython.core.display_functions import display from brainflow.board_shim import BoardShim, BrainFlowInputParams, BoardIds import pandas as pd import tkinter as tk from tkinter import filedialog from queue import Queue from threading import Thread from p...
labels.py
import hashlib import requests import threading import json import sys import traceback import base64 import electrum_seci from electrum_seci.plugins import BasePlugin, hook from electrum_seci.i18n import _ class LabelsPlugin(BasePlugin): def __init__(self, parent, config, name): BasePlugin.__init__(...
BuildReport.py
## @file # Routines for generating build report. # # This module contains the functionality to generate build report after # build all target completes successfully. # # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made a...
autoreload.py
import functools import itertools import logging import os import signal import subprocess import sys import threading import time import traceback import weakref from collections import defaultdict from pathlib import Path from types import ModuleType from zipimport import zipimporter from django.apps import apps fro...
telem_main.py
from multiprocessing import Process, Queue from main_telem import telem_tools import time import numpy as np GLOBAL_WINDOW_SIZE = 1000 def data_read_daemon(queue, ringbuf): """ Data reading process (psuedo-daemon) Fills up window data, then triggers window analysis process """ window_counter ...
DyStockBackTestingStrategyEngineProxy.py
import multiprocessing import threading import queue from .DyStockBackTestingStrategyEngineProcess import * from Stock.Config.DyStockConfig import DyStockConfig class DyStockBackTestingStrategyEngineProxy(threading.Thread): """ 以进程方式启动一个周期的策略回测 """ def __init__(self, eventEngine): super().__init__()...
ppo_continuous_multiprocess.py
''' PPO ''' import math import random import gym import numpy as np import torch torch.multiprocessing.set_start_method('forkserver', force=True) # critical for make multiprocessing work import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.distributions import Normal, Multiva...
_cpthreadinglocal.py
# This is a backport of Python-2.4's threading.local() implementation """Thread-local objects (Note that this module provides a Python version of thread threading.local class. Depending on the version of Python you're using, there may be a faster one available. You should always import the local class from threa...
deepctr.py
import multiprocessing import tensorflow as tf import tef import tef.ops import tef.training batch_queue = multiprocessing.Queue(maxsize=5000) def load_data(): global batch_queue with open("data.txt") as fp: for line in fp.readlines(): columns = line.split(",") assert len(col...
ocl_ga_client.py
#!/usr/bin/python3 import traceback import argparse import pickle import pyopencl as cl from pyopencl import device_info as di import random import tempfile import time import uuid from multiprocessing import Process, Pipe, Value, Event from .ocl_ga import OpenCLGA from .utilities.generaltaskthread import Logger from ...
context_and_start_methods_01_spawn_01.py
import multiprocessing as mp import os def processes_info() -> None: print(f'\nprocess id \t\t-> {os.getpid()}') print(f'\nparent process id \t-> {os.getppid()}') def target_function() -> None: processes_info() if __name__ == '__main__': # should not be used more than once in the program. mp.set_start_met...
script_run_bg.py
# Snippet import threading # Run a script function in a separate thread def run_bg(target_func, args): t = threading.Thread(target=target_func, args=args) t.start() # End snippet
test_add_vectors.py
import time import threading import logging import threading from multiprocessing import Pool, Process import pytest from milvus import IndexType, MetricType from utils import * dim = 128 index_file_size = 10 collection_id = "test_add" ADD_TIMEOUT = 60 tag = "1970-01-01" add_interval_time = 1.5 nb = 6000 class Test...
is_bst_hard.py
# python3 """ You are given a binary tree with integers as its keys. You need to test whether it is a correct binary search tree For example binary tree shown below is considered as INCORRECT 2 / \ 2 2 but binary tree 2 / \ 1 2 is considered as CORRECT Recursive in-order DFS tra...
sync_server.py
#!/usr/bin/env python3 # coding: utf-8 import multiprocessing import os import sys import time from pypi_top_packages_async import get_from_pypi from http.server import SimpleHTTPRequestHandler as Handler from http.server import HTTPServer as Server start = time.time() MAX_PKGS = 200 # Read port selected by the cl...
videoio.py
from pathlib import Path from enum import Enum from collections import deque from urllib.parse import urlparse import subprocess import threading import logging import cv2 LOGGER = logging.getLogger(__name__) WITH_GSTREAMER = False class Protocol(Enum): IMAGE = 0 VIDEO = 1 CSI = 2 V4L2 = 3 RT...
__main__.py
#!/usr/bin/env python3 import argparse from datetime import timedelta, datetime import io import itertools as it import json import multiprocessing as mp import multiprocessing.dummy as mp_dummy import os import os.path as path import sys from time import strptime, strftime, mktime import urllib.request from glob impo...
server.py
''' Server Side code ''' from socket import AF_INET, socket, SOCK_STREAM from threading import Thread def accept_incoming_connections(): """Sets up handling for incoming clients.""" while True: client, client_address = SERVER.accept() print("%s:%s has connected." % client_address) cl...
test_remote_datatypes.py
import pytest import random import time from threading import Thread from assemblyline.common.uid import get_random_id # noinspection PyShadowingNames def test_hash(redis_connection): if redis_connection: from assemblyline.remote.datatypes.hash import Hash with Hash('test-hashmap') as h: ...
21-xspress3.py
from ophyd.device import (Component as Cpt) from hxntools.detectors.xspress3 import (Xspress3FileStore, Xspress3Channel) from hxntools.detectors.hxn_xspress3 import HxnXspress3DetectorBase import threading from ophyd import DeviceStatus class HxnXspress3Detector(HxnXspress3Det...
manage_athenad.py
#!/usr/bin/env python3 import time from multiprocessing import Process from common.params import Params from selfdrive.manager.process import launcher from system.swaglog import cloudlog from system.version import get_version, is_dirty ATHENA_MGR_PID_PARAM = "AthenadPid" def main(): params = Params() dongle_id...
write_hdf5.py
import threading import queue import h5py import time import os from .folder_functions import UserPath class StreamToHDF5(UserPath): def __init__(self, image_width: int, image_height: int, steering_max: int, steering_min: int, t...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
bot.py
import ssl import logging from threading import Thread from irc.client import NickMask from irc.connection import Factory from irc.bot import SingleServerIRCBot, ExponentialBackoff from irclogger.channel import Channel log = logging.getLogger("irc-logger") RECONNECT_TIMEOUT = 10 def handle_client(bot, f): whi...
imthread.py
import threading, time t_index = 0 class multi_threading(): def __init__(self, processing_func, max_threads=10): assert type(max_threads) == int, 'max_threads value should be an integer' assert max_threads >0, 'max_threads value cannot be less than 1' self.process = processing_func ...
cmd_runner_rabbit.py
# Build and run the executable as part of a rabbit runner. import sys import pika import json import os import shutil import logging import threading import base64 import zipfile import tempfile def check_log_file_for_fatal_errors(lines): '''Return true if the log file contains a fatal error that means we should ...
filemanager.py
""" Components/File Manager ======================= A simple manager for selecting directories and files. Usage ----- .. code-block:: python path = '/' # path to the directory that will be opened in the file manager file_manager = MDFileManager( exit_manager=self.exit_manager, # function called wh...
AsyncProcessing.py
import multiprocessing import os _lastMultiProcessId = -1 # Start of our initial id class MultiProcess(): """Initiates a single process using a unique id as a distinguisher and the target is the function being called. """ def __init__(self, Id: int = 0): """Initiates a Multiprocess object...
PyInterpreter.py
from StudentRunner import StudentRunner from FullRunner import FullRunner from translate import tr import multiprocessing as mp import tkinter as tk import tokenize import sys RUN_POLL_DELAY=250 class InterpreterProxy: """ This is a multiprocessing proxy for the underlying python interpreter. """ ...
training.py
from __future__ import print_function from __future__ import absolute_import import warnings import copy import time import numpy as np import multiprocessing import threading from collections import namedtuple import six try: import queue except ImportError: import Queue as queue from .topology import Cont...
test_engine_py3k.py
import asyncio from sqlalchemy import Column from sqlalchemy import create_engine from sqlalchemy import delete from sqlalchemy import event from sqlalchemy import exc from sqlalchemy import func from sqlalchemy import inspect from sqlalchemy import Integer from sqlalchemy import select from sqlalchemy import String f...
analyzer_batch.py
from __future__ import division import logging try: from Queue import Empty except: from queue import Empty 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...
client.py
__author__ = 'tanel' import argparse from ws4py.client.threadedclient import WebSocketClient import time import threading import sys import urllib import queue as Queue #from multiprocessing import Queue import json import time import os def rate_limited(maxPerSecond): minInterval = 1.0 / float(maxPerSecond) ...
proxyserver.py
#!/usr/bin/env python3 import socket from types import ModuleType import sys import threading import logging from collections import OrderedDict, namedtuple import asyncio import errno import base64 HOST = "127.0.0.1" PORT = 9995 LISTEN = 10 FAILURE = 1 MAX_REQUEST_BYTES = 8192 # HTTP 1.1 logging.basicConfig(format=...
lambda_executors.py
import os import re import json import time import logging import threading import subprocess from multiprocessing import Process, Queue try: from shlex import quote as cmd_quote except ImportError: from pipes import quote as cmd_quote # for Python 2.7 from localstack import config from localstack.utils.aws im...
client.py
import socket from threading import Thread import config from utils import recv, log, info, spawn class Client: def __init__(self): self.c = socket.socket(2, 2) self.c.bind(config.client_listen_addr) self.game_addr = None def relay(self, tcp_conn, udp_conn): whi...
vms_async_slave.py
# coding: utf-8 #------------------------------ # 计划任务 #------------------------------ import sys import os import json import time import threading import subprocess import shutil import base64 sys.path.append("/usr/local/lib/python2.7/site-packages") import psutil sys.path.append(os.getcwd() + "/class/core") rel...
dispatch.py
import threading import Queue import traceback def request_results(func, args=(), kwargs={}): # prepare request results = Queue.Queue() func_args = (args, kwargs) instruct = func, func_args, results # ask the thread worker = threading.Thread(target=_compute_results_, args=instruct) worker...
test__xxsubinterpreters.py
from collections import namedtuple import contextlib import itertools import os import pickle import sys from textwrap import dedent import threading import time import unittest from test import support from test.support import script_helper interpreters = support.import_module('_xxsubinterpreters') ##############...
ebs_stress.py
#!/usr/bin/python # # # Description: This script encompasses test cases/modules concerning stressing EBS specific actions and # features for Eucalyptus. # ########################## # # # Test Cases # # # ########################## # # [EbsStress]...
WebServer.py
# coding=utf-8 import threading import os server = None web_server_ip = "0.0.0.0" web_server_port = "8000" web_server_template = "www" def initialize_web_server(config): ''' Setup the web server, retrieving the configuration parameters and starting the web server thread ''' global web_server_ip, ...
ui.py
#!/usr/bin/python3 import sys, os import signal if getattr(sys, "frozen", False): print(sys._MEIPASS) from PyQt5.QtCore import pyqtProperty, QObject, QUrl, pyqtSlot, pyqtSignal from PyQt5.QtCore import QAbstractListModel, QSortFilterProxyModel, QTimer from PyQt5.QtGui import QGuiApplication, QClipboard, QIcon fr...
musicBrainz.py
import json import threading from queue import Queue from io import StringIO from urllib import request import arrow import musicbrainzngs from resources.common import * from searchEngines.searchEngineBase import SearchEngineBase, ThreadData from searchEngines.models.Artist import Artist, ArtistType from searchEngines....
import_thread.py
from collections import defaultdict import threading import traceback import redis import ray from ray import ray_constants from ray import cloudpickle as pickle from ray import profiling from ray import utils import logging logger = logging.getLogger(__name__) class ImportThread: """A thread used to import e...
eval_mini_srcgame_worldmodel.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function USED_DEVICES = "0,1,2,3" import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES import sys import threading import time import tensorflow as tf from absl im...
app_mt.py
''' Copyright 2020 Xilinx Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distr...
p01_start_stop_thread.py
import time def countdown(n): while n > 0: print('T-minus', n) n -= 1 time.sleep(5) # Create and launch a thread from threading import Thread t = Thread(target=countdown, args=(10,)) t.start() if t.is_alive(): print('Still running') else: print('Completed') t.join() t = Threa...
test_failure_2.py
import json import logging import os import signal import sys import threading import time import numpy as np import pytest import ray from ray.experimental.internal_kv import _internal_kv_get from ray.autoscaler._private.util import DEBUG_AUTOSCALING_ERROR import ray._private.utils from ray.util.placement_group impo...
test_pipeline_funcs.py
from base import async_insert, pipeline, clean_db import getpass import psycopg2 import threading import time def test_combine_table(pipeline, clean_db): pipeline.create_stream('s', x='int') pipeline.create_cv('combine_table', 'SELECT x::int, COUNT(*) FROM s GROUP BY x') values = [(i,) for...
viewing.py
#A* ------------------------------------------------------------------- #B* This file contains source code for the PyMOL computer program #C* Copyright (c) Schrodinger, LLC. #D* ------------------------------------------------------------------- #E* It is unlawful to modify or remove this copyright notice. #F* --------...
live_display.py
#!/usr/bin/env python3 import argparse import time import threading import os import sys import gi gi.require_version("Gtk", "3.0") gi.require_version("GdkPixbuf", "2.0") from gi.repository import Gtk, GdkPixbuf, GLib, GObject SRC_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), "src")...
try_login_case.py
# -*- coding: utf-8 -*- # @Author : xiaoke # @Email : 976249817@qq.com import unittest from time import sleep from business.login_business import LoginBusiness import sys, traceback from base.login_exception import LoginException # 第一种方式解决,# 第二种使用元类解决 # 第三种采用一个函数即可实现 class ParameTestCase(unittest.Test...
process_mixin.py
# Copyright 2020 Pax Syriana Foundation. Licensed under the Apache License, Version 2.0 # import time from abc import ABCMeta from abc import abstractmethod from multiprocessing import Process from multiprocessing.managers import BaseManager from via_common.multiprocess.logger_manager import LoggerManager from via_co...
test_tcp.py
# -*- coding: utf-8 -*- """ :codeauthor: Thomas Jackson <jacksontj.89@gmail.com> """ from __future__ import absolute_import, print_function, unicode_literals import logging import socket import threading import salt.config import salt.exceptions import salt.ext.tornado.concurrent import salt.ext.tornado.gen impor...
irSensor.py
import RPi.GPIO as GPIO import time import threading from SAN.sensorDataEntry import SensorDataEntry gpioPin = 23 class IrSensor(SensorDataEntry): def __init__(self): SensorDataEntry.__init__(self) GPIO.setmode(GPIO.BCM) GPIO.setup(gpioPin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) self._objectPresence = None ...
routes.py
"""Define main application routes.""" import os import sys import openpyxl from datetime import datetime from collections import OrderedDict from flask import render_template, redirect, url_for, request, jsonify, current_app, session from flask_login import current_user, login_required from wtforms import StringField, ...
datasets.py
import glob import math import os import random import shutil import time from pathlib import Path from threading import Thread import cv2 import numpy as np import torch from PIL import Image, ExifTags from torch.utils.data import Dataset from tqdm import tqdm from utils.utils import xyxy2xywh, xywh2xyxy help_url =...
messenger.py
# ----------- # Messenger # Credits: JuNi4 (https://github.com/JuNi4/CLOS) # ----------- # # Example Commands: # messenger -server -client -listserver # Server example: python3 messenger.py -s -els -lsip 127.0.0.1 -ecl -name Server # list Server: python3 messenger.py -ls # client python3 messenger.py -c...
update_rate.py
import pglive.examples_pyqt6 as examples from math import ceil from threading import Thread import pyqtgraph as pg from pglive.sources.data_connector import DataConnector from pglive.sources.live_plot import LiveHBarPlot from pglive.sources.live_plot_widget import LivePlotWidget """ In this example, different update...
algo_two.py
from functools import reduce import numpy as np import random as r import socket import struct import subprocess as sp import threading from threading import Thread import ast import time import datetime as dt import os import psutil from netifaces import interfaces, ifaddresses, AF_INET import paho.mqtt.client as mqtt...
dataset.py
import glob import pickle import sys import os import gc import time import ujson as json import tarfile from typing import Iterable, List, Dict, Union, Tuple import multiprocessing import threading import queue from tqdm import tqdm import numpy as np from utils import nn_util from utils.ast import AbstractSyntaxTre...
hevserver.py
#!/usr/bin/env python3 # data server to manage comms between UIs and LLI # # Author: Dónal Murray <donal.murray@cern.ch> import asyncio import json import time import threading import argparse import svpi import hevfromtxt import commsControl from commsConstants import PAYLOAD_TYPE, CMD_TYPE, CMD_GENERAL, CMD_SET_TIME...
test_communicator.py
# Copyright 2021 Fedlearn 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 writi...
bot2.py
#! /usr/bin/env python # responde a comandos import os from telegram.ext import Updater, CommandHandler import threading from io import BytesIO from PIL import Image import cv2 as cv from umucv.stream import Camera from dotenv import load_dotenv load_dotenv() updater = Updater(os.environ['TOKEN']) Bot = updater....
manager.py
#!/usr/bin/env python3 import os import time import sys import fcntl import errno import signal import shutil import subprocess import datetime import textwrap from typing import Dict, List from selfdrive.swaglog import cloudlog, add_logentries_handler from common.basedir import BASEDIR, PARAMS from common.android impo...
Server.py
import socket, threading HOST = "127.0.0.1" PORT = 9999 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((HOST, PORT)) server.listen() clients = [] nicknames = [] # broadcast func def broadcast(message): for client in clients: client.send(message) # handle fun...
midi.py
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- """ LJay/LJ v0.7.0 Midi Handler Deprecated, see midi3 by Sam Neurohack from /team/laser """ print "importing midi 0" import time import rtmidi from rtmidi.midiutil import open_midiinput from threading import Thread from rtmidi.midiconstants import (CHANNEL_PRESSURE...
bulldog_vision_10.py
#!/usr/bin/env python3 #!coding=utf-8 import rospy import numpy as np import PIL.Image as pilimage import actionlib from sensor_msgs.msg import CompressedImage from sensor_msgs.msg import Image from std_msgs.msg import Float64 from cv_bridge import CvBridge, CvBridgeError import cv2 import time from yolo import YOLO fr...
chess_link_usb.py
""" ChessLink transport implementation for USB connections. """ import logging import threading import time import chess_link_protocol as clp try: import serial import serial.tools.list_ports usb_support = True except ImportError: usb_support = False class Transport(): """ ChessLink transpor...
road_speed_limiter.py
import json import os import select import threading import time import socket import fcntl import struct from threading import Thread from cereal import messaging from common.numpy_fast import clip from common.realtime import sec_since_boot from selfdrive.config import Conversions as CV CAMERA_SPEED_FACTOR = 1.05 c...
test_hq.py
import os import sys import unittest import shutil import json from multiprocessing import Process from oct_turrets.turret import Turret from oct_turrets.utils import load_file, validate_conf from oct.core.hq import get_hq_class, HightQuarter from oct.utilities.run import run from oct.utilities.commands import main B...
interfaz.py
import curses from time import sleep import proyecto2 as pyt2 import config as c from threading import Semaphore, Thread def menu(): #Se inicia pantalla, se obtienen dimensiones de la consola scr = curses.initscr() curses.noecho() dims = scr.getmaxyx() hilosCorriendo = False q = -1 while q != 113 and q != 8...
ipPortScan3.py
import optparse import socket import threading ''' 端口扫描 ''' #定义一个信号量 screenLock = threading.Semaphore(value=1) def connScan(tgtHost,tgtPort): try: connSkt = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connSkt.connect((tgtHost, tgtPort)) connSkt.send('ViolentPython\r\n') res...
mycrawl.py
import requests import multiprocessing as mp import re import os import csv import time import random import json from bs4 import BeautifulSoup from random import choices local_proxies = { "http": "http://127.0.0.1:1080", "https": "http://127.0.0.1:1080", } proxy_url = "http://free-proxy-list.net/" headers = {...
NodeManager.py
#!/usr/bin/python2.7 # -*- coding:utf-8 -*- # Author: NetworkRanger # Date: 2019/1/28 3:38 PM from multiprocessing.managers import BaseManager import time from multiprocessing import Process, Queue from DataOutput import DataOutput from UrlManager import UrlManager class NodeManager(object): def start_Manag...
test_csv.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...
zsmeif.py
#!/usr/bin/python # -*- coding: UTF-8 -*- """ AiSpeech/main.py ~~~~~ :copyright:facegood © 2019 by the tang. """ import os import sys import time from os.path import abspath, dirname, join import codecs import json # ******************************************* # *******************************************...
test_autoreconnect.py
import os import time import unittest from threading import Event, Thread import socks import sys from meross_iot.cloud.client_status import ClientStatus from meross_iot.cloud.devices.power_plugs import GenericPlug from meross_iot.cloud.exceptions.CommandTimeoutException import CommandTimeoutException from meross_iot....
process.py
# -*- coding: utf-8 -*- import ansicolor from contextlib import contextmanager import getpass import os import psycopg2 import re import requests import pexpect import signal import socket import subprocess import sys import threading import time from typing import Optional from .utils import PROCESS_TERMINATED, PRO...
tests.py
# -*- coding: utf-8 -*- # Unit and doctests for specific database backends. from __future__ import unicode_literals import datetime import re import threading import unittest import warnings from decimal import Decimal, Rounded from django.core.exceptions import ImproperlyConfigured from django.core.management.color ...
test_connection.py
# Copyright DataStax, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softwa...
test_lock.py
""" TestCases for testing the locking sub-system. """ import time import unittest from .test_all import db, test_support, verbose, have_threads, \ get_new_environment_path, get_new_database_path if have_threads : from threading import Thread import sys if sys.version_info[0] < 3 : from th...
thread.py
__author__ = 'tinglev@kth.se' from threading import Thread, Event, current_thread import threading class SyncThread(Thread): def __init__(self, target): super(SyncThread, self).__init__(target=target, name='SyncThread') self._stop_event = Event() def stop(self): self._stop_event.set(...
uniprot_master_parser.py
""" This file parses the uniprot FTP file and can do various things. such as making a small one that is only human. But mainly the `UniprotMasterReader.convert('uniprot_sprot.xml')` method whcih generates the JSON files required. In future these will be databases... Be warned that ET.Element is a monkeypatched version....
server.py
#!/usr/bin/env python3 from __future__ import print_function import base64 import copy import hashlib import json import logging import os import pkgutil import random import signal import ssl import string import subprocess import sys import time from typing import List import urllib3 import requests import socket...
socket_manager.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import errno import logging import json import threading import time from queue import PriorityQueue, Empty import webso...
WebcamVideoStream.py
# import the necessary packages from threading import Thread import cv2 class WebcamVideoStream: def __init__(self, src=0): # initialize the video camera stream and read the first frame # from the stream self.stream = cv2.VideoCapture(src) (self.grabbed, self.frame) = self.stream.read() # initialize the ...
role_maker.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 app...
process_tester.py
import multiprocessing def tester(command_q, result_q): while True: op, cmd = command_q.get() try: if op == 'terminate': break if op == 'exec': exec(cmd) result_q.put((0, None)) if op == 'eval': res...
handlers.py
import ast import datetime import json import logging import copy from django.http import HttpResponse from multiprocessing import Process from threading import Thread, local try: from mongoengine.base import ValidationError except ImportError: from mongoengine.errors import ValidationError from multiprocess...