source
stringlengths
3
86
python
stringlengths
75
1.04M
agent.py
# Kapacitor UDF Agent implementation in Python # # Requires protobuf v3 # pip install protobuf==3.0.0b2 import sys import udf_pb2 from threading import Lock, Thread from Queue import Queue import io import traceback import socket import os import logging logger = logging.getLogger() # The Agent calls the appropri...
test_list_collections.py
import pdb import pytest import logging import itertools import threading from time import sleep from multiprocessing import Process from utils import * drop_interval_time = 3 collection_id = "list_collections" default_fields = gen_default_fields() class TestListCollections: """ **************************...
main.py
from threading import Thread import ScreenServer2 import multiClientServer def main(): Thread(target = multiClientServer.main).start() Thread(target = ScreenServer2.main).start() if __name__ == '__main__': main()`pyon3sc``dwa``
develop_utils.py
import functools import os import numpy as np # from pl_examples import LightningTemplateModel from pytorch_lightning import seed_everything from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger, TestTubeLogger from tests import TEMP_PATH, RANDOM_PORTS from te...
Index.py
import platform import os import threading from selenium import webdriver from selenium.webdriver.chrome.options import Options appPath = os.path.dirname(__file__) chromeOptions = Options() # chromeOptions.add_argument('--headless') chromeOptions.add_argument('--disable-gpu') chromeDriverPath = "" if platform.system()...
async_api_multi-processes_multi-requests_multi-ncs.py
#!/usr/bin/env python3 import cv2 import os import sys import time import numpy as np from openvino.inference_engine import IENetwork, IEPlugin from multiprocessing import Process, Queue import multiprocessing import threading import queue infered_images = 0 def async_infer_worker(exe_net, request_number, image_qu...
sismic_viz.py
from __future__ import print_function import os import time import shutil import pprint import argparse import webbrowser from contextlib import contextmanager from flask import Flask, send_file, request from sismic.io import import_from_yaml, export_to_plantuml from sismic.model import Event, CompositeStateMixin, Co...
test_election_subsystem.py
from pydantic import BaseModel from queue import Queue from threading import Thread from typing import List from ..scrap_worker.models.event_models import CandidacyEvent from ..scrap_worker.app_state_machine import ScrapWorkerSubsystemConfigurations from ..scrap_worker.state_machine.models import StateFlag, TimeoutFla...
consumer.py
# Copyright European Organization for Nuclear Research (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 # # Authors: # - Wen Guan, <wguan@ce...
bot.py
# coding=utf8 """ bot.py - Willie IRC Bot Copyright 2008, Sean B. Palmer, inamidst.com Copyright 2012, Edward Powell, http://embolalia.net Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> Licensed under the Eiffel Forum License 2. http://willie.dftba.net/ """ from __future__ import unicode_literals from __futu...
consumer.py
from collections import deque import datetime import json import logging import threading import time import unittest from huey import crontab from huey import Huey from huey.backends.dummy import DummyDataStore from huey.backends.dummy import DummyEventEmitter from huey.backends.dummy import DummyQueue from huey.back...
benchmark.py
# -*- coding: utf-8 -*- """ | **@created on:** 16/12/16, | **@author:** Prathyush SP, | **@version:** v0.0.1 | | **Description:** | Benchmark Module | | Sphinx Documentation Status:** | ..todo:: Benchmark Statistics: 1. Physical Memory Consumption - RAM List[Float] Max Physical Memory (RAM) consumed by the run in Mb/...
env_wrapper.py
""" Modified from OpenAI Baselines code to work with multi-agent envs """ import numpy as np from multiprocessing import Process, Pipe from baselines.common.vec_env import VecEnv, CloudpickleWrapper from baselines.common.tile_images import tile_images def worker(remote, parent_remote, env_fn_wrapper): parent_remot...
server.py
"""RPC server implementation. Note ---- Server is TCP based with the following protocol: - Initial handshake to the peer - [RPC_MAGIC, keysize(int32), key-bytes] - The key is in format - {server|client}:device-type[:random-key] [-timeout=timeout] """ from __future__ import absolute_import import os import ctypes...
copyFilesFromGrid.py
#!/usr/bin/python3 import os import sys import time from subprocess import Popen, PIPE from multiprocessing import Process def listdir_shell(path, pattern): p = Popen(('alien_find', path, pattern), shell=False, stdout=PIPE, close_fds=True) return [ str(path, ...
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 xepd shutdown.""" from test_framework.test_framework import XEPTestFramework from test_framework....
test_legacy_checkpoints.py
# Copyright The PyTorch Lightning 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 applicable law or agreed to i...
test_ssl.py
# -*- coding: utf-8 -*- # Test the support for SSL and sockets import sys import unittest from test import test_support as support from test.script_helper import assert_python_ok import asyncore import socket import select import time import datetime import gc import os import errno import pprint impor...
_linux_driver.py
from __future__ import annotations import asyncio import os from codecs import getincrementaldecoder import selectors import signal import sys import logging import termios import tty from typing import Any, TYPE_CHECKING from threading import Event, Thread if TYPE_CHECKING: from rich.console import Console fro...
TriviaBot_v2.py
""" TriviaBot Version 2 Made by Sai Sameer Pusapaty """ import io import os import crayons from threading import Thread # Imports the Google Cloud client library from google.cloud import vision from google.cloud.vision import types from googleapiclient.discovery import build os.environ['GOOGLE_APPLICATION_CREDENT...
db.py
# Copyright 2017 Google 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 writing, ...
subproc_vec_env.py
""" Helper functions to make a vector environment. Code modified based on https://github.com/openai/baselines/blob/master/baselines/common/vec_env/subproc_vec_env.py """ import multiprocessing as mp import numpy as np from .vec_env import VecEnv, CloudpickleWrapper, clear_mpi_env_vars def worker(remote, parent_re...
submit.py
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved. # # This work is made available under the Nvidia Source Code License-NC. # To view a copy of this license, visit # https://nvlabs.github.io/stylegan2/license.html """Submit a function to be run either locally or in a computing cluster.""" import copy impo...
1server.py
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket #from chatbot import get_response from rihanna import get_response from rihanna import rihanna_voice from threading import Thread import ast import json class ChatServer(WebSocket): def handleMessage(self): # echo message back to client ...
test_events.py
# coding: utf-8 from __future__ import unicode_literals from threading import Event, Thread import pytest import requests from boxsdk.object.folder import FolderSyncState from boxsdk.object.event import Event as BoxEvent @pytest.fixture def box_events(box_client): return box_client.events() @pytest.fixture ...
test_main.py
import os import sys import tempfile import time from multiprocessing import Process from unittest import TestCase from corona_cli_germany.__main__ import (CONSOLE, APISettings, get_default_console, get_header, main) from corona_cli_germany.mockup.MockupServer import...
build_openwebtext_pretraining_dataset.py
# coding=utf-8 """Preprocessess the Open WebText corpus for pre-training.""" import argparse import multiprocessing import os import random import tarfile import time import tensorflow.compat.v1 as tf import build_pretraining_dataset from util import utils def write_examples(job_id, args): """A single process cr...
mdns_advertiser.py
#!/usr/bin/env python import logging import socket import time import threading import netifaces as ni from zeroconf import ServiceInfo, Zeroconf logger = logging.getLogger(__name__) class MDNSAdvertiser(object): def __init__(self, type_, name, port, properties, server, interface): self.type = type_ ...
recorder.py
# _*_coding:utf-8 _*_ # @Time  :2020/9/1 0001 下午 9:37 # @Author  : Loner Lin # @File   :recorder.py # @Software :PyCharm import pyaudio import time import threading import wave import os import sys class Recorder: """ 提供一个多线程的录音程序,改程序可以随时空录音的开始和暂停 """ def __init__(self, chunk=1024, channels=1...
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...
RvZip.py
from tkinter import * from tkinter import filedialog, messagebox import os from zipfile import ZipFile import threading class rvzip(Tk): def __init__(self): Tk.__init__(self) self.zip=True self.unzip= False self.zipdir='' self.unzip_file='' self.window_size() ...
rest.py
import sys,logging,os,time,re,threading,hashlib import xml.dom.minidom import tokens from datetime import datetime SPLUNK_HOME = os.environ.get("SPLUNK_HOME") RESPONSE_HANDLER_INSTANCE = None SPLUNK_PORT = 8089 STANZA = None SESSION_TOKEN = None REGEX_PATTERN = None #dynamically load in any eggs in /etc/apps/snmp_ta...
window.py
import os import threading import time def f(): return 123 def raise_above_all(window): window.attributes('-topmost', 1) window.attributes('-topmost', 0) def focus(): os.system('''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python" to true' ''') def lift(): time.sle...
ipythonwidget.py
import os import json from threading import Thread, Event from IPython.core.display import display, HTML from traitlets import Unicode, Dict, default from ipywidgets import DOMWidget, Layout, widget_serialization class MetricVisualizer(DOMWidget): _view_name = Unicode('CatboostIpythonWidgetView').tag(sync=True) ...
bench.py
#!/usr/bin/env python3 import os import sys import time import subprocess import gc import statistics import json import threading import re import csv # Need to avoid as much extra CPU usage as possible gc.disable() # sysfs power supply nodes for power sampling POWER_SUPPLY = None POWER_SUPPLY_NODES = [ # Qualc...
navigation.py
import os import sys import time import threading from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * import vi.app.navigation import vi.grid import vi.search.graph import vi.search.grid class SearchProblemWidget(QWidget): def __init__(self, parent=None, ...
nanny.py
import asyncio import logging from multiprocessing.queues import Empty import os import psutil import shutil import threading import uuid import warnings import weakref import dask from dask.system import CPU_COUNT from tornado.ioloop import IOLoop from tornado import gen from .comm import get_address_host, unparse_h...
portscanner.py
#------------------------------------------------------------------------------- # Name: portscanner.py # version: 1.2 # # Developer: Jack western # # Created: 07/03/2022 # Licence: Open Source #------------------------------------------------------------------------------- import sys, s...
server.py
# encoding=utf-8 __all__ = ["server"] import multiprocessing import os import signal import socket import sys signames = {int(v): v.name for _, v in signal.__dict__.items() if isinstance(v, signal.Signals)} def create_ssl_context(certfile, keyfile): import ssl print("ssl has ALPN: {}".format(ssl.HAS_ALPN...
_trimesh.py
from __future__ import division import collections import logging import threading import pyglet from pyglet import compat_platform import trimesh import trimesh.viewer from .. import model as model_module logger = logging.getLogger('trimesh') logger.setLevel(logging.ERROR) def _redraw_all_windows(): for win...
predict_GUI_v2.py
import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from cv2 import * import cv2 import threading import time from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QWidget,QSplashScreen, QApplication, QGroupBox, QPushButton, QLabel, QHBoxLayout, QVBoxLayout, QGridLayout f...
alert_host_disk_write_bandth.py
''' Test about monitor trigger on host disk writing bandwidth in one minute @author: Songtao,Haochen ''' import os import test_stub import random import time import threading import zstacklib.utils.ssh as ssh import zstackwoodpecker.test_util as test_util import zstackwoodpecker.operations.resource_operations as re...
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...
HoffmanHTTPDownloader.py
#Embedded file name: ACEStream\Core\BitTornado\BT1\HoffmanHTTPDownloader.pyo import sys from random import randint from urlparse import urlparse from httplib import HTTPConnection import urllib from threading import Thread from ACEStream.Core.BitTornado.__init__ import product_name, version_short from ACEStream.Core.Bi...
async-with-threads.py
# -*- coding: utf-8 -*- import asyncio import threading import os import sys root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(root + '/python') import ccxt.async_support as ccxt # noqa: E402 async def test(loop): exchange = ccxt.bittrex({ 'asyncio_loo...
review_scrape.py
import pandas as pd import requests import re from bs4 import BeautifulSoup from timeit import default_timer import asyncio from concurrent.futures import ThreadPoolExecutor from threading import Thread from queue import Empty, Queue import signal import sys START_TIME = default_timer() CLEANR = re.compile('<.*?>') ...
alarm_clock.py
# Import Required Library from tkinter import * import datetime import time import winsound from threading import * # Create Object root = Tk() # Set geometry root.geometry("400x200") # Added comments # Use Threading def Threading(): t1=Thread(target=alarm) t1.start() def alarm(): # Infinite Loop while True: ...
n1ql_fts_integration_phase2.py
import json import threading from lib.membase.api.rest_client import RestConnection from lib.remote.remote_util import RemoteMachineShellConnection from membase.api.exception import CBQError from pytests.fts.fts_base import CouchbaseCluster from pytests.security.rbac_base import RbacBase from .tuq import QueryTests im...
BladderTracker.py
################################################## ## BladderTracker Software ## ## Used to track pressure and wall motions during bladder filling. ## Designed to work with Thorlabs DCC1545M ## For additional info see www.vasostracker.com and https://github.com/VasoTracker/BladderTracker ## ##########################...
port.py
__auther__ ="Abhishek" import socket import time import threading from queue import Queue socket.setdefaulttimeout(0.25) #avoide multiple modification print_lock = threading.Lock() print(""" _ |_) _ ._ _|_ | (_) | |_ __ ...
test_ssl.py
# Copyright 2012 OpenStack Foundation # 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 requ...
test_rpcfs.py
import unittest import sys import os, os.path import socket import threading import time from fs.tests import FSTestCases, ThreadingTestCases from fs.tempfs import TempFS from fs.osfs import OSFS from fs.memoryfs import MemoryFS from fs.path import * from fs.errors import * from fs import rpcfs from fs.expose.xmlrpc...
train_pose_quat_crop.py
import matplotlib matplotlib.use('Agg') import os from os.path import join import argparse import torch import numpy as np import pickle import sys import datetime sys.path.append('./utils') from torch import optim from torch import nn from torch import multiprocessing from torch.optim import lr_scheduler from torch.a...
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 prov...
test-01.py
import requests import threading from random import randrange import datetime def getUrl(limit) : # url = f"https://e9ea25810dfb.ngrok.io?limit={limit}" url = f"http://localhost:3000?limit={limit}" payload = {} headers= {} i=0 while i<1000: try: s = datetime.datetime.now() response = reques...
ansible_runner.py
#!/usr/bin/python -tt """Ansible runner.""" import signal import threading import Queue import time import taskdb import ansible_api from ansible.errors import AnsibleError import netspot_settings PLAYBOOK_PATH = netspot_settings.PLAYBOOK_PATH SLEEP_TIMER = netspot_settings.SLEEP_TIMER class TaskProcessor(object):...
importer.py
"""Take care of import jobs and copying files. Keep track of import modules""" import logging import mimetypes import os import re import base64 import bottle from jsonobject import wrap_raw_json from threading import Thread, Event, Lock from time import sleep from images7.web import ResourceBusy from images7.system...
qtbot.py
import threading import time from PyQt4 import QtCore, QtGui, QtTest import robouser class QObj(QtCore.QObject): # For use with sending signals when you don't have a handle on # a calling widget somethingHappened = QtCore.Signal() def center(widget, view_index=None): """ Gets the global position...
config-fw-v2.py
# /***************************************************************************** # * Copyright (c) 2016, Palo Alto Networks. All rights reserved. * # * * # * This Software is the property of Palo Alto Networks. The Software and all *...
lib.py
import os import random import sys import queue import shutil import zipfile import signal import threading import subprocess import importlib import logging import filecmp from .server import Server from ..tools import workfiles from ..vendor.Qt import QtWidgets self = sys.modules[__name__] self.server = None self.p...
firmware_update.py
# -*- coding: utf-8 -*- # # Copyright 2017-2018 AVSystem <avsystem@avsystem.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
test_params.py
from common.params import Params, UnknownKeyName import threading import time import tempfile import shutil import unittest class TestParams(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp() print("using", self.tmpdir) self.params = Params(self.tmpdir) def tearDown(self): shut...
utils.py
# -*- coding: utf-8 -*- """ Created on Tue Jul 10 14:46:21 2018 @author: a002028 """ import os import numpy as np import pandas as pd from decimal import Decimal, ROUND_HALF_UP from collections import Mapping from fnmatch import fnmatch from datetime import datetime import shutil from trollsift.parser import globify i...
PY_003.py
""" ******************************************************************************* * * Recepción datos del DHT22 a través del puerto serie * ******************************************************************************* * FileName: PY_003.py * Complier: EPython 3.7.1 * Author: Pedro ...
test_watchtower.py
import configparser import logging import os import random import shutil from threading import Thread from time import sleep import pytest from coincurve import PrivateKey from flask import Flask, request, jsonify from pyln.testing.fixtures import * # noqa: F401,F403 import common.receipts as receipts from common im...
manager.py
import argparse # noqa import atexit # noqa import codecs # noqa import copy # noqa import errno # noqa import fnmatch # noqa import hashlib # noqa import os # noqa import shutil # noqa import signal # noqa import sys # noqa import threading # noqa import traceback # noqa from contextlib import contextmana...
2.py
''' 2.升级w7实例,使得服务器可以同时响应多个客户端请求(建议多线程) ''' from socket import * import threading SERVER_IP = "172.25.2.189" SERVER_PORT = 33333 # 创建流式套接字对象 server_sd = socket(AF_INET, SOCK_STREAM) #表明地址可以重复使用 server_sd.setsockopt(SOL_SOCKET,SO_REUSEADDR,1) # 将本地地址与套接字对象绑定 必须绑定,这样客户端才知道与谁链接 server_sd.bind((SERVER_IP,SERVER_PORT)) # ...
cmc_submitter.py
''' NEO Listening and Submitter This python node will listen on the blockchain for changes to the smart contract (i.e. a new game) It will then submit a random number between 1 and 3 Note: you do need a tiny amount of gas each time 0.001 Hence, you need to use the coz faucet somehow ''' import threading from time impo...
dsym.py
""" sentry.runner.commands.dsym ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import uuid import json import click import warnings import threading from sentry.runner.decorator...
appointment_put.py
'''Copyright 2018 Province of British Columbia Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
conftest.py
# *************************************** # |docname| - pytest fixtures for testing # *************************************** # # To get started on running tests, see tests/README.rst # # These fixtures start the web2py server then submit requests to it. # # **NOTE:** Make sure you don't have another server running, ...
jupyter_magic.py
# encoding: utf8 from IPython.core.magic import (Magics, magics_class, line_magic, cell_magic, line_cell_magic) import pandas as pd from IPython.display import display, clear_output import re, time, threading, datetime from pandas import DataFrame from aliyun.log import LogClient, LogEx...
multiprocess.py
import multiprocessing import threading import os import time import sys import csv import time import math def worker(num): print("""thread worker function""") print 'Worker:', num #cmd= "pwd" cmd="brig run brigadecore/empty-testbed -f %s -n brigade> 10minjob-%s.log"%(sys.argv[2],num) os.system(cm...
job.py
# Author: Kevin Ersoy ##### Script description # This script contains the Job class. Once an instance of Job is created, __init__ is run, and you can store # whatever local vars you need from the arguments list. The first argument is the instance itself (self). # When you're ready to start the job, you call ...
python_ls.py
# Copyright 2017 Palantir Technologies, Inc. import json import logging import os import socketserver import threading from functools import partial from hashlib import sha256 from pyls_jsonrpc.dispatchers import MethodDispatcher from pyls_jsonrpc.endpoint import Endpoint from pyls_jsonrpc.streams import JsonRpcStream...
session.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
xla_client_test.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
test_cuda.py
# Owner(s): ["module: cuda"] from itertools import repeat, chain, product from typing import NamedTuple import collections import contextlib import ctypes import gc import io import pickle import queue import sys import tempfile import threading import unittest import torch import torch.cuda import torch.cuda.comm as...
wts-serve.py
# -*- coding: utf-8 -*- import sys import os import logging import json import socket import signal import threading from multiprocessing import Process, Event from collections import defaultdict, OrderedDict import urllib2 import uuid import argparse sys.path.append("tools") import sslutils import time import traceb...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest import unittest.mock from test import support from test.support import import_helper from test.support import os_helper from test.support import socket_helper from test.support import threading_helper from test.support import warnings_helper import sock...
gpu.py
import os, time, multiprocess import configparser import subprocess from comm.platform import linux_win, run_cmd from compute import Config_ini from compute.log import Log import json from compute.db import add_info, get_available_gpus, confirmed_used_gpu import random def parse_nvidia_info(gpu_enabled_list, nvidia_...
detect_mask_video_v1.py
# USAGE # python detect_mask_video.py # import the necessary packages from tensorflow.keras.applications.mobilenet_v2 import preprocess_input from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.models import load_model from imutils.video import VideoStream from playsound import ...
killThreadTest.py
import os import sys import time import threading from signal import signal, SIGINT import subprocess import multiprocessing threads = 10 threadL=[] def shareOrder(iter): proc = subprocess.Popen(["script -c \"~/onionshare/dev_scripts/onionshare --website hello.txt\" -f output" + str(iter) + ".txt"], std...
links_test.py
# -*- coding: utf-8 -*- import requests import threading class Check(object): def __init__(self, urls, p): self.urls = set([u.strip() for u in urls.split('\n') if u.strip()]) self.p = p self.dic = dict() self.headers = {'user-agent': 'Mozilla/5.0 (Windows NT 5.1; WOW64; rv:50.0) Ge...
test_cli.py
"""Tests for the `cli` module.""" import threading import time import pytest from aria2p.cli.commands import top from aria2p.cli.commands.add_magnet import add_magnets from aria2p.cli.commands.add_metalink import add_metalinks from aria2p.cli.commands.add_torrent import add_torrents from aria2p.cli.commands.call imp...
run.py
import time import os import signal import subprocess import psutil import multiprocessing as mp import subprocess import fnmatch from season.command.build import PATH_PROJECT from ... import config, core from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler PATH_PROJECT = core.PA...
params.py
#!/usr/bin/env python3 """ROS has a parameter server, we have files. The parameter store is a persistent key value store, implemented as a directory with a writer lock. On Android, we store params under params_dir = /data/params. The writer lock is a file "<params_dir>/.lock" taken using flock(), and data is stored in...
sub_client.py
#!/usr/bin/env python3 import logging import threading import time import zmq logger = logging.getLogger(__name__) class SubClient(object): def __init__(self, topic_filter=None, on_message_callback=None, host="127.0.0.1", port=5556): self.topic_filter = topic_filter self.on_message_callback = o...
model_logging.py
import tensorflow as tf import numpy as np import scipy.misc import threading from torch.utils.tensorboard import SummaryWriter try: from StringIO import StringIO # Python 2.7 except ImportError: from io import BytesIO # Python 3.x class Logger: def __init__(self, log_interval=50, ...
common_xmr.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2020-2021 tecnovert # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. import os import sys import json import shutil import signal import logging import unittest import...
main.py
"""Main entrypoint for this application""" import sys import logging import warnings from threading import Thread from time import sleep from environs import Env from paho.mqtt.client import Client, MQTTv5 from paho.mqtt.subscribeoptions import SubscribeOptions env = Env() ## Source config MQTT_SOURCE_HOST = env("MQ...
conftest.py
import os import json from multiprocessing import Process from indexd import default_settings, get_app as get_indexd_app from indexclient.client import IndexClient import pytest import requests import requests_mock from mock import patch from flask.testing import make_test_environ_builder from psqlgraph import PsqlGra...
hue.py
import httplib import time DELTA_TIME = 7 IP = "10.42.0.10" PATH = "/api/pY5xq4YUguxLqvEwqeyXRThbl0IX0kml39FzrV0K/lights/1/state" # send request to the hub def httpPUT(ip, path, body): conn = httplib.HTTPConnection(ip) conn.request("PUT", path, body) response = conn.getresponse() print response.status, respon...
core.py
import requests from flask import current_app, request from threading import Thread from . import MatomoError try: from flask import _app_ctx_stack as stack except ImportError: from flask import _request_ctx_stack as stack class Matomo(object): """The Matomo object provides the central interface for in...
manager.py
import logging import threading import time import traceback from functools import reduce from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Set, Tuple from concurrent.futures.thread import ThreadPoolExecutor from blspy import G1Element from chiapos import DiskProver from chaingreen.cons...
main.py
import datetime import threading import logging import os import telebot from functions import * from config import * from Csv import * bot = telebot.TeleBot(TOKEN) logging.basicConfig(level=logging.INFO) threading.Thread(target = timer).start() # запуск в фоне функции проверки # --------------------------------...
minion.py
''' Routines to set up a minion ''' # Import python libs import logging import multiprocessing import fnmatch import os import re import threading import time import traceback # Import third party libs import zmq # Import salt libs from salt.exceptions import AuthenticationError, \ CommandExecutionError, Comma...
pool.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : pool.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 01/28/2018 # # This file is part of Jacinle. # Distributed under terms of the MIT license. import sys import time import multiprocessing as mp import threading import queue import functo...
pythonprompt.py
"""Use Python's >>> prompt inside Porcupine.""" # FIXME: >>> while True: print("lel") (avoid making it as slow as idle is) # FIXME: prevent writing anywhere except to the end of the prompt # TODO: test this on windows, this may turn out to be pretty broken :( import io import queue import signal import subprocess i...
printer.py
from click import echo, secho import sys import time import threading def ssh_id(id: str) -> None: 'Show ssh_id' secho( f" 🧈 {id} ", bold=True, bg='cyan', nl=False ) def command(cmd: str) -> None: 'Show command' secho( f"\t `$ {cmd}` \t", bg='whit...