source
stringlengths
3
86
python
stringlengths
75
1.04M
utils.py
# -*- coding:utf-8 -*- """ Author: Weichen Shen,wcshen1994@163.com """ import json import logging from threading import Thread import requests try: from packaging.version import parse except ImportError: from pip._vendor.packaging.version import parse def check_version(version): """Return version...
test_database.py
# vim: sw=4:ts=4:et import logging import multiprocessing import threading import time import unittest import uuid from multiprocessing import Process, Event, Pipe import saq import saq.database import saq.test from saq.constants import * from saq.database import get_db_connection, Alert, use_db, \ ...
speed-cam_887.py
#!/usr/bin/python """ speed-cam.py written by Claude Pageau pageauc@gmail.com Windows, Unix, Raspberry (Pi) - python opencv2 Speed tracking using picamera module or Web Cam GitHub Repo here https://github.com/pageauc/rpi-speed-camera/tree/master/ This is a python openCV object speed tracking demonstration program. It ...
rman_render.py
import time import os import rman import bpy import sys from .rman_constants import RFB_VIEWPORT_MAX_BUCKETS, RMAN_RENDERMAN_BLUE from .rman_scene import RmanScene from .rman_scene_sync import RmanSceneSync from. import rman_spool from. import chatserver from .rfb_logger import rfb_log import socketserver import thread...
phase_group_test.py
"""Unit tests for PhaseGroups generally and running under the test executor.""" import threading import unittest import openhtf as htf from openhtf import plugs from openhtf.util import test as htf_test def blank(): pass blank_phase = htf.PhaseDescriptor.wrap_or_copy(blank) @htf.PhaseOptions() def stop_phase(...
httpserver.py
import os import queue import shutil import tempfile import threading import http.server import socketserver from ..extern.RangeHTTPServer import RangeHTTPRequestHandler __all__ = ['HTTPServer', 'RangeHTTPServer'] def run_server(tmpdir, handler_class, stop_event, queue): # pragma: no cover """ Runs an HT...
server.py
#!/usr/bin/env python3 import os import threading from http.server import BaseHTTPRequestHandler, HTTPServer from cgi import FieldStorage from .arguments import args from .logger import logger from . import forms from . import redirection success_count = 0 failure_count = 0 class ReCaptchaRequestHandler(BaseHTTPReq...
supreme.py
#!/usr/bin/python3 # Zachary Weeden 2018 import os import random import sys import configparser import json import datetime import requests import time from colorCodes import * import threading from requests.utils import dict_from_cookiejar from selenium import webdriver from selenium.webdriver.support.ui import Selec...
misc.py
"""Module for miscellaneous functions and methods""" import sys import tempfile import inspect import platform import os from threading import Thread import random import string from functools import wraps import scooby import numpy as np # path of this module MODULE_PATH = os.path.dirname(inspect.getfile(inspect.cu...
launchnotebook.py
"""Base class for notebook tests.""" from __future__ import print_function from binascii import hexlify from contextlib import contextmanager import errno import os import sys from threading import Thread, Event import time from unittest import TestCase pjoin = os.path.join from unittest.mock import patch import r...
swapfe.py
#!/bin/env python3 import threading import subprocess import requests import platform import shutil import time import hashlib import psutil import sys import webbrowser from threading import Thread from flask import Flask, request, json, render_template, Response from os import path, mkdir from os.path import expa...
tests.py
import threading from time import sleep from datetime import timedelta from mock import patch from freezegun import freeze_time from django import db from django.test import TransactionTestCase from django.core.management import call_command from django.test.utils import override_settings from django.test.client impo...
4035abe4ee651b035771cc9a5bc307f41e33e0ddnode.py
""" The Node class """ import zmq import logging import tempfile from zerotask.server import Server from zerotask.task import task from zerotask import jsonrpc from zerotask.exceptions import JSONRPCError from zerotask.worker import Worker from multiprocessing import Process import optparse class Node(Server): ""...
util.py
"""Test utilities. .. warning:: This module is not part of the public API. """ import os import pkg_resources import shutil import tempfile import unittest import sys import warnings from multiprocessing import Process, Event from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitive...
utils.py
# -*- coding: utf-8 -*- # Copyright 2012-2021 CERN # # 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...
worker.py
# -*- coding: utf-8 -*- import os import time import signal import traceback import logging import platform import threading import multiprocessing from multiprocessing import cpu_count from concurrent.futures import ThreadPoolExecutor WIN_SYSTEM = "WINDOWS" _thread_lock = threading.Lock() log = logging.getLogger("Wor...
daemon.py
# Copyright (c) 2016, Kevin Rodgers # Released subject to the New BSD License # Please see http://en.wikipedia.org/wiki/BSD_licenses import os import sys import logging import time from active_mail_filter import get_logger, read_configuration_file, trace from active_mail_filter.imapuser import ImapUser from active_ma...
Parallelizer.py
import multiprocessing from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker, scoped_session from utils.log import _info, _debug, _warning, _error, _exception from multiprocessing import Process, Queue, JoinableQueue, Manager import time class Parallelizer: def __init__(self, fun...
test_thread.py
"""TestCases for multi-threaded access to a DB. """ import os import sys import time import errno from random import random DASH = '-' try: WindowsError except NameError: class WindowsError(Exception): pass import unittest from test_all import db, dbutils, test_support, verbose, have_threads, \ ...
ytdl.py
import os if "downloads" not in os.listdir(): os.mkdir("downloads") import threading import queue import youtube_dl import player ydl_opts = { "format": "bestaudio/best" } ydl = youtube_dl.YoutubeDL(ydl_opts) q = queue.Queue() def worker(): while True: item = q.get() ...
updater_mid.py
import os import sys import time import sqlite3 import zipfile import pythoncom import pandas as pd from PyQt5 import QtWidgets from PyQt5.QAxContainer import QAxWidget from multiprocessing import Process, Queue, Lock sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from login.manuallogin im...
dbx.py
import base64 import random import os import time import copy import json import dropbox # from dropbox.exceptions import ApiError, AuthError # from dropbox.files import FileMetadata, FolderMetadata, CreateFolderError from pydispatch import dispatcher # Empire imports from lib.common import helpers from lib.common imp...
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by ...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import sys import threading import traceback from typing import Tuple, List, Callable from PyQt5.QtCore import * from PyQt5.QtG...
Chat.py
import socket import threading import queue import sys import random import os #Client Code def ReceiveData(sock): while True: try: data,addr = sock.recvfrom(1024) print(data.decode('utf-8')) except: pass def RunClient(serverIP): host = so...
thumbnail_maker.py
# thumbnail_maker.py import time import os import logging from urllib.parse import urlparse from urllib.request import urlretrieve from queue import Queue from threading import Thread import multiprocessing import PIL from PIL import Image FORMAT = "[%(threadName)s, %(asctime)s, %(levelname)s] %(message)s" logging.ba...
freeze_source.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2016, Clearpath Robotics # 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...
ncclize.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from lxml import etree as ET from collections import defaultdict from dataclasses import dataclass, field, replace import math import threading, queue, itertools, bisect from enum import Enum from z3 import * @dataclass class _Gpu: precopies...
websockets.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...
test_h5py_utils.py
# coding: utf-8 # /*########################################################################## # Copyright (C) 2016-2017 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to dea...
main-old.py
import copy import glob import os import time from collections import deque from torch import roll import gym import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from reward_predictor import Reward_Predictor from pref_db import PrefBuffer, PrefDB, Segment...
kasif.py
import zipfile import json from datetime import datetime import base64 import time import os import sys import queue import threading import psutil from persistqueue import Queue import queue import os import time import pygame.camera import pygame.image from PIL import Image import cv2 import guid import pika import s...
file.py
# Copyright (C) 2021 CS GROUP - France. All Rights Reserved. # SPDX-License-Identifier: BSD-2-Clause import fcntl import mimetypes import os import threading import time import warnings from idmefv2 import Message, SerializedMessage, get_serializer from queue import Queue from typing import Optional from urllib.parse...
image_loader.py
from multiprocessing import Process, cpu_count, Queue import skimage.io as skio import numpy as np from tqdm import tqdm def produce(producer_queue, data, workers): for datum in data: producer_queue.put(datum) [producer_queue.put(None) for i in range(workers)] def work(producer_queue, consumer_queue...
slp_dagging.py
""" Breadth-first DAG digger for colored coins. We do a breadth-first DAG traversal starting with the transaction-of-interest at the source, and digging into ancestors layer by layer. Along the way we prune off some connections, invalidate+disconnect branches, etc., so our 'search DAG' is a subset of the transaction D...
delete.py
from telegram.ext import CommandHandler, run_async import threading from telegram import Update from bot import dispatcher, LOGGER from bot.helper.telegram_helper.message_utils import auto_delete_message, sendMessage from bot.helper.telegram_helper.filters import CustomFilters from bot.helper.telegram_helper.bot_...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from el...
controller.py
#coding=utf-8 import os import gc import sys import time import json import psutil import zipfile import sqlite3 import requests from multiprocessing import Process, Queue import logging, logging.handlers, logging.config abs_path = os.path.dirname(os.path.abspath(__file__)) sys.path.append(abs_path) def a...
api.py
from __future__ import print_function import collections # Imported to support ordered dictionaries in Python import hug from hug_middleware_cors import CORSMiddleware import waitress from threading import Thread import json from dragonfire.omniscient import Engine from dragonfire.conversational import DeepConversatio...
run_recording.py
#BSD 3-Clause License # #Copyright (c) 2021, Florent Audonnet #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 # lis...
genericpot.py
#!/usr/bin/env python3 import os import signal import threading from . import generic import core.potloader as potloader import core.utils as utils from .dblogger import DBThread class GenericPot(potloader.PotLoader): """ Implementation of generic honeypot that listens on an arbitrary UDP port and respo...
back_dor.py
import os,json,subprocess,sys,threading,random,socket from urllib.request import Request, urlopen try: from pynput.keyboard import Listener from PIL import ImageGrab from scapy.all import * except: os.system("pip install PIL") os.system("pip install pynput") os.system("pip install scapy") from pynput.keyboard im...
plugin.py
#! /usr/bin/env python # -*- coding: utf-8 -*- #################### # shelly Plugin # Developed by Karl Wachs # karlwachs@me.com import os import sys import subprocess import pwd import datetime import time import json import copy import math import socket import threading import Queue import cProfile import pstats im...
UIPublicCall.py
from sys import path from threading import Thread, Lock from time import sleep, perf_counter from foo.arknight.PublicCall import PublicCall from foo.pictureR import pictureFind from PyQt5.QtWidgets import QDialog, QGridLayout, QPushButton, QLabel, QWidget, QScrollArea from PyQt5.QtGui import QIcon from PyQt5.QtCore im...
test_motor.py
import time from threading import Thread import unittest from opentrons import Robot from opentrons.util.vector import Vector class OpenTronsTest(unittest.TestCase): def setUp(self): self.robot = Robot.get_instance() # set this to True if testing with a robot connected # testing while ...
TestSimplePooledDB.py
"""Test the SimplePooledDB module. Note: We don't test performance here, so the test does not predicate whether SimplePooledDB actually will help in improving performance or not. We also do not test any real world DB-API 2 module, we just mock the basic connection functionality of an arbitrary module. Copyright and c...
priority_queue_test.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...
coap.py
import logging.config import os import random import socket import threading import time from coapthon import defines from coapthon.layers.blocklayer import BlockLayer from coapthon.layers.messagelayer import MessageLayer from coapthon.layers.observelayer import ObserveLayer from coapthon.layers.requestlayer import Re...
test_entangled_endive.py
import os upstream_send_message = [ { 'RQ': { 'action': 'PLAYERACTION', 'data': { 'playerAction': { 'boardCards': '', 'log': [ 'PokerStars Hand #124959928530: Hold\'em No Limit ($10.00/$20.00 USD) - 20...
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...
clipwriter.py
from collections import deque from threading import Thread from queue import Queue import time import cv2 class ClipWriter: def __init__(self, bufSize=32, timeout=1.0): # store the maximum buffer size of frames to be kept # in memory along with the sleep timeout during threading self.bufSize = bufSize self.ti...
autonomous_v0.py
import car import cv2 import numpy as np import os import serial import socket import SocketServer import threading import time # KERAS stuff from keras.layers import Dense, Activation from keras.models import Sequential import keras.models SIGMA = 0.25 stop_classifier = cv2.CascadeClassifier('cascade_xml/stop_sign.x...
focuser.py
import os import matplotlib.colors as colours from matplotlib import cm as colormap from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure from astropy.modeling import models, fitting from scipy.ndimage import binary_dilation import numpy as np from copy imp...
hisDataEngine.py
# encoding: UTF-8 ''' 功能:定时下载,如每小时下载 onTimeDownloadHisData() 自动下载全部历史数据 downLoadAllDataManager() 使用方法:把这个模块加载到 vtEngine 中,即可运行。每一秒会触发本模块的 processTimerChecker() 建议:策略启动前先把全部历史数据补全, 策略运行中,以收到的 tick 合成即可。 最新思路: 在ctaEngine中载入策略时,同时触发该品种补全历史数据的事件。把vtSymbol和对应的合约存入事件中。 此引擎收到该事件后即下载并存入数据库。 等下策略初始化时就从...
output.py
from datetime import datetime from threading import Thread import twint from . import format, get from .tweet import Tweet from .user import User from .storage import db, elasticsearch, write, panda import logging as logme follows_list = [] tweets_list = [] users_list = [] author_list = {''} author_list.pop() # us...
main.py
import json import threading from wisbec.date.time import TimeUtil from wisbec.logging.log import Log from src.testdata.test_data_generator import SmsSendDataGenerator, SmsInfo from src.util.post import PostUtil class NoctorroTest: def __init__(self): self.m_send_sms_url: str = 'http://127.0.0.1:8089/mo...
miniterm.py
#!/home/manuel/Desktop/core_android/mycroft-env/bin/python3 # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause import codecs import os import sys import threading import se...
collection_replica.py
# -*- coding: utf-8 -*- # Copyright 2018-2020 CERN # # 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...
thread_communication.py
#coding:utf-8 from queue import Queue from threading import Thread import time # A thread that produces data def producer(out_q): while True: # Produce some data # ... data = 'a str' out_q.put(data) # A thread that consumes data def consumer(in_q): while True: # Get som...
app.py
############################################################################# # Copyright (c) 2018, Voila Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
rtsp-object-ident.py
import cv2 import simplexml import argparse import time import os import pprint import re import numpy as np import pygame import queue import threading import signal import sys import ffmpeg import random def excludeClass(s): try: o = {} o['class'], o['low'], o['high'] = s.split(',') o[...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2019 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test shirecoind shutdown.""" from test_framework.test_framework import ShirecoinTestFramework from tes...
test_closing.py
from fixtures import * # noqa: F401,F403 from flaky import flaky from pyln.client import RpcError from utils import ( only_one, sync_blockheight, wait_for, DEVELOPER, TIMEOUT, VALGRIND, SLOW_MACHINE, COMPAT ) import os import queue import pytest import re import threading import unittest @unittest.skipIf(no...
overtime.py
from cumodoro.component.frame import Frame import cumodoro.config as config from cumodoro.timeconvert import * import threading import time import curses class Overtime(Frame): def __init__(self): super(Overtime,self).__init__() self.set_size(12,1) self.current_time = 0 self.phase_l...
tb_experiments.py
import argparse import itertools import multiprocessing import stat import time import psutil import os import json import uuid import research_toolbox.tb_filesystem as tb_fs import research_toolbox.tb_io as tb_io import research_toolbox.tb_logging as tb_lg import research_toolbox.tb_utils as tb_ut import research_tool...
myBlockChain.py
import hashlib import time import csv import random from http.server import BaseHTTPRequestHandler, HTTPServer from socketserver import ThreadingMixIn import json import re from urllib.parse import parse_qs from urllib.parse import urlparse import threading import cgi import uuid from tempfile import NamedTemporaryFile...
pydevd.py
''' Entry point module (keep at root): This module starts the debugger. ''' import sys # @NoMove if sys.version_info[:2] < (2, 6): raise RuntimeError('The PyDev.Debugger requires Python 2.6 onwards to be run. If you need to use an older Python version, use an older version of the debugger.') import os try: #...
tests.py
#! /usr/bin/env python3 import hashlib import http.server import os import shutil import subprocess import sys import tempfile import threading import unittest @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") class WrapperScriptTests(unittest.TestCase): http_port = 8080 def setUp(sel...
test_repo_server.py
#!/usr/bin/env python3 import email import hashlib import os import socket import requests import tempfile import threading import unittest from contextlib import contextmanager from ..common import Checksum, Path from ..repo_objects import Repodata, RepoMetadata, Rpm from ..repo_server import _CHUNK_SIZE, repo_serve...
workflows.py
"""Makes it easier to run analyses on several samples in parallel.""" from collections import Sized from tqdm import tqdm from multiprocessing import Process, Queue def _process(f, args, queue): res = f(args) queue.put(res) def _consume(processes, queue, results, max_procs): for p in processes: ...
test_dag_serialization.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 #...
redist_base.py
#/**************************************************************************** #* * #* PrimeSense PSCommon Library * #* Copyright (C) 2012 PrimeSense Ltd. * #* ...
EventLoop.py
########################################################################## # # Copyright (c) 2011-2012, John Haddon. All rights reserved. # Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted ...
Hiwin_RT605_ArmCommand_Socket_20190627174032.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
client.py
# Copyright 2021 Cortex Labs, 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 wri...
single_process_with_ws.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Usage: single_process_with_api [options] Options: -h, --help Show this page --debug Show debug logging --verbose Show verbose logging -n=<i> n [default: 1000000] --partition=<p> Partition --ke...
server.py
""" Utilities for creating bokeh Server instances. """ import datetime as dt import html import inspect import os import pathlib import signal import sys import traceback import threading import uuid from collections import OrderedDict from contextlib import contextmanager from functools import partial, wraps from typ...
benchmark_utils.py
# This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp # Copyright 2020 The HuggingFace Team and the AllenNLP 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 o...
spinner.py
import sys import threading import itertools import time class Spinner: def __init__(self, delay=0.1): self.spinner = itertools.cycle(['-', '/', '|', '\\']) self.delay = delay self.busy = False self.spinner_visible = False def write_next(self): with self._screen_lock:...
tests.py
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
task_scheduler.py
import threading import time import random counter = 1 def worker_a(): global counter while counter < 1000: counter += 1 print("Worker A is incrementing counter to {}".format(counter)) sleep_time = random.randint(0, 1) time.sleep(sleep_time) def worker_b(): global counte...
test.py
import sys print(sys.version) import rwflow import time from threading import Thread import re flow = '' N = 10 def appender(letter, exclusive): def append(): global flow rwflow.checkin(letter, exclusive) for n in range(N): flow += letter time.sleep(0.01) t = T...
server.py
import socket import threading from typing import List import pydirectinput HOST = '' PORT = 1024 DISCONNECT_MESSAGE = '!DISCONNECT-REQUEST' KEYDOWN = '!KEYDOWN' KEYUP = '!KEYUP' def log(log_title: str, log_message: str) -> None: print(f'[{log_title.upper()}]: {str(log_message)}') def removeAll(string: str, subs...
helper.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Dec 22 11:53:52 2017 @author: www.github.com/GustavZ """ # python 2 compability from __future__ import absolute_import from __future__ import division from __future__ import print_function import datetime import cv2 import threading import time import ...
data_service_ops_ft_test.py
# Copyright 2020 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...
req_counts.py
#!/usr/local/bin/python3 # coding:utf-8 # ==================================================== # Author: chang - EMail:changbo@hmg100.com # Last modified: 2017-5-13 # Filename: reqcounts.py # Description: real time analysis nginx log,pymysql, Thread, logging # blog:http://www.cnblogs.com/changbo # ====================...
pool.py
import threading import logging import time logging.basicConfig(level=logging.DEBUG, format='%(asctime)s (%(threadName)-2s) %(message)s') class ThreadPool: def __init__(self, size): self.__pool = threading.Semaphore(size) self.__threads = [] def map(self, target, args): ...
train.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 app...
test_poll.py
# Test case for the os.poll() function import os import subprocess import random import select import threading import time import unittest from test.support import cpython_only, requires_subprocess from test.support import threading_helper from test.support.os_helper import TESTFN try: select.poll except Attrib...
Spider.py
# encoding: utf-8 import hashlib import os.path import random import socket from Queue import Queue from struct import unpack, pack from threading import Thread from time import sleep import MetadataInquirer from libs import pymmh3, decodeh from libs.SQLiteUtil import SQLiteUtil from libs.bencode import bencode, bdeco...
__init__.py
import subprocess import threading from pyspark.sql import SparkSession from pyspark.conf import SparkConf from pyspark.context import SparkContext from pyspark.java_gateway import launch_gateway def start(spark23=False, spark24=False, spark31=False, memory="16G", cache_folder=...
test_csv.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...
test_api.py
""" mbed SDK Copyright (c) 2011-2014 ARM Limited 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...
utils.py
import multiprocessing as mp import os import requests import pytest DATA_PATH = os.path.join("tests", "data") def download(url): filename = url.rsplit("/")[-1] filepath = os.path.join(DATA_PATH, filename) if not os.path.exists(filepath): with open(filepath, "wb") as f: response = req...
EventLoopTest.py
########################################################################## # # Copyright (c) 2011-2012, John Haddon. All rights reserved. # Copyright (c) 2012, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provi...
mqtt_publish_test.py
from __future__ import print_function from __future__ import unicode_literals from builtins import str import re import os import sys import ssl import paho.mqtt.client as mqtt from threading import Thread, Event import time import string import random from tiny_test_fw import DUT import ttfw_idf event_client_connec...
play.py
import numpy as np import cv2 from mss import mss from PIL import Image from skimage.transform import resize from skimage.io import imread import math import pyvjoy from threading import Thread from inputs import get_gamepad from train import create_model def resize_image(img): im = resize(img, (120, 160, 3)) ...
donations.py
#!/usr/bin/env python3 """ A small donation service so that users can request ln invoices This plugin spins up a small flask server that provides a form to users who wish to donate some money to the owner of the lightning node. The server can run on an arbitrary port and returns an invoice. Also a list of previously p...
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 ...
KeepTwitch.py
import datetime import getopt import os import signal import subprocess import threading import time import tkinter.filedialog from configparser import ConfigParser as config from tkinter import * from tkinter import ttk import requests from multiprocessing import Queue import queue from idna import idnad...