source
stringlengths
3
86
python
stringlengths
75
1.04M
server.py
"""Usage: catcha_server.py SERVER_PORT Uses OpenCV's cat classifier to check image for cats, returns true or false. Arguments: SERVER_PORT port on which to start listening for image payloads """ import numpy as np import cv2 import socket from docopt import docopt import sys from threading import Thread import b...
taskfarm.py
''' Created on Jul 4, 2013 @author: Vlad & Bert ''' from threading import Thread from collections import deque import os import sys import time import submit_a_task import get_run_time import xmltodict import pprint pp = pprint.PrettyPrinter(indent=4,stream=sys.stderr) class Error(Exception): ...
smtio.py
# # yosys -- Yosys Open SYnthesis Suite # # Copyright (C) 2012 Clifford Wolf <clifford@clifford.at> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. #...
skip-gramHSNP.py
import numpy as np import multiprocessing from multiprocessing import Pool, Array, Process, Value, Manager import random import os import unicodedata import time from io import open num_threads = multiprocessing.cpu_count() start = time.process_time() starting_lr = 1e-3 sample = 1e-3 word_count_actual = 0 lr = 0.025 p...
minicap.py
import logging import socket import subprocess import time from datetime import datetime from .adapter import Adapter MINICAP_REMOTE_ADDR = "localabstract:minicap" ROTATION_CHECK_INTERVAL_S = 1 # Check rotation once per second class MinicapException(Exception): """ Exception in minicap connection """ ...
core.py
import asyncio from collections import deque, defaultdict from datetime import timedelta import functools import logging import six import sys import threading from time import time from typing import Any, Callable, Hashable, Union import weakref import toolz from tornado import gen from tornado.locks import Condition...
test_logging.py
#!/usr/bin/env python # # Copyright 2001-2009 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright n...
sensor.py
"""Pushbullet platform for sensor component.""" import logging import threading from pushbullet import InvalidKeyError, Listener, PushBullet import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import CONF_API_KEY, CONF_MONITORED_CONDITIONS import...
kayn.py
#!/usr/bin/python3 import mythic from mythic import mythic_rest import asyncio import json import base64 import requests import time import ast import types import math import random import socket import struct import platform import os import getpass import threading # from pynput import keyboard import re import sy...
tandem.py
import os import sys import random from subprocess import Popen, PIPE from threading import Thread, Event import sublime import sublime_plugin from tandem.diff_match_patch import diff_match_patch from tandem.edit import Edit # sys hack to add enum, required by the messages module file sys.path.append(os.path.join(o...
plexus.py
import random import math import threading import time usleep = lambda x: time.sleep(x/1000000.0) class Neuron(): def __init__(self, network): self.network = network self.subscriptions = {} self.publications = {} self.potential = random.uniform(0.0, 1.0) self.desired_poten...
test_crud.py
# Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
read_map.py
#!/usr/bin/env python3 import os import sys from threading import Thread import matplotlib.pyplot as plt import mpl_toolkits.mplot3d as plt3d import msgpack import numpy as np import open3d as o3d import pptk import scipy.spatial.transform as sst from PyQt5 import QtCore, QtWidgets from PyQt5.QtCore import QObject,...
Old_AudioSupervisor.py
#!/usr/bin/python from __future__ import unicode_literals import json, sys from socketIO_client import SocketIO from time import time, sleep from threading import Thread from hardware import * from modules.logger import * import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) log = Log(LOGLEVEL.INFO) volumio_host = 'localho...
lcd.py
from rpi_lcd import LCD as RPI_LCD import math import threading import time import unicodedata import queue class LCD(RPI_LCD): def __init__(self, address=0x27, bus=1, width=20, rows=4): self.playing = False self.text_queue = queue.Queue() threading.Thread(target=self.text_queue_worker, daemon=True).st...
test_mysqlx_connection.py
# -*- coding: utf-8 -*- # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # # This program is also d...
test_threading.py
# Very rudimentary test of threading module import test.test_support from test.test_support import verbose import random import re import sys thread = test.test_support.import_module('thread') threading = test.test_support.import_module('threading') import time import unittest import weakref from test im...
AuthMatrix.py
# Copyright (c) 2016 Mick Ayzenberg - Security Innovation # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify...
simpleclient.py
#!/usr/bin/env python2 ############################ CLIENT OPTIONS ########################################## #TXRX_FREQUENCY = 1000.0 STARTUP_NANOKONTROL = True USE_DRAKE_CONTROLLER = True SE_LISTEN_TO_VICON = True SE_VICON_CHANNEL = 'cf2_pete1' SE_PUBLISH_TO_LCM = True SE_USE_RPYDOT = True SE_USE_EKF = True SE_US...
Gluttonous snake.py
import time import random import threading import os from tkinter import * import tkinter.messagebox as messagebox # 核心模块 class Core(): row = 40 # 面板格子行数 column = 40 # 面板格子列数 score = 0 # 分数 interval = 0.08 # 速度 # 反方向 opposite_Direction = { 'Up': 'Down', 'Down': 'Up', 'Right': 'Left', 'Left': '...
Controller.py
# Controller v1.1 # 2020-05-09 12.05 AM (Melb) import math import time from datetime import datetime import threading import RPi.GPIO as GPIO from SensorReader import SensorReader import logging.config # Parameters Ti = 5 # inspiratory time Te = 5 # expiratory time Tw = 1 # waiting time Vt ...
util.py
#!/usr/bin/python # -*- coding: utf-8 -*- 'Utilities (Build Your Own Botnet)' from __future__ import print_function import colorama colorama.init() _debug = False # main def log(info, level='debug'): """ Log output to the console (if verbose output is enabled) """ import logging logging.basicCon...
process.py
""" Raspbot Remote Control Application (Raspbot RCA, Raspbot RCA-G), v1.2 basics module, contains basic application functions such as exiting client software, multithreading, and editing configs. Made by perpetualCreations Handles multithreading. """ from basics import objects from typing import Union def create_pro...
miniterm.py
#!/usr/bin/python # Very simple serial terminal # (C)2002-2009 Chris Liechti <cliechti@gmx.net> # Input characters are sent directly (only LF -> CR/LF/CRLF translation is # done), received characters are displayed as is (or escaped trough pythons # repr, useful for debug purposes) import sys, os, serial, threading ...
audio_module.py
from engine import TextWriter from engine import SystemState from engine import Utilities from engine import Menu from engine import Events import pyaudio import wave import time import os import Queue import numpy import fnmatch import signal import threading import matplotlib matplotlib.use('Agg') import matplotlib.p...
gathering.py
from psychsim.reward import * from psychsim.pwl import * from psychsim.action import * from psychsim.world import * from psychsim.agent import * import psychsim.probability import pyglet from pyglet.window import key from threading import Thread GATHERERS = 2 TURNS = 10000 class Gathering: def __init__(self): ...
pastedispatcher.py
# -*- coding: utf-8 -*- import logging from queue import Empty, Queue from threading import Event, Lock from time import sleep from pastepwn.util import start_thread, join_threads class PasteDispatcher(object): """The PasteDispatcher dispatches the downloaded pastes to the analyzers""" def __init__(self, p...
onefunctime.py
#!/usr/bin/python from bcc import BPF import Tkinter as tk import threading from multiprocessing import Process import signal, os from time import sleep def runbpf(self, name, sym): # print("nanananana %s"%name) # print("lalalalala %s"%sym) bpf_source = """ BPF_HASH(cache, u64, u64); BPF_ARRAY(avg, u64, 2);...
httpserver.py
# # SPDX-License-Identifier: MIT # import http.server import multiprocessing import os import traceback import signal from socketserver import ThreadingMixIn class HTTPServer(ThreadingMixIn, http.server.HTTPServer): def server_start(self, root_dir, logger): os.chdir(root_dir) self.serve_forever()...
ThreadStoppable.py
import threading import queue class ThreadStoppable(object): def __init__(self, target_to_loop, timeout=-1, args=()): self._target_to_loop = target_to_loop self._args = args self._timeout = timeout self.queue = queue.Queue() self.start() def loop(self): while n...
measure_methods.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...
ThreadPool.py
#!/usr/bin/env python # -*- coding:utf-8 -*- #!/usr/bin/env python # -*- coding:utf-8 -*- import queue import threading import contextlib import time # from hubSpider.spiders.downloader import xhub StopEvent = object() class ThreadPool(object): def __init__(self, max_num): self.q = queue.Queue()#存放任务的...
thread_queue_test.py
import pytest from time import sleep from threading import Thread from queue import Queue from zthreading.thread_queue import Queue def test_simple_queue(): queue = Queue() def do_enqueue(): sleep(0.1) queue.put("valid") pass Thread(target=do_enqueue).start() assert queue.get...
client.py
import json import socket import threading from dearpygui.core import * from dearpygui.simple import * with open('user/settings.hqs', 'r') as usersettings: user = json.load(usersettings) with open(f'languages/{user["language"]}.hqs', 'r') as language: lang = json.load(language) username = 'test' FORMAT = 'u...
4_RunShearBias.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 9 17:49:17 2020 @author: ssli Script to run the shear bias calibration Package: ShearBias.mCalFunc Data location: Input: SimCat, KV450/tomo, KV450/split Output: CosmicShear/shear_bias/ """ import multiprocessing as mp import feather...
core_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...
tkew.py
from threading import Thread from multiprocessing import cpu_count from typing import List, Tuple, Optional DEFAULT_WORKER_SIZE = cpu_count() // 2 class TaskQueue: def __init__(self, num_workers: int = DEFAULT_WORKER_SIZE): self.__workers: List[Thread] = [Thread(target=self.__listen, args=(wid,) ) for wi...
webcam_demo_via3.py
import argparse import time from collections import deque from operator import itemgetter from threading import Thread import mmcv import cv2 import numpy as np import torch from mmcv.parallel import collate, scatter from mmcv.runner import load_checkpoint from mmaction.datasets.registry import DATASETS from mmcv.utils...
updateCheck.py
#updateCheck.py #A part of NonVisual Desktop Access (NVDA) #This file is covered by the GNU General Public License. #See the file COPYING for more details. #Copyright (C) 2012-2018 NV Access Limited, Zahari Yurukov, Babbage B.V. """Update checking functionality. @note: This module may raise C{RuntimeError} on i...
test_threading_jy.py
"""Misc threading module tests Made for Jython. """ from __future__ import with_statement import random import subprocess import sys import threading import time import unittest from subprocess import PIPE, Popen from test import test_support from threading import Condition, Lock, Thread from java.lang import Thread...
build.py
# Copyright 2014 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
main.py
import time, math import os, sys import numpy as np from multiprocessing import Process, Lock import cert_information as ci dir = "./"+sys.argv[1].strip() [subfolders] = os.walk(dir) start = time.time() for file in subfolders[2]: domains = [] lock = Lock() p = 10 # Number of threads arq = open(dir...
restapi.py
#!/usr/bin/python3 from threading import Thread import signal import base64 from uuid import getnode as get_mac from decimal import * from threading import Lock from Crypto.Cipher import AES import simplejson as json from flask import Flask, request, send_from_directory from datetime import datetime import time from po...
lisp.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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...
io.py
import pickle as pickle import codecs import contextlib from contextlib import contextmanager import gzip import json import os import random import shutil import subprocess import sys import time from queue import Queue, Empty from abc import ABCMeta, abstractmethod from collections import Mapping, OrderedDict from o...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Cornellieis 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 im...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # 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 witho...
proxygrab.py
import threading, requests, time, os, sys, random class RangeIP_Generate(object): def __init__(self): self.r = '\033[31m' self.g = '\033[32m' self.y = '\033[33m' self.b = '\033[34m' self.m = '\033[35m' self.c = '\033[36m' self.w = '\033[37m' self.r...
num4.py
import threading import time import random total = [] locking = threading.Lock() def produce(cnt): global total while cnt>0: locking.acquire() total.append(random.randint(1,101)) locking.release() cnt-=1 thread_A = threading.Thread(target=produce, args=(20,)) thread_B = threa...
easy.py
#!/usr/bin/env python ''' brozzler-easy - brozzler-worker, warcprox, pywb, and brozzler-dashboard all working together in a single process Copyright (C) 2016 Internet Archive Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain...
evolve.py
#!/usr/bin/env python3 import subprocess import random import csv import json import pickle import pathlib import sys import filecmp import logging import io import os import time import gc import shutil from itertools import cycle from threading import Thread from threading import Event from threading import Lock # ...
ConductorWorker.py
# # Copyright 2017 Netflix, 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...
多地址端口扫描[线程+协程].py
import asyncio import functools import threading # 端口扫描 class PortScan: def __init__(self, ip_list, rate, all_ports=None): super(PortScan, self).__init__() self.ip_list = ip_list self.rate = rate if rate else 500 self.scan_port_list = [] self.common_port = "21,22,23,25,53,6...
sh.py
""" http://amoffat.github.io/sh/ """ #=============================================================================== # Copyright (C) 2011-2020 by Andrew Moffat # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to dea...
ws_utils.py
import websocket import threading import gzip import json from datetime import datetime from urllib import parse import hmac import base64 from hashlib import sha256 from alpha.platforms.huobi_usdt_swap.logger import * import time class WsUtils: def __init__(self, path: str, host: str = None, access_key: str = N...
__init__.py
"""The heap package is a Python extension for GDB which adds support for analyzing the heap. Currently only one heap implementation, that of glibc, is supported. """ import _gdb as gdb import sys import threading from _heap import HeapDetectionError, WrongHeapVersionError, UnsupportedHeap from glibc import detect_gl...
scraper.py
#encoding:utf-8 import threading import Queue import urlparse import requests import bs4 class ScraperWorkerBase(object): """ No needs to learn how is work, rewrite parse_page using self.soup(Beautiful), and return result, you can get the result by using (inpage_urls, your_own_result) urls...
test_partition.py
import time import random import pdb import threading import logging from multiprocessing import Pool, Process import pytest from utils.utils import * from common.constants import * from common.common_type import CaseLabel TIMEOUT = 120 class TestCreateBase: """ **********************************************...
utilities.py
from __future__ import with_statement __author__ = 'Tom Schaul, tom@idsia.ch; Justin Bayer, bayerj@in.tum.de' import gc import pickle import logging import threading import os import operator from itertools import count from math import sqrt from random import random, choice from string import split from scipy impo...
GenericWebcam.py
#!/usr/bin/env # coding: utf-8 # Code parts for asynchronous video capture taken from # http://blog.blitzblit.com/2017/12/24/asynchronous-video-capture-in-python-with-opencv/ import cv2 import threading from VIGITIA_toolkit.core.VIGITIACameraBase import VIGITIACameraBase CAMERA_ID = 0 RES_X = 1920 RES_Y = 720 FPS =...
build_mscoco_data.py
# Copyright 2016 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...
stratum-miner.py
# Copyright (c) 2019, The Monero Project # # 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 # list of ...
PyShell.py
#! /usr/bin/env python import os import os.path import sys import string import getopt import re import socket import time import threading import traceback import types import exceptions import linecache from code import InteractiveInterpreter from Tkinter import * import tkMessageBox from EditorWindow import Edit...
twitter.py
import sys import os import time from queue import Queue from threading import Thread from tweepy import Stream import tweepy import db as db import slack as slack import yaml from watchgod import run_process, watch from watchgod.watcher import DefaultDirWatcher from http.client import IncompleteRead as http_incomplet...
test_local_task_job.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 #...
ddosalfa.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # DDos cru Alfa v1.0 from queue import Queue from optparse import OptionParser import time,sys,socket,threading,logging,urllib.request,random def user_agent(): global uagent uagent=[] uagent.append("Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14") uage...
vehicle-inspector.py
#! /usr/bin/env python from smartcameras.subscriber import VehicleInspector import threading def main(): print("########################################") print "" print("Welcome to the Vehicle Inspector!") print "" print("########################################") vehicleInspector = Vehicle...
video_grabber.py
import cv2 import threading class VideoGrabber(): sources_urls = { "tvp:": "http://user:user@192.168.2.112:9981/stream/channel/28c32609c3e9143dff5dc1b0d16838cd?profile=mpeg", "polsat": "http://user:user@192.168.2.112:9981/stream/channel/a5f47e2442e9d19f43dafb7b51c686a2?profile=mpeg", "tvn"...
NTGmutiTask.py
from os import kill import total import RPC_Thread import tkinter.messagebox import time import threading def pause(TaskID, part, count): if part['text'] == '‖': part['text'] = '▶' part.update() total.RPC_down[count]['ispause'] = True RPC_Thread.PauseTask(TaskID) el...
python_instance.py
#!/usr/bin/env python # # 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 # "...
_server_adaptations.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...
repairer.py
# Copyright 2013-2018 CERN for the benefit of the ATLAS collaboration. # # 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...
main.py
from notification.notification import Notification as nf from git.git import Git import threading import time branch = "master" def worker(): number_of_commit = Git.number_of_commit(branch) while True: new_number_of_commit = Git.number_of_commit(branch) if number_of_commit != new_number_of_co...
routes.py
from flask import render_template, request from werkzeug.utils import secure_filename from app import app import logging import sys import os import pandas as pd import json import uuid import flask_executor import threading from app.backend import server_tools, tools UPLOAD_FOLDER = sys.path.append(os.p...
random_shuffle_queue_test.py
# Copyright 2015 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...
core.py
# Copyright 2017, David Wilson # # 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 list of conditions and the following disclaimer. # # 2....
test_base.py
import unittest import subprocess as sp import threading import os import time import taish TAI_TEST_MODULE_LOCATION = os.environ.get("TAI_TEST_MODULE_LOCATION", "") if not TAI_TEST_MODULE_LOCATION: TAI_TEST_MODULE_LOCATION = "0" TAI_TEST_TAISH_SERVER_ADDRESS = os.environ.get("TAI_TEST_TAISH_SERVER_ADDRESS", "") ...
apkleaks.py
#!/usr/bin/env python3 from apkleaks.colors import clr from contextlib import closing from distutils.spawn import find_executable from pyaxmlparser import APK from urllib.request import urlopen from zipfile import ZipFile import io import json import logging.config import mimetypes import numpy import os import re impo...
futures.py
# # This file is part of Gruvi. Gruvi is free software available under the # terms of the MIT license. See the file "LICENSE" that was provided # together with this source file for the licensing terms. # # Copyright (c) 2012-2014 the Gruvi authors. See the file "AUTHORS" for a # complete list. from __future__ import a...
process.py
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
utils.py
#================================================================ # # File name : utils.py # Author : PyLessons # Created date: 2020-09-27 # Website : https://pylessons.com/ # GitHub : https://github.com/pythonlessons/TensorFlow-2.x-YOLOv3 # Description : additional yolov3 and yolov4 functio...
mavproxy2.py
#!/usr/bin/env python # -*- coding:utf-8 -*- ''' mavproxy - a MAVLink proxy program Copyright Andrew Tridgell 2011 Released under the GNU GPL version 3 or later ''' import sys, os, time, socket, signal reload (sys) sys.setdefaultencoding('utf-8') import fnmatch, errno, threading import serial, Queue...
step_00_remove_pil_error_images.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Jun 26 14:24:22 2018 @author: pilgrim.bin@163.com """ import os import shutil import random import argparse import threading from threading import Lock import math from PIL import Image # usage: is_allowed_extension(filename, IMG_EXTENSIONS) IMG_E...
ex_3.py
""" Example 3: How do I have processes communicate? """ # Imports import numpy as np import multiprocessing as mp import tracemalloc from time import sleep # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def f1(q): q.put('Hello I am subprocess 1') sleep(0.05) print(q.get()) q.put('Hello fat...
common_cache_test.py
# Copyright 2018-2021 Streamlit 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 wr...
__main__.py
import sys import serial import threading from blueplayer import blueplayer def main(): args = sys.argv[1:] # first argument should be a serial terminal to open if not len(args): port = "/dev/ttyS0" else: port = args[0] player = None with serial.Serial(port, 19200) as serial_...
analysis.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 applic...
upload_payload_handler.py
import ftplib from payloads.absract_payload_handler import AbstractPayloadHandler from client import settings from threading import Thread class FTPUploadPayloadHandler(AbstractPayloadHandler): @classmethod def get_platform(cls): return "cross_platform" def ftp_upload(self,file_name): self....
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import queue as pyqueue import contextlib import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import struct import operator import weakref import test.su...
pyhash.py
#!/usr/bin/env python3 # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
web_directory_discovery.py
#! /usr/bin/python # ----------------------------------------------------------------------------------------------------------------------------- # GENERAL # ----------------------------------------------------------------------------------------------------------------------------- # # author: Sebastiaan Van Hoecke ...
mem.py
"Utility functions for memory management" from ..imports.torch import * from ..core import * from ..script import * from ..utils.env import * import pynvml, functools, traceback, threading, time from collections import namedtuple IS_IN_IPYTHON = is_in_ipython() GPUMemory = namedtuple('GPUMemory', ['total', 'used', '...
infolog.py
import atexit from datetime import datetime import json from threading import Thread from urllib.request import Request, urlopen _format = '%Y-%m-%d %H:%M:%S.%f' _file = None _run_name = None _slack_url = None def init(filename, run_name, slack_url=None): global _file, _run_name, _slack_url _close_logfile() _...
server.py
import asyncio import os import traceback from functools import partial from inspect import isawaitable from multiprocessing import Process from signal import SIG_IGN, SIGINT, SIGTERM, Signals from signal import signal as signal_func from socket import SO_REUSEADDR, SOL_SOCKET, socket from time import time from httpt...
learn.py
# # Unity ML-Agents Toolkit import logging from multiprocessing import Process, Queue import numpy as np from docopt import docopt from mlagents.trainers.trainer_controller import TrainerController from mlagents.trainers.exception import TrainerError def run_training(sub_id, run_seed, run_options, process_queue): ...
duet_test.py
# stdlib import atexit from multiprocessing import Process from multiprocessing import set_start_method import socket import sys import time from typing import Any from typing import Generator from typing import List # third party import pytest # syft absolute import syft as sy # syft relative from ...grid.duet.proc...
window change listener.py
""" Script using the Windows API to register for window focus changes and print the titles of newly focused windows. """ import sys import time import ctypes import ctypes.wintypes import threading import six class ObservableWindowChange(object): def __init__(self): self.__observers = [] ...
tweet.py
import time import threading import subprocess # 実行間隔を設定 def wait(): time.sleep(600) # 実行するファイルを設定 def cmd_exe(): # Call Python files subprocess.call("python osaka_tweet.py") print("大阪ツイート") print("------------------------------------------------------") subprocess.call("python hyogo_tweet.py") ...
run_end_to_end_tests.py
#!/usr/bin/env python3 # # Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
utils.py
# coding=utf-8 # Copyright 2019 The SEED Authors # 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 agre...