source
stringlengths
3
86
python
stringlengths
75
1.04M
myhttp.py
from Queue import Queue from threading import Thread from threading import Lock from threading import Event from cStringIO import StringIO from externals.reqresp.exceptions import ReqRespException from framework.core.myexception import FuzzException from framework.utils.myqueue import FuzzQueue from framework.fuzzer....
utils.py
# -*- coding: utf-8 -*- """ Various function that can be usefull """ import numpy as np from scipy.spatial.distance import cdist import multiprocessing import time __time_tic_toc=time.time() def tic(): """ Python implementation of Matlab tic() function """ global __time_tic_toc __time_tic_toc=time.time() ...
processes.py
#!/usr/bin/env python3.8 # -*- coding: utf-8 -*- from argparse import ArgumentParser from logging import basicConfig, INFO, info from multiprocessing import (Lock, Process, Queue, current_process, get_all_start_methods, set_start_method) from queue import Empty from time import sleep fr...
voice.py
import asyncio import concurrent.futures import threading import traceback from random import shuffle import discord import youtube_dl from discord.ext import commands class Song: def __init__(self, player, message, args=None, loop=False): self.player = player if player: self.title =...
threads.py
import logging import threading import time import random def thread_function(name): t0 = time.time() tSleep = random.randint(1,5) logging.info(f"Thread {name} : starting, sleep_for: {tSleep} sec(s)") time.sleep(tSleep) logging.info(f"Thread {name} : finishing, took: {round((time.time()-t0),2)...
RedisPerformanceClass.py
import redis from multiprocessing import Process def check_redis(logger, host, port, ret=None, passwd=None, socket_timeout=3): try: r = redis.StrictRedis(host=host, port=int(port), password=passwd, db=0, socket_timeout=socket_timeout, charset='utf-8') info = r.info() ...
train.py
#!/usr/bin/env python ''' Train Start the training and validation servers in their own subprocess. Run the steering training in this process. It can sometimes take multiple CTRL+C breaks to stop this. Author: Tawn Kramer ''' from __future__ import print_function import os import multiprocessing as mp import server impo...
client.py
import asyncio import logging import sys import time from asyncio import Transport, Protocol from threading import Thread from typing import Union, List, Tuple from bs4 import BeautifulSoup import kik_unofficial.callbacks as callbacks import kik_unofficial.datatypes.exceptions as exceptions import kik_unofficial.data...
serve.py
# Most of this code is: # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # The server command includes the additional header: # For discussion of daemonizing: # http://aspn.activestate.com/ASPN/C...
ODPP.py
# -*- coding: utf-8 -*- # wfr 20210907 实现 ODPP (Indicator-Directed Dynamic Power Management for Iterative Workloads on GPU-Accelerated Systems) import numpy as np import matplotlib.pyplot as plt import pandas as pd import os import threading import pickle import time import multiprocessing from multiprocessing import P...
main.py
from pyrogram import Client, filters, idle from config import API_ID, API_HASH, TOKEN, sudofilter import os, sys from tortoise import run_async from threading import Thread from datetime import datetime from db.db import init_db from db.functions import get_users_count, chat_exists, get_lang bot = Client( ":memory...
Chord.py
from datetime import datetime import hashlib import json import os import random import select import signal import socket import struct import sys import threading import time import os from ReadLog import MyLogger from ChordMessage import ChordMessage as c_msg from ChordMessage import newMsgDict # Represents any o...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from electrum_ltc.util import bfh, bh2u, UserCancelled from electrum_ltc.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, TYPE_ADDRESS, TYPE_SCRIPT, is_segwit_address) from e...
test_capture.py
import contextlib import io import os import pickle import subprocess import sys import textwrap from io import StringIO from io import UnsupportedOperation from typing import List from typing import TextIO import pytest from _pytest import capture from _pytest.capture import CaptureManager from _pytest.main import Ex...
api.py
from flask import Flask, request, render_template, Response import json from threading import Thread from labAPI import path import os, sys import logging logging.getLogger('werkzeug').setLevel(logging.ERROR) class API: def __init__(self, environment, addr='127.0.0.1', port=8000, debug=False): self.addr =...
raffle.py
import logging, coloredlogs from threading import Thread from random import choice from time import sleep from modules.config import * from modules.database import Database from modules.api import API database = Database(db_host, db_user, db_pass, db_name, db_autocommit) database.database_connection() class Raffle: ...
queues.py
from multiprocessing import Process, Queue, Lock import time from Just_wait import * from tictoc import * def reader(queue): while True: msg = queue.get() if (msg == 'DONE'): break def reader2(queue, lock): while True: x = queue.get() time.sleep(.1) lock.a...
util.py
#standard imports import sys, traceback, threading, time, urllib, os, requests, argparse, hashlib, pprint from termcolor import colored from akamai.edgegrid import EdgeGridAuth, EdgeRc from configparser import ConfigParser from urllib import parse #global variables, NOT thread safe do_snore = 0 ...
submit_module.py
import argparse import random import multiprocessing import time import ast import math import kubernetes import requests import os from subprocess import Popen, PIPE import influxdb from task_submit_torch import SubTask,ClusterAgent from pytz import UTC from dateutil import parser from datetime import datetime import...
sanitylib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fu...
__init__.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...
qt.py
#!/usr/bin/env python # # 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...
azcammonitor.py
# AzCam Monitor class import configparser import os import socket import socketserver import subprocess import sys import threading import time import psutil from azcam_monitor.webserver.web_server import WebServer import azcam class DataItem(object): def __init__(self): self.number = 0 self.ty...
main.py
# -*- coding: utf-8 -*- import argparse import json import multiprocessing import sys import time sys.path.append("..") sys.path.append("../src/") from src.main import execute DESCRIPTION = "Benchmarking utility." verbose = False class Timeout(Exception): pass def log(message): if verbose: print(message...
gateway.py
""" Cli Module =========== Contains the cmd cli interface launch as wm-gw-cli or python -m wirepas_gateway_client.cli .. Copyright: Copyright 2019 Wirepas Ltd under Apache License, Version 2.0. See file LICENSE for full license details. """ import cmd import json import threading...
test_05_ingestarchive.py
"""Ingest by directly writing a ZIP file to archive storage. """ from __future__ import print_function import sys import os import os.path import re import time from threading import Thread if sys.version_info < (3, 0): import Queue as queue else: import queue import zlib import logging import pytest import ic...
test.py
import time import threading import random from collections import Counter import pytest from helpers.cluster import ClickHouseCluster cluster = ClickHouseCluster(__file__) node1 = cluster.add_instance('node1', with_zookeeper=True) node2 = cluster.add_instance('node2', with_zookeeper=True) nodes = [node1, node2] ...
client_gui.py
import os import re import socket import threading import sys import qdarkstyle from PyQt5.QtCore import QTimer, Qt from PyQt5.QtWidgets import QApplication, QGridLayout, QWidget, QListWidget, QPushButton, QLineEdit, QPlainTextEdit class chat_window(QWidget): def mousePressEvent(self, event): self.offse...
soundtheme.py
import os import shutil from zipfile import ZipFile import threading import controlTypes from .camlorn_audio import Sound3D from config import conf from logHandler import log UNSPOKEN_ROOT_PATH = os.path.abspath(os.path.dirname(__file__)) UNSPOKEN_SOUNDS_PATH = os.path.join(UNSPOKEN_ROOT_PATH, "sounds") CONTROL_ROLE_...
terminology.py
""" Handles (deferred) loading of terminology data and access to it for odML documents """ import datetime import os import sys import tempfile import threading try: import urllib.request as urllib2 except ImportError: import urllib2 from hashlib import md5 from .tools.parser_utils import ParserException fro...
SlaverService.py
#!/usr/bin/env python # - encoding: utf-8 import win32serviceutil import win32service import win32event import sys import servicemanager import time import win32timezone import logging import traceback from slaver import main_slaver import threading from configparser import ConfigParser from pathlib i...
phaselink_dataset.py
#!/usr/bin/python #----------------------------------------------------------------------------------------------------------------------------------------- # PhaseLink: Earthquake phase association with deep learning # Author: Zachary E. Ross # Seismological Laboratory # California Institute of Technology # Script D...
WorkloadInvoker.py
#!/usr/bin/env python3 # Copyright (c) 2019 Princeton University # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # Standard imports import json from optparse import OptionParser import os import requests from requests_futures.sessions impor...
osa_online_reintegration.py
#!/usr/bin/python """ (C) Copyright 2020 Intel 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 applicable ...
caching.py
''' Created on 26.8.2019 @author: daim ''' from django.core.cache import cache from threading import Thread def postpone(function): """postpone -> connection needs to be closed in function if db connection""" def decorator(*args, **kwargs): t = Thread(target=function, args=args, kwargs=kwargs) ...
linkcheck.py
# -*- coding: utf-8 -*- """ sphinx.builders.linkcheck ~~~~~~~~~~~~~~~~~~~~~~~~~ The CheckExternalLinksBuilder class. :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re import sys import Queue import socket import threading from o...
lock_in_thread.py
from threading import Thread import time import threading global_value = 0 def run(threadName): global global_value local_cp = global_value print(f"{threadName} with value {local_cp}") global_value = local_cp+1 def run2(threadName, lock): global global_value lock.acquire() local_cp = glo...
thread-withevents.py
import socket import _thread from threading import Thread, Event import time mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock.connect(("35.240.31.174", 8500)) print("=== Connecté au serveur ===") print("Envoyez le message 'exit' pour terminer le programme\n") mainexit = Event() def listener(): ...
object_detector.py
# -*- coding: utf-8 -*- # Copyright © 2017 Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can # be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause """ Class definition and utilities for the object detection toolkit. """ from __futu...
dsym.py
""" sentry.runner.commands.dsym ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import uuid import json import click import warnings import threading from sentry.runner.decorator...
gameMain.py
from pkg.snakeGame import * import time from tkinter import * from pynput import keyboard import threading import random redCandy = candy class greenSnake(snake): def setup(): greenSnake.head.last_x = greenSnake.head.x greenSnake.head.last_y = greenSnake.head.y mainWD.gp.greenSnake = mainWD.gp.create_rectangl...
test_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...
state.py
import time import typing import traceback import threading import warnings from .state_status import StateStatus from .board import Board class State(): # Name of this state _name: str _transitions: typing.Sequence[typing.Tuple[typing.Callable[[ 'State', Board], bool], 'State']] # Stor...
utils.py
import glob import os from multiprocessing import JoinableQueue, Process, Queue import numpy as np from PIL import Image def ensure_exists(dir_path): try: os.makedirs(dir_path) except FileExistsError: pass else: print(f"Created directory {dir_path}!") def load_img(i, o, clip_0_1...
ircthread.py
#!/usr/bin/env python # Copyright(C) 2011-2016 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 to use, copy, m...
bootstrap.py
#!/usr/bin/env python -S # This file was automatically generated by # METATOOLS_SELF # at METATOOLS_TIME. import os import sys argv_emulation = METATOOLS_ARGV_EMULATION target = METATOOLS_TARGET target_type = METATOOLS_TARGET_TYPE envvars = METATOOLS_ENVVARS on_open_document = METATOOLS_ON_OPEN_DOCUMENT on_open_url ...
hornfuzz.py
import multiprocessing import faulthandler import argparse import os.path from src.seeds import * faulthandler.enable() enable_trace('spacer') enable_trace('dl_rule_transf') heuristics = [] heuristic_flags = defaultdict(bool) mutations = [] options = [] seed_number = 0 queue = [] current_ctx = None counter = defaul...
Session.py
from __future__ import annotations from Crypto.Hash import HMAC, SHA1 from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 from librespot.audio import AudioKeyManager, PlayableContentFeeder from librespot.audio.cdn import CdnManager from librespot.audio.storage import ChannelManager from librespot.c...
create_files_to_read.py
#!/usr/bin/env python3 import multiprocessing import os # Crea los ficheros que se van a leer por los clientes def create_file(num_bytes, path): content = bytes(int(num_bytes)) if num_bytes == 0: with open(path, 'w') as server_file: server_file.truncate(0) else: with open(path,...
PH_parallel_BoseHubbardStatics.py
import MPSPyLib as mps import networkmeasures as nm import ph_utils as ph import numpy as np import matplotlib.pyplot as plt import sys import os.path import time import argparse from threading import Thread from multiprocessing import Process from collections import defaultdict #import tempfile as tp import shutil de...
worker.py
from contextlib import contextmanager import atexit import faulthandler import hashlib import inspect import io import json import logging import os import redis import sys import threading import time import traceback from typing import Any, Dict, List, Iterator # Ray modules from ray.autoscaler._private.constants im...
main.py
#! /usr/bin/env python2.7 import util from util.include import * import screens def delete_event (widget, event, data = None): gobject.source_remove (timer) return False writer = None # Uncomment to record a demo for attract mode # Use Motion JPEG because, although it's not a good codec, it's not heavil...
AVR_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin AVR Miner (v1.8) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2020 ########################################## import socket, threading, time, re, subprocess, platform, configparser...
updating-server-data.py
#!/usr/bin/env python ''' Pymodbus Server With Updating Thread -------------------------------------------------------------------------- This is an example of having a background thread updating the context while the server is operating. This can also be done with a python thread:: from threading import Thread ...
aem_hacker.py
import concurrent.futures import itertools import json import datetime import traceback import sys import argparse import base64 import time from collections import namedtuple from http.server import BaseHTTPRequestHandler, HTTPServer from random import choice, randint from string import ascii_letters from threading im...
test_client.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import sys, time, readline, multiprocessing from optparse import OptionParser from sqlobject import SQLObject, IntCol, StringCol, BLOBCol from sqlobject.sqlite.sqliteconnection import SQLiteConnection ''' mock_client: this is a script that helps testing of Slingsho...
mpirun_exec_fn.py
# Copyright 2019 Uber Technologies, 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 applica...
_serial.py
# Copyright (c) 2019 UAVCAN Consortium # This software is distributed under the terms of the MIT License. # Author: Pavel Kirienko <pavel@uavcan.org> import copy import typing import asyncio import logging import warnings import threading import dataclasses import concurrent.futures import serial import pyuavcan.trans...
observer.py
# Copyright 2015-2017 F-Secure # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this file except in compliance with the License. You may # obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, ...
hyperopt.py
# Copyright 2019 IBM 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 applicable law or agreed to in writing, ...
sanitylib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fu...
backend.py
import os import inspect import imp import sys import threading import time from syncstep import SyncStep from synchronizers.base.event_loop import XOSObserver from xos.logger import Logger, logging from xos.config import Config from django.utils import timezone from diag import update_diag watchers_enabled = getattr...
yubikey.py
# _ __ # | |/ /___ ___ _ __ ___ _ _ ® # | ' </ -_) -_) '_ \/ -_) '_| # |_|\_\___\___| .__/\___|_| # |_| # # Keeper Commander # Copyright 2019 Keeper Security Inc. # Contact: ops@keepersecurity.com # import time import threading import logging import os import signal import base64 from ha...
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...
test_integration.py
import itertools import logging import os import subprocess import sys import mock import pytest import six import ddtrace from ddtrace import Tracer from ddtrace.internal import agent from ddtrace.internal.runtime import container from ddtrace.internal.writer import AgentWriter from tests.utils import AnyFloat from ...
test.py
import threading, time def print_console(): num = 1 while True: num += 1 print(f'\rCompleted: {num}', end='\n') time.sleep(1) def input_console(): test = input('') if test != '': print('пошел нвахнвахнвахнвахнвахнвах') return input_console() thr1 = threading.Th...
zeromq.py
# -*- coding: utf-8 -*- ''' Zeromq transport classes ''' # Import Python Libs from __future__ import absolute_import import os import sys import copy import errno import signal import hashlib import logging import weakref from random import randint # Import Salt Libs import salt.auth import salt.crypt import salt.uti...
kubectl.py
import os import logging import tempfile import time import threading from contextlib import suppress from pathlib import Path from stat import S_IREAD, S_IRGRP, S_IROTH from typing import List, Callable import plumbum as pb from ghao.errors import GhaoRuntimeError from ghao.jobs_view import JobsView from gi.reposit...
tests.py
from __future__ import with_statement import random import shutil import threading import time from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist from django.db import transaction from django.test import TestCase from versions.base impor...
executorwebdriver.py
import json import os import socket import sys import threading import time import traceback import urlparse import uuid from .base import (CallbackHandler, RefTestExecutor, RefTestImplementation, TestharnessExecutor, extra_timeout, ...
email.py
import pdb from threading import Thread from flask import current_app, render_template from flask.ext.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()...
devserver.py
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import atexit import logging import os import subprocess import sys from threading import Thread from django.contrib.staticfiles.management.commands.runserver import Command as RunserverCommand from dj...
openmmsetup.py
import openmm as mm import openmm.unit as unit from openmm.app import PDBFile, PDBxFile from pdbfixer.pdbfixer import PDBFixer, proteinResidues, dnaResidues, rnaResidues, _guessFileFormat from flask import Flask, request, session, g, render_template, make_response, send_file, url_for from werkzeug.utils import secure_f...
day9-2.py
import queue import threading class Intcode: def __init__(self, instructions, inputBuffer=queue.Queue(), outputBuffer=queue.Queue()): self.instructions = instructions self.inputBuffer = inputBuffer self.outputBuffer = outputBuffer self.relativeBase = 0 self.instructions.ex...
state.py
# -*- coding: utf-8 -*- """This class maintains the internal dfTimewolf state. Use it to track errors, abort on global failures, clean up after modules, etc. """ import logging import sys import threading import traceback from dftimewolf.lib import errors from dftimewolf.lib import utils from dftimewolf.lib.modules ...
simple_http_server.py
import os import urlparse import datetime import threading import mimetools import socket import errno import sys import select import time import json import base64 import hashlib import struct import xlog class GetReqTimeout(Exception): pass class ParseReqFail(Exception): def __init__(self, message): ...
mysql_test.py
#!/usr/bin/env python import logging import os import random import string import threading import unittest # TODO(hanuszczak): This should be imported conditionally. import MySQLdb import unittest from grr.server.grr_response_server import db_test_mixin from grr.server.grr_response_server import db_utils from grr.se...
app.py
import os import sys import numpy as np from threading import Thread from pynput import keyboard from torusengine.scene import Scene from torusengine.camera import Camera from torusengine.light import Light from torusengine.status import Status from torusengine.move import Move command_line_options = { "-h": "help", ...
_server.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...
fuzzer.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
core.py
from ctypes import * from OpenGL.GL import * from PIL import Image from math import copysign from .matrix import Matrix from . import glfw from . import util import cPickle as pickle import os import Queue import threading import time def delete_all(obj): '''Calls `delete()` on all members of `obj` that are recogn...
test.py
# a = [1,2,3,4,5,6] # b = 0 # for i in a: # b += 1 # if b % 3 == 0: # print('remove%d'%i) # a.remove(i) # print(i) # # def KK(a): # if a %2==0: # return True, 0 # else: # return False, 2 # # a = KK(3) # print(a) # if a[0]: # print('dd') # b = KK(4) # print(b) # if...
run_thread.py
import sys import time import datetime import threading from pytz import timezone def thread_test(number, float_time): _currtime = datetime.datetime.now(timezone('Asia/Seoul')) print(str(_currtime) + ', thread_test, number is \'' + str(number) + '\', time: \'' + str(float_time) + '\' [start]') time.sleep(...
thread_5.py
import logging import threading import time logging.basicConfig(level=logging.DEBUG, format='%(threadName)s: %(message)s') def worker1(): logging.debug("start") time.sleep(5) logging.debug("end") def worker2(): logging.debug("start") time.sleep(2) logging.debug("end") if __name__ == "__main_...
manage.py
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2021 Aaron Dewes <aaron.dewes@protonmail.com> # # SPDX-License-Identifier: MIT import stat import tempfile import threading from typing import List from sys import argv import os import requests import shutil import json import yaml import subprocess from lib.composeg...
speedtest.py
if 64 - 64: i11iIiiIii if 65 - 65: O0 / iIii1I11I1II1 % OoooooooOO - i1IIi import xbmc import xbmcgui import xbmcaddon import os import re import sys import math import signal import socket import timeit import threading import time import uuid try: import xml.etree.cElementTree as ET from xml.dom import minid...
test_asyncore.py
import asyncore import unittest import select import os import socket import sys import time import errno import struct import threading from test import support from test.support import os_helper from test.support import socket_helper from test.support import threading_helper from test.support import warnings_helper ...
speedtest_cli.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2013 Matt Martz # 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/lic...
warg.py
#!/usr/bin/python import subprocess, os, shutil, time, winreg, sys import win32api, win32gui, win32con, win32process import pyodbc import psutil import datetime, calendar from queue import Queue from threading import Thread from argparse import ArgumentParser from getpass import getpass from http.server import BaseHT...
multi.py
import multiprocessing def worker(): """worker function""" print ('Worker') return def receive(): n = input(">>>") if __name__ == '__main__': p = multiprocessing.Process(target=worker) p.start() o = multiprocessing.Process(target=receive) o.start() for i in range(10): p = mu...
runDask.py
### Imports from mpi4py import MPI import os import argparse import time from dask.distributed import Client from azureml.core import Run import sys, uuid import threading import subprocess import socket import glob import dask import pandas as pd import dask.dataframe as dd from notebook.notebookapp import list_runn...
demo.py
import ctypes import Tkinter from multiprocessing import Process from multiprocessing.sharedctypes import Value from mouse import Mouse, stream class DemoApp: def __init__(self): self.master = Tkinter.Tk() self.x = Tkinter.StringVar() self.x.set("0.0") self.y = Tkinter.StringVar...
page.py
import json import logging import threading from typing import List, Literal, Optional from beartype import beartype from pglet import constants from pglet.connection import Connection from pglet.control import Control from pglet.control_event import ControlEvent from pglet.protocol import Command ALIGN = Literal[ ...
fbv.py
#!/usr/bin/env python3 #doing all needed imports from os import system from firebase import firebase import threading import subprocess as s from sys import argv from datetime import datetime from playsound import playsound import os import pyrebase from mss import mss import time #we're creating db for our messages ...
failed-auth-cleanup.py
import pandas as pd import os from os import listdir from os.path import isfile, join import sys import threading import itertools import time class Spinner: def __init__(self, message, delay=0.1): self.spinner = itertools.cycle(['-', '/', '|', '\\']) self.delay = delay self.busy = False ...
servers.py
import os from http.server import HTTPServer, SimpleHTTPRequestHandler import multiprocessing import signal import time from django.core.servers import basehttp from django.core.wsgi import get_wsgi_application import pytest @pytest.fixture def run_django_server(): # Run a Django server in a process def runner(): ...
TServer.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...
movement_consumer.py
import json from time import sleep import sys import requests from bs4 import BeautifulSoup from kafka import KafkaConsumer, KafkaProducer from threading import Thread def kafkaConsumer(): topic_name = 'postgres.banking.movements' consumer = KafkaConsumer(topic_name, bootstrap_servers=['...
muultiprocess_env.py
import numpy as np from multiprocessing import Process, Pipe import abc def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() while True: cmd, data = remote.recv() if cmd == 'step': ob, reward, done, info = env.step(data) ...
example2.py
# ch6/example2.py from multiprocessing import Process, current_process import time def f1(): pname = current_process().name print('Starting process %s...' % pname) time.sleep(2) print('Exiting process %s...' % pname) def f2(): pname = current_process().name print('Starting process %s...' % p...