source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test.py | from proxypool.utils import Page as get_page
from pyquery import PyQuery as pq
import re
import time
import requests
class ProxyMetaclass(type):
"""
元类,在FreeProxyGetter类中加入
__CrawlFunc__和__CrawlFuncCount__
两个参数,分别表示爬虫函数,和爬虫函数的数量。
"""
def __new__(cls, name, bases, attrs):
c... |
dpsctl.py | #!/usr/bin/env python
"""
Copyright (c) 2017 Johan Kanflo (github.com/kanflo)
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 to use,... |
kurisu.py | import time
import threading
from win10toast import ToastNotifier
from scheduleManager.scheduleManager import ScheduleManager
from animeTracker.animeTracker import AnimeTracker
from classScheduler.classScheduler import ClassScheduler
toast = ToastNotifier()
URL = 'http://192.168.1.35:5000/'
if __name__ == '__main... |
test_sys.py | import builtins
import codecs
import gc
import locale
import operator
import os
import struct
import subprocess
import sys
import sysconfig
import test.support
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, assert_python_failure
from test.support imp... |
serial_cube.py | #!/usr/bin/env python
# Starts a server with a default cube that runs on a serial port with the given baud rate.
# Requires pySerial.
from queue import Queue
from serial import Serial
from server import CubeServer, Output
import sys
import threading
class SerialOutput(Output):
def __init__(self, tty):
self.tty... |
run.py | import time
import os
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.PATH.PROJECT
sea... |
test_memusage.py | import decimal
import gc
import itertools
import multiprocessing
import weakref
import sqlalchemy as sa
from sqlalchemy import ForeignKey
from sqlalchemy import inspect
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import select
from sqlalchemy import String
from sqlalchemy import test... |
shell.py | #Copyright 2018, The RouterSploit Framework (RSF) by Threat9 All rights reserved.
import socket
import telnetlib
import binascii
from http.server import BaseHTTPRequestHandler, HTTPServer
import threading
import time
from os import listdir
from os.path import isfile, join
import importlib
from secistsploit.core.exploi... |
tf_util.py | import numpy as np
import tensorflow as tf # pylint: ignore-module
import copy
import os
import functools
import collections
import multiprocessing
def switch(condition, then_expression, else_expression):
"""Switches between two operations depending on a scalar value (int or bool).
Note that both `then_expres... |
event_output.py | """
Functions for output pegasus-monitord events to various destinations.
"""
##
# Copyright 2007-2011 University Of Southern 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
#... |
_health_servicer_test.py | # Copyright 2016 gRPC 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 law or agreed to in writing... |
gstreamer.py | # Copyright 2019 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, ... |
chat_frame.py | # coding=utf-8
"""好友列表窗口"""
import datetime
import json
import threading
import wx
from com.qq.client.my_frame import *
class ChatFrame(MyFrame) :
def __init__(self, friendsframe, user, friend):
super().__init__(title='', size=(450, 400))
self.friendsframe = friendsframe
... |
pjit_test.py | # Copyright 2021 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, ... |
coin_flip.py | """
Python 3.4+
Demonstrate how probability works by flipping a fair coin.
Explanation: https://techtorials.me/coin-flipping-probabilities/
"""
# Native imports
import os
import random
import multiprocessing as mp
import time
import pathlib
import csv
def flip_coin():
"""
Perform a coin ... |
threaded_generator.py | #!/usr/bin/env python3
"""Threaded generator. https://github.com/Lasagne/Lasagne/issues/12#issuecomment-59494251"""
def threaded_generator(generator, num_cached=50):
"""Implements threaded generator to produce batches in background thread.
# Arguments
generator: an object exposing generator interface... |
git_common.py | # Copyright 2014 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.
# Monkeypatch IMapIterator so that Ctrl-C can kill everything properly.
# Derived from https://gist.github.com/aljungberg/626518
from __future__ import prin... |
run_unittests.py | #!/usr/bin/env python3
# Copyright 2016-2017 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by ... |
tests.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import threading
import unittest
import sys
import os
import ssl
import base64
import json
import random
import string
import time
import uuid
import logging
import socket
import flask
try:
import responses
except ImportError:
from . import response... |
train_dist_onnx_mpi.py | import time
import argparse
import sys
import os
import threading
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.onnx
from math import ceil
from random import Random
from torch.multiprocessing import Process
from torch.autogr... |
network.py | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""Network utility for the render pipeline.
This utility provides a uniform abstraction for interacting acro... |
04-Crepe-Amazon-advc.py | """
SUMMARY:
Amazon pos/neg sentiment classification
Accuracy: 0.94
Time per Epoch: 21,629 = 166 rps
Total time: 21,629 * 10 = 3604 min = 60 hours
Train size = 3.6M
Test size = 400k
This method is slower than higher-level API (166 rps vs 220 rps) ...
DETAILS:
Attempt to replicate crepe model using MXNET:
https://git... |
lock_code.py | import RPi.GPIO as GPIO
import time
import threading
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
red = 7
white = 11
green = 13
switch = 15
A0, A1, B0, B1 = [29, 31, 33, 35]
GPIO.setmode(GPIO.BOARD)
system = True # True: Locked, False: Unlocked
threads = []
myMQTTClient = AWSIoTMQTTClient("my_test_lock")
d... |
example_test.py | import http.server
import os
import re
import socket
import ssl
from threading import Thread
import ttfw_idf
from tiny_test_fw import DUT, Utility
server_cert = '-----BEGIN CERTIFICATE-----\n' \
'MIIDWDCCAkACCQCbF4+gVh/MLjANBgkqhkiG9w0BAQsFADBuMQswCQYDVQQGEwJJ\n'\
'TjELMAkGA1UECAwCTUgxDDAK... |
4.py | import multiprocessing as mp
def foo(q):
q.put('hello')
if __name__ == '__main__':
ctx = mp.get_context('spawn')
q = ctx.Queue()
p = ctx.Process(target=foo, args=(q,))
p.start()
print(q.get())
p.join()
|
main.py | import threading
import time
import sys
sys.path.append(".")
from data_source import Source
from data_class import Data
from monitoring import Monitoring
from car_platform import CarPlatform
from sign_cam import SignCam
from planner import MotionPlanner
from control import Control
def main():
# global data
... |
writer.py | # stdlib
import atexit
import logging
import threading
import random
import os
import time
from ddtrace import api
log = logging.getLogger(__name__)
MAX_TRACES = 1000
MAX_SERVICES = 1000
DEFAULT_TIMEOUT = 5
LOG_ERR_INTERVAL = 60
class AgentWriter(object):
def __init__(self, hostname='localhost', port=8126, ... |
evaluate.py | import json
import logging
import time
import threading
from datetime import datetime, timedelta
import requests
import yaml
# Constants
DATABASE_URL = 'http://0.0.0.0'
DATABASE_PORT = 5000
EXECUTOR_URL = 'http://0.0.0.0'
EXECUTOR_PORT = 5001
EVALUATION_INTERVAL = 20 # Seconds
EVALUATION_CONFIG_FILE = 'evaluation_con... |
chat_app_server.py | # Python server/client project using python version 3.3
print ("********* networking (SERVER SIDE) **********\n\n.".upper())
#import socket # Import socket module
import threading
import socketserver
import ctypes
class ClientThread(threading.Thread):
def __init__(self, target, *args):
thr... |
app.py | from flask import Flask, render_template, url_for, redirect, request, jsonify
import client
import logging
import threading
babbleZ_app = Flask(__name__)
logging.basicConfig(filename='app_log.txt', level=logging.DEBUG,
format=f'%(levelname)s %(asctime)s %(name)s %(threadName)s : %(message)s')
use... |
test_lib.py | import sys
if sys.version_info >= (2, 7):
import unittest
else:
try:
import unittest2 as unittest
except ImportError:
raise RuntimeError("unittest2 is required for Python < 2.7")
import threading
from twiggy import lib
from . import when
class ThreadNameTest(unittest.TestCase):
def ... |
task.py | """ Backend task management support """
import itertools
import json
import logging
import os
import re
import sys
from copy import copy
from datetime import datetime
from enum import Enum
from multiprocessing import RLock
from operator import itemgetter
from tempfile import gettempdir
from threading import Thread
from... |
2048.py | import math
import os
import random
import threading
import pyHook
import pygame
import pythoncom
import wx
class BoardPanel(wx.Panel):
__COLOR_COLLECTION = ["#f5ecce", "#f5da81", "#facc2e", "#fe9a2e", "#ff8000",
"#df7401", "#ff4000", "#ff0000",
"... |
audio.py | # Connection audio controller.
import os
import pyaudio
import threading
import subprocess as sp
CHUNK=1024
FORMAT=pyaudio.paInt16
CHANNELS = 1
RATE = 48000
audio_thread_running = False
audio_thread_obj = None
history = []
HISTORY_LEN = 6
def audio_thread(mumble_conn):
global audio_thread_running
audio_thr... |
test.py | import logging
import time
import os
import pytest
from helpers.cluster import ClickHouseCluster, get_instances_dir
from helpers.utility import generate_values, replace_config, SafeThread
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
CONFIG_PATH = os.path.join(SCRIPT_DIR, './{}/node/configs/config.d/stora... |
test_clients_gateways.py | import asyncio
import copy
import multiprocessing
import time
from typing import Dict
import pytest
from jina import Document, DocumentArray
from jina.helper import random_port
from jina.parsers import set_gateway_parser
from jina.serve import networking
from jina.serve.runtimes.gateway.grpc import GRPCGatewayRuntime... |
pipeline.py | #!/usr/bin/env python
import ConfigParser
import json
import numpy as np
import socket
import struct
import time
import shlex
from subprocess import PIPE, Popen, check_output
from inspect import currentframe, getframeinfo
from astropy.time import Time
import astropy.units as units
import logging
from katcp import Sens... |
PySimpleGUI.py | #!/usr/bin/python3
version = __version__ = "4.20.0 Released 6-Jun-2020"
port = 'PySimpleGUI'
# 888888ba .d88888b oo dP .88888. dP dP dP
# 88 `8b 88. "' 88 d8' `88 88 88 88
# a88aaaa8P' dP dP `Y88888b. dP 8... |
__main__.py | #####################################################################
# #
# /main.pyw #
# #
# Copyright 2014, Monash University ... |
Binance Detect Moonings.py | """
Disclaimer
All investment strategies and investments involve risk of loss.
Nothing contained in this program, scripts, code or repositoy should be
construed as investment advice.Any reference to an investment's past or
potential performance is not, and should not be construed as, a recommendation
or as a guarantee... |
io.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... |
threading_n_forking.py | #!/usr/bin/env python3
# coding:utf8
import sys
import multiprocessing
import subprocess
from concurrent.futures import ThreadPoolExecutor
def run(arg):
print("starting %s" % arg)
p = multiprocessing.Process(target=print, args=("running", arg))
p.start()
p.join()
print("finished %s" % arg)
if _... |
list_ec2_instances.py | import os
import boto3
import json
import datetime
import threading
import logging
from logging.handlers import RotatingFileHandler
import logmatic # type: ignore
#
# helper functions
#
def os_touch(file):
"""
creates a file if it doesn't already exist.
:param file: the full path to the file to be rem... |
test_weakref.py | import gc
import sys
import unittest
import collections
import weakref
import operator
import contextlib
import copy
import threading
import time
import random
from test import support
from test.support import script_helper, ALWAYS_EQ
# Used in ReferencesTestCase.test_ref_created_during_del() .
ref_from_del = None
#... |
fixtures.py | """ Fixtures for testing """
import sys
import threading
import os
import pytest
sys.path.append(".") # This puts the root of this repository on the Python path
from test_data import web_server # pylint: disable=wrong-import-position
from src.web_automation import WebAutomation # pylint: disable=wrong-import-positi... |
test_full_system.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import time
import uuid
import os
from unittest import mock
from parlai.mturk.core.socket_manager import... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement
import os
import re
import sys
import copy
import time
import types
import signal
import fnmatch
import logging
import threading
import traceback
import contextlib
impo... |
multiprocessing_terminate.py | import multiprocessing
import time
def slow_worker():
print('Starting worker')
time.sleep(0.1)
print('Finished worker')
if __name__ == '__main__':
p = multiprocessing.Process(target=slow_worker)
print('BEFORE:', p, p.is_alive())
p.start()
print('DURING:', p, p.is_alive())
p.termina... |
demo.py | #!/usr/bin/env python
from itertools import count
import math
import random
import sys
from threading import Thread
import time
import numpy as np
import sparcli
NAN = float("nan")
running = True
def demo():
jobs = start_producers()
try:
time.sleep(100)
finally:
stop_producers(jobs)
d... |
conftest.py | import logging
import os
import random
import time
import tempfile
import textwrap
import threading
from concurrent.futures.thread import ThreadPoolExecutor
from datetime import datetime
from itertools import chain
from math import floor
from random import randrange
from time import sleep
from shutil import copyfile
fr... |
test_uploader.py | import time
import threading
import unittest
import logging
import json
from selfdrive.swaglog import cloudlog
import selfdrive.loggerd.uploader as uploader
from common.xattr import getxattr
from selfdrive.loggerd.tests.loggerd_tests_common import UploaderTestCase
class TestLogHandler(logging.Handler):
def __init... |
server_v11n2.py | import socket
from threading import Thread
from lesson11n2.states.out import OutState
from lesson11n2_projects.house.data.state_gen import house_state_gen
class ServerV11n2:
def __init__(self, host="0.0.0.0", port=5002, message_size=1024):
"""初期化
Parameters
----------
host : str
... |
cli_helpers.py | """ 21 sell CLI helper methods.
Helper methods for interactive CLI commands.
"""
# python standard imports
import os
import re
import sys
import time
import json
import logging
import threading
import subprocess
from collections import namedtuple
# 3rd party imports
import yaml
import click
# two1 imports
from two1... |
test_cluster_connection_pool.py | # -*- coding: utf-8 -*-
# python std lib
import os
import re
import time
from threading import Thread
# rediscluster imports
from rediscluster.client import RedisCluster
from rediscluster.connection import (
ClusterConnectionPool, ClusterBlockingConnectionPool, ClusterReadOnlyConnectionPool,
ClusterConnection... |
slice.py | import multiprocessing as mp
import os
from typing import Optional
import h5py
from fastapi import APIRouter
from starlette.responses import JSONResponse
from hdf5_reader_service.utils import NumpySafeJSONResponse
router = APIRouter()
SWMR_DEFAULT = bool(int(os.getenv("HDF5_SWMR_DEFAULT", "1")))
# Setup blueprint... |
base.py |
"""
activenodes/activeNodesExec.py
executable python file of activeNodes.py
"""
import sys
import subprocess
import ipaddress
from threading import Thread
from queue import Queue
def next(oldip):
def gen_next_ip(ip):
octets = ip.split(".")
last_octet = octets[-1]
if last_octet == '254':
... |
test_array.py | from math import ceil, log
from random import shuffle
from threading import Thread
from unittest.case import skip
from uuid import UUID, uuid4
from eventsourcing.domain.model.array import AbstractArrayRepository, Array, BigArray
from eventsourcing.exceptions import ArrayIndexError, ConcurrencyError
from eventsourcing.... |
gt_check_for_updates.py | """
GT Check for Updates - This script compares your current GT Tools version with the latest release.
@Guilherme Trevisan - TrevisanGMW@gmail.com - 2020-11-10 - github.com/TrevisanGMW
1.1 - 2020-11-11
Fixed a few issues with the color of the UI.
Updated link to show only latest release.
The "Update" but... |
engine.py | """
"""
import logging
from logging import Logger
import smtplib
import os
from abc import ABC
from datetime import datetime
from email.message import EmailMessage
from queue import Empty, Queue
from threading import Thread
from typing import Any, Sequence, Type, Dict, List, Optional
from vnpy.event import Event, Eve... |
eeg.py | """ Abstraction for the various supported EEG devices.
1. Determine which backend to use for the board.
2.
"""
import sys
import time
import logging
from time import sleep
from multiprocessing import Process
import numpy as np
import pandas as pd
from brainflow import BoardShim, BoardIds, BrainFlowInputPar... |
impala_opt.py | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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
# to us... |
tello.py | import threading
import socket
import time
import datetime
import struct
import sys
import os
from . import crc
from . import logger
from . import event
from . import state
from . import error
from . import video_stream
from . utils import *
from . protocol import *
from . import dispatcher
from easytello.stats impor... |
app.py | from distutils.version import LooseVersion
from logging import getLogger
import select
import sys
from threading import Thread
from time import sleep
import webbrowser
import wx
from wx.adv import TaskBarIcon, TBI_DOCK
from .._utils import IS_OSX, IS_WINDOWS
from ..plot._base import CONFIG
from .about import AboutFra... |
watcher.py | import logging
import os.path
import threading
import time
try:
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
can_watch = True
except ImportError:
Observer = None
FileSystemEventHandler = object
... |
nerfblaster.py | from camera import Camera
from enum import Enum
import time
import threading
import RPi.GPIO as GPIO
horizontal_servo_pin = 12
vertical_servo_pin = 13
laInput1Pin = 22
laInput2Pin = 27
class LinearAcuatorDirection(Enum):
FORWARD = "FORWARD"
BACKWARD = "BACKWARD"
STOPPED = "STOPPED"
def convert_angle_to_duty_cy... |
local.py | import asyncio
from multiprocessing import Process
from typing import Optional
from .executor import Executor
from ..tasks.task import Task
class LocalExecutor(Executor):
def __init__(self, **kwargs) -> None:
super().__init__(**kwargs)
self.proc: Optional[Process] = None
async def execute(sel... |
detector_utils.py | # Utilities for object detector.
from utils import label_map_util
import numpy as np
import sys
import tensorflow as tf
import os
from threading import Thread
from datetime import datetime
import cv2
from collections import defaultdict
detection_graph = tf.Graph()
sys.path.append("..")
# score threshold for showi... |
omxplayer.py |
# pyomxplayer from https://github.com/jbaiter/pyomxplayer
# modified by KenT, heniotierra
# ********************************
# PYOMXPLAYER
# ********************************
import pexpect
import re
import string
import dbus
import gobject
import sys
from threading import Thread
from time import sleep
from dbus impo... |
meta.py | import json
import os
import sys
import platform
import multiprocessing
import pynvml
import threading
import signal
import time
import socket
import getpass
import logging
from shutil import copyfile
from datetime import datetime
from wandb import util
from wandb import env
import wandb
METADATA_FNAME = 'wandb-metad... |
stat_parser.py | import multiprocessing
import numpy
import os
import platform
import queue
import time
import sys
# This script depends on a SJSON parsing package:
# https://pypi.python.org/pypi/SJSON/1.1.0
# https://shelter13.net/projects/SJSON/
# https://bitbucket.org/Anteru/sjson/src
import sjson
def parse_argv():
options = {}
... |
unlogger.py | #!/usr/bin/env python3
import argparse
import os
import sys
import zmq
import time
import gc
import signal
from threading import Thread
import numpy as np
from uuid import uuid4
from collections import namedtuple
from collections import deque
from multiprocessing import Process, TimeoutError
from datetime import dateti... |
server.py | # First of all see if we can load PyWin32
try:
import _win32sysloader
except:
raise Exception("Cannot import PyWin32. Are you sure it's installed?")
import logging
import sys
import os
import collections
import importlib
# Hack to find pythoncom.dll - needed for some distribution/setups
# E.g., if python is st... |
store_utils.py | # Copyright 2011 OpenStack Foundation
# Copyright 2012 Red Hat, 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/... |
test_failure.py | import logging
import os
import sys
import tempfile
import threading
import time
import numpy as np
import pytest
import redis
import ray
import ray.utils
import ray.ray_constants as ray_constants
from ray.exceptions import RayTaskError
from ray.cluster_utils import Cluster
from ray.test_utils import (
wait_for_c... |
cbmonitor.py | import time
from collections import OrderedDict
from copy import copy
from multiprocessing import Process
from typing import Callable, Union
import requests
from decorator import decorator
from cbagent.collectors import (
IO,
PS,
ActiveTasks,
Disk,
DurabilityLatency,
ElasticStats,
Eventing... |
service.py |
import os
import sys
import discord
import datetime
import schedule
import time
import asyncio
import threading
# Plugin loading libs
import importlib
from .util import ListGuilds
from .msgprocessor import ProcessMessage
class DiscordAlertBot:
def __init__(self, client, config, plugins, args):
self.clie... |
test_throttle.py | #!@PYTHON_EXECUTABLE@
# MIT License
#
# Copyright (c) 2018, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy). All rights reserved.
#
# Permission is hereby granted, free of charge, to any person o... |
run_thor.py | # -*- coding:utf-8 -*-
from PyQt5.QtWidgets import QDialog, QApplication, QPushButton, QTextEdit, QComboBox, QLineEdit, QHBoxLayout, \
QVBoxLayout, QLabel, QWidget, QScrollArea, QCheckBox, QTextBrowser, QFileDialog
from PyQt5.QtGui import QImage, QPixmap
from PyQt5 import uic
from PyQt5 import QtCore
from PyQt5.Qt... |
test_context.py | # Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import copy
import gc
import sys
import time
from threading import Thread, Event
import zmq
from zmq.tests import (
BaseZMQTestCase, have_gevent, GreenTest, skip_green, PYPY, SkipTest,
)
class TestContext(BaseZMQTestCase... |
client.py | import logging
import time
from threading import Thread
import websocket
from .frame import Frame
VERSIONS = '1.0,1.1'
class Client:
def __init__(self, url):
self.url = url
self.ws = websocket.WebSocketApp(self.url)
self.ws.on_open = self._on_open
self.ws.on_message = self._on... |
hospital_publisher.py | from coap.Hospital.hospital_model import Hospital
from coapthon.resources.resource import Resource
import random
import threading
import time
class HospitalPublisher(Resource):
def __init__(self, name="HospitalPublisher", coap_server=None):
super(HospitalPublisher, self).__init__(name, coap_server, visib... |
dokku-installer.py | #!/usr/bin/env python3
import cgi
import json
import os
import re
import shutil
try:
import SimpleHTTPServer
import SocketServer
except ImportError:
import http.server as SimpleHTTPServer
import socketserver as SocketServer
import subprocess
import sys
import threading
VERSION = 'v0.22.8'
def bytes_t... |
keep.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():
app.run(host='0.0.0.0',port=8080)
def keep():
t = Thread(target=run)
t.start() |
mp.py | import multiprocessing as mp
import logging
import socket
import time
logger = mp.log_to_stderr(logging.DEBUG)
def worker(socket):
while True:
client, address = socket.accept()
logger.debug("{u} connected".format(u=address))
client.send("OK")
client.close()
if __name__... |
PluginManager.py | import os
import importlib
import threading
import inspect
from Networking.PacketHelper import isValidPacket
def findClass(func):
return getattr(inspect.getmodule(func), func.__qualname__.split(".<locals>", 1)[0].rsplit(".", 1)[0])
class PacketHooks:
def __init__(self):
self._funcs = {}
self._... |
test_multiprocess_file_cache.py | import multiprocessing
import os
import pickle
import tempfile
import numpy as np
import pytest
from pfio.cache import FileCache, MultiprocessFileCache
def test_pickable():
with tempfile.TemporaryDirectory() as d:
cache = MultiprocessFileCache(10, dir=d, do_pickle=True)
try:
pickle.d... |
py_kernwin.py | # -----------------------------------------------------------------------
# Standalone and testing code
import sys
try:
import pywraps
pywraps_there = True
print "Using pywraps"
except:
pywraps_there = False
print "Not using pywraps"
try:
import _idaapi
except:
print "Please t... |
measure_methods.py | # pylint: disable=consider-using-enumerate,invalid-name,too-many-function-args
"""
Functions that run on executor for measurement.
These functions are responsible for building tvm module, uploading it to
remote devices, recording the running time costs and checking the correctness of output
"""
import logging
import o... |
ED_AP.py | from pickletools import read_unicodestring1
import traceback
from math import atan, degrees
import json
import random
import cv2
from PIL import Image
from pathlib import Path
from EDlogger import logger, logging
import Image_Templates
import Screen
import Screen_Regions
from EDWayPoint import *
from EDJournal import... |
automatix.py | # -*- coding: utf-8 -*-
# Copyright 2013-2020 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
encode.py | #!/usr/bin/env python2.7
import argparse
import json
import traceback
import fcntl
from multiprocessing import Process
from os import listdir
from os import mkfifo
from os.path import isfile, join
from os.path import basename
from os.path import splitext
from os import environ
from os import getcwd
from os import remo... |
classifier.py | #!/usr/bin/env python3
import os
import socket
from argparse import Namespace
from time import sleep
from queue import Empty
import multiprocessing as mp
import threading
import yaml
import numpy as np
import h5py
from darc.definitions import CONFIG_FILE
from darc.logger import get_queue_logger
# silence the tensorfl... |
netview.py | #!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Author:
# beto (@agsolino)
#
# Description:
# The ... |
StreamFiledescriptors_test.py | import os
import sys
import subprocess
import threading
import errno
import unittest
from pysam import AlignmentFile
from TestUtils import make_data_files, BAM_DATADIR
IS_PYTHON2 = sys.version_info[0] == 2
def setUpModule():
make_data_files(BAM_DATADIR)
def alignmentfile_writer_thread(infile, outfile):
def... |
captureData.py | import cv2
import math
import pandas as pd
import numpy as np
import time, sys, os, shutil
import yaml
from multiprocessing import Process, Queue
from Queue import Empty
"""
# This script collects data
if len(sys.argv) < 2:
print "No configuration file specified"
collectData = False
config = None
else:
... |
test_socketserver.py | """
Test suite for socketserver.
"""
import contextlib
import io
import os
import select
import signal
import socket
import tempfile
import threading
import unittest
import socketserver
import test.support
from test.support import reap_children, reap_threads, verbose
test.support.requires("networ... |
feeder.py | import os
import threading
import time
import joblib
import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split
from infolog import log
from tacotron.utils.text import text_to_sequence
_batches_per_group = 64
class Feeder:
"""
Feeds batches of data into queue on a ba... |
batcher.py | #Most of this file is copied form https://github.com/abisee/pointer-generator/blob/master/batcher.py
import queue
import time
from random import shuffle
from threading import Thread
import numpy as np
import tensorflow as tf
import torch
import data_util.config as config
import data_util.data as data
import random
... |
dataset.py | """
author: ikhtiyor
date: 27.11.2019
this script is only designed to work with multiple gpus, i think it will work with one gpu as well ))
original :https://github.com/mcdavid109/Multi-GPU-Training/blob/master/TrainingDemo.ipynb
"""
import tensorflow as tf
from threading import Thread
import cv2
impo... |
smoketests.py | #!/usr/bin/env python
# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.