source
stringlengths
3
86
python
stringlengths
75
1.04M
ws.py
from queue import Queue, Empty import time import threading import logging import atexit import json import ssl import urllib.parse from awxkit.config import config log = logging.getLogger(__name__) class WSClientException(Exception): pass changed = 'changed' limit_reached = 'limit_reached' status_changed =...
camera.py
import cv2 import threading import time from datetime import datetime from ...node import NodeBase from ...view.cv.facialrecogn import FacialRecognition from ...model.messages import SayMessage SOMEONE_THERE = 1 NO_ONE_THERE = 0 class CameraController(NodeBase): def __init__(self, node_name="camera", host="127.0....
TrackerServer.py
# -*- coding: utf-8 -*- import logging from multiprocessing import Process, Queue import gevent from sledilnik.TrackerGame import TrackerGame from so2.servers.Server import Server class TrackerServer(Server): """Tracker process babysitter Server spawns an external OpenCV tracker process and reads data fro...
utils.py
# -*- coding: utf-8 -*- """ flask_testing.utils ~~~~~~~~~~~~~~~~~~~ Flask unittest integration. :copyright: (c) 2010 by Dan Jacob. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, with_statement import gc import time try: import unittest2 as unittest ex...
thread_add_syn_change.py
#!/usr/bin/env python "每次都打印200,因为共享资源的访问已经同步化" import threading import time COUNT_INT = 0 def adder(count_int_mutex): "间隔地给COUNT_INT加1" global COUNT_INT with count_int_mutex: COUNT_INT += 1 time.sleep(0.5) with count_int_mutex: COUNT_INT += 1 def main(): global COUNT_INT count_int_mutex = threading.Lo...
server_voice.py
#!/usr/bin/python3 import socket import threading class Server: def __init__(self): self.ip = socket.gethostbyname(socket.gethostname()) while 1: try: #self.port = int(input('Enter port number to run on --> ')) self.port = ...
ipcontrollerapp.py
#!/usr/bin/env python # encoding: utf-8 """ The IPython controller application. Authors: * Brian Granger * MinRK """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full ...
allreduce.py
#!/usr/bin/env python import os import torch as th import torch.distributed as dist from torch.multiprocessing import Process def allreduce(send, recv): """ Implementation of a ring-reduce. """ rank = dist.get_rank() size = dist.get_world_size() send_buff = th.zeros(send.size()) recv_buff = th.zer...
GUI.py
import numpy as np from PIL import Image from Parser import Parser from mazeMaker import MapMaker from SystemControl import SystemControl from Tkinter import Tk, Label, Frame, PhotoImage, Toplevel import scipy.misc import threading from moveRobot import moveRobot import Globals as G from pynput import keyboard from pir...
initialize.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals from ..libraries import __version__ as version from ..libraries.project_check import ProjectCheck from ..libraries.tools im...
rebalance.py
#!/usr/bin/env python3 from pyln.client import Plugin, Millisatoshi, RpcError from threading import Thread, Lock from datetime import timedelta import time import uuid plugin = Plugin() plugin.rebalance_stop = False def setup_routing_fees(plugin, route, msatoshi): delay = plugin.cltv_final for r in reversed(...
games_cog.py
import asyncio import json import random import re import requests from multiprocessing import Process, Queue from typing import Union import discord from discord.ext import commands from lib.connectX import Board as ConnectX from lib.discord_interface import add_choices_message, wait_for_choice, remove_choices from ...
test.py
import json import random import re import string import threading import time from multiprocessing.dummy import Pool import pytest from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster cluster = ClickHouseCluster(__file__) node1 = cluster.add_instance('node1', ...
predict.py
# # Copyright (c) 2018, Salesforce, Inc. # The Board of Trustees of the Leland Stanford Junior University # 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 ...
core.py
# -*- coding: utf-8 -*- # # 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 #...
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...
autoLoginYahooMail.py
from threading import Thread from selenium import webdriver from selenium.webdriver.common.keys import Keys import time import sys #email_forward = 'rimalisa2019@gmail.com' # read txt file def read_email_info(): file1 = open("yahoo forward.txt", "r+") n = 0 with file1 as myfile: data = myfile.readlines() n = le...
taskManager.py
# BSD 2-Clause License # # Copyright (c) 2021, Hewlett Packard Enterprise # 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 noti...
conftest.py
from __future__ import print_function import pytest import time import datetime import requests import os import sys import threading import logging import shutil from contextlib import contextmanager from tests import utils from six.moves import queue from wandb import wandb_sdk # from multiprocessing import Process...
record.py
#!/usr/bin/env python3 import json import os import threading import time import logging from pyMusicSync import utils class Record: """ Class representing a record file to keep track of converted and synced file """ threadLock = threading.Lock() filePath = "" record = {} # <trackID>:<filePath> ...
_threading.py
__all__ = ('run_in_thread', 'run_in_executer', ) from threading import Thread from kivy.clock import Clock import asynckivy def _wrapper(func, event): ret = None exc = None try: ret = func() except Exception as e: exc = e finally: Clock.schedule_once(lambda __: event.set((r...
engine.py
"""""" from threading import Thread from queue import Queue, Empty from copy import copy from vnpy.event import Event, EventEngine from vnpy.trader.engine import BaseEngine, MainEngine from vnpy.trader.object import ( SubscribeRequest, TickData, BarData, ContractData ) from vnpy.trader.event import EV...
utils.py
import argparse import os import random from threading import Thread import numpy as np import torch import torch.distributed as dist import wandb class AverageMeter: def __init__(self, name=None): self.name = name self.reset() def reset(self): self.sum = self.count = self.avg = 0 ...
test_wal_acceptor.py
import pytest import random import time import os import subprocess import uuid from contextlib import closing from multiprocessing import Process, Value from fixtures.zenith_fixtures import WalAcceptorFactory, ZenithPageserver, PostgresFactory, PgBin from fixtures.utils import lsn_to_hex, mkdir_if_needed pytest_plug...
frontend_test.py
#!/usr/bin/env python """Unittest for grr http server.""" import hashlib import ipaddress import os import socket import threading import time from absl import app import portpicker import requests from grr_response_core.lib import utils from grr_response_core.lib.rdfvalues import file_finder as rdf_file_finder from...
system_metrics_monitor.py
import time import datetime as dt import threading import sys import argparse import psutil import firebase_util from core_data_modules.logging import Logger log = Logger(__name__) firebase_client = None COLLECTION = 'pipeline_system_metrics' #name of the firebase collections to store metrics DEFAULT_INTERVAL = 600 ...
ntpot.py
#!/usr/bin/env python3 import os import signal import threading from . import ntp import core.potloader as potloader import core.utils as utils from .dblogger import DBThread class NTPot(potloader.PotLoader): """ Implementation of NTP honeypot that responds to NTP messages type 3, 6 and 7. """ def name...
data_utils.py
# Lint as python3 # Copyright 2018 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 r...
plugin.py
# -*- coding: utf-8 -*- import time import logging import traceback import sys import json from threading import Thread from mamonsu.lib.const import Template class PluginDisableException(Exception): pass class Plugin(object): # plugin interval run Interval = 60 # plugin config DEFAULT_CONF...
config.py
"""Configuration Utilities.""" import configparser import inspect import os import subprocess import sys import threading import requests quiet_STDOUT = True # # Interactions # def send(info, force=False): """Force output to parent application.""" if not quiet_STDOUT or force: print('{}'.format(i...
test_triggers.py
# (C) Copyright 1996- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernment...
debug_tracker.py
import socket import pickle import time import sched import numpy as np from tracker.debug.debug_command import DebugCommand import threading class Debug: def __init__(self, tracker, address): self.ui_server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.ui_server.setsockopt(socket.SOL_S...
thruster_manager.py
# Copyright (c) 2020 The Plankton Authors. # All rights reserved. # # This source code is derived from UUV Simulator # (https://github.com/uuvsimulator/uuv_simulator) # Copyright (c) 2016-2019 The UUV Simulator Authors # licensed under the Apache license, Version 2.0 # cf. 3rd-party-licenses.txt file in the root direct...
goroutine.py
from threading import Thread from typing import Any, Iterable, Mapping, Generator from types_extensions import Function, void, safe_type, const, Number_t class ChannelClosed(Exception): def __str__(self) -> str: return "This channel is closed. You can bypass this exception by passing `safe=True` to put(...
_app.py
""" """ """ websocket - WebSocket client library for Python Copyright (C) 2010 Hiroki Ohtani(liris) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the...
rpc_test.py
import concurrent.futures import contextlib import json import os import sys import threading import time from collections import namedtuple from functools import partial from threading import Event from threading import Lock from unittest import mock import torch import torch.nn as nn import torch.distributed as dis...
test_mturk_agent.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import os import time import threading from unittest import mock from parlai.mturk.core.agents import MT...
app-2020-0803-0500.py
#!/usr/bin/env python3 ##jwc o #!/usr/bin/env python # Key Notes # # jwc 2020-0519 Convert from Crickit_Adafruit to RoboHat_4tronix # jwc 2020-0519 Use 'gpiozero' for noise-free servo-control # jwc Add 'robohat.init()' # jwc Make sure 'servod' copied in from 'RoboHat' dir # jwc Using 'ro...
SignatureDPI.py
import socket import threading from scapy.all import * signatureTable = [(71, (70, b'\x90\xf6')), (None, (60, b'\x07\x03\x04')), (346, (54, b'\xf9\xa0\xba\xa8\x81\x8d\xdc'))] firstIface = 'eth0' firstIfaceFlows = ['52:54:00:00:00:65'] secondIface = 'eth1' secondIfaceFlows = ['52:54:00:a1:54:c0'] def inOutServer(): ...
91porn_cookie.py
import requests import os,re,time,random,threading def Handler(start, end, url, filename): headers = {'Range': 'bytes=%d-%d' % (start, end)} with requests.get(url, headers=headers,stream=True) as r: with open(filename, "r+b") as fp: fp.seek(start) var = fp.tell() ...
plot-data.py
""" This demo demonstrates how to draw a dynamic matplotlib plot in a wxPython application. This code is based on Eli Bendersky's code found here: http://eli.thegreenplace.net/files/prog_code/wx_mpl_dynamic_graph.py.txt """ import os import random import wx import serial import threading import json import time im...
session.py
from os import wait import threading import requests import time from .common import * from .synguar_algo import synguar_3H, synguar_singleH KEEPALIVE_STRPROSE = 15 KEEPALIVE_STRSTUN = 0 is_number = lambda x : type(x) == int or type(x) == float class Session(): def __init__(self, synthesizer, example_file, epsil...
main.py
from flask import Flask, render_template, request, session, redirect, url_for, flash from threading import Thread import os import json import smtplib from email.mime.text import MIMEText app = Flask(__name__) app.secret_key = os.urandom(24) @app.route("/") def home(): return render_template("index.html") ...
train_multi_gpu.py
"""Training IGMC model on the MovieLens dataset.""" import os import sys import time import glob import random import argparse from shutil import copy import numpy as np import torch as th import torch.nn as nn import torch.optim as optim import traceback from functools import wraps from _thread import start_new_thr...
MasterService.py
# app.py import os, sys, time import json from threading import Thread from selenium import webdriver from selenium.webdriver.common.keys import Keys from webwhatsapi import WhatsAPIDriver from pprint import pprint # from ServiceImporter import * import requests # export PATH="$HOME/wholesomegarden/WhatsappReminder:...
data_batcher.py
# -*- coding: utf-8 -*- import numpy as np import pickle import time from queue import Queue from threading import Thread from .data_loader import DataLoader CHUNK_NUM = 20 class DataBatcher(object): """ Data batcher with queue for loading big dataset """ def __init__(self, data_dir, file_list, ...
newhacu1.py
#!/usr/bin/python # -*- coding: UTF-8 -*- from os import system, name import itertools import threading import time import sys import datetime from base64 import b64decode,b64encode from datetime import date expirydate = datetime.date(2022, 1, 13 ) #expirydate = datetime.date(2021, 12, 30) today=date.today() def her...
selector.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...
calibrate.py
""" This file contains code for calibrating camera Saving calibration and collecting old calibrations """ import pickle as pkl import os import threading import cv2 import time import mediapipe as mp class Status(): start_calculate = False stop = False result = (0, 0) def calibrate(camera): """Calcul...
multi_adb.py
#!/usr/bin/env python3 # coding: utf-8 from __future__ import print_function, unicode_literals from distutils.spawn import find_executable import asyncio import os import re import subprocess import sys from threading import Thread import time adb_path = find_executable("adb") if not adb_path: print('adb path ...
processor.py
# MIT License # # Copyright (c) 2021 Javier Alonso <jalonso@teldat.com> # # 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...
test_nntplib.py
import io import socket import datetime import textwrap import unittest import functools import contextlib import os.path import threading from test import support from nntplib import NNTP, GroupInfo import nntplib from unittest.mock import patch try: import ssl except ImportError: ssl = None ...
template-gui.py
from tkinter import * from tkinter import ttk, messagebox from halo import Halo from threading import Thread root = Tk() root.geometry('800x600+500+150') def start(): spinner = Halo(text='App is running', placement='right', text_color='green' , color='cyan') spinner.animation t = Thread(target=lambda:spin...
stats_requester.py
""" Simple timed stat requester. Requests stats that all other methods can listen for """ from pox.core import core import pox.openflow.libopenflow_01 as of import time import threading import math log = core.getLogger() stat_interval_seconds = 1 def launch(): def request_stats_loop(): next_time = math.floor(...
multidownloadXkcd.py
#! python3 # multidownloadXkcd.py - Downloads XKCD comics using multiple threads. import requests, os, bs4, threading os.chdir(r'.\Chapter-15_scheduling_tasks') os.makedirs('xkcd', exist_ok=True) def downloadXkcd(startComic, endComic): for urlNumber in range(startComic, endComic): # Download the page ...
LogCollectDaemon.py
import subprocess import uuid, threading, datetime from pymongo import MongoClient import time class RunDaemon(): def __init__(self): super(RunDaemon, self).__init__() self.thread_stop_flag = True self.MONGO_URL = "localhost" self.MONGO_PORT = 27017 self.MONGO_DB = "LogNoti...
uf2dialog.py
import logging import threading import os.path import time import traceback import tkinter.font as tkfont import urllib.request from tkinter import ttk, messagebox from typing import Optional from urllib.request import urlopen from thonny import get_runner from thonny.languages import tr from thonny.misc_utils import ...
test_state.py
# -*- coding: utf-8 -*- ''' Tests for the state runner ''' # Import Python Libs from __future__ import absolute_import import errno import os import shutil import signal import tempfile import textwrap import yaml import threading from salt.ext.six.moves import queue # Import Salt Testing Libs from tests.support.case...
test_subprocess.py
import unittest from unittest import mock from test import support import subprocess import sys import signal import io import itertools import os import errno import tempfile import time import traceback import selectors import sysconfig import select import shutil import threading import gc import textwrap from test....
kivy_ui.py
import json import re import time from copy import copy from datetime import datetime from functools import partial from subprocess import Popen, PIPE, STDOUT from threading import Thread from collections import namedtuple from kivy.logger import Logger import io import os import atexit import yaml from PIL import Ima...
test_search_vectors.py
import pdb import copy import pytest import threading import datetime import logging from time import sleep from multiprocessing import Process import numpy from milvus import Milvus, IndexType, MetricType from utils import * dim = 128 table_id = "test_search" add_interval_time = 2 vectors = gen_vectors(100, dim) # ve...
mjc_env.py
import matplotlib.pyplot as plt import numpy as np import os import random from threading import Thread import time from tkinter import TclError import traceback import sys import xml.etree.ElementTree as xml from dm_control.mujoco import Physics, TextOverlay from dm_control.mujoco.wrapper.mjbindings import enums from...
CPULoader.py
#!/usr/bin/python # # Program never ends. Press Ctrl-C to terminate # import multiprocessing def calculate(): x = 1.0 while True: x = x + 1.0 if __name__ == '__main__': for i in range(multiprocessing.cpu_count()): p = multiprocessing.Process(target=calculate) p.start()
B.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def main(): return 'JDBot is up and running!!' def run(): app.run(host='0.0.0.0', port=3000) def b(): server = Thread(target=run) server.start()
run_synth_tests.py
import os import sys import multiprocessing sys.path.append(os.path.join("..", "..")) sys.path.append(os.path.join("..", "..", "algo")) import params.PDL1NetConfig as pdl1_config import algo.PDL1Net.PDL1NetTester as Tester import algo.mrcnn.model as modellib ROOT_DIR = os.path.join(os.getcwd(), "..", "..") DEFAULT_LO...
systray.py
import time from io import StringIO from threading import Lock, Thread from typing import List from PyQt5.QtCore import QThread, pyqtSignal, QCoreApplication, Qt, QSize from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QSystemTrayIcon, QMenu, QWidget, QSizePolicy from bauh import __app_name__ from bauh.api.ab...
s20.py
""" Orbivo S20. """ import binascii import struct import logging import socket import threading import time _LOGGER = logging.getLogger(__name__) # S20 UDP port PORT = 10000 # UDP best-effort. RETRIES = 3 TIMEOUT = 1.0 DISCOVERY_TIMEOUT = 1.0 # Timeout after which to renew device subscriptions SUBSCRIPTION_TIMEOUT...
rdd.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...
__init__.py
# -*- coding: utf-8 -*- ''' Set up the Salt integration test suite ''' # Import Python libs from __future__ import absolute_import, print_function import os import re import sys import copy import time import stat import errno import signal import shutil import pprint import atexit import socket import logging import...
player.py
import os import threading from tkinter import * from tkinter import filedialog from mutagen.mp3 import MP3 import tkinter.messagebox import time from tkinter import ttk from ttkthemes import ThemedTk as tk from pygame import mixer import sqlite3 conn=sqlite3.connect('users.db') c=conn.cursor() # ---- Initialization ...
zconfig.py
#!/usr/bin/python3 -OO # Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any late...
__init__.py
from typing import Dict, List, Union import threading import asyncio import json from aiocqhttp import CQHttp, MessageSegment from Core.UMRType import UnifiedMessage, MessageEntity, ChatType, EntityType from Core import UMRDriver from Core import UMRLogging from Core.UMRMessageRelation import set_ingress_message_id, se...
create_tfrecords.py
""" Create the tfrecord files for a dataset. A lot of this code comes from the tensorflow inception example, so here is their license: # Copyright 2016 Google 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...
base_camera.py
# reference https://github.com/miguelgrinberg/flask-video-streaming/blob/master/base_camera.py import threading import time try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident class Camer...
core.py
import re import struct import time import socket, select import threading import xmltodict import json try: import queue as queue except ImportError: import Queue as queue import netifaces from collections import namedtuple from . import commands from .utils import ValueRange, format_nri_list class ISCPMess...
bchn-rpc-gbt-checkvalidity-ignorecache.py
#!/usr/bin/env python3 # Copyright (c) 2021 The Bitcoin Cash Node developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ bchn-rpc-gbt-checkvalidity-ignorecache Test that the -gbtcheckvalidity arg works, and that the te...
runtests_log_handler.py
# -*- coding: utf-8 -*- ''' :codeauthor: Pedro Algarvio (pedro@algarvio.me) :copyright: Copyright 2016 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. pytestsalt.salt.log_handlers.pytest_log_handler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
conftest.py
import asyncio import threading import psycopg2 import psycopg2.errors import pytest @pytest.fixture def executor(postgresql): """Create a thread and return an execute() function that will run SQL queries in that thread. """ cnx = [] loop = asyncio.new_event_loop() def execute(query: str, c...
test_socket.py
import unittest from test import support import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import array import contextlib from weakref import proxy import signal import math import pickle import struct import random import...
test_interrupt.py
import os import signal import tempfile import time from threading import Thread import pytest from dagster import ( DagsterEventType, Failure, Field, ModeDefinition, RetryPolicy, String, execute_pipeline, execute_pipeline_iterator, job, op, pipeline, reconstructable, ...
server_4.py
import socket from threading import Thread conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM) conn.bind(("127.0.0.1", 14900)) # сервер занимает такой адрес conn.listen(10) clientsocket, address = conn.accept() # сервер подключает клиента def send(): while True: clientsocket.send(input().encode("...
pscan_thread.py
import socket import threading from Queue import Queue print_lock = threading.Lock() target = 'Pythonprogramming.net' server_ip = socket.gethostbyname(target) def port_scan(port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((target,port)) with print_loc...
redis_lock.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # author: bigfoolliu """ 使用redis实现分布式锁 实现思想: 1. 获取锁的时候,使用setnx加锁,并用expire加一个超时时间,超过时间则自动释放锁, 锁的value值为随机生成的uuid 2. 获取锁的时候设置一个获取的超时时间,超过时间则放弃获取锁 3. 释放锁的时候,通过uuid判断是不是该锁,是的话则delete进行锁释放 https://www.cnblogs.com/angelyan/p/11523846.html """ import time import uuid from...
anti.py
import requests import random from fake_headers import Headers import names import threading count = 1 def hehe(): while True: n = names.get_first_name() + '@ad.unc.edu' p = ''.join(random.sample('1234567890qwertyuiopasdfghjklzxcvbnm!@#$%^&*()', 10)) header = Headers(headers=False) ...
benchmark.py
""" **benchmark** module handles all the main logic: - load specified framework and benchmark. - extract the tasks and configure them. - create jobs for each task. - run the jobs. - collect and save results. """ from copy import copy from enum import Enum from importlib import import_module, invalidate_caches import ...
proc.py
# Subprocess containers """ A mechanism to run subprocesses asynchronously and with non-blocking read. """ import os import Queue import shlex import subprocess import threading class Group: """ Runs a subprocess in parallel, capturing it's output and providing non-blocking reads (well, at least for the caller t...
main.py
import multiprocessing as mp import sys import yaml from kivy.config import Config import constants from shared import SettingLoader class Settings: def __init__(self): # Number of divisions of the sea in every axis self.space_subdivisions = None # Frame rate of the game in seconds per f...
ninjaMQTTBridge.py
#!/usr/bin/python # # used to interface the NinjaCape via MQTT # - reads data from serial port and publishes on MQTT client # - writes data to serial port from MQTT subscriptions # # - uses the Python MQTT client from the Mosquitto project http://mosquitto.org (now in Paho) # # https://github.com/perrin7/ninjacape-mqtt...
plotting.py
"""Pyvista plotting module.""" import pathlib import collections.abc from functools import partial import logging import os import textwrap import time import warnings import weakref from functools import wraps from threading import Thread import imageio import numpy as np import scooby import vtk from vtk.util impor...
neural_gpu_trainer.py
# Copyright 2015 Google 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 a...
httpserver.py
import os import queue import shutil import tempfile import threading import http.server import socketserver from ..extern.RangeHTTPServer import RangeHTTPRequestHandler __all__ = ['HTTPServer', 'RangeHTTPServer'] def run_server(tmpdir, handler_class, stop_event, queue): # pragma: no cover """ Runs an HT...
generic_shell.py
import sublime import os import sys import threading import subprocess from time import time, sleep from .settings import Settings """ Generic shell implementations, derived from Sublime Text's exec command implementation """ class GenericShell(threading.Thread): def __init__(self, cmds, view, on_complete=N...
utils.py
#!/usr/bin/env python import sys import gc import glob import array import os import random from PIL import Image import mss try: # import cupy as np import numpy as np except ImportError: print("Cupy not installed.") import numpy as np from skimage.color import rgb2gray from skimage.transform import...
rview.py
""" Library for supporting general functionality in retroactive views. """ import abc import inspect import numbers import threading import db.errors as errors import db.rrecord as rrecord import db.types.subscribable as rpubsub def wrap(cls, clsname=None, no_rewrite=()): """ Wraps a class so that all its inher...
stage_op_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...
utils.py
import json import sys import re import os import stat import fcntl import shutil import hashlib import tempfile import subprocess import base64 import threading import pipes import uuid import codecs import zipfile try: from collections.abc import Iterable, Mapping except ImportError: from collections import...
benchmark_server.py
import unittest import urllib2 import json import os import signal from uuid import uuid4 from toto.secret import * from multiprocessing import Process, active_children from toto.server import TotoServer from time import sleep, time def run_server(processes=1): TotoServer(method_module='web_methods', port=9000, proc...
emulator.py
""" Commodore-64 simulator in 100% pure Python 3.x :) This module is the GUI window logic, handling keyboard input and screen drawing via tkinter bitmaps. Written by Irmen de Jong (irmen@razorvine.net) License: MIT open-source. """ import io import os import sys import tkinter import pkgutil import threading import ...
plc.py
import threading import time from asyncio import Queue from collections import deque from pprint import pprint from typing import List, Optional, Any import snap7 from snap7.snap7types import S7AreaDB, S7WLReal, S7WLBit, S7WLByte from stream2py import SourceReader from stream2py.sources.raw_plc import PlcRawRead, Plc...
saver.py
# burp extension to save page response content from the site map via a right click #burp imports from burp import IBurpExtender from burp import IContextMenuFactory #Java imports from javax.swing import JMenuItem from java.util import List,ArrayList from java.net import URL #python imports import threading import os...