source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
postmaster.py | import logging
import multiprocessing
import os
import psutil
import re
import signal
import subprocess
import sys
from patroni import PATRONI_ENV_PREFIX
# avoid spawning the resource tracker process
if sys.version_info >= (3, 8): # pragma: no cover
import multiprocessing.resource_tracker
multiprocessing.res... |
WebUtilities.py | # vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# Python WebUtilities for piCAMTracker package
# Copyright (c) 2021-2022 Axel Barnitzke <barney@xkontor.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redis... |
httpclient_test.py | import base64
import binascii
from contextlib import closing
import copy
import gzip
import threading
import datetime
from io import BytesIO
import subprocess
import sys
import time
import typing # noqa: F401
import unicodedata
import unittest
from tornado.escape import utf8, native_str, to_unicode
from tornado impor... |
context.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 us... |
sqlite.py | import os
import sys
import time
import sched
import sqlite3
from typing import Any, List, Dict
from appdirs import user_data_dir
from contextlib import closing
from multiprocessing import Process, Queue
from specklepy.transports.abstract_transport import AbstractTransport
from specklepy.logging.exceptions import Speck... |
mover.py | import os
import shutil
import threading
import time
from typing import Dict, List
import yaml
from src.lock import Lock
from src.logger import logger
class PlotMover:
CONFIG_FILE_NAME = 'config.yaml'
SLEEP_PERIOD = 60
MIN_K32_PLOT_SIZE = 11 * 10 ** 9
_config: Dict
def __init__(self):
... |
zeromq_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Thomas Jackson <jacksontj.89@gmail.com>`
'''
# Import python libs
from __future__ import absolute_import
import os
import threading
import zmq.eventloop.ioloop
# support pyzmq 13.0.x, TODO: remove once we force people to 14.0.x
if not hasattr(zmq.eventloop.ioloop, ... |
GenShin_AutoScrape_Artifact.py | import os
import sys
import time
from datetime import datetime
from threading import Thread
import win32gui
import cv2
import pyautogui
import numpy as np
import pydirectinput
import keyboard
from queue import Queue
if os.path.exists('./GenShin_AutoScrape_Artifact.log'):
os.remove('./GenShin_AutoSc... |
extensions.py | """
Main class for Senpy.
It orchestrates plugin (de)activation and analysis.
"""
from future import standard_library
standard_library.install_aliases()
from . import plugins, api
from .plugins import Plugin
from .models import Error
from .blueprints import api_blueprint, demo_blueprint, ns_blueprint
from threading i... |
train_pg_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany
Adapted for pytorch version by Ning Dai
"""
import numpy as np
import torch
import gym
import ... |
check_keycode.py | import threading
import keyboard
import time
import numpy as np
import sys
from bluetooth.ble import GATTRequester
STOP = 0
MOVE_FWD = 1
MOVE_BWD = 2
MOVE_R = 3
MOVE_L = 4
F = 5
L = 6
state = 0
keycode = ""
def print_pressed_keys(e):
global keycode
keycode = str([str(code) for code in keyboard._pressed_events])
... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
import os
import pickle
import random
import re
import subprocess
import sys
import sysconfig
import textwrap
import time
import unittest
from test import support
from te... |
monitor_test.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
import os
import pytest
import subprocess
import time
import ray
from ray.test.test_utils import run_and_get_output
def _test_cleanup_on_driver_exit(num_redis_shards):
stdout = ru... |
VoiceSync.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""
A simple audio Sync for League Spectator with VLC python bindings using wxPython.
Author: Tom Rolle
Date: 04.03.2021
"""
# Tested with Python 3.9.1
__version__ = '0.0.3'
# import
import wx
import vlc
import requests
import json
import threading, tim... |
main.py | """
Example to show how to use this with a long running schedule process which can have jobs dynamically added or removed.
Example:
..code-block:: python
$ python tests/schedule_run/main.py
# New terminal
$ python tests/schedule_run/send_schedule.py add --name hello --script "hello.bat 2 seconds" --i... |
thapp.py | from kivy.app import App
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.animation import Animation
from kivy.clock import Clock, mainthread
from kivy.uix.gridlayout import GridLayout
import threading
import time
Builder.load_string("""
<AnimWidget@Widget>:
canvas:
Color:
... |
bilibili_video_download_bangumi.py | # !/usr/bin/python
# -*- coding:utf-8 -*-
# time: 2019/07/21--20:12
__author__ = 'Henry'
'''
项目: B站动漫番剧(bangumi)下载
版本2: 无加密API版,但是需要加入登录后cookie中的SESSDATA字段,才可下载720p及以上视频
API:
1.获取cid的api为 https://api.bilibili.com/x/web-interface/view?aid=47476691 aid后面为av号
2.下载链接api为 https://api.bilibili.com/x/player/playurl?avid=4... |
network.py | import threading
from queue import Queue
import time
import socket
import requests
# a print_lock is what is used to prevent "double" modification of shared variables.
# this is used so while one thread is using a variable, others cannot access
# it. Once done, the thread releases the print_lock.
# to use it, you want... |
stacks.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
"""Provides facilities to dump all stacks of all threads in the process.
"""
impo... |
rl_scheduler.py | import os
import json
import time
import pickle
import logging
import threading
import multiprocessing as mp
from collections import OrderedDict
import mxnet as mx
from .resource import DistributedResource
from ..utils import (load, tqdm)
from .. import Task
from ..decorator import _autogluon_method
from ..searcher i... |
profiler.py | import os
import sys
import copy
import time
import threading
import queue as Queue
import multiprocessing
from utils.logger import get_logger
from utils.time_util import timestamp as _timestamp
_LOGGER = get_logger("Serving")
_is_profile = int(os.environ.get('FLAGS_profile_pipeline', 0))
class PerformanceTracer(ob... |
worker.py | import logging
import time
import json
import numpy as np
from datetime import datetime
import os
import subprocess
import shutil
import cv2
import yaml
from multiprocessing import Queue, Process
from kicker.opcua_motor import motor_worker
from kicker.storage import storage_worker
def worker(queue, video_queue, nam... |
tar_to_h264_compressor.py | import os
import shutil
import logging
import tarfile
import tempfile
import subprocess
import distutils.spawn
from threading import Thread
if not distutils.spawn.find_executable('ffmpeg'):
raise ImportError('ffmpeg executable not found')
class TarToH264Compressor(object):
fps = 20
scale = '-1:360'
b... |
util.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 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 limitation the rights t... |
camera.py | import cv2
import threading, queue
class Camera:
def __init__(self, size_queue, fps, queue_image):
self.size_queue = size_queue
self.fps = fps
self.queue_image = queue_image
self.window_name = "Imshow Image"
def get_camera_image(self):
# Open webcam and put im... |
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... |
tcp_server.py | import socket
import threading
import struct
import time
import queue
class TcpServer(object):
def __init__(self, host, port):
self.host_ = host
self.port_ = port
self.q_ = queue.Queue()
self.sock_ = None
self.quit_event_ = threading.Event()
def lau... |
example_binance_dex.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: example_binance_dex.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api
# PyPI: https://pypi.... |
osmedeus.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import time
import argparse
from multiprocessing import Process
from core import routine
from core import config
from core import slack
from core import utils
from core import report
#############
# Osmedeus - One line to rude them all
#############... |
DnC.py | '''
/* ******************* */
/*! \file DnCParallelSolver.py
** \verbatim
** Top contributors (to current version):
** Haoze Wu
** This file is part of the Marabou project.
** Copyright (c) 2017-2019 by the authors listed in the file AUTHORS
** in the top-l... |
json_pusher.py | #!/usr/bin/env python
from p3lib.json_networking import JSONServer, JsonServerHandler
import threading
class JsonPusherServerHandler (JsonServerHandler):
"""@brief The handler for clients that wish to receive (pushed) json status updates."""
def handle(self):
try:
try:
... |
test_errno.py | import unittest, os, errno
from ctypes import *
from ctypes.util import find_library
try:
import threading
except ImportError:
threading = None
class Test(unittest.TestCase):
def test_open(self):
libc_name = find_library("c")
if libc_name is None:
raise unittest.Skip... |
server.py | from flask import Flask, render_template, request, jsonify
from flask_cors import CORS, cross_origin
from multiprocessing import Process
import json
import boto3
import time
import paramiko
from io import StringIO
import os
import base64
app = Flask(__name__)
CORS(app)
#Paraminko ssh information
sshClient = paramiko.... |
Express_Query_cmd.py | #coding=utf-8
import sys
import os
from os.path import abspath, dirname
sys.path.append(abspath(dirname(__file__)))
import tkinter
import tkinter.filedialog
from tkinter import *
import Fun
ElementBGArray={}
ElementBGArray_Resize={}
ElementBGArray_IM={}
import threading
def ThreadCount(param1,param2,param... |
run.py | import os
import threading
import time
import sys, getopt
def client(i,results,loopTimes):
print("client %d start" %i)
command = "./single-cold_warm.sh -R -t " + str(loopTimes)
r = os.popen(command)
text = r.read()
results[i] = text
print("client %d finished" %i)
def warmup(i,warmupTimes,a... |
run_engine.py | import asyncio
from datetime import datetime
import sys
from warnings import warn
from inspect import Parameter, Signature
from itertools import count
from collections import deque, defaultdict, ChainMap
from enum import Enum
import functools
import inspect
from contextlib import ExitStack
import threading
import weakr... |
threaded_runner.py | # Copyright 2017 reinforce.io. 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... |
UIscript.py | from interfaces import AD7961, ADS8686
from PyQt5 import QtWidgets, QtCore
from scipy import signal
import pyqtgraph as pg
from interfaces import FPGA
import numpy as np
import threading
import datetime
import platform
import time
import json
import h5py
import sys
import os
#File locations determined by the user, bit... |
freezerstate.py | """
freezerstate.py
Temperature sensing and alerting application to be run on a Raspberry Pi.
Code based on ModMyPi's tutorial:
- http://www.modmypi.com/blog/ds18b20-one-wire-digital-temperature-sensor-and-the-raspberry-pi
And Tim Fernando's "temperature-serve-pi" project:
- https://github.com/timfernando/temperatur... |
test_concurrency.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for concurrency libraries."""
import glob
import os
import random
import re
import sys
import threading
import time
from flaky import flaky
import pytest... |
test_selenium.py | import re
import threading
import unittest
from selenium import webdriver
from app import create_app, db
from app.models import Role, User, Post
class SeleniumTestCase(unittest.TestCase):
client = None
@classmethod
def setUpClass(cls):
# start Firefox
try:
cls.client = web... |
test_concurrency.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for concurrency libraries."""
import glob
import os
import random
import sys
import threading
import time
from flaky import flaky
import coverage
from c... |
docker_image_manager.py | from collections import namedtuple
import threading
import time
import traceback
import logging
import docker
from docker import DockerClient
import codalab.worker.docker_utils as docker_utils
from .docker_utils import DEFAULT_DOCKER_TIMEOUT
from codalab.worker.fsm import DependencyStage
from codalab.worker.state_co... |
views.py | import time
from threading import Thread
from numpy import NaN
# pandas managing dataframes
import pandas as pd
# django core
from django.shortcuts import get_object_or_404, redirect, render
# API endpoint for sentiment analysis:
from django.http import JsonResponse
from rest_framework.decorators import api_view
fro... |
Web.py | from gevent import monkey
import socket
import re
import threading
import multiprocessing
import gevent
import sys
monkey.patch_all() # 将阻塞程序的函数变成非阻塞,从而实现协程
class HTTPServer(object):
def __init__(self, port, func):
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 服务器重启地址重用
... |
xla_device.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_search.py | import time
import pdb
import copy
import threading
import logging
from multiprocessing import Pool, Process
import pytest
import numpy as np
from milvus import DataType
from utils import *
dim = 128
segment_row_count = 5000
top_k_limit = 2048
collection_id = "search"
tag = "1970-01-01"
insert_interval_time = 1.5
nb ... |
analyze.py | # !/usr/local/bin/python3.6
# MIT licensed
# Copyright (c) 2018 White Russsian
# Github: <https://github.com/Eve-PySpy/PySpy>**********************
''' The primary function is main(), which takes a set of EVE Online
character names and gathers useful information from CCP's ESI API and
zKIllboard's API, to be stor... |
008_ctr-vhc.py | # dont delete this line, help us make the project known :)
print('open-source project by www.OPEN-ATS.eu \n change to your own IP and password')
import os, socket, threading, time
os.system('sudo pigpiod') # starting GPIO deamon
os.system('clear') # not needed but otherwise a annoying message appears
time.sleep(1)... |
front.py | # -*- coding: utf-8 -*-
from tkinter import *
from tkinter import ttk
import time
import requests
from threading import Thread
import csv
import datetime
import codecs
import web3
from web3 import Web3, HTTPProvider, IPCProvider
import abisensores
import sensoresEvento
web3 = Web3(HTTPProvider(<IP:Port blockcha... |
vis1.py | #!/usr/bin/python
"""
A program to create the illusion of motion by modulating contrast and color.
See: https://journals.sagepub.com/doi/full/10.1177/2041669518815708
"""
#
#
# Copyright 2019 David Talkin.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compl... |
episodic_memory_ddq.py | import numpy as np
from stable_baselines.td3.episodic_memory import EpisodicMemory
import threading
class EpisodicMemoryDDQ(EpisodicMemory):
def __init__(self, buffer_size, state_dim, action_shape, obs_space, q_func, repr_func, obs_ph, action_ph, sess,
gamma=0.99,
alpha=0.6, max... |
main.py | #!/usr/bin/env python3
# Copyright (c) 2021, NVIDIA CORPORATION. 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
#
# U... |
manager.py | from multiprocessing import Process
from proxypool.tester import Tester
from proxypool.db import RedisClient
from proxypool.crawl import Crawler
from proxypool.api import start_api
from time import sleep
from proxypool.settings import *
class Manager(object):
def handle_getter(self):
"""
爬取代理
... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
Multithreading.py | # single_threaded.py
import time
from threading import Thread
COUNT = 50000000
def countdown(n):
while n>0:
n -= 1
start = time.time()
countdown(COUNT)
end = time.time()
print('Time taken in seconds : ', end - start)
t1 = Thread(target=countdown, args=(COUNT//2,))
t2 = Thread(target=countdown, args=(CO... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
eynollah.py | # pylint: disable=no-member,invalid-name,line-too-long,missing-function-docstring,missing-class-docstring,too-many-branches
# pylint: disable=too-many-locals,wrong-import-position,too-many-lines,too-many-statements,chained-comparison,fixme,broad-except,c-extension-no-member
# pylint: disable=too-many-public-methods,too... |
petri_net_node.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
from actionlib import ActionServer
from ros_petri_net_msgs.msg import RPNAction, RPNResult
from pnp_execution.executor import Executor
import yaml
import json
from copy import deepcopy
from pnp_gen.generator import Generator
from pnp_actions.pn_action import P... |
keepkey.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_ltc.util import bfh, bh2u, UserCancelled
from electrum_ltc.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT,
is_segwit_address)
from e... |
script.py | from threading import Thread
import subprocess
t1 = Thread(target=subprocess.run, args=(["/home/kathir/miniconda3/envs/gait/bin/python", "script1.py"],))
t2 = Thread(target=subprocess.run, args=(["/home/kathir/miniconda3/envs/gait/bin/python", "script2.py"],))
t1.start()
t2.start()
t1.join()
t2.join() |
test_mongoexp.py | from __future__ import print_function
from __future__ import absolute_import
import six.moves.cPickle as pickle
import os
import signal
import subprocess
import sys
import threading
import time
import unittest
import numpy as np
import nose
import nose.plugins.skip
from hyperopt.base import JOB_STATE_DONE
from hypero... |
__main__.py | #!/usr/bin/env python3
import argparse
from datetime import timedelta, datetime
import io
import itertools as it
import json
from lxml import html
import math
import multiprocessing as mp
import multiprocessing.dummy as mp_dummy
import os
import os.path as path
import sys
from time import strptime, strftime, mktime
im... |
test_sampling.py | from functools import partial
import math
import threading
import pickle
import pytest
from copy import deepcopy
import numpy as np
from numpy.testing import assert_allclose, assert_equal, suppress_warnings
from numpy.lib import NumpyVersion
from scipy.stats.sampling import (
TransformedDensityRejection,
Discre... |
example_userdata_stream.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: example_userdata_stream.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://www.lucit.tech/unicorn-binance-websocket-api.html
# Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api
# Documentation: https://u... |
post.py | import collections
import json
import logging
import os
import shutil
import torch
import math
import pandas as pd
import numpy as np
import six
import h5py
from multiprocessing import Process
from time import time
from scipy.sparse import csr_matrix, save_npz, hstack, vstack
from termcolor import colored, cprint
from ... |
test.py | import os
import sys
import glob
import time
import unittest
import tempfile
from multiprocessing import Process
import flask
import scrapelib
app = flask.Flask(__name__)
@app.route('/')
def index():
resp = app.make_response("Hello world!")
return resp
@app.route('/ua')
def ua():
resp = app.make_respo... |
client.py | #!/usr/bin/env python2.7
#
# @desc This is the client daemon. It will be run in the background and intercept incoming traffic from
# the C2 server. The script will read and execute any command coming through the C2 channel. Finally,
# the output of executed commands will be sent via the covert channel to the C2 serve... |
tests.py | import re
import threading
import unittest
from django.db import connection, transaction
from django.db.models import Avg, StdDev, Sum, Variance
from django.db.models.fields import CharField
from django.db.utils import NotSupportedError
from django.test import TestCase, TransactionTestCase, override_settings
from djan... |
show_videos_thread.py | #-*-coding:utf-8-*-
'''
DpCas-Light
|||| |||| |||| || ||||
|| || || || || || |||| || ||
|| || || || || || || || ||
|| || || || || ||====|| ||||
|| || |||| || || ||======|| ||
|| || || || || || ... |
GANTrain.py | # coding=utf-8
import tensorflow as tf
from GANNetwork.cycleGAN import CycleGAN
from common.common import getImg, torch_decay, getFiles, saveImg, imgPool, encode, linear_decay, imgRandomCrop
import numpy as np
import random
import threading, os, time, cv2
slim = tf.contrib.slim
tf.app.flags.DEFINE_string('i... |
whatsapp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys;
sys.dont_write_bytecode = True;
import os;
import signal;
import base64;
from threading import Thread, Timer
import math;
import time;
import datetime;
import json;
import io;
from time import sleep;
from threading import Thread;
from Crypto.Cipher import AES;... |
mp.py | from multiprocessing import Process
import os
import time
from datetime import datetime
class Test:
def __init__(self) -> None:
time.sleep(3)
self.Name = "now: {}".format(datetime.now())
def Change(self, name):
print("-----------------{}".format(name))
print("changed: {}".format... |
generate_breakpad_symbols.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to generate symbols for a binary suitable for breakpad.
Currently, the tool only supports Linux, Android, and Mac. Support f... |
test_s3boto3.py | import gzip
import pickle
import threading
from datetime import datetime
from textwrap import dedent
from unittest import mock, skipIf
from urllib.parse import urlparse
from botocore.exceptions import ClientError
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.... |
pydoc.py | #!/usr/bin/env python
# -*- coding: latin-1 -*-
"""Generate Python documentation in HTML or text for interactive use.
In the Python interpreter, do "from pydoc import help" to provide online
help. Calling help(thing) on a Python object documents the object.
Or, at the shell command line outside of Python:
... |
drum_server_utils.py | import os
import psutil
import requests
import signal
import time
from threading import Thread
from datarobot_drum.drum.utils import CMRunnerUtils
from datarobot_drum.drum.common import ArgumentsOptions, ArgumentOptionsEnvVars
from datarobot_drum.resource.utils import _exec_shell_cmd, _cmd_add_class_labels
def _wait... |
wurlitzer.py | """Capture C-level FD output on pipes
Use `wurlitzer.pipes` or `wurlitzer.sys_pipes` as context managers.
"""
from __future__ import print_function
__version__ = '1.0.3.dev'
__all__ = [
'pipes',
'sys_pipes',
'sys_pipes_forever',
'stop_sys_pipes',
'Wurlitzer',
]
from contextlib import contextmana... |
utils.py | import os
import threading
from functools import wraps
class Configurable(object):
def __new__(cls, *args, **kwargs):
pass
def config_base(self):
pass
def config_default(self):
pass
pass
def async(fun):
@wraps(fun)
def inner(*args, **kwargs):
thread = thread... |
loader_base.py | """Parent class for data loaders.
Author: Satwik Kottur
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import threading
import queue
import numpy as np
import torch
class LoaderParent:
def __init__(self):
"""Class constructor.
"""
# Assert the pr... |
sniffer.py | #Python script relying on Scappy python's library
#
#-Detects TELNET connections
#-Intercepts TELNET connections
#-Hijacks TELNET connections
#-Write to TELNET connections
#
# @author flrPwr - Vlad Florea
import psutil #We use it to find out the interfaces
import sys #We use it to force kill threads
from sc... |
copyutil.py | # cython: profile=True
# 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
# "... |
cloudtik_node_controller.py | """Node control loop daemon."""
import argparse
import logging.handlers
import sys
import signal
import time
import traceback
import threading
from multiprocessing.synchronize import Event
from typing import Optional
import json
import psutil
import subprocess
import cloudtik
from cloudtik.core._private import consta... |
vnlhang.py | # encoding: utf-8
import urllib.request, urllib.parse, urllib.error
import hashlib
import requests
from queue import Queue, Empty
from threading import Thread
from time import sleep
LHANG_API_ROOT ="https://api.lhang.com/v1/"
FUNCTION_TICKER = ('ticker.do', 'get')
FUNCTION_DEPTH = ('depth.do', 'get')
FUNCTION_TRA... |
tasks.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
from collections import OrderedDict, namedtuple
import errno
import functools
import importlib
import json
import logging
import os
import shutil
import stat
import tempfile
import time
import traceback
from distutils.dir_util ... |
auto.py | import turtle
from amazon import Boa
from random import randrange
import threading
# from keysclass import Keys
# import configparser
import winsound
def controlthread(arg1, stop_event, fwd, rev, left, right):
step = 5
turnstep = 15
while (not stop_event.is_set()):
stop_event.wait(0.1)
if... |
msg_dispatcher_base.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import threading
import logging
from queue import Queue, Empty
from .env_vars import dispatcher_env_vars
from ..common import load
from ..recoverable import Recoverable
from .tuner_command_channel import CommandType, TunerCommandChannel
_logge... |
consumer.py | """
Python with RabbitMQ—simplified so you won't have to.
This module implements PyRMQ Consumer class
:copyright: 2020-Present by Alexandre Gerona.
:license: MIT, see LICENSE for more details.
Full documentation is available at https://pyrmq.readthedocs.io
"""
import json
import logging
import os... |
test_function.py | import threading
import unittest
import mock
import six
import cupy
from cupy import testing
from cupy_tests.core_tests.fusion_tests import fusion_utils
class FusionTestBase(unittest.TestCase):
def generate_inputs(self, xp, nargs, dtype):
inputs = [
testing.shaped_random((3, 4), xp, dtype, s... |
base_camera.py | import abc
import time
import threading
from greenlet import getcurrent as get_ident
class CameraEvent(object):
"""An Event-like class that signals all active clients when a new frame is
available.
"""
def __init__(self):
self.events = {}
def wait(self):
"""Invoked from each clien... |
test_diaper.py | from threading import Thread
import pytest
import diaper
# Might as well overengineer the tests while we're in here...
@pytest.fixture
def clean_diaper():
diaper.change()
@pytest.fixture
def dirty_diaper():
diaper.soil()
expection = RuntimeError("I exploded and you'll never find out about it!")
def ex... |
up2k.py | # coding: utf-8
from __future__ import print_function, unicode_literals
import re
import os
import time
import math
import json
import gzip
import stat
import shutil
import base64
import hashlib
import threading
import traceback
import subprocess as sp
from copy import deepcopy
from .__init__ import WINDOWS, ANYWIN, ... |
led.py | import pingo
import time
import threading
class Led(object):
"""A single LED"""
def __init__(self, pin, lit_state=pingo.HIGH):
"""Set lit_state to pingo.LOW to turn on led by bringing
cathode to low state.
:param lit_state: use pingo.HI for anode control, pingo.LOW
... |
data_generator.py | import torch.multiprocessing as mp
from torch.multiprocessing import Queue
from basic_utils.env_wrapper import Scaler
from models.agents import *
class Parallel_Path_Data_Generator:
def __init__(self,
agent,
env,
n_worker,
path_num,
... |
igv.py | """ A wrapper for working with IGV via its socket interface.
This class was written by Brent Pedersen:
https://github.com/brentp/bio-playground/blob/master/igv/igv.py
It is released under the MIT license.
"""
import socket
import os.path as op
import os
import sys
class IGV(object):
r"""
Simple wrapper ... |
test_coordination.py | # -*- coding: utf-8 -*-
#
# Copyright © 2013-2015 eNovance 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/LIC... |
test_functools.py | import abc
import builtins
import collections
import collections.abc
import copy
from itertools import permutations
import pickle
from random import choice
import sys
from test import support
import threading
import time
import typing
import unittest
import unittest.mock
import os
import weakref
import... |
line_detector_node2.py | #!/usr/bin/env python
from cv_bridge import CvBridge, CvBridgeError
from duckietown_msgs.msg import BoolStamped, Segment, SegmentList, Vector2D, AntiInstagramTransform
from geometry_msgs.msg import Point
from line_detector.LineDetector2 import *
from line_detector.LineDetectorPlot import *
from anti_instagram.AntiInsta... |
subproc_vec_env.py | import numpy as np
from multiprocessing import Process, Pipe, set_start_method
from vec_env import VecEnv, CloudpickleWrapper
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while True:
cmd, data = remote.recv()
if cmd == 'step':
... |
index.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from multiprocessing import Process
from voicesan import VoiceScan
from commandscan import CommandScan
from lib import baidu_voice
import recode
# 子进程创建
def sub_process(name):
if "start_recode" == name:
recode.start()
if "start_voice_scan" == name:
V... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.