source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
tcp_proxy.py |
#!/usr/bin/env python3
import sys
import socket
import threading
import getopt
import subprocess
from colorama import init
from termcolor import cprint
from pyfiglet import figlet_format
def usage():
cprint(figlet_format('Proxy',font='dotmatrix'),'yellow','on_red',attrs=['bold'])
if len(sys.argv[1:]) != 5:
prin... |
test_tracer.py | import opentracing
from opentracing import (
child_of,
Format,
InvalidCarrierException,
UnsupportedFormatException,
SpanContextCorruptedException,
)
import ddtrace
from ddtrace.ext.priority import AUTO_KEEP
from ddtrace.opentracer import Tracer, set_global_tracer
from ddtrace.opentracer.span_contex... |
main.py | import time
import os
import argparse
import multiprocessing as mp
import logging
import cProfile, pstats, io
import random
from page_generator import FragmentPage, FilePersistence
from webserver import Webserver
def worker(input_queue, output_queue):
for func, args in iter(input_queue.get, 'STOP'):
resul... |
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 sys
import unittest
from test import support
import _testcapi
def testfunction(self):
"""some doc"""
return self
class InstanceMethod:
id = _testcapi... |
scheduler.py | """
Copyright 2018, Oath Inc.
Licensed under the terms of the Apache 2.0 license. See LICENSE file in project root for terms.
This module implements classes that can be used by any Plugin Scheduler to setup a Celery App and Celery Beat
"""
import signal
import sys
import threading
from .. import const
from ..validato... |
runner.py | import threading
import multiprocessing
import uuid
import logging
import requests
import flask
import time
from typing import Callable
from zig import Zig
logger = logging.getLogger(__name__)
class ServerThread:
# common interface that can be used by Thread or Process
# without coupling Thread/Proce... |
cmd_process.py | import fcntl
import inspect
import os
import re
import subprocess
from threading import Thread
from time import sleep
from waiting import wait, TimeoutExpired
class CmdProcess:
"""
Lightweight wrapper over subprocess.Popen.
Should be used where interaction with stdin and callbacks on
events are not r... |
test_WiFiServer.py | from mock_decorators import setup, teardown
from threading import Thread
import socket
import time
stop_client_thread = False
client_thread = None
@setup('Simple echo server')
def setup_echo_server(e):
global stop_client_thread
global client_thread
def echo_client_thread():
server_address = socket... |
__version__.py | # pylint: disable=C0415,C0413
__version__ = '0.0.15'
def check_version():
def _check_version():
import re
from distutils.version import LooseVersion as V
import httpx
try:
resp = httpx.get(
'https://mirrors.aliyun.com/pypi/simple/botoy/', timeout=10
... |
__init__.py | # We import importlib *ASAP* in order to test #15386
import importlib
import importlib.util
from importlib._bootstrap_external import _get_sourcefile
import builtins
import marshal
import os
import platform
import py_compile
import random
import stat
import sys
import threading
import time
import unittest
import unitte... |
DaloyGround.py | from NRFReader import NRFReader
from WebServer import WebServer
from DataIO import DataIO
from threading import Thread
import os
class Singleton:
def __init__(self):
self.reader = NRFReader()
self.server = WebServer()
self.io = DataIO()
self.packets = []
self.packetId = 0
self.clear = False
self.backupS... |
test_server.py |
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
clic.py | #!/usr/bin/env python3
import subprocess
import os
import re
import time
import rpyc
import configparser
import fileinput
from threading import Thread
from clic import initnode
from clic import nodesup
from clic import synchosts
from clic import pssh
from clic import nodes
config = configparser.ConfigParser()
config.r... |
test_random.py | from __future__ import division, absolute_import, print_function
import warnings
import numpy as np
from numpy.testing import (
assert_, assert_raises, assert_equal, assert_warns,
assert_no_warnings, assert_array_equal, assert_array_almost_equal,
suppress_warnings
)
from numpy import ra... |
printer.py | import os
import logging
from threading import Thread, Event, Lock
from time import sleep, time
import serial
# for python 2/3 compatibility
try:
reduce
except NameError:
# In python 3, reduce is no longer imported by default.
from functools import reduce
try:
isinstance("", basestring)
def is_s... |
__init__.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# 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 ... |
server.py | import sys
import os
from datetime import timedelta
import threading
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(os.path.split(rootPath)[0])
from src.web.web_util.web_util import judge_pool, get_redis_conn, begin_check_redis
from flask import Flask, render_... |
withqueue.py | import threading, time, random, queue
##########################################################################################
# Fuzzing is a technique for amplifying race condition errors to make them more visible
FUZZ = True
def fuzz():
if FUZZ:
time.sleep(random.random())
##########################... |
worker.py | import logging
import queue
import threading
from time import sleep
from searchzone.tasks.helper import read_file_and_add_to_queue
from searchzone.elastic.appsearch import AppSearchConnector
from searchzone.tasks.update import outdated
from searchzone.tasks.new import new
from searchzone.tasks.diff import diff
from se... |
subprocess_server.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... |
keep_alive.py | from flask import Flask
from threading import Thread
class localFlask(Flask):
def process_response(self, res):
#Every response will be processed here first
res.headers = {}
return res
app = localFlask('')
@app.route('/')
def home():
return ''
def run():
app.run(host='0.0.0.0', po... |
test_process_utils.py | import pytest
import uuid
from mlflow.utils.process import cache_return_value_per_process
from multiprocessing import Process, Queue
@cache_return_value_per_process
def _gen_random_str1(v):
return str(v) + uuid.uuid4().hex
@cache_return_value_per_process
def _gen_random_str2(v):
return str(v) + uuid.uuid4(... |
webshell.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import base64
import random
import requests
import threading
import time
class WebShell(object):
# Initialize Class + Setup Shell
def __init__(self, interval=1.3, proxies='http://127.0.0.1:8080'):
self.url = r"http://10.10.10.64/Monitoring/example/Welcome.action"
... |
editscenariodb.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
import time
import wx
import cw
#-------------------------------------------------------------------------------
# シナリオDB構築ダイアログ
#-------------------------------------------------------------------------------
class ConstructScenarioDB(w... |
test_nanny.py | import asyncio
import gc
import logging
import multiprocessing as mp
import os
import random
import sys
from contextlib import suppress
from time import sleep
from unittest import mock
import psutil
import pytest
pytestmark = pytest.mark.gpu
from tlz import first, valmap
from tornado.ioloop import IOLoop
import das... |
sstvLauncher.py | import sys, signal, os, urllib, subprocess, json, logging, ntpath, platform, requests, shutil, threading, multiprocessing
from PyQt4 import QtGui, QtCore
from logging.handlers import RotatingFileHandler
# Setup logging
log_formatter = logging.Formatter(
'%(asctime)s - %(levelname)-10s - %(name)-10s - %(funcName)-2... |
find_spots_server.py | import http.server as server_base
import json
import logging
import multiprocessing
import sys
import time
import urllib.parse
import libtbx.phil
from cctbx import uctbx
from dxtbx.model.experiment_list import ExperimentListFactory
from libtbx.introspection import number_of_processors
from dials.algorithms.indexing i... |
watch.py | import asyncio
import os
import signal
import sys
from multiprocessing import Process
from aiohttp import ClientSession
from watchgod import awatch
from .exceptions import SanicDevException
from .log import rs_dft_logger as logger
from .config import Config
from .serve import serve_main_app
class WatchTask:
def... |
manual_pool.py | #! /usr/local/bin/python
from sys import argv
from multiprocessing import Process, Manager
import time
import itertools
import re
def do_work(in_queue, out_list):
def any_word(patterns, data):
return [p.search(data) for p in patterns]
while True:
item = in_queue.get()
# print item
line_no, line, patterns ... |
pysel.py | import json
import time
from selenium import webdriver
import tkinter as tk
import threading
class Output():
def __init__(self):
self.outfile = open("log.log","a")
def write(self, what):
self.outfile.write(what)
class Operations():
def run(self):
for count in range(int(app.agents.g... |
plotter.py | """Renders rollouts of the policy as it trains."""
import atexit
from collections import namedtuple
from enum import Enum
import platform
from queue import Queue
from threading import Thread
import numpy as np
import tensorflow as tf
from garage.sampler.utils import rollout as default_rollout
__all__ = ... |
api_test.py | import datetime
import json
import os
import re
import shutil
import socket
import sys
import tempfile
import threading
import time
import io
import docker
import requests
from requests.packages import urllib3
import six
from .. import base
from . import fake_api
import pytest
try:
from unittest import mock
exc... |
KinectServerThreaded.py | import socket
import sys
import threading
# Create a list to hold all client objects
ProviderList = []
ReceiverList = []
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Bind the socket to the port
server_address = ('0.0.0.0', 1935)
print(sys.stderr, 'starting up on %s port %s' % se... |
pyterm.py | #!/usr/bin/env python3
"""Simple Python serial terminal
"""
# Copyright (c) 2010-2018, Emmanuel Blot <emmanuel.blot@free.fr>
# Copyright (c) 2016, Emmanuel Bouaziz <ebouaziz@free.fr>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided th... |
sspmanager.py | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import math
import socket
import datetime as dt
import threading
import time
import copy
import numpy as np
import matplotlib.patches
import wx
from wx import PyDeadObjectError
from . import wxmpl # local version of this modul... |
email.py | from threading import Thread
from django.contrib.sites.shortcuts import get_current_site
from django.core import signing
from django.core.mail import EmailMultiAlternatives, get_connection
from django.template import loader
from django.urls import reverse
from comment.conf import settings
from comment.messages import... |
request.py | import json
import socket
import threading
import warnings
import requests
import six
import tldextract
from selenium.common.exceptions import NoSuchWindowException, WebDriverException
from six.moves import BaseHTTPServer
from six.moves.urllib.parse import urlparse
FIND_WINDOW_HANDLE_WARNING = (
'Created window h... |
loader.py | # Copyright 2018 Jörg Franke
#
# 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, s... |
test_utils.py | # coding: utf-8
#
import time
import threading
import pytest
from uiautomator2 import utils
def test_list2cmdline():
testdata = [
[("echo", "hello"), "echo hello"],
[("echo", "hello&world"), "echo 'hello&world'"],
[("What's", "your", "name?"), """'What'"'"'s' your 'name?'"""]
]
for... |
core.py | import subprocess, socketserver, socket, argparse, re, os, selflib, pipes, time, configparser
from multiprocessing import Process
from selflib import *
# These values are set in load_config, from the values in selflib.py. just here for global reference. Maybe move to main?
COMMAND = "python3" # this is just because ev... |
test_cancel.py | # Copyright (c) 2019-2021 Micro Focus or one of 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 applic... |
CrossPi.py | from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
from gopigo import *
import time
import sys
import subprocess
import os
import threading
import psutil
conns = []
class Leds:
def __init__(self):
print 'Leds Ready'
def on(self):
led_on(LED_L)
led_on(LED_R)
def o... |
MainRunner.py | import _thread
import datetime
import logging
import threading
import time
import traceback
from multiprocessing import Process, Value
import utils
from BiliLive import BiliLive
from BiliLiveRecorder import BiliLiveRecorder
from BiliVideoChecker import BiliVideoChecker
from DanmuRecorder import BiliDanmuRecorder
from ... |
profiler_test.py | # Copyright 2020 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, ... |
midiator.py | from midi.midi_io import find_device
from midi.midi_enums import Notes
from windows.windows_enums import KeyFlags, DICodes, MouseFlags, MouseDirections
from windows.windows_io import send_key_event, send_mouse_movement_event, send_mouse_button_event
import threading
import time
from math import sin
class MIDIator:
... |
main.py | import itchat
from itchat.content import *
import os
import traceback
import re
from modules.__config__ import multi_process, terminal_QR
if multi_process:
from multiprocessing import Process
else:
from modules.__stoppable__ import Process
if __name__ == "__main__":
# load modules in ./modules folder
... |
run_bad.py | # -*- coding: utf-8 -*-
import time
from threading import Thread
from flask import Flask, request
from sio_server import socketio
from sio_client import get_ws_client
app = Flask(__name__)
socketio.init_app(app)
app.socketio = socketio
index_tmpl_str = '''
<!DOCUMENT html>
<html>
<head>
<meta charset="uff-8" ... |
global_handle.py | #!/usr/bin/python
'''
(C) Copyright 2018-2020 Intel Corporation.
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 applic... |
bigipconfigdriver.py | #!/usr/bin/env python
# Copyright (c) 2016-2018, F5 Networks, 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 a... |
connection.py | import io
import logging
import random
import struct
import threading
import time
import uuid
from hazelcast import six, __version__
from hazelcast.config import ReconnectMode
from hazelcast.core import AddressHelper, CLIENT_TYPE, SERIALIZATION_VERSION
from hazelcast.errors import (
AuthenticationError,
Target... |
lync.py | import sys
import traceback
import socket
import ssl
import time
import urlparse
import re
import functools
import threading
__VERSION__ = '0.1'
def url_encode(s, encoding='utf-8'):
""" Encode s with percentage-encoding. """
eb = bytearray()
for b in bytearray(s.encode(encoding)):
... |
logger_test.py | # Copyright (c) 2018 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... |
manager.py | # -*- coding: utf-8 -*-
"""
:copyright: (C) 2010-2013 by Contrail Consortium.
"""
from threading import Thread
from conpaas.core.expose import expose
from conpaas.core.manager import BaseManager
from conpaas.core.https.server import HttpJsonResponse, HttpErrorResponse
from conpaas.services.htc.agent import cli... |
upgrade_tests.py | from .newupgradebasetest import NewUpgradeBaseTest
import queue
import copy
import threading
from random import randint
from remote.remote_util import RemoteMachineShellConnection
from couchbase_helper.tuq_helper import N1QLHelper
from pytests.eventing.eventing_helper import EventingHelper
from eventing.eventing_base i... |
test_launcher.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... |
real_time_pos.py | from os import read
import queue
from codetiming import Timer
import asyncio
import matplotlib.pyplot as plt
import numpy as np
import sys
import random
from itertools import count
import time
from matplotlib.animation import FuncAnimation
from numpy.core.numeric import True_
import matplotlib
import queue
import async... |
external_miner.py | import argparse
import json
import logging
import random
import threading
import time
from typing import Dict, Optional, List, Tuple
import jsonrpcclient
from aioprocessing import AioProcess, AioQueue
from quarkchain.cluster.miner import Miner, MiningWork, MiningResult
from quarkchain.config import ConsensusType
# d... |
fixtures.py | # coding: utf-8
# Original work Copyright Fabio Zadrozny (EPL 1.0)
# See ThirdPartyNotices.txt in the project root for license information.
# All modifications Copyright (c) Robocorp Technologies Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file e... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from utils import xyxy2xywh, xywh2xyxy
help_url = 'http... |
realtime.py | from typing import Callable, Dict, Optional
import json
import time
import logging
from threading import Thread
import websocket
from websocket import WebSocketApp, WebSocketConnectionClosedException
from bitflyer.enumerations import ProductCode, Channel, PublicChannel
from bitflyer.responses import Ticker
logger ... |
app.py | #!/usr/bin/env python3
"""
Duino-Coin REST API © MIT licensed
https://duinocoin.com
https://github.com/revoxhere/duco-rest-api
Duino-Coin Team & Community 2019-2021
"""
import gevent.monkey
gevent.monkey.patch_all()
from werkzeug.utils import secure_filename
import string
import secrets
from datetime import timedelta
f... |
storage.py | #!/usr/bin/env python3
# Copyright 2020 The Kraken 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 applicabl... |
test_generator_mt19937.py | import sys
import hashlib
import pytest
import numpy as np
from numpy.linalg import LinAlgError
from numpy.testing import (
assert_, assert_raises, assert_equal, assert_allclose,
assert_warns, assert_no_warnings, assert_array_equal,
assert_array_almost_equal, suppress_warnings)
from numpy.ran... |
app.py | import os
import sys
from multiprocessing import Process
from flask import Flask
from flask_cors import CORS
from flask_restful import Api
# from flask_restplus import Api
from routes.sites import SiteApi
from utils.log import other
from constants.node import NodeStatus
from db.manager import db_manager
from routes.sc... |
suite.py | import asyncio
import os
import re
import signal
import sys
import threading
import time
from asyncio import (
AbstractEventLoop,
CancelledError,
Future,
Task,
ensure_future,
get_event_loop,
new_event_loop,
set_event_loop,
sleep,
)
from contextlib import contextmanager
from subproces... |
asynchronous.py | import threading
def asynchronously(callback):
def _wrapped(*args, **kwargs):
thread = threading.Thread(target=callback, args=args, kwargs=kwargs, daemon=True)
thread.start()
return {}
return _wrapped |
test_semaphore.py | import unittest
from typing import Callable, List
from threading import Thread
from tests.tests_utils import check_message
from homework.homework6.semaphore import Semaphore
def run_threads(number_of_threads: int, function: Callable):
threads = [Thread(target=function) for _ in range(number_of_threads)]
fo... |
ContentWorker.py | from app.api.engines.ContentEngine import ContentEngine
from multiprocessing import Process
class ContentWorker(object):
def _start_process(self, target, args):
process = Process(target=target, args=args)
process.daemon = True
process.start()
def train_item(self, item_id):
se... |
ai.py | from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import *
from random import randint, random, choice
import math
import sys
import engine
import entities
import net
import components
import controllers
import threading
import time
ACCURACY = 0.7 # Relative probability of an AI droid hitt... |
_re.py | import queue
import threading
import time
a = [1, 2, 3]
q = queue.Queue()
q.put(1)
q.put('abc')
# q.put(a)
print(q.get())
print(q.get())
# print(q.get())
def handle(q:queue.Queue):
time.sleep(5)
q.put('xyz')
t = threading.Thread(target =handle,args = (q,))
t. start() # 启动
print(q.get()) # empty
|
client.py | #!/usr/bin/env python3
#
# The MIT License (MIT)
#
# Copyright shifvb 2015-2016
#
# 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
... |
server.py | #!/usr/bin/python
from __future__ import print_function
from pyrad.dictionary import Dictionary
from pyrad.server import Server, RemoteHost
from pyrad.packet import AccessReject, AccessAccept
import logging
from okta import OktaAPI, ResponseCodes
import os
import sys
import threading
logging.basicConfig(level="INFO",
... |
test24.py | from threading import get_ident, Thread
import time
# 自定义字典实现
storage = {}
def set(k, v):
ident = get_ident()
if ident in storage:
storage[ident][k] = v
else:
storage[ident] = {k: v}
def get(k):
ident = get_ident()
return storage[ident][k]
def task(arg):
set('val', arg)
... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
conftest.py | import sys
import threading
from functools import wraps, partial
from http.server import SimpleHTTPRequestHandler
import pytest
import torch.multiprocessing as mp
def pytest_configure(config):
config.addinivalue_line("markers", "spawn: spawn test in a separate process using torch.multiprocessing.spawn")
@pytes... |
centro_controle.py | import RPi.GPIO as GPIO
import time
import threading
from controle import *
from distancia import *
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
SENSOR_DIR = 40
SENSOR_ESQ = 38
estado_ativo = GPIO.LOW
motores = 1
def setup_sensor():
global estado_ativo
GPIO.setup(SENSOR_DIR, GPIO.IN)
GPIO.setup(SENS... |
task.py | # coding: utf-8
#------------------------------
# 计划任务
#------------------------------
import sys
import os
import json
import time
import threading
# print sys.path
sys.path.append(os.getcwd() + "/class/core")
import mw
# reload(sys)
# sys.setdefaultencoding('utf-8')
import db
# cmd = 'ls /usr/local/lib/ | grep ... |
dark-iblis.py | # -*- coding: utf-8 -*-
import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize
from multiprocessing.pool import ThreadPool
try:
import mechanize
except ImportError:
os.system('pip2 install mechanize')
else:
try:
import requests
except ImportEr... |
util.py | """Test utilities.
.. warning:: This module is not part of the public API.
"""
import multiprocessing
import os
import pkg_resources
import shutil
import tempfile
import unittest
import sys
import warnings
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serializati... |
main.py | # Copyright (c) 2019, salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: MIT
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
if __name__ == "__main__":
import torch.multiprocessing as mp
mp.set_start_method('spawn')
import os
os.environ[... |
callback-server.py | #!/usr/bin/env python
'''
Pymodbus Server With Callbacks
--------------------------------------------------------------------------
This is an example of adding callbacks to a running modbus server
when a value is written to it. In order for this to work, it needs
a device-mapping file.
'''
#--------------------------... |
utils.py | #!/usr/bin/env python
import json, subprocess, time, copy, sys, os, yaml, tempfile, shutil, math, re
from datetime import datetime
from clusterloaderstorage import *
from multiprocessing import Process
from flask import Flask, request
def calc_time(timestr):
tlist = timestr.split()
if tlist[1] == "s":
... |
dokku-installer.py | #!/usr/bin/env python3
import cgi
import json
import os
import re
try:
import SimpleHTTPServer
import SocketServer
except ImportError:
import http.server as SimpleHTTPServer
import socketserver as SocketServer
import subprocess
import sys
import threading
VERSION = 'v0.19.10'
def bytes_to_string(b):
... |
multitester.py | """
Certbot Integration Test Tool
- Configures (canned) boulder server
- Launches EC2 instances with a given list of AMIs for different distros
- Copies certbot repo and puts it on the instances
- Runs certbot tests (bash scripts) on all of these
- Logs execution and success/fail for debugging
Notes:
- Some AWS ima... |
25_vendor_terms.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
from xmlrpc import client as xmlrpclib
import multiprocessing as mp
from scriptconfig import URL, DB, UID, PSW, WORKERS
def update_vendor_terms(pid, data_pool, write_ids, error_ids):
sock = xmlrpclib.ServerProxy(URL, allow_none=True)
while data_pool:
... |
__init__.py | import contextlib
import datetime
import errno
import inspect
import multiprocessing
import os
import re
import signal
import subprocess
import sys
import tempfile
import threading
from collections import namedtuple
from enum import Enum
from warnings import warn
import six
import yaml
from six.moves import configpars... |
app.py | import requests,schedule,sqlite3,json
from operator import itemgetter
from flask import Flask,render_template,session,request,redirect,url_for,flash
import os
import multiprocessing
import time
app = Flask(__name__)
cursor = sqlite3.connect('ranklist.db',check_same_thread=False)
cursor2 = sqlite3.connect('ranklist.db'... |
test_utils.py | import uuid
import tempfile
import threading
import time
import unittest
#import redis
import requests
from requests.exceptions import ConnectionError
from tornado import ioloop
#import zmq
from bokeh.tests.test_utils import skipIfPy3
from ..models import user
from .. import start, configure
from ..app import bokeh_a... |
parallel_sampler_orig.py | import time
import datetime
from multiprocessing import Process, Queue, cpu_count
import torch
import numpy as np
# from pytorch_transformers import BertModel
from transformers import BertModel
from . import utils
from . import stats
class ParallelSampler():
def __init__(self, data, args, num_episodes=None):
... |
tcpros_service.py | # Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... |
test_threadstats_thread_safety.py | import re
import time
import threading
from datadog import ThreadStats
class MemoryReporter(object):
""" A reporting class that reports to memory for testing. """
def __init__(self):
self.metrics = []
self.events = []
def flush_metrics(self, metrics):
self.metrics += metrics
... |
base_historian.py | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2015, Battelle Memorial Institute
# 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. Redistri... |
test_bz2.py | #!/usr/bin/env python
from test import test_support
from test.test_support import TESTFN, import_module
import unittest
from cStringIO import StringIO
import os
import subprocess
import sys
try:
import threading
except ImportError:
threading = None
bz2 = import_module('bz2')
from bz2 import BZ2File, BZ2Compr... |
server.py | import socket
import threading
import socketserver
import logging as log
from tcp_request_handler import TCPRequestHandler as RequestHandler
class ThreadTcpServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
pass
if __name__ == '__main__':
log.basicConfig(level=log.DEBUG)
host, port = "localhost... |
test_insert.py | from ssl import ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY
import threading
import numpy as np
import pandas as pd
import random
import pytest
from pymilvus import Index, DataType
from pymilvus.exceptions import MilvusException
from base.client_base import TestcaseBase
from utils.util_log import test_log as log
from comm... |
main.py | from __future__ import absolute_import
import argparse
import logging
import logging.config
import docker
import multiprocessing.pool
import os
import psutil
import random
import shutil
import sys
import traceback
from ann_benchmarks.datasets import get_dataset, DATASETS
from ann_benchmarks.constants import INDEX_DIR... |
payment_service.py | # Copyright © 2019 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
eve_simple_esi.py | # Thanks Qandra-Si (https://github.com/Qandra-Si) for help and basis of implementation
import urllib
import requests
import base64
import hashlib
import secrets
import sys
import time
import json
import webview
from http.server import HTTPServer, CGIHTTPRequestHandler, BaseHTTPRequestHandler
import threading
import re
... |
pipeline.py | import json
import os
import shutil
import xml.etree.ElementTree as ET
from generator import Generator
from construct_sample import ConstructSample
from updater import Updater
from multiprocessing import Process, Pool
from model_pool import ModelPool
import random
import pickle
import model_test
import pandas as pd
imp... |
weather.py | #! /usr/bin/env python
"""Creates an OData service from weather data"""
import io
import logging
import os
import os.path
import threading
import time
from wsgiref.simple_server import make_server
from pyslet import iso8601 as iso
from pyslet.http import client as http
from pyslet.odata2 import csdl as edm
from pysl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.