source
stringlengths
3
86
python
stringlengths
75
1.04M
depthai_record.py
#!/usr/bin/env python3 from pathlib import Path from multiprocessing import Queue from threading import Thread import depthai as dai from enum import Enum import cv2 class EncodingQuality(Enum): BEST = 1 # Lossless MJPEG HIGH = 2 # MJPEG Quality=97 (default) MEDIUM = 3 # MJPEG Quality=93 LOW = 4 # H265...
pktgen.py
#!/usr/bin/python ###################################################### # Copyright (C) Microsoft. All rights reserved. # ###################################################### import os import sys import random import threading if os.getuid() !=0: print """ ERROR: This script requires root privileges. ...
async_event_loop.py
# ---------------------------------------------------------------------------- # - Open3D: www.open3d.org - # ---------------------------------------------------------------------------- # The MIT License (MIT) # # Copyright (c) 2018-2021 www.open3d.org # # Permission i...
test_queue.py
# Some simple queue module tests, plus some failure conditions # to ensure the Queue locks remain stable. import itertools import random import threading import time import unittest import weakref from test import support from test.support import import_helper py_queue = import_helper.import_fresh_module('queue', bloc...
dqn_mountaincar.py
import os, sys, json import numpy as np import tensorflow as tf import gym, time import multiprocessing import threading from threading import Lock, Thread from ql_method import dqn_method from ql_networks import build_dense_network, build_dense_duel np.random.seed(1) tf.set_random_seed(1) MEMORY_SIZE = 1000 layers=...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def main(): return "Your bot is alive!" def run(): app.run(host="0.0.0.0", port=8080) def keep_alive(): server = Thread(target=run) server.start()
server_test.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...
mate.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2018 JiNong, Inc. # All right reserved. # """ Base Mate를 정의함. """ import time import util import logging import logging.handlers import traceback from calibration import Calibrator from threading import Thread from mblock import MBlock, BlkType from ...
audio_reader.py
import fnmatch import os import random import re import threading import json import librosa import numpy as np import tensorflow as tf from .ops import upsample_labels FILE_PATTERN = r'p([0-9]+)_([0-9]+)\.wav' def get_category_cardinality(files): id_reg_expression = re.compile(FILE_PATTERN) min_id = None ...
base.py
#!/usr/bin/env python """ fs.base ======= This module defines the most basic filesystem abstraction, the FS class. Instances of FS represent a filesystem containing files and directories that can be queried and manipulated. To implement a new kind of filesystem, start by sublcassing the base FS class. For more infor...
start_api_integ_base.py
from unittest import TestCase import threading from subprocess import Popen import time import os import random try: from pathlib import Path except ImportError: from pathlib2 import Path class StartApiIntegBaseClass(TestCase): template = None binary_data_file = None integration_dir = str(Path(__...
progress.py
# The MIT License (MIT) # Copyright (c) 2019 by the xcube development team and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation...
at_protocol.py
#! /usr/bin/env python # encoding: utf-8 """ Example of a AT command protocol. https://en.wikipedia.org/wiki/Hayes_command_set http://www.itu.int/rec/T-REC-V.250-200307-I/en """ from __future__ import print_function import sys sys.path.insert(0, '..') import logging import serial import serial.threaded import thread...
test_cli.py
from threading import Thread from _thread import interrupt_main import pytest import time from flashcrashed.cli import main, performance def test_main(patched_bitfinex): trader, notifier = patched_bitfinex def wait_sell(): while len(trader.calls) < 2: time.sleep(0.01) interrupt_ma...
master.py
import logging import math import os import pickle import random import signal import sys import uuid from time import sleep from threading import Thread import rpyc from rpyc.utils.server import ThreadedServer from utils import LOG_DIR from conf import block_size, replication_factor, minions_conf MASTER_PORT = 213...
build_pretraining_dataset.py
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
chatServer.py
#!/usr/bin/env python3 """Server for multithreaded (asynchronous) chat application.""" 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.accep...
train_policy.py
from functools import partial from typing import Sequence import os, time, multiprocessing import torch from rl import utils from models.ppo import MultiAgentPPO from models.networks import ExpertNetwork from env.scenarios import * from models.agent import DLAgent from models.env import Env import config import arg...
prototype-picamera.py
import picamera import cv2 import numpy as np import datetime import threading import queue def read_kbd_input(inputQueue): print('Press q to quit:') while (True): # Receive keyboard input from user. input_str = input() # Enqueue this input string. # Note: Lock not required here since we a...
test-D455_frame_drops.py
# License: Apache 2.0. See LICENSE file in root directory. # Copyright(c) 2021 Intel Corporation. All Rights Reserved. #test:device D455 #test:donotrun import time import threading from queue import Queue from rspy import test import pyrealsense2 as rs # Run RGB stream in D455 with 90 fps and find frame drops by che...
sleeping_barber.py
from threading import Thread, Lock, Event import time, random # # ref: https://github.com/bragisig/python-sleeping-barber/blob/master/sleeping_barber.py # mutex = Lock() #Interval in seconds customerIntervalMin = 5 customerIntervalMax = 15 haircutDurationMin = 3 haircutDurationMax = 15 class BarberShop: waitingCu...
export.py
#!/usr/bin/env python import sys import os import csv import time import multiprocessing from Queue import Empty from datetime import datetime from collections import namedtuple from pymongo import Connection import StringIO pid = os.getpid() import_start = time.time() print '[%s] Loading trie...' % pid from oxtail....
ssh_utils.py
#!/usr/bin/env python # # Copyright (c) Greenplum Inc 2008. All Rights Reserved. # # This file contains ssh Session class and support functions/classes. import sys import os import cmd import threading from gppylib.commands.base import WorkerPool, REMOTE, ExecutionError from gppylib.commands.unix import Hostname, Echo...
cmd_auto.py
"""starts a long-running process that whatches the file system and automatically execute tasks when file dependencies change""" import os import time import sys from multiprocessing import Process from .exceptions import InvalidCommand from .cmdparse import CmdParse from .filewatch import FileModifyWatcher from .cmd_...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS # environment import ftplib import asyncore import asynchat import socket import io import errno import os import time try: import ssl except ImportError: ssl = None from unittest import TestCase, skipUnless ...
run.py
import cv2 as cv import numpy as np from easyocr.easyocr import * from PIL import ImageFont, ImageDraw, Image from video_processing_parallel import WebcamStream import time from threading import Thread # library for implementing multi-threaded processing # GPU 설정 os.environ['CUDA_VISIBLE_DEVICES'] = '0,1' def get_f...
dataset.py
import os import tensorflow as tf import numpy as np from PIL import Image import time import threading class Dataset(object): def __init__(self, args): self.train_directory = args.train_directory self.validation_directory = args.validation_directory self.batch_size = args.batch_size ...
stats_manager.py
# std import logging import re from datetime import datetime, timedelta from typing import cast, List, Union from threading import Thread from time import sleep # project from . import ( HarvesterActivityConsumer, PartialConsumer, BlockConsumer, WalletAddedCoinConsumer, FinishedSignageConsumer, ) f...
dynamixel_serial_proxy.py
# -*- coding: utf-8 -*- # # Software License Agreement (BSD License) # # Copyright (c) 2010-2011, Antons Rebguns. # 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...
test_smtplib.py
import asyncore import email.utils import socket import smtpd import smtplib import StringIO import sys import time import select import unittest from test import test_support try: import threading except ImportError: threading = None HOST = test_support.HOST def server(evt, buf, serv): serv.listen(5) ...
data_helper.py
import copy import socket from multiprocessing.process import Process from multiprocessing.queues import Queue import random import time from random import Random import uuid from TestInput import TestInputServer from TestInput import TestInputSingleton import lib.logger import lib.crc32 import hashlib import threading...
server.py
#!sudo /usr/bin/env python import os import json from jsmin import jsmin import threading import glob from lib.unicorn_wrapper import UnicornWrapper from time import sleep from datetime import datetime from gpiozero import CPUTemperature from flask import Flask, jsonify, make_response, request, redirect, url_for, sen...
callbacks_test.py
# Copyright 2016 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...
test_bootstrap.py
"""Test the bootstrapping.""" # pylint: disable=protected-access import os from unittest import mock import threading import logging import voluptuous as vol from homeassistant.core import callback from homeassistant.const import EVENT_HOMEASSISTANT_START import homeassistant.config as config_util from homeassistant ...
script.py
# IMPORTS from tkinter.filedialog import askopenfilename import json import importlib import threading import time from tabulate import tabulate import numpy as np import matplotlib.pyplot as plt import os import shutil import webbrowser from wikipedia import wikipedia import colorama from termcolor import cprint from ...
views.py
#!venv/bin/python # -*- coding: utf-8 -*- import os import aiohttp_jinja2 import aiohttp from app.src.instabot import InstaBot from app.src.stoppable_thread import StoppableThread from rq import Queue from app.worker import conn from threading import Thread async def index(request): ''' Render main page t...
__init__.py
import os import threading import urllib.parse from typing import Optional from platypush.context import get_bus from platypush.plugins.media import PlayerState, MediaPlugin from platypush.message.event.media import MediaPlayEvent, MediaPlayRequestEvent, \ MediaPauseEvent, MediaStopEvent, MediaSeekEvent, MediaVolu...
EuropePubMedCentralDataset.py
from os import listdir, system, remove from os.path import isfile, join import re import multiprocessing from urllib.parse import unquote import json from lxml import etree import pandas as pd import tqdm import time import httplib2 from bs4 import BeautifulSoup, SoupStrainer import wget from multiprocessing.pool impor...
DLManager.py
from .packer import Packer import time, threading from .DLError import DLUrlError from .DLThreadPool import ThreadPool import queue from . import DLCommon as cv from .DLProgress import TimeStatus class Manager(Packer, object): def __init__(self, daemon=False, max_task=2): self.threads = ThreadPool(daem...
test_utils.py
import json import os import shutil import tempfile import time import zipfile import multiprocessing import contextlib from unittest import mock from django import forms from django.conf import settings from django.core.files.storage import default_storage as storage from django.core.files.uploadedfile import Simple...
ntlmrelayx.py
#!/usr/bin/env python # SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved. # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # Generic NTLM Relay Module # # Authors: # Alberto Sol...
tracker.py
import multiprocessing from tft import utils class Tracker: def __init__(self, players, file_name=None): self.__unitLookupTable = initialize_unit_lookup_table() manager = multiprocessing.Manager() self.__stages = manager.dict() self.__current_stage = "0-0" self.__players =...
command.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2007-2013, GoodData(R) Corporation. All rights reserved """ Module for various command executions """ import subprocess import threading import os import psutil import atexit import datetime import logging import time lg = logging.getLogger(__name__) def ...
Project_Selector.py
#! python3.7 from git import Repo from threading import Thread import os import subprocess project_dictionary = {} def get_project_name(project_directory="D:\\Code"): """ :param project_directory: Project Directory Build a dictionary of all projects - consisting of {Project Name : Project Directory Path...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS # environment import ftplib import asyncore import asynchat import socket import io import errno import os import time try: import ssl except ImportError: ssl = None from unittest import TestCase, skipUnless ...
pp.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # --------------------------------------------------------------- # Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu) # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following c...
preparer.py
# -*- coding: utf-8 -*- # Copyright 2020-2022 CERN # # 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 a...
simple_tests.py
''' Created on May 31, 2016 @author: yglazner ''' import unittest import threading from cheesyweb import * import logging import time import requests _app = None log = logging.getLogger("Logger") def stop_threaded(): if not _app: return if _app.running: _app.stop() def _run(app): global _app _...
configure.pyw
#! /usr/bin/env python """Post-install / configuration script for Iromlab""" import os import sys import imp import site import sysconfig from shutil import copyfile import threading import logging import pythoncom from win32com.client import Dispatch try: import tkinter as tk # Python 3.x import tkinter.scro...
pyrebase.py
import requests from requests import Session from requests.exceptions import HTTPError try: from urllib.parse import urlencode, quote except: from urllib import urlencode, quote import json import math from random import uniform import time from collections import OrderedDict from sseclient import SSEClient im...
controller.py
# Copyright (c) 2016-2022 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. import os import shutil import time import traceback from math im...
mainwindow.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Spyder, the Scientific Python Development Environment ===================================================== Developed and maintained by the Spyder Proj...
mapd.py
#!/usr/bin/env python3 # Add phonelibs openblas to LD_LIBRARY_PATH if import fails from common.basedir import BASEDIR try: from scipy import spatial except ImportError as e: import os import sys openblas_path = os.path.join(BASEDIR, "phonelibs/openblas/") os.environ['LD_LIBRARY_PATH'] += ':' + openblas_pat...
go_tool.py
from __future__ import absolute_import import argparse import copy import json import os import re import shutil import subprocess import sys import tempfile import threading import six from functools import reduce arc_project_prefix = 'a.yandex-team.ru/' std_lib_prefix = 'contrib/go/_std/src/' vendor_prefix = 'vendor...
session.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...
EWSO365.py
import random import string from typing import Dict import dateparser import chardet import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import sys import traceback import json import os import hashlib from io import StringIO import logging import warnings import email...
tpu_estimator.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
scheduler_job.py
# pylint: disable=no-name-in-module # # 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, Versio...
orchestrator.py
from flask import Flask, render_template, request, redirect, abort, jsonify import threading import requests import time, signal, sys import docker from tornado.wsgi import WSGIContainer from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop ip = "http://127.0.0.1:" apis = ['/api/v1/_count', '/...
run_tests.py
#!/usr/bin/env python ''' Run tests for Pannellum, set up with Continuous Integration. Contributed by Vanessa Sochat, JoSS Review 2019. See the project repository for licensing information. ''' from selenium.common.exceptions import TimeoutException from selenium.webdriver.chrome.options import Options from seleniu...
test.py
#!/usr/bin/env python3 import datetime import sys import requests import os import time import threading from mfutil import BashWrapperOrRaise NGINX_PORT = int(os.environ['MFSERV_NGINX_PORT']) RUN = True RES = True BashWrapperOrRaise("rm -Rf foobar") BashWrapperOrRaise("plugins.uninstall foobar || true") print(Bash...
updater.py
from subprocess import call import os, sys from os import path #from tkinter import * from threading import * import tkinter as tk #from tk import tkFileDialog from tkinter import filedialog as fd from tkinter import messagebox as mb #from tk import tkMessageBox import logging from logging import handlers import csv ...
api.py
import socket import urllib.parse from selectors import DefaultSelector, EVENT_WRITE, EVENT_READ from threading import Thread from ..core.eventQueue import eventQueue from ..core.eventloop import LoopManager @LoopManager.asyncapi def get(*, url, callback, asyncDone): urlObj = urllib.parse.urlparse(url) select...
repair_test.py
import os import os.path import threading import time import re import pytest import logging from collections import namedtuple from threading import Thread from cassandra import ConsistencyLevel from cassandra.query import SimpleStatement from ccmlib.node import ToolError from dtest import FlakyRetryPolicy, Tester,...
task.py
import atexit import os import signal import sys import threading import time from argparse import ArgumentParser from tempfile import mkstemp try: from collections.abc import Callable, Sequence as CollectionsSequence except ImportError: from collections import Callable, Sequence as CollectionsSequence from t...
ner_with_spacy.py
import spacy import sys from os import listdir, system from os.path import isfile, join from multiprocessing import Process from math import ceil import subprocess indir_path = sys.argv[1] outdir_path = sys.argv[2] nthreads = int(sys.argv[3]) def process(filenames, tid): nlp = spacy.load('en') for fname in fi...
test_client.py
import os import pytest import time import sys import logging import queue import threading import _thread from unittest.mock import patch import numpy as np import ray.util.client.server.server as ray_client_server from ray.tests.client_test_utils import create_remote_signal_actor from ray.tests.client_test_utils imp...
its.py
#!/usr/bin/env python from threading import Thread from accessoryFunctions import * from itsx.parallel import ITSx import os __author__ = 'mike knowles' class ITS(object): def __init__(self, inputobject): from Queue import Queue self.metadata = [sample for sample in inputobject.runmetadata.sample...
process.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import, with_statement import os import sys import time import types import signal import logging import threading import contextlib import subprocess import multiprocessing import multiprocessing.util # Import salt libs import salt.default...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bip32 import BIP32Node from electrum import constants from electr...
test_c10d_nccl.py
import copy import math import os import random import signal import sys import tempfile import threading import time from contextlib import contextmanager from datetime import timedelta from itertools import product from unittest import mock import torch import torch.distributed as c10d if not c10d.is_available(): ...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
wp_killer2.py
from bhp3_class.web import get_words from collections import deque from io import BytesIO from lxml import etree import requests import sys import threading import time EXTENSIONS = ['.php', '.bak', '.orig', '.inc'] SUCCESS = 'Welcome to WordPress!' WORDLIST = '/Users/jtimarnold/Downloads/cain.txt' def get_params(co...
WaitingService.py
from time import sleep from datetime import datetime from Common.Configuration.ConfigurationService import ConfigurationService import threading import time class WaitingService: def __init__(self, configurationService: ConfigurationService): self.isCancelled = True self.configurationService = con...
extended-monitoring.py
#!/usr/bin/env python3 # Copyright 2021 Flant JSC # Licensed under the Deckhouse Platform Enterprise Edition (EE) license. # See https://github.com/deckhouse/deckhouse/blob/main/ee/LICENSE from concurrent.futures.thread import ThreadPoolExecutor from itertools import chain from threading import Thread from time import...
rcmd.py
import paramiko import threading import sys import os import getpass def rcmd(host, user='root', passwd=None, port=22, cmds=None): ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname=host, port=port, username=user, password=passwd) stdin, stdout, st...
sr_receiver.py
import time from collections import deque from threading import Lock, Condition, Thread from senders.udt_sender import UDTSender, LossyUDTSender, CorruptingUDTSender from helpers.logger_utils import get_stdout_logger from receivers.udt_receiver import UDTReceiver, InterruptableUDTReceiver from senders.sr_sender impor...
_communicator.py
import threading as th import multiprocessing as mp from modi._communicator_task import CommunicatorTask from modi._ser_task import SerTask from modi._can_task import CanTask from modi._spp_task import SppTask class Communicator(mp.Process): def __init__(self, recv_q, send_q, conn_mode, module_uuid): s...
challenge.py
from typing import Dict, Any import os import sys import glob import json import yaml import time import gzip import random import logging import multiprocessing as mp import queue import threading import ai2thor.controller import ai2thor.util.metrics from robothor_challenge.startx import startx logger = logging.ge...
server.py
import math import os import queue import sys import threading import time import uuid from collections import namedtuple from concurrent.futures import ThreadPoolExecutor from threading import Event as ThreadingEventType from time import sleep import grpc from dagster import check, seven from dagster.core.code_pointe...
async_time_test.py
# -*- coding: utf-8 -*- ''' module: async_time_test author: denis@ryzhkov.org license: free See «async_time_test.async_time_test» docstring. ''' __all__ = [ 'async_time_test', ] __version__ = '0.4' #### async_time_test def async_time_test(actions_args=[], actions_per_second=1, action_time_limit_in_seconds=1, ...
ispresso.py
<<<<<<< HEAD #!/usr/bin/python # Copyright (c) 2013 Chris Synan & Dataworlds LLC # Portions copyright (c) 2012 Stephen P. Smith # # 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 re...
test_weakref.py
import gc import sys import unittest import collections import weakref import operator import contextlib import copy import threading import time import random from test import support from test.support import script_helper, ALWAYS_EQ # Used in ReferencesTestCase.test_ref_created_during_del() . ref_from_del = None #...
Server.py
# coding=utf-8 from socket import * import threading import sqlite3 import hashlib import struct class Server(object): """ 1.register 2.login 3.logout 4.Get the current list of all online users 5.Group messaging to all online users 6.Private message to specified user 7....
VariationReportServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
Main.py
# Copyright (c) 2019 Max Graf # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute...
GenomeReportServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
player.py
import queue, pafy, youtube_dl, vlc, threading, sys, os from enum import Enum JobTypes = {'ADD':0,'PLAY':1,'PAUSE':2,'STOP':3,'EXIT':10} jobQueue = queue.Queue() def enqueue_job(job): jobQueue.put(job) class Player: def __init__(self): self._player = vlc.MediaPlayer() self._vid...
example_multithread.py
import argparse import collections import time import threading from py_elasticinfra.utils.parse_config import ConfigParser from py_elasticinfra.elk.elastic import Indexer from py_elasticinfra.runner import Runner def foreground_thread(): for i in range(5): time.sleep(3) print('[INFO] Foreground t...
test_partition.py
import threading import pytest from base.partition_wrapper import ApiPartitionWrapper from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks prefix = "partition_" class TestPartitionParams(TestcaseBase)...
Controleur.py
# -*- coding: utf-8 -*- from VueJeu import * from Model import * from random import randint import MinMax import AlphaBeta import threading import os class Controleur: """ Classe qui gère le passage du menu au jeu et qui gère les différentes actions (clic) - root : fenêtre principal de l'application - fra...
MachineExecutor.py
""" SlipStream Client ===== Copyright (C) 2014 SixSq Sarl (sixsq.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 a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required ...
VideoStream.py
from threading import Thread import sys import cv2 from queue import Queue # This class reads all the video frames in a separate thread and always has the # keeps only the latest frame in its queue to be grabbed by another thread class VideoStream(object): def __init__(self, path, queueSize=15): se...
test_events.py
"""Tests for events.py.""" import collections.abc import concurrent.futures import functools import io import os import platform import re import signal import socket try: import ssl except ImportError: ssl = None import subprocess import sys import threading import time import errno import unittest from unitt...
interval.py
from threading import Event, Thread def SetInterval(interval, func, *args): stopped = Event() # call it right away func(*args) def loop(): # then call it after the first interval has elapsed while not stopped.wait(interval): func(*args) Thread(target=loop, daemon=True)....
webtransport_h3_server.py
import asyncio import logging import os import ssl import threading import traceback from urllib.parse import urlparse from typing import Any, Dict, List, Optional, Tuple # TODO(bashi): Remove import check suppressions once aioquic dependency is resolved. from aioquic.buffer import Buffer # type: ignore from aioquic....
test_main.py
""" Goal: Implement ZWL API testing @authors: Gaël MONDON """ import json import socket import base64 import os import threading import pytest from fastapi.testclient import TestClient from app.tests import TCPServer from app.main import app from app.config import defaults valid_credentials = base64.b64encode(st...
test_sqlackqueue.py
# coding=utf-8 import random import shutil import sys import tempfile import unittest from threading import Thread from persistqueue.sqlackqueue import ( SQLiteAckQueue, FILOSQLiteAckQueue, UniqueAckQ) from persistqueue import Empty class SQLite3AckQueueTest(unittest.TestCase): def setUp(self): ...
manager.py
# =============================================================================== # Copyright 2016 Jake Ross # # 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...
ipytools.py
# coding=utf-8 """ General tools for the Jupyter Notebook and Lab """ from ipywidgets import HTML, Tab, Accordion, Checkbox, HBox, Layout, Widget, \ VBox, Button, Box, ToggleButton, IntSlider, FloatText from traitlets import List, Unicode, observe, Instance, Tuple, Int, Float from .. import batch # imports for a...