source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
ssh.py | import socket
import datetime
import sys
import ipaddress
import threading
import os
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[1;94m', '\033[1;91m', '\33[1;97m', '\33[1;93m', '\033[1;35m', '\033[1;32m', '\033[0m'
class ThreadManager(object):
i = 0
def __init__(self, ipList):
self.allIps = ... |
test_lambda_wrapper_thread_safety.py | import time
# import unittest
import threading
from datadog import lambda_metric, datadog_lambda_wrapper
from datadog.threadstats.aws_lambda import _lambda_stats
TOTAL_NUMBER_OF_THREADS = 1000
class MemoryReporter(object):
""" A reporting class that reports to memory for testing. """
def __init__(self):
... |
map_dataset_op_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... |
server.py | import importlib
import logging
import multiprocessing
import queue
import socket
import random
import netaddr
import psutil
from pyats import configuration as cfg
from pyats.datastructures import AttrDict
from pyats.utils.dicts import recursive_update
logger = logging.getLogger(__name__)
process = multiprocessing.g... |
run.py | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""sMRIPrep: Structural MRI PREProcessing workflow."""
def main():
"""Set an entrypoint."""
opts = get_parser().parse_args()
return build_opts(opts)
def check_deps(work... |
_v4__speech_playvoice.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# COPYRIGHT (C) 2014-2020 Mitsuo KONDOU.
# This software is released under the MIT License.
# https://github.com/konsan1101
# Thank you for keeping the rules.
import sys
import os
import queue
import threading
import subprocess
import datetime
import tim... |
client_web.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from socket import *
from threading import Thread, Lock
import sys
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
# IP of robot
server_ip = str(sys.argv[1])
# port to connect to
server_port = 50007
# currently pressed Keys
pressed_keys = []
# Keys allowed t... |
socketserver.py | # coding:utf-8
'''
Created on Feb 17, 2014
@author: magus0219
'''
import socket, logging, threading, pickle
from core.command import Command
def recv_until(socket, suffix):
'''
Receive message suffixed with specified char
@param socket:socket
@param suffix:suffix
'''
message = ''
w... |
feature_shutdown.py | #!/usr/bin/env python3
# Copyright (c) 2018-2020 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 monicoind shutdown."""
from test_framework.test_framework import MonicoinTestFramework
from test_... |
test_stim_client_server.py | import threading
import time
from ...externals.six.moves import queue
from mne.realtime import StimServer, StimClient
from nose.tools import assert_equal, assert_raises
def test_connection():
"""Test TCP/IP connection for StimServer <-> StimClient.
"""
# have to start a thread to simulate the effect of ... |
dockerTest.py | # Copyright (C) 2015-2018 Regents of the University of California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
synthesize.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Synthesize waveform using converted features.
# By Wen-Chin Huang 2019.06
import json
import os
import tensorflow as tf
import numpy as np
from datetime import datetime
from importlib import import_module
import pysptk
import pyworld as pw
from scipy.io import loadma... |
bully.py | import zmq
import time
import parse
import sys
import threading
class Bully:
def __init__(self, proc_ip, proc_port, proc_port2, id):
conf_file = open("file.config","r")
input = conf_file.readlines()
n = int(input[0])
self.processes = []
self.maxId = 0
for i in range... |
http_sensor.py | from threading import Thread
from time import sleep
import sys
from flask import Flask
from know.http_sensor_sim import simulate_http_sensor
from flaskstream2py.flask_request_reader import FlaskRequestReader
app = Flask(__name__)
@app.route('/', methods=['POST'])
def handle_stream():
print('received request')
... |
pyneurocl_train.py | import os, sys, time, threading
microdot = False
if ( os.uname()[1] == 'raspberry' ):
try:
from microdotphat import write_string
microdot = True
except ImportError:
print "---> microdotphat module is not installed on your raspberry"
sys.path.append("../lib")
import pyneurocl
print "... |
test_font_manager.py | from io import BytesIO, StringIO
import multiprocessing
import os
from pathlib import Path
import shutil
import subprocess
import sys
import warnings
import numpy as np
import pytest
from matplotlib.font_manager import (
findfont, findSystemFonts, FontProperties, fontManager, json_dump,
json_loa... |
plan_party.py | #uses python3
import sys
import threading
# This code is used to avoid stack overflow issues
sys.setrecursionlimit(10**6) # max depth of recursion
threading.stack_size(2**26) # new thread will get stack of such size
class Vertex:
def __init__(self, weight):
self.weight = weight
self.children = ... |
caches.py | #!/usr/bin/env python3
import time
import threading
import queue
import weakref
from collections import defaultdict
from electroncash.util import PrintError
class ExpiringCache:
''' A fast cache useful for storing tens of thousands of lightweight items.
Use this class to cache the results of functions or oth... |
networking.py | """
Defines helper methods useful for setting up ports, launching servers, and handling `ngrok`
"""
import os
import socket
import threading
from http.server import HTTPServer as BaseHTTPServer, SimpleHTTPRequestHandler
import pkg_resources
from distutils import dir_util
from gradio import inputs, outputs
import json
... |
server.py | from __future__ import (
absolute_import,
unicode_literals,
)
import argparse
import atexit
import codecs
import importlib
import logging
import logging.config
import os
import random
import signal
import sys
import threading
import time
import traceback
from types import FrameType
from typing import (
Any... |
test_pool.py | import threading
import time
from sqlalchemy import pool, select, event
import sqlalchemy as tsa
from sqlalchemy import testing
from sqlalchemy.testing.util import gc_collect, lazy_gc
from sqlalchemy.testing import eq_, assert_raises
from sqlalchemy.testing.engines import testing_engine
from sqlalchemy.testing import f... |
SADULUR.py | # -*- coding: utf-8 -*-
import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize
from multiprocessing.pool import ThreadPool
from requests.exceptions import ConnectionError
from mechanize import Browser
reload(sys)
sys.setdefaultencoding('utf8')
br = mechanize.Browser... |
test_streaming_pull_manager.py | # Copyright 2018, Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
queuecrazy.py | #!/usr/bin/env python
# Foundations of Python Network Programming - Chapter 8 - queuecrazy.py
# Small application that uses several different message queues
import random, threading, time, zmq
zcontext = zmq.Context()
def fountain(url):
"""Produces a steady stream of words."""
zsock = zcontext.socket(zmq.PUSH... |
log.py | # coding:utf-8
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
labels.py | import hashlib
import requests
import threading
import json
import sys
import traceback
import base64
from electrum_dash.plugin import BasePlugin, hook
from electrum_dash.crypto import aes_encrypt_with_iv, aes_decrypt_with_iv
from electrum_dash.i18n import _
class LabelsPlugin(BasePlugin):
def __init__(self, p... |
test_smtplib.py | import asyncore
import base64
import email.mime.text
from email.message import EmailMessage
from email.base64mime import body_encode as encode_base64
import email.utils
import hashlib
import hmac
import socket
import smtpd
import smtplib
import io
import re
import sys
import time
import select
import errno
import textw... |
reltestbase.py | # -*- coding: utf-8; -*-
##############################################################################
#
# Copyright (c) 2008 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this... |
batch_env_factory.py | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
test_session.py | import multiprocessing as mp
import logging
import pytest
from awswrangler import Session
logging.basicConfig(level=logging.INFO, format="[%(asctime)s][%(levelname)s][%(name)s][%(funcName)s] %(message)s")
logging.getLogger("awswrangler").setLevel(logging.DEBUG)
def assert_account_id(session):
account_id = (ses... |
test_kudu.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... |
ADS1115TempSensor.py | from MQTT import Publisher, Subscriber, Client
import math
import threading
import time
import log
import Filter
import time
import board
import busio
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
import Threaded
# Create the I2C bus
def get_i2c():
return busio.I2C(board.SC... |
server.py | #!/usr/bin/env python
"""
Dummy server used for unit testing.
"""
from __future__ import print_function
import errno
import logging
import os
import random
import string
import sys
import threading
import socket
import warnings
from datetime import datetime
from urllib3.exceptions import HTTPWarning
from tornado.pl... |
log_server_test.py | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
controller.py | import copy
import json
import os
import random
import re
import shlex
import subprocess
import sys
import threading
import time
from queue import Queue
from kivy.clock import Clock
from kivy.storage.jsonstore import JsonStore
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.checkbox import CheckBox
from kivy.ui... |
tunnel.py | """Basic ssh tunnel utilities, and convenience functions for tunneling
zeromq connections.
"""
# Copyright (C) 2010-2011 IPython Development Team
# Copyright (C) 2011- PyZMQ Developers
#
# Redistributed from IPython under the terms of the BSD License.
import atexit
import os
import re
import signal
import socket
impor... |
ConvertToUTF8.py | # -*- coding: utf-8 -*-
import sublime, sublime_plugin
import sys
import os
if sys.version_info < (3, 0):
from chardet.universaldetector import UniversalDetector
NONE_COMMAND = (None, None, 0)
ST3 = False
else:
from .chardet.universaldetector import UniversalDetector
NONE_COMMAND = ('', None, 0)
ST3 = True
impor... |
eventlet.py | """A eventlet based handler."""
from __future__ import absolute_import
import contextlib
import logging
import eventlet
from eventlet.green import select as green_select
from eventlet.green import socket as green_socket
from eventlet.green import time as green_time
from eventlet.green import threading as green_thread... |
__init__.py | # Copyright 2011 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,... |
email.py | from threading import Thread
from flask import current_app, render_template
from flask.ext.mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
msg =... |
transports.py | from ...typecheck import *
from ...import core
from ..dap import Transport
import socket
import os
import subprocess
import threading
class Process:
@staticmethod
async def check_output(command: List[str]) -> bytes:
return await core.run_in_executor(lambda: subprocess.check_output(command))
def __init__(self, c... |
aws_helper.py | import os, sys, collections
import boto, boto.ec2
from atlas_helper_methods import *
import re, datetime
import memcache, collections
from concurrent.futures import ThreadPoolExecutor
import chef
from chef import DataBag, DataBagItem
from chef import DataBagItem
from dateutil import parser
from dateutil import tz
from ... |
photoboothapp.py | # import the necessary packages
import tkinter as tki
from PIL import Image
from PIL import ImageTk
import cv2
import threading
import imutils
import datetime
import os
import time
import traceback
import shutil
# FaceAnalyzer
import dlib
import numpy as np
import cv2
from keras.models import load_model
import glob
f... |
client.py | import socket
import threading
class Client:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
message = ""
server_address = 0
def welcome(self):
print("Welcome, please enter the address of the connection you want to reach")
try:
address = input("Address: ")
... |
http_stubber.py | # Copyright 2017 The WPT Dashboard Project. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import BaseHTTPServer
import json
import threading
import urllib2
class HTTPStubber(object):
'''An HTTP server which forwards errors raised during... |
sys_tray.py | #encoding:utf-8
''' Flash windows tray icon sample code '''
from Tkinter import Tk, Menu
import tkMessageBox
import os
import time
import threading
icon_state = False # Show icon0 when False, else show icon1
tray_root_menu = None
tray_menu = None
show_main_menu_callback = None
def flash_icon(root,icon):
global ... |
web_service.py | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
zeromq.py | # -*- coding: utf-8 -*-
'''
Zeromq transport classes
'''
# Import Python Libs
from __future__ import absolute_import
import os
import copy
import errno
import hashlib
import logging
import weakref
from random import randint
# Import Salt Libs
import salt.auth
import salt.crypt
import salt.utils
import salt.utils.veri... |
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... |
fabfile.py |
# NB: this file requires fabric 3
from __future__ import print_function
import sys
import time
import atexit
import threading
from fabric.api import env, run, sudo, cd, local
env.hosts = ['login.tools.wmflabs.org']
env.sudo_prefix = "sudo -ni -p '%(sudo_prompt)s' "
# TODO
DEFAULT_TOOL = 'montage-dev'
DEFAULT_RELEA... |
test_pocketfft.py | from __future__ import division, absolute_import, print_function
import numpy as np
import pytest
from numpy.random import random
from numpy.testing import (
assert_array_almost_equal, assert_array_equal, assert_raises,
)
import threading
import sys
if sys.version_info[0] >= 3:
import queue
else:
... |
console.py | #!/usr/bin/env python3
import os
import sys
import argparse
import serial
import threading
import time
def read_handler():
while True:
try:
b = serial_port.read()
s = b.decode('ascii')
except UnicodeDecodeError:
print(repr(b), end='')
pass
el... |
launcher.py | """
TODO LIST:
- Get mirai python built with _ssl and bz2
- Fix up patcher.
- Graphical User Interface (inb4 python needs m0ar)
"""
from fsm.FSM import FSM
import urllib, json, sys, os, subprocess, threading, time, stat, getpass
import settings, localizer, messagetypes
from urllib.request import urlopen
fr... |
add.py | from __future__ import print_function
from __future__ import unicode_literals
from hashlib import md5
from PIL import Image
from io import BytesIO
from os.path import basename, dirname, realpath, exists, lexists, join, sep
from os import readlink, symlink, unlink, stat
from wellpapp import Client, VTstring, make_pdirs... |
Debug.py | from time import time
import cv2
import numpy as np
from Mosse_Tracker.TrackerManager import Tracker, TrackerType
from PIL import Image
#from Car_Detection_TF.yolo import YOLO
#from Car_Detection.detect import Yolo_image
from Mosse_Tracker.utils import draw_str
from boxes.yoloFiles import loadFile
pi=22/7
# clf = pi... |
chickencoop.py | #To use this program run the following from admin command prompt:
#pip install flask pymodbus
#
from flask import Flask, render_template, request
import os.path
import requests
import random
import pickle
import atexit
from threading import Thread, Lock, Event
import time
import datetime
from pymodbus.clien... |
asyncPool.py | """
asyncio 实现的协程池 asyncio为python原生支持
调用时需要引入
import asyncio
还有另外一个版本的实现 asyncPoolGevent 为 Gevent实现协程
"""
# -*- coding:utf-8 -*-
import asyncio
import queue
from concurrent.futures import ThreadPoolExecutor
class 协程池(object):
"""
1. 支持动态添加任务
2. 支持停止事件循环
3. 支持最大协程数:maxsize
4. 支持进度条
5. 实时获取... |
run.py | """Run a simulation from an existing WMT configuration."""
from __future__ import print_function
import os
import argparse
from ..slave import Slave
from ..env import WmtEnvironment
from cmt.component.model import Model
def run(path):
os.chdir(path)
import yaml
with open('model.yaml', 'r') as opened:
... |
app.py | # -*- coding: utf-8 -*-
from flask import Flask, jsonify, request
from configparser import ConfigParser
from warnings import filterwarnings
from urllib.request import urlopen
from threading import Thread
from logging import handlers
import logging
import pymysql
import pexpect
import json
from bin.server_obj import Se... |
monobeast_football.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
async_executor.py | from multiprocessing import Process
from multiprocessing import Manager
import multiprocessing
import numpy as np
from progressbar.bar import ProgressBar
class AsyncExecutor:
def __init__(self, n_jobs=1):
self.num_workers = n_jobs if n_jobs > 0 else multiprocessing.cpu_count()
self._pool = []
... |
cliente_tcp.py | #!/usr/bin/python3
from socket import *
import threading
from threading import Thread
from time import sleep
import sys, ssl
lock = threading.Lock()
RECV_BUFFER = 2024
global writer
chatting = False
def envia(mensagem, sock):
lock.acquire()
sock.send( mensagem.encode('utf-8') )
lock.release()
class Heartbeat(... |
Hiwin_RT605_ArmCommand_Socket_20190627184253.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
block_tools.py | # -*- coding: utf-8 -*-
from __future__ import print_function, division
# QuSpin modules
# numpy modules
import numpy as _np # generic math functions
# _scipy modules
import scipy as _scipy
import scipy.sparse as _sp
from scipy.sparse.linalg import expm_multiply as _expm_multiply
# multi-processing modules
from multip... |
test_add_vectors.py | import time
import threading
import logging
import threading
from multiprocessing import Pool, Process
import pytest
from milvus import IndexType, MetricType
from utils import *
dim = 128
index_file_size = 10
collection_id = "test_add"
ADD_TIMEOUT = 60
tag = "1970-01-01"
add_interval_time = 1.5
nb = 6000
class Test... |
__init__.py | """
doc string
"""
# pylint: disable=fixme
from email.header import Header
from email.mime.text import MIMEText
from datetime import datetime
import io
import json
import logging
import os
import re
import shutil
import smtplib
import sys
import time
import threading
import traceback
import queue
import requests
impo... |
run_csmith.py | #!/usr/bin/env python3
import os.path
import sys
import subprocess
import tempfile
from multiprocessing import Process
import time
import shutil
class Csmith:
"""Wrapper for Csmith"""
def __init__(self, csmith: str, csmith_inc: str, csmith_args=""):
if not os.path.exists(csmith):
raise V... |
app.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import cgi
import urlparse
import traceback
from threading import Thread
from SocketServer import ThreadingMixIn
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from django.utils.simplejson import JSONEncoder
from django.db.models.query import QuerySet
... |
thermald.py | #!/usr/bin/env python3
import datetime
import os
import queue
import threading
import time
from collections import OrderedDict, namedtuple
from pathlib import Path
from typing import Dict, Optional, Tuple
import psutil
import cereal.messaging as messaging
from cereal import log
from common.dict_helpers import strip_d... |
distanceFinder.py | from threading import Thread
import cv2
import vision
import pyrealsense2
class DistanceGet:
"""
Class that continuously shows a frame using a dedicated thread.
"""
def __init__(self):
self.frames = None
self.stopped = False
self.x = 0
self.y = 0
self.w = 0
... |
pool.py | """
Multithreads to get proxies from free websites
"""
from proxy_pool import settings
from proxy_pool.db import Proxy
from proxy_pool.utils import print_log
from queue import Queue
import threading
import requests
import random
import time
import re
# turn off unnecessary warnings
requests.packages.urllib3.disab... |
conman_etcd_test.py | import os
import sys
import time
from collections import defaultdict
from threading import Thread
from conman.conman_etcd import ConManEtcd
from conman.etcd_test_util import (start_local_etcd_server,
kill_local_etcd_server,
set_key,
... |
sflow_test.py | #ptf --test-dir ptftests sflow_test --platform-dir ptftests --platform remote -t "enabled_sflow_interfaces=[u'Ethernet116', u'Ethernet124', u'Ethernet112', u'Ethernet120'];active_collectors=[];dst_port=3;testbed_type='t0';router_mac=u'52:54:00:f7:0c:d0';sflow_ports_file='/tmp/sflow_ports.json';agent_id=u'10.250.0.101'"... |
test_uow.py | # pylint: disable=broad-except, too-many-arguments
import threading
import time
import traceback
from typing import List
from unittest.mock import Mock
import pytest
from allocation.domain import model
from allocation.service_layer import unit_of_work
from ..random_refs import random_sku, random_batchref, random_orderi... |
zoni-cli.py | #! /usr/bin/env python
#
# 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
... |
standalone_test.py | """Tests for acme.standalone."""
import socket
import threading
import unittest
from unittest import mock
import josepy as jose
import requests
from six.moves import http_client # pylint: disable=import-error
from six.moves import socketserver # type: ignore # pylint: disable=import-error
from acme import challeng... |
webcam.py | """Raspberry Pi Face Recognition Treasure Box
Webcam OpenCV Camera Capture Device
Copyright 2013 Tony DiCola
Webcam device capture class using OpenCV. This class allows you to capture a
single image from the webcam, as if it were a snapshot camera.
This isn't used by the treasure box code out of the box, but is usef... |
utilit.py | # -*- coding: utf-8 -*-
__author__ = 'Akinava'
__author_email__ = 'akinava@gmail.com'
__copyright__ = 'Copyright © 2019'
__license__ = 'MIT License'
__version__ = [0, 0]
import json
import sys
from datetime import datetime
from time import time
import threading
import logging
import settings
import get_args
class S... |
test_subprocess.py | import unittest
from unittest import mock
from test import support
import subprocess
import sys
import signal
import io
import itertools
import os
import errno
import tempfile
import time
import traceback
import types
import selectors
import sysconfig
import select
import shutil
import threading
import gc
import textwr... |
run.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""NiBabies runner."""
from .. import config
def main():
"""Entry point."""
from os import EX_SOFTWARE
from pathlib import Path
import sys
import gc
from multiprocessing import Process, Manager
from .parser import parse_args
from ..utils.bi... |
callbacks_test.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
rfid.py |
import threading
import server
from api import crud
import sys
import helper
import time
def start_rfid_reader():
print("Starting RFID Reader...")
x = threading.Thread(target=read_rfid_forever, daemon=True)
x.start()
print("Started RFID Reader.")
def read_rfid_forever():
print("Starting read_rf... |
server.py | import os
import signal
import ssl
import threading
from base64 import b64encode
from contextlib import contextmanager
from textwrap import dedent
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator
from unittest.mock import Mock
from werkzeug.serving import BaseWSGIServer, WSGIRequestHandler
fro... |
joystick_and_video.py | """
tellopy sample using joystick and video palyer
- you can use PS3/PS4/XONE joystick to controll DJI Tello with tellopy module
- you must install mplayer to replay the video
- Xbox One Controllers were only tested on Mac OS with the 360Controller Driver.
get it here -> https://github.com/360Controller/360Cont... |
__init__.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
"""A watchdog process for debuggee processes spawned by tests.
Interacts with the... |
test_execute.py | # coding: utf-8
from contextlib import contextmanager
import re
import threading
import weakref
import sqlalchemy as tsa
from sqlalchemy import bindparam
from sqlalchemy import create_engine
from sqlalchemy import create_mock_engine
from sqlalchemy import event
from sqlalchemy import func
from sqlalchemy import inspe... |
tests.py | import os
import uuid
import time
import random
from threading import Thread
from string import ascii_lowercase
import zmq
from smite import (
Client,
RClient,
Servant,
Proxy,
utils,
)
from smite.exceptions import (
ClientTimeout,
MessageException,
)
HOST = '127.0.0.1'
PORT = 3000
CONNEC... |
record_multiplayer.py | #!/usr/bin/python
from __future__ import print_function
from vizdoom import *
from random import choice
import os
from multiprocessing import Process
def player1():
game = DoomGame()
game.load_config('../config/multi_duel.cfg')
game.add_game_args("-host 2 -deathmatch +timelimit 0.15 +sv_spawnfarthest 1 "... |
utils.py | from bitcoin.rpc import RawProxy as BitcoinProxy
from pyln.testing.btcproxy import BitcoinRpcProxy
from collections import OrderedDict
from decimal import Decimal
from ephemeral_port_reserve import reserve
from pyln.client import LightningRpc
import json
import logging
import lzma
import math
import os
import random
i... |
postgres_consumers.py | #!/usr/bin/env python3
import json
import requests
import flask
from kafka import KafkaConsumer
import postgres_helpers
from threading import Thread
KAFKA_BROKER = 'ec2-35-162-75-2.us-west-2.compute.amazonaws.com'
KAFKA_PORT = '9092'
def transfer_consumer():
consumer = KafkaConsumer('pg_transfer',
... |
CamerGrabTest.py | #!/usr/bin/env python
from threading import Thread, Lock
import cv2
class WebcamVideoStream :
def __init__(self, src = 0, width = 320, height = 240) :
self.stream = cv2.VideoCapture(src)
self.stream.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, width)
self.stream.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT,... |
start_signaling_server.py | # stdlib
import argparse
from multiprocessing import Process
import socket
import socketserver
from time import time
# syft absolute
from syft.grid.example_nodes.network import signaling_server
def free_port() -> int:
with socketserver.TCPServer(("localhost", 0), None) as s: # type: ignore
return s.serv... |
WxAPI.py | # encoding=utf-8
import os
import sys
import random
import time
import datetime
from multiprocessing import Process
import threading
from .tools import save_json,read_json,url_2pdf
from .ArticlesUrls import ArticlesUrls
from .Config import GlobalConfig
class AccountManager():
def __init__(self):
self.app =... |
test_scan_testdata.py | import unittest
import subprocess
import os
import tempfile
import http.server
import ssl
import threading
TESTDATA_REPO = "https://github.com/hannob/snallygaster-testdata"
TESTDATA = {"backup_archive": "[backup_archive] https://localhost:4443/backup.zip",
"git_dir": "[git_dir] https://localhost:4443/.git... |
Spawner.py | # Copyright 2016 Ufora 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 i... |
core.py | import socketserver
import threading
import json
import time
import os
import shutil
from shutil import copyfile
def copy_html_template(name, new_string=None, old_string=None,
path="core/srv/html_templates",
tmp_path="core/srv/tmp"):
""" Copies a file from html_tem... |
load-data.py | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# This script is used to load the proper datasets for the specified workloads. It loads
# all data via Hive except for parquet data which needs to be loaded via Impala.
# Most ddl commands are executed by Impala.
import collections
import ... |
val.py | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Validate a trained YOLOv5 model accuracy on a custom dataset
Usage:
$ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640
"""
import argparse
import json
import os
import sys
from pathlib import Path
from threading import Thread
import numpy as... |
core.py | # Copyright 2018 John Reese
# Licensed under the MIT license
import asyncio
import sys
import time
from unittest import TestCase
from unittest.mock import patch
import aiomultiprocess as amp
from .base import (
async_test,
do_nothing,
get_dummy_constant,
initializer,
raise_fn,
sleepy,
two... |
multiprocess_test.py | #importing modules
import multiprocessing
import time
#define function to calculate the square value of a number
def calculate_square(nums):#defining the function
for n in nums: #for loop
time.sleep(5)#essentially we slow down the process so we can see the output
print('square ' + str(n*n)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.