source
stringlengths
3
86
python
stringlengths
75
1.04M
Event.py
import threading from config import NOTIFY_SIMULATED_PLAYER_ASYNC class Event: def __init__(self): self.listeners = [] def __iadd__(self, listener): self.listeners.append(listener) return self def notify(self, *args): for listener in self.listeners: if NOTIFY...
sshclient.py
## ## Name: sshclient.py ## Purpose: Wrapper for OpenSSH command-line tool. ## ## Copyright (c) 2009 Michael J. Fromberger, All Rights Reserved. ## import getpass, os, threading, select import runpty class SSH(object): """Interface to the SSH command-line tool. Usage: ssh = SSH('hostname', subsys...
Builder.py
# encoding: utf-8 # Copyright 2012 Red Hat, 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 applica...
utils.py
import errno import logging import os from abc import ABC, abstractmethod from toil.lib.threading import ExceptionalThread log = logging.getLogger(__name__) class WritablePipe(ABC): """ An object-oriented wrapper for os.pipe. Clients should subclass it, implement :meth:`.readFrom` to consume the readable...
correctord.py
# The MIT License # Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) # Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"...
manager.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...
feeder.py
from sklearn.model_selection import train_test_split from .utils.text import text_to_sequence from .infolog import log import tensorflow as tf import numpy as np import threading import time import os _batches_per_group = 64 class Feeder: """ Feeds batches of data into queue on a background thread. """ def __in...
main.py
from ray import tune from utils.RAC_agent import Agent import gym import numpy as np import torch import time from torch.multiprocessing import Value, Event, Process from utils.ExperienceReplay import ReplayBuffer from utils.others import NormalizedActions, NoisyActionWrapper import threading import random from multipr...
uploadutils.py
# -*- coding: utf-8 -*- from noval import GetApp,_ from tkinter import messagebox import os import noval.ui_base as ui_base from dummy.userdb import UserDataDb import requests import noval.util.appdirs as appdirs import noval.python.parser.utils as dirutils import threading class UploadProgressDialog(ui_bas...
polling.py
import requests import threading import time import traceback from . import TelegramConnection, MessageHandler class LongPollingConnection(TelegramConnection): def __init__(self, token: str, handler: MessageHandler) -> None: super().__init__(token, handler) self._connected = False self.la...
test_athenad.py
#!/usr/bin/env python3 import json import os import requests import tempfile import time import threading import queue import unittest from multiprocessing import Process from pathlib import Path from unittest import mock from websocket import ABNF from websocket._exceptions import WebSocketConnectionClosedException ...
installwizard.py
from functools import partial import threading from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform from kivy...
bittrex.py
from befh.restful_api_socket import RESTfulApiSocket from befh.exchanges.gateway import ExchangeGateway from befh.market_data import L2Depth, Trade from befh.util import Logger from befh.instrument import Instrument from befh.clients.sql_template import SqlClientTemplate from functools import partial from datetime impo...
latest_comics_checker.py
import logging import asyncio from time import sleep from threading import Thread import comics as Comics LatestComicsNumber = 1981 needToCheckLastComics = True UNDEFINED = -1 # Setup logger logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) logger = logging.getLog...
client4.py
import socket import time from select import select from threading import Thread from collections import deque tasks = deque() stopped = {} def run_queries(): while any([tasks, stopped]): while not tasks: ready_to_read, _, _ = select(stopped.keys(), [], []) for r in ready_to_read:...
test_keyboard_async.py
import os import subprocess import sys import threading import time import asyncio from itertools import product from unittest import TestCase, IsolatedAsyncioTestCase project_root = os.path.abspath( os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..") ) sys.path.insert(0, project_root) from ahk impo...
build_vg_data.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
bot.py
import argparse import random from commands import availableCommands from threading import Thread import vk_api from vk_api.bot_longpoll import VkBotEventType, VkBotLongPoll from vk_api.keyboard import VkKeyboard, VkKeyboardColor from keyboards import startGameKeyboard from messages import failureMessages, successMes...
manager.py
# -*- coding: utf-8 -*- """ :copyright: (C) 2010-2013 by Contrail Consortium. """ from threading import Thread from conpaas.core.expose import expose from conpaas.core.manager import BaseManager from conpaas.core.https.server import HttpJsonResponse, HttpErrorResponse from conpaas.services.htc.agent import cli...
ai_client.py
#!/usr/bin/env python3 from sys import argv, stdout from threading import Thread, Semaphore from time import sleep, time from tkinter import N import GameData import socket from constants import * import os import ai if len(argv) < 4: print("You need the player name to start the game.") #exit(-1) playerNa...
ib_gateway.py
""" IB Symbol Rules SPY-USD-STK SMART EUR-USD-CASH IDEALPRO XAUUSD-USD-CMDTY SMART ES-202002-USD-FUT GLOBEX """ from copy import copy from datetime import datetime from queue import Empty from threading import Thread, Condition from typing import Optional import shelve from ibapi import comm from ibapi.client ...
cli.py
# encoding: utf-8 import collections import csv import multiprocessing as mp import os import datetime import sys from pprint import pprint import re import itertools import json import logging import ckan.logic as logic import ckan.model as model import ckan.include.rjsmin as rjsmin import ckan.include.rcssmin as rcs...
communicaton_service.py
import logging import threading _THREAD_PREFIX = 'CommunicationThread-' LOGGER = logging.getLogger('script_server.communication_service') class CommunicationsService: def __init__(self, destinations) -> None: self._destinations = destinations def send(self, title, body, files=None): if not...
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...
rotation.py
# -*- coding: utf-8 -*- import threading import traceback import time from deval.utils.snippet import reg_cleanup, on_method_ready from deval.utils.logger import get_logger from wda import LANDSCAPE, PORTRAIT, LANDSCAPE_RIGHT, PORTRAIT_UPSIDEDOWN from wda import WDAError LOGGING = get_logger(__name__) class Rotatio...
ex7_netmiko_sh_ver_proc.py
#!/usr/bin/env python """ 7. Repeat exercise #6 except use processes. """ from netmiko import ConnectHandler from datetime import datetime from net_system.models import NetworkDevice, Credentials import django from multiprocessing import Process, current_process, Queue import time import ex1_link_obj_2_credential...
emails.py
# -*- coding: utf-8 -*- from threading import Thread from flask import current_app, render_template from flask_mail import Message from awesome_flask_webapp.extensions import mail def _send_async_mail(app, message): with app.app_context(): mail.send(message) def send_mail(subject, to, template, **kwar...
papagotrans.py
import urllib.parse import time import math import threading import chromedriver_autoinstaller from selenium import webdriver class Translated: def __init__(self,source,target,origin,text,pronunciation): self.source = source self.target = target self.origin = origin self...
caching_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...
fixedmainengine.py
# !/usr/bin/python # vim: set fileencoding=utf8 : # __author__ = 'keping.chu' import importlib import os from threading import Thread, Lock import time from easyquant.log_handler.default_handler import DefaultLogHandler from easyquant.main_engine import MainEngine from easyquant.multiprocess.strategy_wrapper import P...
conftest.py
import asyncio import json import os import threading import time import typing import pytest import trustme from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.serialization import ( BestAvailableEncryption, Encoding, PrivateFormat, load_pem_private_key, ) from...
jd_OpenCard.py
#!/bin/env python3 # -*- coding: utf-8 -* ''' 项目名称: JD_OpenCard Author: Curtin 功能:JD入会开卡领取京豆 CreateDate: 2021/5/4 下午1:47 UpdateTime: 2021/6/19 建议cron: 2 8,15 * * * python3 jd_OpenCard.py new Env('开卡有礼'); ''' version = 'v1.2.2' readmes = """ # JD入会领豆小程序 ![JD入会领豆小程序](https://raw.githubusercontent.com/curtinlv/JD-Script/...
callbacks.py
### # Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2008-2009, James Vega # 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 c...
main.py
import os import re import threading import time from datetime import datetime from math import cos, sin import logging import platform import kivy import numpy as np import obd from kivy.app import App from kivy.clock import Clock, mainthread from kivy.config import Config from kivy.lang import Builder from kivy.prop...
proxy.py
import logging import subprocess import json from subprocess import Popen, PIPE import arguments import logging import threading import Queue import time log = logging.getLogger(__name__) log.setLevel(logging.DEBUG) formatter = logging.Formatter( fmt="%(asctime)s %(levelname)s: %(message)s", datefmt="%Y-%m-%d - %H...
gdbclientutils.py
import ctypes import errno import io import threading import socket import traceback from lldbsuite.support import seven def checksum(message): """ Calculate the GDB server protocol checksum of the message. The GDB server protocol uses a simple modulo 256 sum. """ check = 0 for c in message: ...
Elsevier_pybliometrics.py
#!/usr/bin/env python # coding: utf-8 import pybliometrics from pybliometrics.scopus import ScopusSearch from pybliometrics.scopus.exception import Scopus429Error import pandas as pd import numpy as np from sklearn.utils import shuffle import os import multiprocessing from os import system, name import json import tim...
speedtest_cli.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2012-2014 Matt Martz # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.or...
bot.py
#!/usr/bin/python3 from multiprocessing import Process from os import getenv from guild_client import GuildClient from message_client import MessageClient def launch_guild_client(): g = GuildClient() g.run(getenv('TOKEN')) def launch_message_client(): m = MessageClient() m.run(getenv('TOKEN')) if...
main.py
import requests import random import threading import names import string from termcolor import cprint web = "https://useast-www.securly.com/app/api/sendtwl" proxies = ["http://51.91.157.66:80", "http://196.15.221.201:80", "http://106.45.105.247:3256", "http://81.18.45.36:3128", ...
SocketServer_multithreading.py
#!/usr/bin/env python #-*- coding:utf-8 -*- import socket from threading import Thread """ 多线程实现Socket """ # 链接循环 -- 并发的是链接 def server(ip,port): server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server.bind((ip, port)) server.listen...
serverTest.py
#!/usr/bin/env/python # File name : server.py # Production : RaspTank # Website : www.adeept.com # E-mail : support@adeept.com # Author : William # Date : 2018/08/22 # TODO: improve keyboard interupt response import socket import time import threading import move import Adafruit_PCA9685 pwm = A...
measure motion time with PIR - local MQTT publish.py
# Import standard python modules import time import datetime import sys import threading # Import GPIO Module import RPi.GPIO as GPIO # Import paho MQTT Client import paho.mqtt.client as mqtt # Control of sincronization in Threads lock = threading.RLock() # Setup Sensor pin var SENSOR_PIN = 5 # Setup var controls...
tuby.py
from tkinter import* from tkinter import filedialog,messagebox try: from PIL import Image,ImageTk import PIL._tkinter_finder except ImportError: print('module not found') from pytube import YouTube from threading import * import webbrowser,os,pyperclip,sys #print(urlClip) class tuby(): def _...
__init__.py
""" * Experimental * Like the map function, but can use a pool of threads. Really easy to use threads. eg. tmap(f, alist) If you know how to use the map function, you can use threads. """ __author__ = "Rene Dudfield" __version__ = "0.3.0" __license__ = 'Python license' import traceback, sys from pygame.compat i...
__main__.py
import csv import json import sys import threading import traceback from datetime import datetime, timedelta from time import sleep from flask import Flask, render_template, Response from flask_sockets import Sockets from gevent import pywsgi from geventwebsocket.handler import WebSocketHandler from geventwebsocket.we...
GameHelper.py
# -*- coding: utf-8 -*- # Created by: Vincentzyx import win32gui import win32ui import win32api from ctypes import windll from PIL import Image import cv2 import pyautogui import matplotlib.pyplot as plt import numpy as np import os import time import threading from win32con import WM_LBUTTONDOWN, MK_LBUTTON, WM_LBUTTO...
poc_multi_threading.py
import multiprocessing import concurrent.futures import time from typing import Callable S_T = [4, 2, 7, 4, 3, 10, 11, 3, 2, 1] def task(args: tuple = ('', 1)) -> str: name = args[0] sec = args[1] print('Task', name, 'sleeps for', sec) time.sleep(sec) return 'Task', name, sec, 'finished.' def ...
sinal2.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Sina Level2 Data Sina Level2 Client & Parser, Usage:: >>> c = L2Client(USERNAME, PASSWORD) >>> if c.login(): ... c.watch(['sh601398'], on_data=None, parse=True) By default, if no on_data callback is found, L2Printer.on_data will be used to dump parsed info to std...
worker_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
car_helpers.py
import os import time import threading import requests from common.params import Params from common.basedir import BASEDIR from selfdrive.version import get_comma_remote, get_tested_branch from selfdrive.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars from selfdrive.car.vin import get_v...
PC_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Python PC Miner (v2.5.1) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## # Import libraries import sys from configparser import ...
worker_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
docnado.py
""" docnado.py A rapid documentation tool that will blow you away. """ import os import re import sys import csv import glob import time import signal import shutil import urllib import base64 import hashlib import argparse import tempfile import datetime import threading import traceback import subprocess import co...
test_forward.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...
abstract_calls_test.py
import time import threading import unittest from com.data.abstract_calls import AbstractApiCall from com.amazon.amazon_api import ProductAPI from com.ebay.ebay_api import EbayFindingAPI class Test(unittest.TestCase): def setUp(self): AbstractApiCall.__abstractmethods__ = set() self.agc = Abstrac...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum_redd.util import bfh, bh2u, UserCancelled, UserFacingException from electrum_redd.bip32 import BIP32Node from electrum_redd import constants from elect...
DockerWatcher.py
import docker import threading import SocketServer import socket import httplib import tempfile import os import re import select import traceback import logging import simplejson import uuid import time docker_client = docker.from_env() #initialize the docker threadpool try: docker_client.containers.list() except...
pyrdpos.py
#!/usr/bin/env python3 #-*- encoding: utf-8 -*- import multiprocessing import threading import rdp import serial_datagram import time import random class RDPoSConnection(object): class TickTimer(threading.Thread): def __init__(self, dt, conn): threading.Thread.__init__(self) self....
bot.py
import json import logging import os import queue import subprocess import tempfile import threading from behave import fixture class BotHandler: def __init__(self, *, process, message_queue, message_timeout): self.process = process self.message_queue = message_queue self.message_timeout ...
backend.py
import os import sys import threading import time from synchronizers.base.event_loop import XOSObserver from synchronizers.base.event_manager import EventListener from xos.logger import Logger, logging from synchronizers.model_policy import run_policy from xos.config import Config logger = Logger(level=logging.INFO) ...
Mirror.py
import sublime, sublime_plugin from . import websocket import ssl import json import threading import webbrowser class EventDump(sublime_plugin.EventListener): is_mirroring = False socket = None create_uri = "wss://mirror.chmod4.com/create" mirror_uri = "" listener_thread = None def send_view(ws, view): Event...
test_server.py
# SPDX-License-Identifier: MIT import fcntl import os import shutil import subprocess import threading import warnings import pytest import requests import libevdev from time import time, sleep from pathlib import Path from ratbag_emu.util import MM_TO_INCH from ratbag_emu.protocol.base import MouseData class Cli...
IntegrationTests.py
from __future__ import absolute_import import os import multiprocessing import time import unittest import percy import threading import platform import flask import requests from selenium import webdriver from selenium.webdriver.chrome.options import Options class IntegrationTests(unittest.TestCase): @classmet...
server.py
#!/usr/bin/python3 # coding=utf-8 import socket import threading class Server: def __init__(self): self.ip = socket.gethostbyname(socket.gethostname()) while 1: try: # self.port = int(input('Enter port number to run on --> ')) self.port = 8000 ...
runMyTrading.py
# encoding: UTF-8 from __future__ import print_function import sys try: reload(sys) # Python 2 # sys.setdefaultencoding('utf8') except NameError: pass # Python 3 import multiprocessing from time import sleep from datetime import datetime, time from negociant.event import EventEngine2 from negoci...
diskover_s3.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """diskover - Elasticsearch file system crawler diskover is a file system crawler that index's your file metadata into Elasticsearch. See README.md or https://github.com/shirosaidev/diskover for more information. Amazon S3 inventory module for diskover Copyright (C) Chris...
poisson.py
#!/usr/bin/env python import numpy as np import multiprocessing as mp import time def poisson_interarrivals(conf): np.random.seed() total_reqs_per_client = int((conf.reqs_rate / conf.clients_num) * conf.gen_time) _lamda = float(conf._lamda/total_reqs_per_client) print _lamda, total_reqs_per_client ...
newsfirst.py
import tweepy import os import time import threading from elasticsearch import Elasticsearch, helpers from datetime import datetime from dotenv import load_dotenv load_dotenv() consumer_key = os.getenv('consumer_key') consumer_secret = os.getenv('consumer_secret') access_key = os.getenv('access_key') access_secret = ...
dev_servers.py
"""\ Examples For the development.ini you must supply the paster app name: %(prog)s development.ini --app-name app --init --clear """ from pkg_resources import resource_filename from pyramid.paster import get_app, get_appsettings from multiprocessing import Process, set_start_method import atexit import logging ...
main.py
import tkinter import cv2 import PIL.Image, PIL.ImageTk from functools import partial import threading import imutils import time stream = cv2.VideoCapture("Clips\\clip4.mp4") color = 'red' def play(speed): print(f"You clicked on play. Speed is {speed}") global color frame1 = stream.get(cv2....
generic.py
import pandas as pd import numpy as np import multiprocessing as mp import pyteomics.mass from ..constants import MAX_ION, ION_TYPES, MAX_FRAG_CHARGE from .. import utils aa_comp = dict(pyteomics.mass.std_aa_comp) aa_comp["o"] = pyteomics.mass.Composition({"O": 1}) translate2spectronaut = {"C": "C[Carbamidomethyl (C...
test.py
import os.path as p import random import threading import time import pytest from helpers.cluster import ClickHouseCluster from helpers.test_tools import TSV from helpers.client import QueryRuntimeException import json import subprocess import kafka.errors from kafka import KafkaAdminClient, KafkaProducer, KafkaConsu...
manager_dist.py
# coding: utf-8 from multiprocessing import Process, Manager class TheBall(object): def __init__(self): self.q={} def f(d, l): d[1] = '1' d['2'] = 2 d[0.25] = None l.reverse() d['tb'].q["hahaha"] = "hohooh" print(d) print(l) if __name__ == '__main__': with Manager() as...
rstr_mod.py
# Copyright 2013-2014 James P Goodwin bkp@jlgoodwin.com """ module to implement shared functions for the rstr tool """ import sys import os import tempfile import re import traceback import queue import threading import platform import time import subprocess import datetime import urllib.request, urllib.parse, urllib.e...
1.py
from GENERATOR import * from datetime import datetime from time import sleep from bs4 import BeautifulSoup from gtts import gTTS from googletrans import Translator from multiprocessing import Pool, Process from ffmpy import FFmpeg import time, random, asyncio, timeit, sys, json, codecs, threading, glob, re, string, os,...
multiThreaded_nested_loop_join.py
from fhipe import ipe from timeit import default_timer as timer import multiprocessing,resource import sys #Thread that queries all rows of the B table for a row that meets the join predicate and has the # matching join attribute def indexesMatch(target, indicies, row): for t in range(0,len(indicies)): if(target[t]...
rt.py
from . import ticket import os from datetime import datetime import queue import threading import time import re import yaml import json import requests import traceback def call_clsinit(cls): cls.__clsinit__() return cls @call_clsinit class RT: base_url = "https://support.oit.pdx.edu/NoAuthCAS/REST/1.0/"...
cardwindow.py
import tkinter as tk import queue from PIL import ImageTk, Image import os import sys from threading import Thread image_location = "/home/coljac/build/cards" windows = [] def show_image_window(card="00001", geometry=None): t = Thread(target=_show_image_window, args=([card, geometry])) t.start() def _show_i...
Script.py
from UI import * from database import * import database as DB app = None app = ClassUI() def insertCommand(): DB.Process("Insert",app.txtOriginal.get(), app.txtUso.get()) viewCommand() ...
webServer.py
#!/usr/bin/env/python # File name : server.py # Production : GWR # Website : www.adeept.com # Author : William # Date : 2020/03/17 import time import threading import move import Adafruit_PCA9685 import os import info import RPIservo import functions import robotLight import switch...
a3c.py
import gym import multiprocessing import threading import numpy as np import os import shutil import matplotlib.pyplot as plt import tensorflow as tf #PARAMETERS OUTPUT_GRAPH = True # safe logs RENDER=False # render one worker LOG_DIR = './log' # savelocation for logs N_WORKERS = 20 ...
client.py
import argparse import requests import random import threading import time import logging import socket import sys def do_request(s, args): addrs = socket.getaddrinfo(args.target, args.port) addrs = [a for a in addrs if a[0] == socket.AF_INET] if len(addrs) <= 0: logging.info("Could not resolve %s...
agent.py
import os import sys sys.path.append('./nlu') sys.path.append('./core') from typing import Text,Dict import logging logging.basicConfig(format='%(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s', level=logging.INFO) import queue import threading import time q1=queue.Queue(maxsize=0) q2=...
email.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Miguel Grinberg' from flask.ext.mail import Message from threading import Thread from flask import current_app, render_template from app import mail def _send_async_email(app, msg): '''_send_async_email .. function:: sends an email with fal...
test_index.py
""" For testing index operations, including `create_index`, `get_index_info` and `drop_index` interfaces """ import logging import pytest import time import pdb import threading from multiprocessing import Pool, Process import numpy import sklearn.preprocessing from milvus import IndexType, MetricType from utils imp...
singleton.py
#! /usr/bin/env python import sys import os import errno import tempfile import unittest import logging from multiprocessing import Process class SingleInstance: """ If you want to prevent your script from running in parallel just instantiate SingleInstance() class. If is there another instance already runni...
test_multiprocessing.py
#!/usr/bin/env python # # Unit tests for the multiprocessing package # import unittest import threading import Queue import time import sys import os import gc import signal import array import copy import socket import random import logging from StringIO import StringIO # Work around broken sem_open implementation...
windows.py
import contextlib import ctypes import ctypes.wintypes import io import json import os import re import socket import socketserver import threading import time import typing import click import collections import collections.abc import pydivert import pydivert.consts if typing.TYPE_CHECKING: class WindowsError(OS...
test_capture.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import contextlib import io import os import pickle import subprocess import sys import textwrap from io import UnsupportedOperation import py from six import text_type import pytest f...
nbsp.py
# _*_ coding:UTF-8 _*_ import time from threading import Thread, Event from .compat import queue from .logger import get_logger LOGGING = get_logger(__name__) class NonBlockingStreamReader: def __init__(self, stream, raise_EOF=False, print_output=True, print_new_line=True, name=None): ''' stream:...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from electrum.bitcoin import TYPE_ADDRESS from electrum.storage import WalletStorage from electrum.wallet import Wallet, InternalAddressCorruption from electrum.paymentrequest import ...
watcher_monitor.py
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest import unittest.mock from test import support import socket import select import time import datetime import gc import os import errno import pprint import urllib.request import threading import traceback import asyncore import weakref import platform i...
dag_processing.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...
reminder.py
import threading import time from datetime import datetime import sched import asyncio import discord class Reminder: def __init__(self, loop): self.loop = loop def send_remind(self, channel, body): asyncio.ensure_future(channel.send(body), loop=self.loop) print("Reminder done.") def remind(self, channel, d...
serial.py
#!/usr/bin/env python # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2020 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause from __future__ import absolute_import import codecs import os import sys import threading import ...
executor.py
from typing import Optional, Union import datetime import uuid import time import queue import shutil import threading import tempfile from pathlib import Path from concurrent.futures import Executor, Future, wait from concurrent.futures._base import FINISHED from multiprocessing.pool import ApplyResult import htcond...
timer_test.py
from matrix import * import random import LED_display as LMD import threading import time import timeit def LED_init(): thread = threading.Thread(target=LMD.main, args=()) thread.setDaemon(True) thread.start() return def draw_matrix(m): array = m.get_array() for y in range(m.get_dy()): ...
PrefetchingIter.py
# -------------------------------------------------------- # Deformable Convolutional Networks # Copyright (c) 2017 Microsoft # Licensed under The MIT License [see LICENSE for details] # Modified by Yuwen Xiong # -------------------------------------------------------- # Based on: # MX-RCNN # Copyright (c) 2016...