source
stringlengths
3
86
python
stringlengths
75
1.04M
upnp.py
from __future__ import annotations import logging import threading from dataclasses import dataclass, field from queue import Queue from typing import Optional, Tuple, Union from typing_extensions import Literal try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) @dataclass c...
thread2.py
#! /usr/bin/env python # coding: utf-8 import time from threading import Thread from mysqldb_rich.db2 import DB __author__ = '鹛桑够' db = DB() t = "sys_users" cols = ["account", "password"] def test_select(t_name, freq=1): print("------------------------test %s freq=%s-----------------------" % (t_name, freq)) ...
invoker.py
"""Abstraction for invoking AWS APIs (a.k.a. operations) and handling responses.""" import logging from queue import Queue from threading import Thread import botocore from opinel.utils.credentials import read_creds from . import config from . import progress from . import store from tqdm import * L...
cyber_launch.py
#!/usr/bin/env python3 # **************************************************************************** # Copyright 2018 The Apollo 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 o...
reporter.py
import json import logging import math from time import time try: from collections.abc import Iterable # noqa except ImportError: from collections import Iterable import six import numpy as np from threading import Thread, Event from ..base import InterfaceBase from ..setupuploadmixin import SetupUploadMixi...
common.py
"""Test the helper method for writing tests.""" import asyncio import functools as ft import json import logging import os import uuid import sys import threading from collections import OrderedDict from contextlib import contextmanager from datetime import timedelta from io import StringIO from unittest.mock import M...
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...
sanntid_oving_2.py
# Python 3.3.3 and 2.7.6 # python fo.py from threading import Thread, Lock # Potentially useful thing: # In Python you "import" a global variable, instead of "export"ing it when you declare it # (This is probably an effort to make you feel bad about typing the word "global") lock = Lock() i = 0 def ...
dataset_test.py
# Lint as: python3 # Copyright 2019 DeepMind Technologies Limited. # # 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 ap...
waiter.py
from dataclasses import dataclass from typing import Callable import threading import time @dataclass class Waiter: callback: Callable = None duration: float = 1 cycle_time: float = 0.1 def is_alive(self): return (t := getattr(self, 'thread', None)) and t.is_alive() def start(self): ...
recorder.py
import sys import threading import time import wave import cv2 import numpy as np import pyaudio import sounddevice as sd from moviepy.editor import * from PIL import ImageGrab from PyQt5 import * from PyQt5.Qt import * from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * ...
fetcher.py
import multiprocessing import os import queue import signal import threading import time from pghoard.common import get_object_storage_config from pghoard.config import key_lookup_for_site from pghoard.rohmu import get_transfer from pghoard.rohmu.rohmufile import create_sink_pipeline class FileFetchManager: """M...
example3.py
# ch05/example3.py import threading import requests import time from os import system, name def ping(url): res = requests.get(url) print(f'{url}: {res.text}') urls = [ 'http://httpstat.us/200', 'http://httpstat.us/400', 'http://httpstat.us/404', 'http://httpstat.us/408', 'http://httpstat....
whatsapp.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from whatsapp_binary_reader import whatsappReadBinary from whatsapp_binary_writer import whatsappWriteBinary from utilities import * from whatsapp_defines import WAWebMessageInfo, WAMetrics, WAFlags import pyqrcode import curve25519 import websocket import traceback import...
entities.py
import os import platform import subprocess import multiprocessing import shutil from pathlib import Path from typing import Tuple import requests import uvicorn from triggercmd_cli import __version__ from triggercmd_cli.command.webview import PythonWebView from triggercmd_cli import settings from triggercmd_cli.util...
bench_control.py
import pybullet as p import pybullet_data as pd import time, psutil, os import numpy as np from uuid import uuid4 import rocksdb, json from multiprocessing import Process useMaximalCoordinates = True needLog = False db = rocksdb.DB("fyp.db", rocksdb.Options(create_if_missing=True)) class PandaArm: def __init__(s...
gen_protos.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...
utils.py
import os import sys import json import time import decimal import zipfile import datetime import sqlalchemy from app import app from app.models import Jobs from app.env import JOBS_DIR, JOB_CALLBACK, logging from multiprocessing import Process, Queue # 解压数据到指定文件 def unzip_file(zip_path, dir_path): """ 解压到指定文件夹...
trex_capture.py
from trex_stl_lib.api import * from trex_stl_lib.utils import parsing_opts, text_tables import threading import tempfile import select from distutils import spawn from subprocess import Popen import subprocess # defines a generic monitor writer class CaptureMonitorWriter(object): def deinit(self): # by de...
foggycam.py
"""FoggyCam captures Nest camera images and generates a video.""" from urllib.request import urlopen import pickle import urllib import json from http.cookiejar import CookieJar import os from collections import defaultdict import traceback from subprocess import Popen, PIPE import uuid import threading import time fr...
test_asyncioscheduler.py
import asyncio import threading import unittest from datetime import datetime, timedelta from rx.concurrency.mainloopscheduler import AsyncIOScheduler class TestAsyncIOScheduler(unittest.TestCase): def test_asyncio_schedule_now(self): loop = asyncio.get_event_loop() scheduler = AsyncIOScheduler(...
auto.py
# This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of th...
storage_node.py
#!/usr/bin/env python from sys import version_info if version_info[0] <= 2: from Queue import Queue else: from queue import Queue import threading import re import rospy import actionlib from actionlib_msgs.msg import GoalStatus from std_srvs.srv import Empty from robonomics_liability.msg import Liability from...
collective_ops_gpu_test.py
# Copyright 2019 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 applicab...
shallow_backup.py
import os import git import sys import json import click import inquirer import shutil import subprocess as sp import multiprocessing as mp from os.path import expanduser from colorama import Fore, Style from pprint import pprint from constants import Constants def print_version_info(): version = "{} v{} by {} -> (G...
test_bz2.py
from test import test_support as support from test.test_support import TESTFN, _4G, bigmemtest, import_module import unittest from cStringIO import StringIO import os import subprocess import sys try: import threading except ImportError: threading = None bz2 = import_module('bz2') from bz2 import BZ2File, BZ...
simplify.py
import os import logging import itertools from multiprocessing import Process, Pipe from osgeo import ogr from django.contrib.gis.geos import GEOSGeometry,Polygon,MultiPolygon from django.db import connection from django.forms.models import model_to_dict from django.db.models import Q,F from django.utils import timezo...
gfontmaker.py
#!/usr/bin/env python3 import os import io import threading from functools import partial from PIL import Image from kivy.core.image import Image as CoreImage from kivy.app import App from kivy.properties import NumericProperty, ObjectProperty, StringProperty, ListProperty from kivy.uix.boxlayout import BoxLayout from...
webserver.py
# Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
logger.py
import json import os import threading import uuid from urllib import parse import allure from requests import Response, post API_VERSION = 'v1' LOGGER_ENDPOINT = os.environ.get('LAMA_LOGGER_ENDPOINT', 'http://localhost:8000') def parse_query_params(url: str) -> dict: """Used to parse query params from url""" ...
menu.py
import os from threading import Thread from park_access import ParkAccess from alpr_exception import AlprException from plate_detection import PlateDetection class Menu: def __init__(self): self.entry_park_lights = None self.exit_park_lights = None self.entry_plate_detection = None ...
client.py
import socket import select import errno import sys from pynput.keyboard import Key, Listener, KeyCode from pynput import mouse, keyboard from random import randint import subprocess import threading import time class RHBotClientConnection(): def __init__(self, ip) -> None: self.HEADER_LENGTH = 10 ...
easydownloader.py
import os import pyperclip import dl import sys import logging import subprocess import dlffmpeg import tempfile import shutil # for move files import psutil # for kill ffmpeg process from exceptions import TerminateThreadException from datetime import datetime from PIL import Image from pystray import Icon, Menu as...
nonogram_solver.py
import json import os import threading from flask import Flask, render_template, request, session from flask_socketio import SocketIO, emit from src.nonogram import Nonogram from src.genetic_algorithm_solver import GeneticAlgorithmSolver, Population PUZZLE_DIR = 'puzzles' app = Flask(__name__) app.secret_key = os.u...
client.py
# -*- coding: utf-8-*- from Imgood.linepy import * from Imgood.akad import * from Imgood.linepy.style import * from Imgood.linepy.login import * from justgood import imjustgood from time import sleep from gtts import gTTS from datetime import datetime from bs4 import BeautifulSoup from threading import Thread...
perf.py
#!/usr/bin/python3 import argparse import clickhouse_driver import itertools import functools import math import os import pprint import random import re import statistics import string import sys import time import traceback import xml.etree.ElementTree as et from threading import Thread from scipy import stats def ...
transient.py
from . import checked_threading from . import configuration from . import editor from . import qemu from . import image from . import utils from . import scan from . import ssh from . import sshfs from . import static import base64 import contextlib import enum import glob import json import logging import os import p...
run-tests.py
#!/usr/bin/env python # # 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 "Li...
sonar_ssl.py
import argparse import sys from multiprocessing import cpu_count, Process, Queue import logging from datetime import datetime from elasticsearch import Elasticsearch from elasticsearch.helpers import bulk, scan import hashlib import gzip import requests import os from helpers.certparser import process_cert from helper...
random_agent.py
# Copyright 2021 Siemens Corporation # SPDX-License-Identifier: MIT """Random agent to probe enviroment """ import matplotlib.pyplot as plt import numpy as np import imageio import glob from powergym.env_register import make_env, remove_parallel_dss import argparse import random import itertools impor...
image_build.py
""" Copyright (c) 2017 Cyberhaven Copyright (c) 2017 Dependable Systems Laboratory, EPFL 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 right...
demon.py
#! /usr/bin/env python import threading import subprocess import time import os import sys PORT = str(os.getenv("PORT") or 4747) def MainServer(): with subprocess.Popen(["python", "-m", "http.server", "--directory={dir}".format(dir="."), PORT], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIP...
asyn.py
import asyncio import functools import inspect import re import os import sys import threading from .utils import other_paths, is_exception from .spec import AbstractFileSystem # this global variable holds whether this thread is running async or not thread_state = threading.local() private = re.compile("_[^_]") def...
_handler.py
import functools import json import multiprocessing import string import sys import threading import traceback import ansimarkup class StrRecord(str): __slots__ = ("record",) class Handler: def __init__( self, *, writer, stopper, levelno, formatter, i...
worker.py
"""Embedded workers for integration""" import threading from contextlib import contextmanager from celery import worker, shared_task, Celery from celery.result import allow_join_result, _set_task_join_will_block from celery.utils.dispatch import Signal from celery.utils.nodenames import anon_nodename from celery.worker...
fraud-detector.py
#!python # # Copyright 2021 mmontour@enya.ai. Internal use only; all rights reserved # # Basic fraud checker. Reads state roots from SCC and checks them against # actual L2 values, reporting mismatches. Note - code was copied from # stress_tester.py and contains a lot of irrelevant cruft to be cleaned up # later. impo...
conftest.py
import pytest import threading import asyncio from opentrons.hardware_control.emulation.app import ServerManager from opentrons.hardware_control.emulation.settings import ( Settings, SmoothieSettings, PipetteSettings, ) CONFIG = Settings( host="0.0.0.0", smoothie=SmoothieSettings( left=Pipe...
vntq.py
# encoding: UTF-8 """ 对接天勤行情的网关接口,可以提供国内期货的报价/K线/Tick序列等数据的实时推送和历史仿真 使用时需要在本机先启动一个天勤终端进程 天勤行情终端: http://www.tq18.cn """ import json import threading import tornado from tornado import websocket from sortedcontainers import SortedDict ######################################################################## class TqA...
test_connection.py
#!/usr/bin/env python # test_connection.py - unit test for connection attributes # # Copyright (C) 2008-2011 James Henstridge <james@jamesh.id.au> # # psycopg2 is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published # by the Free Software Foun...
run_k_truss_reorderd_graph_nvprof.py
import socket from exec_utilities import time_out_util from config import * from exec_utilities.exec_utils import * from multiprocessing import Process def run_exp(env_tag=knl_tag, with_c_group=True, data_path_tag=k_truss_exec_path_tag): hostname = socket.gethostname() with open('config.json') as ifs: ...
USBPrinterOutputDevice.py
# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from UM.Logger import Logger from UM.i18n import i18nCatalog from UM.Application import Application from UM.Qt.Duration import DurationFormat from UM.PluginRegistry import PluginRegistry from cura.PrinterOutputDevice impor...
musicdata_mpd.py
#!/usr/bin/python # coding: UTF-8 # musicdata service to read from MPD # Written by: Ron Ritchey from __future__ import unicode_literals import json, mpd, threading, logging, Queue, time, sys, getopt import musicdata import re, ipaddress class musicdata_mpd(musicdata.musicdata): def __init__(self, q, server=u'lo...
main.py
import pathlib import Wave.Player import Wave.Sampler import Wave.WaveFile import Wave.noise_generator import Wave.NoiseMaker #import asyncio import threading import pyaudio import time #Pythonはスレッドの終了ができないらしい…… #> 現状では、優先度 (priority)やスレッドグループがなく、スレッドの破壊 (destroy)、中断 (stop)、一時停止 (suspend)、復帰 (resume)、割り込み (interrupt) ...
tasbot.py
"""Contains the script which performs recording and playback of macros. Press <TOGGLE_RECORDING_HOTKEY> to start/stop recording Press <START_PLAYBACK_HOTKEY> to replay the recording """ from pynput import mouse from pynput import keyboard import threading from EventRecorder import EventRecorder from Events import Eve...
Multithreading_pixiv_date_r18.py
import requests import re, os ,json from threading import Thread from fake_useragent import UserAgent class pixiv_date_r18: def __init__(self): proxies = json.load(open('name.json', mode='r')).get('proxies') self.proxies = eval(proxies) self.list_img_url = [] self.thread...
PingIP.py
#!/usr/bin/env python3 import base64 import json import os from signal import SIGKILL import requests import socket import subprocess import time #import logging #logger = logging.getLogger("Sub") from cls.LocalFile import LocalFile from cls.IsValid import IsValid from cls.StrText import StrText class PingIP(): d...
ai.py
from .agent import Agent from ..network.network import * from .mcts import * from ..utils import * MIN = -99999999 MAX = 99999999 score_5 = 5 score_4_live = 4.5 score_4_and_3_live = 4.3 score_4 = 4 score_double_3_live = 3.8 score_3_live = 3.5 score_3 = 3 score_double_2_live = 3 score_2_live = 2.5 score_2 = 2 class ...
utility.py
################################### # Script : # 1) Contains trivial and useful # functions # # ganesans - Salilab - UCSF # ganesans@salilab.org ################################### import pandas as pd import sys,os,glob import numpy as np import pickle from collections import Counter import argparse def dict_to_JSl...
helper.py
import os import platform import shlex import subprocess import time from collections import defaultdict from functools import wraps from itertools import chain, combinations from re import ASCII, match from threading import Thread from typing import ( Any, Callable, Dict, FrozenSet, Iterable, List, Set, Tuple, Uni...
webevents.py
import os import io import cgi import json import pathlib import threading import contextlib import socketserver import multiprocessing from http.server import SimpleHTTPRequestHandler import pkg_resources class WebGUIRequestHandler(SimpleHTTPRequestHandler): def __init__(self, request, client_address, server): ...
40.get_annotation_from_uniprot.py
# -*- coding: utf-8 -*- """ Created on Wed May 30 15:11:21 2018 @author: thodoris """ import pandas import sys import os import multiprocessing import numpy sys.path.append('../') from core_functions import construct_graph_from_mongo from core_functions import uniprot_query from core_functions import correct_uniprot_...
utility.py
# coding=utf-8 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------...
simple_bridge.py
""" Bridge script catches packages from netfilterqueue and adds puts them through custom channels """ import os import time from datetime import datetime from threading import Thread from netfilterqueue import NetfilterQueue from qunetsim.components import Host from qunetsim.backends import ProjectQBackend from qunets...
seer_plugin.py
import seer_config import queue import time import logging import threading class DataCollectorPlugin(object): """ An abstract class that describes the behaviour of a data collector plugin. These plugins will be dynamically loaded when the seer application runs. """ def __init__(self): # Custom time step to...
launchProxies.py
#!/usr/bin/env python3 '''launches new NCS instances and starts the squid proxy on them''' import argparse from concurrent import futures import datetime import json import logging import os import subprocess import sys import time # third-party module(s) import requests # neocortix modules import ncscli.ncs as ncs imp...
fork_wait.py
"""This test case provides support for checking forking and wait behavior. To test different wait behavior, override the wait_impl method. We want fork1() semantics -- only the forking thread survives in the child after a fork(). On some systems (e.g. Solaris without posix threads) we find that all active threads su...
register_service_test.py
""" Tests the service registration methods of the DxlClient. """ from __future__ import absolute_import from __future__ import print_function import time import logging import threading import json from nose.plugins.attrib import attr from dxlclient import DxlException, EventCallback, Request from dxlclient import Req...
runner_slurm.py
import os import time import signal import threading from popper import utils as pu from popper.cli import log as log from popper.runner_host import HostRunner from popper.runner_host import DockerRunner as HostDockerRunner from popper.runner_host import SingularityRunner as HostSingularityRunner class SlurmRunner(H...
readArduinos.py
# Copyright © 2020, Johan Vonk # SPDX-License-Identifier: MIT # pip install pyserial paho-mqtt import serial, serial.tools.list_ports, serial.threaded import time import datetime import paho.mqtt.client as mqtt import json import multiprocessing import re def read_serial(portName, queue): ser = serial.Serial(port ...
login_view.py
from kivy.app import App import sqlite3 from kivy.properties import ObjectProperty from GUI.modified_classes import NewFloatLayout from GUI.popups import show_message_popup, show_question_popup from GUI.data_manager import DataManager from threading import Thread import os.path class LoginView(NewFloatLayout): use...
plot.py
import numpy as np import os import pinocchio as pin from pinocchio import SE3 from mlp.utils.util import * import matplotlib matplotlib.use("Qt4agg") import matplotlib.pyplot as plt from multiprocessing import Process from mlp.utils.computation_tools import computeZMP,computeZMPRef plt.ioff() def show(plt): plt...
event.py
# -*- coding: utf-8 -*- ''' tests.integration.modules.event ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` :copyright: © 2012-2013 by the SaltStack Team, see AUTHORS for more details :license: Apache 2.0, see LICENSE for more details. ''' # Import python l...
udaan.py
from loguru import logger import json import socketio import datetime import time import numpy import threading import random import trajectory as trajectoryUtil from util import airports as airportsUtil sio = socketio.Client() @sio.event def connect(): logger.info("Connected to Server") def main(): log...
ncclize.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from lxml import etree as ET from collections import defaultdict from dataclasses import dataclass, field, replace import math import threading, queue, itertools, bisect from enum import Enum from z3 import * @dataclass class _Gpu: precopies...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
__init__.py
# -*- coding: utf-8 -*- """ sphinx.builders ~~~~~~~~~~~~~~~ Builder superclass for all builders. :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os from os import path try: import multiprocessing import threading except ...
RelayServer.py
# RelayServer.py # Billy Kihei (c) 2021 # Intelligent Mobile Device Lab @ Kennesaw State University # Part of the 5Gtoolkit for testing commercial 5G networks. # This app receives control messages from a client and performs the request. # a. Client Sends: GDP:100:60, the RelayServer will stream 100 byte packets for 60...
decorators.py
from functools import wraps from django.contrib.auth import REDIRECT_FIELD_NAME from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.urls import reverse_lazy from django.views import generic from experiments.constants import Constants from experiments.models import P...
MATLAB_pendulum_dqn_main.py
#!/usr/bin/env python3 import time import sys from codes.e_utils import rl_utils from codes.e_utils.names import PROJECT_HOME sys.path.insert(0,"c:\\users\\wlckd\\anaconda3\\envs\\link_rl\\lib\\site-packages") import torch import torch.multiprocessing as mp from torch import optim import os from common.environments ...
graphic_debugger.py
import threading import cv2 import numpy as np from utils import mttkinter from utils.misc import color_filter, kill_thread from screen import Screen from item import ItemFinder from config import Config import tkinter as tk from template_finder import TemplateFinder from PIL import ImageTk, Image import re class G...
test_socket.py
import unittest from test import support import errno import collections import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import platform import array import contextlib from weakref import proxy import signal import math import pickle...
scalene_profiler.py
"""Scalene: a scripting-language aware profiler for Python. https://github.com/plasma-umass/scalene See the paper "docs/scalene-paper.pdf" in this repository for technical details on an earlier version of Scalene's design; note that a number of these details have changed. by Emery Berger http...
mturk_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 logging import math import os import pickle import threading import time import uuid import errno import requests...
qsession.py
#!/bin/env/python3 #-*- encdoing: utf-8 -*- """ """ from __future__ import print_function from __future__ import division import numpy as np import cloudpickle import subprocess import threading import datetime import pickle import random import shutil import time import sys import os import re from clusterweb.int...
app.py
import pygame import sys import os import ctypes import threading import tkinter as tk import platform # For graphics quality ctypes.windll.shcore.SetProcessDpiAwareness(1) # Position of pygame window from top left of screen os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (5, 60) WHITE = 255, 255, 255 class App: ...
buche.py
import asyncio import json import re from threading import Thread from uuid import uuid4 as uuid from hrepr import Tag from .event import EventDispatcher from .repr import id_registry class Encoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, Tag): return str(obj) els...
test_webui.py
#!/usr/bin/env python # coding=UTF-8 import os from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys from selenium.webdriver.firefox.options import Options import time import unittest class BasicWebUiTest(unittest.TestCase): ...
tcpclient.py
from tornado.tcpclient import TCPClient from tornado.ioloop import IOLoop from tornado.iostream import IOStream from tornado.iostream import StreamClosedError import asyncio import struct import msgpack import threading # class A: # async def instance_method(self): # print('instance method') # @classm...
test_diskutils.py
import functools import gc import os import queue import shutil import subprocess import sys from time import sleep import mock import pytest import dask from distributed.compatibility import WINDOWS from distributed.diskutils import WorkSpace from distributed.metrics import time from distributed.utils import mp_cont...
lab13_a.py
from sys import setrecursionlimit import threading setrecursionlimit(10 ** 9) threading.stack_size(3 * 67108864) def main(): #Knuth_Morris_Pratt file_input, file_output = open("search1.in", 'r'), open("search1.out", 'w') def get_prefix(string : str) -> list: prefix = [0] + [None for _ in range(len(stri...
WatchDog.py
import threading import time import subprocess import os import datetime import json import copy import platform import psutil from .EventReceiver import EventReceiver, EventSink from .WtLogger import WtLogger from enum import Enum def isWindows(): if "windows" in platform.system().lower(): ...
_reloader.py
import os import sys import time import subprocess import threading from itertools import chain from werkzeug._internal import _log from werkzeug._compat import PY2, iteritems, text_type def _iter_module_files(): """This iterates over all relevant Python files. It goes through all loaded files from modules,...
ardu.py
import serial.tools.list_ports import serial import time import threading last_input = time.time() dev = serial.tools.list_ports.comports()[0].device ser = serial.Serial(dev) def read_input(): while True: input2 = input("valgus: ") if input2 == "1": ser.write(b'A') else: ...
test_command_signal.py
import sys import time import signal import multiprocessing import tornado from circus.tests.support import TestCircus, EasyTestSuite, TimeoutException from circus.client import AsyncCircusClient from circus.stream import QueueStream, Empty from circus.util import tornado_sleep from circus.py3compat import s exiting...
test_h5py_utils.py
# coding: utf-8 # /*########################################################################## # Copyright (C) 2016-2017 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to dea...
performance_test.py
# MIT License # # Copyright (c) 2021 Mobotx # # 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, publi...
crawler.py
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). """Support for webpage parsing and crawling.""" from __future__ import absolute_import import os import re import threading import traceback from pex.compatibility import PY3 from pex.h...
worker.py
import logging import threading import time import random import uuid from mysql_dao import TaskDBMySqlDao from mongo_dao import TaskDBMongoDao from database_enum import Database from database_enum import DatabaseStack import argparse import sys from cloudwatch_agent import CloudWatchAgent import requests from database...
app_test.py
#!/usr/bin/python3 # Start a Qt application, and use an asynchronous thread to "click" on the GUI. import sys import time import threading from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import * from picamera2.previews.q_gl_picamera2 import * from picamera2.picamera2 import * def request_callback...
test_gui.py
#!/usr/bin/env python3 import cv2 from argparse import Namespace from PIL import Image, ImageTk from threading import Thread from time import sleep from tkinter import Canvas, Tk, NW from tkinter.filedialog import askopenfilename from test import main class StopPlaying(Exception): pass def wrapper(args, writer...