source
stringlengths
3
86
python
stringlengths
75
1.04M
utils.py
# -*- coding: utf-8 -*- from __future__ import division import atexit import functools import os import signal import sys import tempfile from subprocess import Popen, PIPE, STDOUT from threading import Thread try: from Queue import Queue, Empty except ImportError: from queue import Queue, Empty from time imp...
compareHistograms.py
#!/bin/env python3 from __future__ import print_function import ROOT ROOT.PyConfig.IgnoreCommandLineOptions = True import os import sys import argparse import numpy as np from DQMServices.FileIO.blacklist import get_blacklist import multiprocessing def create_dif(base_file_path, pr_file_path, pr_number, test_number, ...
multi_thread.py
import copy import inspect import os import pickle import threading import time import prettytable as pt from ..experiment import StateIO class aceThreading: """This class implement multi-threading in active learning for multiple random splits experiments. It will display the progress of each thead. Wh...
mosquitto.py
# Copyright (c) 2012,2013 Roger Light <roger@atchoo.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this lis...
old_ssh.py
import logging import os import socket import sys import traceback from queue import Queue from threading import Thread from time import sleep from tlz import merge from tornado import gen from ..metrics import time logger = logging.getLogger(__name__) # These are handy for creating colorful terminal output to enh...
PixelGUI.py
#!/usr/bin/python3 """Example of using LightBerries module functions with a GUI. Use GUI to interact with individual LEDs. """ import time import multiprocessing import multiprocessing.queues from tkinter.colorchooser import askcolor import tkinter as tk import LightBerries.LightPixels from LightBerries.Lig...
wpahandler.py
# -*- coding: utf-8 -*- # vim: ts=2 sw=2 et ai ############################################################################### # Copyright (c) 2012,2021 Andreas Vogel andreas@wellenvogel.net # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentatio...
main.py
TOKEN = "xxx.xxx.xxx" import websocket from time import sleep from threading import Thread from json import loads from html import unescape def ping_thread(ws): """ A thread to ping the server every 25 secs to keep the connection alive """ print("Started pinging") while True: ws.send("2"...
TCPClient_2nodes.py
import sys import socket import time import multiprocessing def send2server(bytes2send): """ Send packet to server Arg: bytes2send...bytes """ # target_host = "129.114.33.155" # external port is not open target_host = "192.168.0.64" target_port = 9998 # create a socket object ...
utils.py
""" Miscellaneous utils Date: September 2018 Author: Ignacio Heredia Email: iheredia@ifca.unican.es Github: ignacioheredia """ import os import subprocess from distutils.dir_util import copy_tree from multiprocessing import Process import numpy as np from tensorflow.keras import callbacks from tensorflow.keras import...
__init__.py
import gi import logging gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, Gio, GLib # register ui gresource file from os.path import abspath, join, dirname scriptdir = dirname(abspath(__file__)) resource = Gio.resource_load(join(scriptdir, 'resources', 'saldo.gresource')) Gio.Resource._register(r...
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...
teamtalk.py
"""PyTeamTalk A wrapper around the TeamTalk 5 TCP API. author: Carter Temm license: MIT http://github.com/cartertemm/pyteamtalk """ import shlex import time import threading import telnetlib import warnings import functools # constants ## MSG Types NONE_MSG = 0 USER_MSG = 1 CHANNEL_MSG = 2 BROADCAST_MSG = 3 CUSTO...
page2.py
from wizard import WizardPage from PySide2.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QScrollArea, QListWidget, QGridLayout, QLabel, QComboBox, QSpacerItem, QSizePolicy, QFrame from PySide2.QtCore import Qt, Signal, Slot from PySide2.QtGui import QBrush, QColor import threading class Page2(WizardPage): _...
main.py
#!/usr/bin/env python import threading import time import random import sys import multiprocessing as mp import os # import agent types (positions) from aigent.soccerpy.agent import Agent as A0 # strikers from aigent.agent_1 import Agent as A1 # defenders from aigent.agent_2 import Agent as A2 # goalie from aigent.ag...
rlock_ex.py
# rlock_ex.py # # An example of code-based locking. Every method of the class # below uses the same RLock object. However, some methods call # other methods. These nested calls will work within the same # thread. import threading class Foo(object): lock = threading.RLock() def __init__(self): self....
runner.py
from __future__ import division from collections import deque import numpy as np import os from os.path import abspath, dirname, join import subprocess import sys import time import threading from relay import log, configure_logging, add_zmq_log_handler from relay import util from relay import argparse_shared as at ...
Single_Walabot.py
from walabot import Walabot import math import numpy as np import matplotlib.pyplot as plt import time import json import collections from multiprocessing import Process import os import seaborn as sns """输出热图""" def getmap(param,rawImage):#获取垂直和水平热图 theta,phi,R=rawImage.shape H=np.zeros((phi,R)) ...
download_HCP_1200_xuanzang.py
# download_HCP_1200.py ''' This script downloads data from the Human Connectome Project - 1200 subjects release. ''' # Import packages from loguru import logger from pathlib import Path import threading import boto3 import time from utils.conf import * from utils.util import * project_path = Path.cwd() log_path = P...
led.py
import asyncio import concurrent import discovery import environment as env import instruction import random import time from threading import Thread import tlc5947 resolution_ms = 15 max_brightness = 4095 def start_background_loop(loop: asyncio.AbstractEventLoop): asyncio.set_event_loop(loop) loop.run_foreve...
filestreams.py
from collections.abc import Iterator import reactivestreams import asyncio from subscription import Subscription from queue import Queue, Empty from threading import Thread, Event import time import logging class FileSource(Iterator): def __init__(self, file_path): self.file_path = file_path self.g...
nanny.py
from __future__ import print_function, division, absolute_import from datetime import timedelta import logging from multiprocessing.queues import Empty import os import psutil import shutil import threading import uuid import dask from tornado import gen from tornado.ioloop import IOLoop, TimeoutError from tornado.lo...
Structure.py
import scipy import numpy as np import multiprocessing as mp from scipy.sparse import csc_matrix,csr_matrix, linalg, vstack, find import time class prolongation_operator(): def __init__(self, global_ids_internal_faces, coupled_edges_local_ids=None): self.OP_part = self.get_OP_part(global_ids_internal_faces...
portable_runner.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...
nsq_to_rocksdbserver.py
from rocksdbserver import Table, RocksDBServer, RocksDBAPI import nsq import uuid import json import Queue import atexit import rocksdb import datetime import tornado.ioloop from threading import Thread, Lock class NSQTable(Table): # TODO should we make pack and unpack json or msgpack ? # TODO revisit these ...
highlights.py
"""Highlights API handler.""" import os import sys sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')) import json import time from time import sleep import requests import threading try: from gateway_addon import APIHandler, APIResponse, Adapter, Device, Property, Database #prin...
awsterraformbuild.py
#!/usr/bin/env python import subprocess from python_terraform import * import network import json import container.handler import filecreator import os import varsdata import jsonRead import checkresources import warnings from threading import Thread from destroy_resource_utils import confirm_resource_deletion pacbot_...
relay_integration.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...
test_handler.py
# Copyright (C) 2015 Swift Navigation Inc. # Contact: https://support.swiftnav.com # # This source is subject to the license found in the file 'LICENSE' which must # be be distributed together with this source. All other rights reserved. # # THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, # ...
motion_pushover.py
# coding=utf-8 ''' pi@raspberrypi ~ $ echo $LANG zh_TW.UTF-8 https://github.com/ashtons/picam url http://host:port/s/foo_webapp.html ''' import settings import picam import logging,threading import datetime,time import Image import httplib, urllib import collections,array import tornado.httpserver import tornado.webs...
test_pooling_base.py
# Copyright 2012 10gen, 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, soft...
thread_buffer.py
# Copyright (c) MONAI Consortium # 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, so...
nifty.py
"""@package geometric.nifty Nifty functions, originally intended to be imported by any module within ForceBalance. This file was copied over from ForceBalance to geomeTRIC in order to lighten the dependencies of the latter. Table of Contents: - I/O formatting - Math: Variable manipulation, linear algebra, least square...
codeUtilityClass.py
import sys,json import subprocess from django.http import JsonResponse from utility.utilityClass import RUNNING_TASK_MEMORY from random import choice from string import ascii_uppercase import datetime import linecache from trainModel import kerasUtilities kerasUtilities = kerasUtilities.KerasUtilities() logFolder='./lo...
transformer_multireplica_local.py
# Copyright 2020 Petuum, 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.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
SPOR_BASIC_3.py
#!/usr/bin/env python3 import sys import os import time import subprocess from itertools import product from threading import Thread import TEST import TEST_FIO import TEST_LIB import TEST_LOG import TEST_SETUP_POS arrayId = 0 volId = 1 current_test = 0 run_time = 0 ################################################...
daemonize.py
#!/usr/bin/env python import signal import time from multiprocessing import Process import Pyro4 @Pyro4.expose class Thing: def method(self, arg): return arg * 2 def start_server(): daemon = Pyro4.Daemon() uri = daemon.register(Thing) print(f"uri={uri}") daemon.requestLoop() # ----...
mtSleepC.py
# threading 모듈 사용하기 import threading from time import sleep, ctime loops = [4, 2] def loop(nloop, nsec) : print 'start loop', nloop, 'at:', ctime() sleep(nsec) print 'loop', nloop, 'done at :', ctime() def main() : print 'starting at :', ctime() threads = [] nloops = range(len(loops)) for i in nlo...
begin_analysis.py
import hashlib import os import threading from threading import Lock from flask import render_template, redirect, request, make_response, url_for from Mercator import app, analysis_dir, socketio from Mercator.utils.Analysis import Analysis from flask_socketio import disconnect, emit a = None # OLD CODE FOR AJAX...
fixedmainengine.py
# !/usr/bin/python # vim: set fileencoding=utf8 : # __author__ = 'keping.chu' import importlib import os from threading import Thread, Lock import time from easyquant.log_handler.default_handler import DefaultLogHandler from easyquant.main_engine import MainEngine from easyquant.multiprocess.strategy_wrapper import P...
tests.py
# Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. import copy import io import os import pickle import re import shutil import tempfile import threading import time import unittest import warnings from unittest import mock from django.conf import settings from django.core...
tcp_srv.py
import socket import time from datetime import datetime host = '0.0.0.0' port = 8080 bind_address = (host, port) backlog_size = 2 def server_loop(): if not args.target: args.target = '0.0.0.0' server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((args.target, args.port)) s...
test_sender.py
from __future__ import print_function import os import pytest import six from six.moves import queue import threading import time import shutil import sys import wandb from wandb.util import mkdir_exists_ok # TODO: consolidate dynamic imports PY3 = sys.version_info.major == 3 and sys.version_info.minor >= 6 if PY3:...
mock_binary_server.py
import threading import socketserver import socket class MockMemSession(socketserver.BaseRequestHandler): def handle(self): data = self.request.recv(1024) self.server.append(data) self.server.server.basic_handler(self.server.data, self.request) class MockMemcachedServerInternal(socketser...
line2page.py
from pagetools.src.line2page.Line2Page import Line2Page import logging from typing import Tuple from pathlib import Path import time import multiprocessing from multiprocessing import Semaphore import click @click.command("line2page", help="Links line images and corresponding texts in a page and creates a combined ...
test_debug.py
import importlib import inspect import os import re import sys import tempfile import threading from io import StringIO from pathlib import Path from unittest import mock from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection from djan...
test_fortran_macro_micro.py
import multiprocessing as mp from pathlib import Path import subprocess import sys from libmuscle import Instance, Message from ymmsl import Operator def run_macro(instance_id: str): sys.argv.append('--muscle-instance={}'.format(instance_id)) macro() def macro(): instance = Instance({ Opera...
tello_pilot_node.py
#!/usr/bin/env python3 import time import math from utils.GetTelloIP import get_tello_ip from anyio import sleep import rospy from tf.transformations import quaternion_from_euler from std_msgs.msg import Empty, String, Int32 from sensor_msgs.msg import Image, Imu from sensor_msgs.msg import Joy from geometry_msgs....
tlsh_bh_tool.py
__name__ = "tlsh_bh_tool" __version__ = 1.0 __author__ = "Jayson Pryde" import os, sys, tlsh, argparse, threading, pefile, requests import logging, logging.config, hashlib, ConfigParser, simplejson from extended_file_properties import extended_file_properties as efp from os.path import getsize class TlshStru...
alert_host_disk_write_iops.py
''' Test about monitor trigger on host disk writing iops in one minute @author: Songtao,Haochen ''' import os import test_stub import random import threading import time import zstacklib.utils.ssh as ssh import zstackwoodpecker.test_util as test_util import zstackwoodpecker.operations.resource_operat...
add_books_to_db.py
import sys import string from datetime import datetime from threading import Thread import mongoengine from gutenberg.acquire import load_etext from gutenberg.cleanup import strip_headers from gutenberg.query import get_etexts from gutenberg.query import get_metadata import model import extract_metadata if __name...
som.py
import pickle from multiprocessing import cpu_count, Process, Queue import matplotlib.patches as mptchs import matplotlib.pyplot as plt import numpy as np from scipy.spatial.distance import cdist from sklearn.decomposition import PCA def man_dist_pbc(m, vector, shape=(10, 10)): """ Manhattan distance calculation...
formats.py
from __future__ import print_function, division, absolute_import import errno import os import stat import struct import subprocess import sys import shutil import tarfile import tempfile import threading import time import zipfile import zlib from contextlib import closing from functools import partial from io impor...
framereader.py
# pylint: skip-file import json import os import pickle import struct import subprocess import tempfile import threading from functools import wraps import numpy as np from aenum import Enum from lru import LRU import _io from tools.lib.cache import cache_path_for_file_path from tools.lib.exceptions import DataUnread...
engine.py
import re import ssl import sys import json import base64 import urllib2 import threading from core.alert import * from core._time import now from subprocess import Popen, PIPE from core.targets import target_type from core.log import __log_into_file devs = {}; ipList = [] httpPort = 80 debug = 0 scanid = '' scancmd =...
intel_side_communicate_with_nodemcu.py
import socket import time import threading def recvdata(cobj): while(1): data = ""; char = ""; while(char!="\n"): char = cobj.recv(1).decode() ; data+=char ; print(data); if not len(data):break; data="" ; s = socket.socket(socket.AF_INET , socket.SOCK_DGRAM) ; s.setsockopt(socket.SOL_SOC...
cli.py
import typer INFO = typer.style("INFO", fg=typer.colors.GREEN) + ": " HELP = typer.style("HELP", fg=typer.colors.BLUE) + ": " FAIL = typer.style("FAIL", fg=typer.colors.RED) + ": " SUCCESS = typer.style("SUCCESS", fg=typer.colors.BLUE) + ": " import click import os import yaml app = typer.Typer() def sc...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import verbose, strip_python_stderr, import_module, cpython_only from test.support.script_helper import assert_python_ok, assert_python_failure import random import re import sys _thread = import_module('_thread') threading = import_module(...
UtilityFunctions.py
# # Utility Functions to support re-use in python scripts. ## # Includes functions for running external commands, etc ## # Copyright Microsoft Corporation, 2017 ## from __future__ import print_function # support Python3 and 2 for print import os import logging import datetime import shutil import threading import sub...
conftest.py
from pcloud.tests.server import MockHandler from pcloud.tests.server import MockServer import pytest from threading import Thread PORT = 5000 @pytest.fixture(scope="session") def start_mock_server(): """ Start a mock server on port 5000 """ httpd = MockServer(("", PORT), MockHandler) httpd_thread = T...
dbfetcher.py
# XXX: A good starting point but does not work. For mdb is good enough. import sys import threading import datetime from itertools import chain import mysql.connector as mdb from wikipediabase.util import time_interval class DBUtil(object): """ Ad-hoc utils to iteract with a wikimirror database. """ ...
accessory_driver.py
"""AccessoryDriver - glues together the HAP Server, accessories and mDNS advertising. Sending updates to clients The process of sending value changes to clients happens in two parts - on one hand, the value change is indicated by a Characteristic and, on the other, that change is sent to a client. To begin, typically...
scrapy_polo_h5.py
# core import os import sys import time from datetime import datetime, timedelta from threading import Thread import traceback # installed # if running from the code/ folder, this will try to import # a module Poloniex from the folder. Better to run from within the # poloniex folder as a result from poloniex import P...
test_single_application_controller.py
# Copyright (c) 2017 LSD - UFCG. # # 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 writin...
LSE_GameClient.py
from framework.latentmodule import LatentModule import threading import rpyc, rpyc.core, rpyc.utils.classic, rpyc.utils.server from pandac.PandaModules import * from direct.task import Task import pygame,time import framework.ui_elements.ScrollPresenter, framework.ui_elements.TextPresenter, framework.ui_elements.Imag...
printer.py
import os import logging from threading import Thread, Event, Lock from time import sleep import serial HERE = os.path.dirname(os.path.abspath(__file__)) logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) #logger.addHandler(logging.StreamHandler()) #fh = logging.FileHandler(os.path.join(HERE, 'voxel...
learn.py
# # Unity ML-Agents Toolkit import logging import os import multiprocessing import numpy as np from docopt import docopt from .trainer_controller import TrainerController from .exception import TrainerError def run_training(sub_id, run_seed, run_options): """ Launches training session. :param sub_id: U...
asyncSignalCalculator.py
class AsyncSignalCalculator: def __init__(self, owner, cellSizeInMeters, filearray, rasterHeights, validAntennas, minx, miny, roadpoints, threadCount): self.owner = owner self.cellSizeInMeters = cellSizeInMeters self.filearray = filearray self.rasterHeights = rasterHeights s...
grid.py
from typing import List, Tuple from sklearn.mixture import GaussianMixture from calibration.util import * import cv2 import copy import numpy as np import threading as th import queue import h5py as hf import math import pint # useful DEBUG = False DEBUG_IMAGE = False # default processing settings GAUSS_KERNEL = 5 TH...
test_blue_dot.py
from bluedot import MockBlueDot, BlueDotSwipe, BlueDotRotation from time import sleep from threading import Event, Thread def test_default_values(): mbd = MockBlueDot() assert mbd.device == "hci0" assert mbd.port == 1 assert mbd.running assert mbd.print_messages assert mbd.double_press_time ==...
Test_test.py
''' import PySimpleGUI as sg data = [ [11,12,13,14], [21,22,23,24], [31,32,33,34], [41,42,43,44], [51,52,53,54] ] data2 = [["","","",""]] print(data[0]) print([a[0] for a in data]) layout = [ [sg.Table(data, headings=["col1", "col2", "col3", "col4"], visible_column_map=[True,True,Fa...
stream.py
import threading from sender import Sender from tcpserver import TCPServer class Stream: def __init__(self): self.senders = {} self._server_in_buf = [] def callback(address, queue, data): queue.put(bytes('ACK', 'utf8')) self._server_in_buf.append(data) s...
ManagementScanner.py
import queue import threading import requests import json import time test = 1 def info(): info = { 'name': 'manage', 'path': 'ManagementScanner', 'fullname': 'SWEP MANAGEMENT PAGE SCANNER', 'description': 'A simple management bruteforcing tool.', 'parameters': { ...
ReaderThread.py
from RFID import RFID import threading from gi.repository import GLib class ReaderThread: def __init__(self, isTest, handler): self.reader = RFID(isTest) self.handler = handler def startReader(self, join = False): """ Creates and starts the reader thread. :param handler: GUI ha...
upnp.py
import logging import threading from queue import Queue from typing import Optional try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) class UPnP: thread: Optional[threading.Thread] = None queue: Queue = Queue() def __init__(self): def run(): t...
templatizer.py
#!/usr/bin/env python3.5 import sys import glob import collections import time import csv import os import datetime import gzip import re import argparse from multiprocessing import Process csv.field_size_limit(sys.maxsize) TIME_STAMP_STEP = datetime.timedelta(minutes=1) STATEMENTS = ['select', 'SELECT', 'INSERT', '...
testthreads.py
import threading import queue if __name__ == '__main__': q = queue.Queue() def infinite_loop(): while True: obj = q.get() print(obj) t = threading.Thread(target=infinite_loop) t.start() for i in range(10): q.put(2**i)
test_streams.py
"""Tests for streams.py.""" import gc import os import queue import pickle import socket import sys import threading import unittest from unittest import mock from test.support import socket_helper try: import ssl except ImportError: ssl = None import asyncio from test.test_asyncio import utils as test_utils ...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from el...
demo_timeserver.py
""" <Program Name> demo_timeserver.py <Purpose> Acts as an Uptane-compliant Timeserver: -Listens for requests from vehicles over XML-RPC. -Receives a list of nonces and responds with a signed time attestation that lists those nonces. Currently, this module contains both core and demo code. Use: ...
ObsRS.py
# Update : 2019/12/19 # Author : Tzung-Hsien Huang import cv2 import pyrealsense2 as rs import numpy as np import threading, time class SenseObstacle(object): def __init__(self, coord1, coord2): # The ROI coordinate self.roi_top_left = coord1 self.roi_bot_right = coord2 ...
Chap10_Example10.15.py
import threading from time import sleep def multiply_two(): for i in range(11): print(f"2*{i} = {i * 2}") sleep(1) print("Child Thread Completed") def multiply_three(): for i in range(11): print(f"3*{i} = {i * 3}") myt1 = threading.Thread(target=multiply_two) myt1.start() myt1....
dag_processing.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...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from electrum.util import bfh, bh2u, UserCancelled from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import deserialize_xpub from electrum import constants from electrum.i18n import _ from electrum.transaction import deseriali...
test_poplib.py
"""Test script for poplib module.""" # Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL # a real test suite import poplib import asyncore import asynchat import socket import os import errno import threading from unittest import TestCase, skipUnless from test import support as test_support from ...
test_s3.py
import boto3 import botocore.session from botocore.exceptions import ClientError from botocore.exceptions import ParamValidationError from nose.tools import eq_ as eq from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest import isodate import email.utils import datetime import threading import re ...
beamdefender.py
import json import logging import threading import traceback import random import pyqrcode import schedule import re import numpy as np from PIL import Image, ImageFont, ImageDraw from mpl_finance import candlestick2_ohlc import matplotlib.pyplot as plt import matplotlib.ticker as ticker import datetime import time imp...
oca.py
#!/usr/bin/python3 """Oca comm test library""" import threading import serial class OpenCanalyzer(): """ Abstraction from the hardware """ def __init__(self): pass class OpenCanalyzerHw(): """ Internal class for communicating with the hardware""" def __init__(self, port): self.rxt = t...
runner.py
#!/usr/bin/env python3 """ Hit the target endpoints with GET requests """ import sys from argparse import ArgumentParser, RawDescriptionHelpFormatter as RDHF from urllib.request import urlopen from threading import Thread def read_url(url): """ Get request targeting the provided endpoint :param url: A UR...
test_generator_mt19937.py
import sys import pytest import numpy as np from numpy.linalg import LinAlgError from numpy.testing import ( assert_, assert_raises, assert_equal, assert_allclose, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings) from numpy.random import Generator, MT199...
ChildGuard.py
#!python3 import os,sys,subprocess,re,json,time import glob import win32com.client as win32com #pip install pywin32 import tempfile from xmlrpc.server import SimpleXMLRPCServer import xmlrpc.client from socketserver import ThreadingMixIn import threading from multiprocessing import Process import win32gui,win32process...
pig_chase_baseline.py
# Copyright (c) 2017 Microsoft Corporation. # # 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, publis...
benchmark_core.py
"""Benchmark diskcache.Cache $ export PYTHONPATH=/Users/grantj/repos/python-diskcache $ python tests/benchmark_core.py -p 1 > tests/timings_core_p1.txt $ python tests/benchmark_core.py -p 8 > tests/timings_core_p8.txt """ from __future__ import print_function import collections as co import multiprocessing as mp im...
main_process.py
# Process the incoming MQTT Data from the ESP32's Ultrasonic Sensor # Save and visuzalize the data # Written by Ahmed Al Bayati # IoT Simplified # https://iotsimplified.com/ import paho.mqtt.client as mqtt import threading import time import datetime as dt import matplotlib.animation as animation import matplotlib.pyp...
bases.py
from multiprocessing import Event, Process from typing import Mapping, Any, Tuple from ..test_utils import silence_function, random_channel, random_port from ...master import Master from ...slave import Slave, TaskFail class _TestInteractionBase: # noinspection PyMethodMayBeStatic def _slave_endpoint(self, p...
camera.py
import time import io import threading import picamera class Camera(): thread = None # background thread that reads frames from camera frame = None # current frame is stored here by background thread last_access = 0 # time of last client access to the camera def initialize(self): if Camera...
session.py
''' 会话管理 ''' import time import os import logging from ipaddress import ip_network import uuid as UUID_GENERATOR from threading import Thread from core.sys_manage import TunManager logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(filename)s[:%(lineno)d] %(levelname)s %(message)s', ...
scan.py
from scapy.all import * import info import threading from time import sleep MODE_ARP = 1 ARP_WHO_HAS = 1 ARP_IS_AT = 2 discovered = [] def arp_scan(host, current): p = Ether(dst=ETHER_BROADCAST) / ARP(op=ARP_WHO_HAS, pdst=current, psrc=host) return srp1(p, timeout=0.001, verbose=0) # shortest response time ...
monitoring.py
import matplotlib.pyplot as plt import serial import argparse import sys import json import time from matplotlib.animation import FuncAnimation from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from threading import Thread import tkinter as tk NB_POINTS = 50 STATE_DELAY = 75 ERROR_DELAY = 600 GRAPH_FRAM...
spawn_a_process.py
#Spawn a Process – Chapter 3: Process Based Parallelism import multiprocessing def function(i): print ('called function in process: %s' %i) return if __name__ == '__main__': Process_jobs = [] for i in range(5): p = multiprocessing.Process(target=function, args=(i,)) Process_...