source
stringlengths
3
86
python
stringlengths
75
1.04M
trainer_utils.py
# coding=utf-8 # Copyright 2020-present the HuggingFace Inc. team. # # 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...
cleanup.py
import tempfile import argparse import logging import datetime import threading import os import re from ocs_ci.framework import config from ocs_ci.ocs.constants import CLEANUP_YAML, TEMPLATE_CLEANUP_DIR from ocs_ci.utility.utils import get_openshift_installer, run_cmd from ocs_ci.utility import templating from ocs_ci...
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...
dataloader.py
import os import sys import time from multiprocessing import Queue as pQueue from threading import Thread import cv2 import numpy as np import torch import torch.multiprocessing as mp import torch.utils.data as data import torchvision.transforms as transforms from PIL import Image from torch.autograd import Variable ...
idf_monitor.py
#!/usr/bin/env python # # esp-idf serial output monitor tool. Does some helpful things: # - Looks up hex addresses in ELF file with addr2line # - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R) # - Run "make flash" (Ctrl-T Ctrl-F) # - Run "make app-flash" (Ctrl-T Ctrl-A) # - If gdbstub output is detected, gdb is automa...
run_package.py
# Copyright 2018 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. """Contains a helper function for deploying and executing a packaged executable on a Target.""" from __future__ import print_function import common import ...
visual_test.py
import multiprocessing import random import shlex import subprocess import time import numpy as np import matplotlib import numpy.random import matplotlib.pyplot as plt from utils import VisualBoard from multiprocessing import process def ta(board:VisualBoard): for i in range(1000): board.add_scalar('ta/t...
test_io.py
import sys import gzip import os import threading from tempfile import mkstemp, NamedTemporaryFile import time from datetime import datetime import warnings import gc from numpy.testing.utils import WarningManager import numpy as np import numpy.ma as ma from numpy.lib._iotools import ConverterError, ConverterLockErro...
dispatchers.py
# -*- coding: utf-8 -*- '''A Dispatcher is the interface for submitting queries to the C backend in an ordered manner. These are meant to be used as Mixins. ''' import time from six.moves import queue as Queue import threading import abc from .logger import logger from .decorators import order_call_once from functools ...
processing.py
import echopype as ep import numpy as np import argparse import xarray from .utils import find_files from multiprocessing import Queue, Process import pyproj from scipy.ndimage import convolve from echopype.core import SONAR_MODELS def fetch_cruise_distance(ed: xarray.Dataset, nmea_msg: str = "RMC"): """ Ca...
go_sim.py
#!/usr/bin/env python # A script to run simulations sequentially. # Copyright F. Nedelec, 2010--2018 # Using multiprocessing thanks to Adolfo Alsina and Serge Dmitrieff, March 2016 """ Synopsis: Run simulations sequentially. For each config file, a simulation is started in a separate 'run' directory. ...
port-scanner.py
import threading, sys import requests from queue import Queue import time import socket, psutil from datetime import datetime import logging logging.basicConfig(filename = "logs.log", level=logging.INFO, format = '%(asctime)s %(name)s %(module)s %(levelname)s %(message)s') def parseProcessInfo...
bacnet_scan.py
#!/usr/bin/python ''' Copyright (c) 2013, Battelle Memorial Institute 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 ...
utils_gui.py
""" Classes to organize the sections of the GUI: display, info and control. Display implements a canvas for the user to graphically view the machine, info shows the main information of the machine along with the currently selected transition's info and a status bar, and control implements three panels to control the s...
board_hmi_lib.py
#!/usr/bin/env python3 from datetime import datetime, timedelta import copy import glob import functools import io import json import math import os import subprocess import tempfile import locale import logging import threading import time import traceback import tkinter as tk import redis import PIL.Image import PIL...
logging_vsajip.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # ======================================================================================================================== # # Project : Lab # # Version : 0.1.0 ...
kafka_listener.py
# # Copyright 2021 Red Hat Inc. # SPDX-License-Identifier: Apache-2.0 # """Sources Integration Service.""" import itertools import logging import queue import random import sys import threading import time from confluent_kafka import Consumer from confluent_kafka import TopicPartition from django.db import connections...
email.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from . import mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(to, subject, template, **kwargs): app = current_app._get_current_object() msg = Messa...
proxy.py
# Copyright 2020 Broadband Forum # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
dataloader_iter.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
test_fedavg.py
import threading import unittest import tensorflow as tf import numpy as np import fedlearner.common.fl_logging as logging from fedlearner.fedavg import train_from_keras_model (x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data() x_train = x_train.reshape(x_train.shape[0], -1).astype(np.float32) /...
start.py
#!/usr/bin/env python3 from concurrent.futures import ThreadPoolExecutor, as_completed from contextlib import suppress from itertools import cycle from json import load from logging import basicConfig, getLogger, shutdown from math import log2, trunc from multiprocessing import RawValue from os import urandom as randb...
installwizard.py
from functools import partial import threading import os from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform...
compute-topology-paths.py
#!/usr/bin/python import time, sys import networkx as nx from random import sample from multiprocessing import Process, Queue, cpu_count from threading import Thread, Lock INPUT_GRAPH="topology.pruned.graphml.xml" OUTPUT_GRAPH="topology.complete.graphml.xml" CLIENT_SAMPLE_SIZE=10000 def worker(taskq, resultq, G, poi...
simwss.py
#coding=utf-8 from wssExchange.base.basesub import BaseSub import wssExchange import ccxt # 常量定义 import logging log = logging.getLogger() import time from threading import Thread def simwss(exName, config={}): if exName in dir(wssExchange): exClass = getattr(wssExchange,exName) else: exClass = ...
md_acme.py
import logging import os import shutil import subprocess from abc import ABCMeta, abstractmethod from datetime import datetime, timedelta from threading import Thread from typing import Dict from .md_env import MDTestEnv log = logging.getLogger(__name__) def monitor_proc(env: MDTestEnv, proc): _env = env p...
archiver.py
import argparse import errno import io import json import logging import os import pstats import random import re import shutil import socket import stat import subprocess import sys import tempfile import time import unittest from binascii import unhexlify, b2a_base64 from configparser import ConfigParser from datetim...
ram_usage.py
################################################################################ # Copyright (c) 2021 ContinualAI. # # Copyrights licensed under the MIT License. # # See the accompanying LICENSE file for terms. ...
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...
ToontownAIRepository.py
from direct.distributed.PyDatagram import * from panda3d.core import * from otp.ai.AIZoneData import AIZoneDataStore from otp.ai.MagicWordManagerAI import MagicWordManagerAI from otp.ai.TimeManagerAI import TimeManagerAI from otp.ai import BanManagerAI from otp.distributed.OtpDoGlobals import * from otp.friends.Friend...
monitor.py
# Copyright (C) 2016 Nippon Telegraph and Telephone Corporation. # # 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 appli...
SerialPlot.py
import time import datetime from threading import Thread from collections import deque import serial import pandas as pd import plotly.experess as px class SerialLinePlot(object): def __init__(self, port: int, baudrate: int, window_size: int): self.port = port self.baudrate = baudrate s...
tomcat_manager_brute.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # https://www.0dayhack.com 来自颓废的博客 import sys import requests import threading import Queue import time import base64 import os #headers = {'Content-Type': 'application/x-www-form-urlencoded','User-Agent': 'Googlebot/2.1 (+[url]http://www.googlebot.com/bot.html[/ur...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2019 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test multiwallet. Verify that a bitcoind node can load multiple wallet files """ from threading import...
atac.py
import argparse import os from threading import Thread import atac def str2bool(v): if isinstance(v, bool): return v if v.lower() in ('yes', 'true', 't', 'y', '1'): return True elif v.lower() in ('no', 'false', 'f', 'n', '0'): return False else: raise argparse.ArgumentT...
test_describe_collection.py
import pytest import logging import time from utils import * from constants import * uid = "describe_collection" class TestDescribeCollection: @pytest.fixture( scope="function", params=gen_single_filter_fields() ) def get_filter_field(self, request): yield request.param @pyt...
server.py
""" Telnet server. Example usage:: class MyTelnetApplication(TelnetApplication): def client_connected(self, telnet_connection): # Set CLI with simple prompt. telnet_connection.set_application( telnet_connection.create_prompt_application(...)) def handle_com...
it_menu.py
#!/usr/bin/python3 import os import sys import time import smtplib import threading from requests import Session from requests.auth import HTTPBasicAuth from multiprocessing import Process from email import encoders from email.mime.text import MIMEText from email.mime.base import MIMEBase from email.mime.multipart impo...
gateway.py
# Copyright 2019 Novartis Institutes for BioMedical Research 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...
window.py
import psutil import logging from chartItem import * from PyQt5 import QtCore from PyQt5 import QtWidgets from PyQt5.QtGui import QIcon, QPixmap, QPalette from multiprocessing import Process, Queue sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from utility.static import * class Window(Q...
lm_client_tests.py
#!/usr/bin/env python3 # # Copyright (c) 2014-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # from __future__ import absolute_import, division, print_function, unicode_literals import unittest from builtins import...
train_ac_f18.py
""" Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017 Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam Adapted for CS294-112 Fall 2018 by Soroush Nasiriany, Sid Reddy, and Greg Kahn """ import numpy as np import tensorflow as tf import gym import logz import os import...
nMigen_test.py
import random import itertools from functools import partial from nmigen.sim import * from Nmigen_backend import Nmigen_backend from Data_interface import Data_interface import threading tests = [] def mytest(cls): obj = cls() tests.append(obj) return cls fail = False #example init for self.ui for help...
time.py
import os import time from contextlib import suppress from datetime import timezone as tz from astropy import units as u from astropy.time import Time from panoptes.utils import error from panoptes.utils.logging import logger def current_time(flatten=False, datetime=False, pretty=False): """ Convenience method t...
app.py
# encoding: utf-8 import multiprocessing import os import re import uuid import time from gozokia.i_o import Io from gozokia.conf import settings from gozokia.core import Rules from gozokia.core.text_processor import Analyzer from gozokia.utils.util_logging import Logging from gozokia.db import Model # settings.confi...
run.py
# -*- coding: utf-8 -*- # -*- python version: 3.** -*- """ Running the trained neural network, normalise image and control RoboFace. Copyright (C) 2017 Letitia Parcalabescu Modified by (2018): Viacheslav Honcharenko, Athanasios Raptakis This program is free software: you can redistribute it and/or modify it ...
dance_m1013.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ## # @brief [py example simple] motion basic test for doosan robot # @author Kab Kyoum Kim (kabkyoum.kim@doosan.com) import rospy import os import threading, time import sys sys.dont_write_bytecode = True sys.path.append( os.path.abspath(os.path.join(os.path.dirn...
keep_alive.py
from threading import Thread import random from app import create_app app = create_app() def keep_alive(): t = Thread(target=app.run(host="0.0.0.0", port=random.randint(2000, 9000))) t.start()
ib_gateway.py
""" Please install ibapi from Interactive Brokers github page. """ from copy import copy from datetime import datetime from queue import Empty from threading import Thread, Condition from ibapi import comm from ibapi.client import EClient from ibapi.common import MAX_MSG_LEN, NO_VALID_ID, OrderId, TickAttrib, TickerId...
main.py
import os, sys from threading import Thread, Timer from bokeh.layouts import column, row from bokeh.models import Button from bokeh.plotting import curdoc, figure from bokeh.models.widgets import Div from functools import partial try: import datashader except ImportError: datashader = None print("\n\nThe d...
ponselfbot2.py
# -*- coding: utf-8 -*- #Cakmin_BOTeam Newbie #Owner:https://line.me/ti/p/~agsantr #Official Account:http://line.me/ti/p/%40fvz4767v #Instagram:cakminofficial import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time, random, sys, ast, re, os, io, json, subprocess, threading, str...
kb_plant_rastServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
pubsub.py
import zmq import msgpack import threading as mt from .bridge import Bridge, no_intr, log_bulk from ..ids import generate_id, ID_CUSTOM from ..url import Url from ..misc import get_hostip, as_string, as_bytes, as_list from ..logger import Logger # ---------------------------------------------------------...
alert.py
#!/usr/bin/python3.8 #OpenCV 4.2, Raspberry pi 3/3b/4b - test on macOS import threading, queue import boto3 from utils.settings import get_settings_aws, get_settings_alarm class Alert: def __init__(self): super().__init__() self.q = queue.Queue() self.CURRENT_MOV = 0 self.clien...
manager.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2015 clowwindy # # 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 b...
text_client.py
# Copyright 2017 Mycroft AI 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 writin...
pytorch.py
import logging from dataclasses import dataclass from pathlib import Path from subprocess import Popen from threading import Thread from typing import Any, List, Optional, Union import torch import torch.nn as nn from nni.experiment import Experiment, TrainingServiceConfig from nni.experiment.config import util from n...
overseer.py
import traceback from asyncio import gather, Semaphore, sleep, Task, CancelledError from datetime import datetime from statistics import median from sys import platform from cyrandom import shuffle from collections import deque from itertools import dropwhile from time import time, monotonic from threading import Threa...
job_service.py
import logging import os import signal import threading import time import traceback from concurrent.futures import ThreadPoolExecutor from typing import Dict, List, Tuple import grpc import feast from feast.constants import ConfigOptions as opt from feast.core import JobService_pb2_grpc from feast.core.JobService_pb...
speedpwn.py
#!/usr/bin/env python ## # Author: Yorick Peterse # Website: http://www.yorickpeterse.com/ # Description: SpeedTouch Key is a Python script that generates (possible) keys # for a SpeedTouch Wireless network that uses the default SSID/password # combination based on the serial number. # # Imports from hashlib ...
threads.py
import threading from multiprocessing import Queue results = [] results2 = [] def take_numbers(q): print('Enter the numbers:') for i in range(0,3): num1 = int(input('Enter first number: ')) num2 = int(input('Enter second number: ')) q.put(num1) q.put(num2) def add_num(q): ...
CPageMonitor.py
import threading import time from Core.CUpworkPage import CUpworkPage from Core.CMonitoringTask import CMonitoringTask class CPageMonitor(): def __init__(self, configs, timeProvider=time.time): self._configs = configs self._tasks = { # UUID: task } self._time = timeProvider self...
video_stream.py
import cv2 # Computer vision import numpy as np import util import textable_frame as frame from collections import deque from threading import Thread # Constants WEBCAM_FRAME_WIDTH = 1080 # default webcam width WEBCAM_FRAME_HEIGHT = 720 # default webcam height MONITOR_FRAMES = 50 ...
ma_double_cross.py
''' golden cross buy; dead cross sell ''' import os import numpy as np import pandas as pd import pytz from datetime import datetime, timezone import multiprocessing import quanttrader as qt import matplotlib.pyplot as plt import empyrical as ep import pyfolio as pf import pickle # set browser full width from IPython.c...
ib_brokerage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from .brokerage_base import BrokerageBase from ..event.event import LogEvent from ..account import AccountEvent from ..data import TickEvent, TickType, BarEvent from ..order.order_type import OrderType from ..order.fill_event import FillEvent from ..order.order_event import...
host.py
# Software License Agreement (BSD License) # # Copyright (c) 2018, Fraunhofer FKIE/CMS, Alexander Tiderko # 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 mu...
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 grab from item import ItemFinder from config import Config import tkinter as tk import template_finder from PIL import ImageTk, Image import re class GraphicDebuggerControll...
__init__.py
import json import threading import time from platypush.context import get_bus from platypush.plugins import action from platypush.plugins.media import MediaPlugin, PlayerState from platypush.message.event.media import MediaPlayEvent, MediaPauseEvent, MediaStopEvent, \ MediaSeekEvent, MediaVolumeChangedEvent cla...
schedule.py
import builtins import threading import sched import time import schedule as _schedule import datetime import pause __all__ = () __version__ = '0.0.1' Inf = float('inf') class SchedJob: def __init__(self, method, amount): self._method = method self._amount = amount def do(self, func, *pargs...
app.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
test_b2_command_line.py
#!/usr/bin/env python2 ###################################################################### # # File: test_b2_command_line.py # # Copyright 2015 Backblaze Inc. All Rights Reserved. # # License https://www.backblaze.com/using_b2_code.html # ###################################################################### from _...
Run_CtaStrategy_NoUI_1.py
import multiprocessing from time import sleep from datetime import date, datetime, time from logging import INFO from vnpy.event import EventEngine from vnpy.trader.setting import SETTINGS from vnpy.trader.engine import MainEngine from vnpy.trader.utility import load_json, send_dingding, send_weixin from vnpy.gateway...
eeg.py
""" Abstraction for the various supported EEG devices. 1. Determine which backend to use for the board. 2. """ import sys import time import logging from time import sleep from multiprocessing import Process import numpy as np import pandas as pd from brainflow import BoardShim, BoardIds, BrainFlowInputPar...
driver.py
from os import environ import logging import asyncio from threading import Event, Thread, Lock from time import sleep from typing import Any, Optional, Mapping, Dict, Tuple from serial.serialutil import SerialException # type: ignore from opentrons.drivers import serial_communication, utils from opentrons.drivers.ser...
main_script.py
import numpy as np import cv2 from keras.preprocessing import image import time import multiprocessing import csv from tempfile import NamedTemporaryFile import shutil import matplotlib.pyplot as plt import matplotlib.animation as animation from imutils.video import VideoStream import argparse import imutils from PIL i...
videocaptureasync.py
# file: videocaptureasync.py import threading import cv2 import copy class VideoCaptureAsync: def __init__(self, width=2688, height=1520): self.src = "rtsp://admin:DocoutBolivia@192.168.1.64:554/Streaming/Channels/102/" #self.src = "video.mp4" self.cap = cv2.VideoCapture(self.src) se...
Hiwin_RT605_ArmCommand_Socket_20190627191835.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...
coqtopinstance.py
#!/usr/bin/env python3 '''Coqtop process handle.''' import logging from queue import Queue, Empty from subprocess import Popen, PIPE, TimeoutExpired from threading import Thread import xml.etree.ElementTree as ET from . import xmlprotocol as xp logger = logging.getLogger(__name__) # pylint: disable=C0103 ...
diskcache_manager.py
from . import BaseLongCallbackManager _pending_value = "__$pending__" class DiskcacheLongCallbackManager(BaseLongCallbackManager): def __init__(self, cache, cache_by=None, expire=None): """ Long callback manager that runs callback logic in a subprocess and stores results on disk using dis...
TAMV.py
#!/usr/bin/env python3 # Python Script to align multiple tools on Jubilee printer with Duet3d Controller # Using images from USB camera and finding circles in those images # # Copyright (C) 2020 Danal Estes all rights reserved. # Released under The MIT License. Full text available via https://opensource.org/licenses/MI...
pg_viewer_server.py
import json import time import threading import os import cv2 import igraph as ig from tcp_server import TcpServer from pg_viewer import PgViewer COLOR_DICT = { "ConceptNode": "#0C6DEF", "ObjectNode": "#EF0C0C" } class PgViewerServer(object): def __init__(self, host, port, tmp_path="./tmp.png"): ...
NGGRA.py
from tkinter import * from tkinter.filedialog import askopenfilename, asksaveasfilename from img_utils.detector import Detector import cv2 from config_utils import JsonWriter, JsonReader from config_utils.JsonConfig import * import threading from imutils.video import VideoStream import imutils from PIL import Image fro...
test_cli_task.py
# Copyright 2013: Mirantis 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 b...
test_request_safety.py
import threading import asyncio import aiohttp_jinja2 from urllib import request from aiohttp.test_utils import unittest_run_loop from ddtrace.pin import Pin from ddtrace.provider import DefaultContextProvider from ddtrace.contrib.aiohttp.patch import patch, unpatch from ddtrace.contrib.aiohttp.middlewares import tra...
turbo.py
import requests import json import threading import time import random #deal with config.json with open("config.json") as file: config = json.load(file) username = config['username'] password = config['password'] targets = config['targetUsernames'] #this is so I can dynamically change the endpoint endpoint = '...
flood.py
import random import socket import string import sys import threading import time # Parse inputs host = "" ip = "" port = 0 num_requests = 0 if len(sys.argv) == 2: port = 80 num_requests = 100000000 elif len(sys.argv) == 3: port = int(sys.argv[2]) num_requests = 100000000 elif len(sys.argv) == 4: ...
api_image_test.py
import contextlib import json import shutil import socket import tarfile import tempfile import threading import pytest import six from six.moves import BaseHTTPServer from six.moves import socketserver import docker from ..helpers import requires_api_version from .base import BaseAPIIntegrationTest, BUSYBOX clas...
__init__.py
import os import io import sys import time import glob import socket import locale import hashlib import tempfile import datetime import threading import subprocess from ctypes import windll from urllib.request import urlopen import psutil import win32gui import win32api import pythoncom import win32process import win...
bullet.py
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # 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 us...
sdk_worker.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...
measure_methods.py
# pylint: disable=invalid-name,too-many-function-args,too-many-nested-blocks """ Functions that run on executor for measurement. These functions are responsible for building the tvm module, uploading it to remote devices, recording the running time costs, and checking the correctness of the output. """ import logging...
conftest.py
import os from http.server import HTTPServer, SimpleHTTPRequestHandler from multiprocessing import Process import pytest from selenium import webdriver from selenium.webdriver.chrome.options import Options BROWSER = os.environ.get('BROWSER', 'ChromeHeadless') @pytest.fixture(scope="module") def browser(request): ...
helpers.py
""" Helper functions file for OCS QE """ import base64 import random import datetime import hashlib import json import logging import os import re import statistics import tempfile import threading import time import inspect from concurrent.futures import ThreadPoolExecutor from itertools import cycle from subprocess i...
webserver.py
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait import logging import argparse from http.server import HTTPServer, BaseHTTPRequestHandler import cgi import threading capabilities = { "browserName": "chrome", "version": "84.0", "enableVNC": False, "enableVideo": Fa...
server.py
import argparse import socket import threading import time import select gameState = {"users" : {},"shots":{}, "position":{}, "forward":{} } def get_amount_of_health(response): if "head" in response: return 5 if "body" in response: return 2 if "arm" in response: retu...
test1.py
import sys import io import unittest import os import time import threading from procwatcher.watcher import Proc, Daemon from procwatcher.command import Command, RESULT CFGFILE = 'test.conf' class TestCase(unittest.TestCase): def run_server(self): print print '(I) this test takes around about 30...
ipython.py
r""" The ParaViewWeb iPython module is used as a helper to create custom iPython notebook profile. The following sample show how the helper class can be used inside an iPython profile. # Global python import import exceptions, logging, random, sys, threading, time, os # Update python path to have ParaView libs pv_pa...
results.py
import os import subprocess import uuid import time import json import requests import threading import re import math import csv from datetime import datetime from toolset.utils.output_helper import log class Results: def __init__(self, benchmarker): ''' Constructor ''' self.bench...
TriviaTavernServer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 28 17:09:35 2021 @author: alessandro """ from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import random import time def accept_connections(): """ Accept incoming client connection.""" while True: # Playe...
threading.py
"""A threading based handler. The :class:`SequentialThreadingHandler` is intended for regular Python environments that use threads. .. warning:: Do not use :class:`SequentialThreadingHandler` with applications using asynchronous event loops (like gevent). Use the :class:`~kazoo.handlers.gevent.Sequential...