source
stringlengths
3
86
python
stringlengths
75
1.04M
manager.py
class JobManager: def __init__(self, numworkers=4): self.active_jobs = {} self.all_jobs = {} self.job_queue = Queue() self.done_queue = SimpleQueue() self.workers = [ JobWorker(self.job_queue, self.done_queue) for _ in range(numworkers) ] ...
ws_session.py
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import asyncio from threading import Thread import websockets from ....util.logger import get_logger from .session import Session from .ws_server import WSServer logger = get_logger(__name__) class WebSocketSession(Session): def __...
phage_per_taxon.py
""" Count the number of phages at the lowest taxonomic level so we can accumulate them later """ import os import sys import argparse from multiprocessing import Process, Queue import gzip import re from taxon import taxonomy_hierarchy_as_list, get_taxonomy_db, EntryNotInDatabaseError __author__ = 'Rob Edwards' def...
OSCListener.py
#!/usr/bin/python # OSCListener.py # # by Claude Heintz # copyright 2014 by Claude Heintz Design # # see license included with this distribution or # https://www.claudeheintzdesign.com/lx/opensource.html import socket import threading import time from select import select import math import struct class OSCList...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import queue as pyqueue import contextlib import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import struct import operator import weakref import test.su...
ca.py
import os import socket import threading from base64 import b64encode import functions # *******************GENERATE CA RSA KEYS******************** p = functions.pstart("Generating RSA keys", 0.2) public, private = functions.newkeys(1024) ca_keys = functions.keys(public, private) # as RSA Object directory = os.path...
test_http_client.py
#! /usr/bin/env python import errno import io import logging import os.path import select import shutil import socket import threading import time import random import unittest from tempfile import mkdtemp import pyslet.http.client as http import pyslet.http.messages as messages import pyslet.http.params as params i...
echo-server.py
import socket import os import json from threading import Lock import threading import time HOST = "127.0.0.1" PORT = 65431 FILE = "store.json" def ensure_store_exists(): if not os.path.exists(FILE): with open(FILE, 'w'): pass class KeyValueCache(object): def __init__(self, host, port): sel...
laikago_stand_batch.py
import os,inspect,argparse, datetime, copy, itertools, time currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(os.path.dirname(currentdir)) os.sys.path.insert(0, parentdir) os.sys.path.insert(0, os.path.dirname(currentdir)) from b3px_gym.b3px_env.singleto...
cluster.py
import zmq import time import threading import json import socket class Node: name = '' ipaddr = '' cmd_port = 0 event_port = 0 details = None def __init__ (self, cmd_port, event_port, name = ''): self.ipaddr = socket.gethostbyname_ex (socket.gethostname ())[2][0] self.cmd_port...
test_autocommit_update_blocks.py
############## # Setup Django import django django.setup() ############# # Test proper import threading import time import pytest from django.db import transaction from django.db.models import F, Subquery from app.models import Sock @pytest.mark.django_db def test_autocommit_update_blocks(): # We check that ...
main_file.py
import face_recognition as fr from threading import Thread import numpy as np import time import os import cv2 exclude_names = ['Unknown', 'HOD', 'Principal'] class VideoStream: def __init__(self, stream): self.video = cv2.VideoCapture(stream) # Setting the FPS for the video stream self.vi...
test_utils.py
"""This module provides utilities related to unit testing. This module contains the `build_and_run_watched_suite`, `assert_array_equals`, `behavior_test`, `generic_test`, `dalpy_equals` and the `dalpy_to_string` functions, as well as `UnexpectedReturnWarning`. """ import copy import inspect import math import tracebac...
threading_local_defaults.py
#!/usr/bin/env python3 # encoding: utf-8 # # Copyright (c) 2008 Doug Hellmann All rights reserved. # """Defaults for thread-local values """ #end_pymotw_header import random import threading import logging def show_value(data): try: val = data.value except AttributeError: logging.debug('No va...
controller.py
import traceback from datetime import datetime from threading import Thread from typing import List, Set, Type from bauh.api.abstract.controller import SearchResult, SoftwareManager, ApplicationContext from bauh.api.abstract.disk import DiskCacheLoader from bauh.api.abstract.handler import ProcessWatcher from bauh.api...
network.py
# Copyright 2019 Uber Technologies, 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/LICENSE-2.0 # # Unless required by applica...
utils.py
#================================================================ # Adapted from: https://github.com/pythonlessons/TensorFlow-2.x-YOLOv3 # Description : additional yolov3 and yolov4 functions # #================================================================ from multiprocessing import Process, Queue, Pipe import ...
main.py
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: main.py Description : 运行主函数 Author : JHao date: 2017/4/1 ------------------------------------------------- Change Activity: 2017/4/1: ----------------------------------------...
decorators.py
#!/usr/bin/env python # encoding:utf-8 from threading import Thread from functools import wraps from flask import abort from flask.ext.login import current_user __author__ = 'zhangmm' def async(fun): def wrapper(*args, **kwargs): thr = Thread(target=fun, args=args, kwargs=kwargs) thr.start() ...
test_testutils.py
# Copyright 2012 National Research Foundation (South African Radio Astronomy Observatory) # BSD license - see LICENSE for details from __future__ import absolute_import, division, print_function from future import standard_library standard_library.install_aliases() # noqa: E402 import threading import time import u...
sampler.py
# Copyright (c) 2016-2018 Uber Technologies, 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 agree...
contentSpanExtractor.py
import sys import os from corenlp_xml_reader import AnnotatedText as A #from intermediaries.nlpReaders.annotated_text import AnnotatedText as A from intermediaries.nlpReaders.parc_reader import AnnotatedText as B from parc_reader import ParcCorenlpReader as P from nltk.tree import * import csv import multiprocessing fr...
random_job6.py
# 1584927559 import task_submit_fix from task_submit_fix import VGGTask,RESTask,RETask,DENTask,XCETask import random import kubernetes import influxdb import kubernetes import signal from TimeoutException import TimeoutError,Myhandler import yaml import requests from multiprocessing import Process import multiprocessin...
optimization.py
import hashlib import json from copy import copy from datetime import datetime from itertools import product from logging import getLogger from threading import Thread, Event from time import time from typing import Union, Any, Sequence, Optional, Mapping, Callable from .job import TrainsJob from .parameters import Pa...
tests.py
# -*- coding: utf-8 -*- """ gns3-proxy GNS3 Proxy Server in Python. based on proxy.py - HTTP Proxy Server in Python - copyright: (c) 2013-2018 by Abhinav Singh :copyright: (c) 2020 by Sebastian Rieger. :license: BSD, see LICENSE for more details. """ import sys import base64 import socket import ...
metric_store_test.py
# Copyright 2015 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. import random import threading import time import unittest import mock from infra_libs.ts_mon.common import distribution from infra_libs.ts_mon.common impo...
thread_race.py
#导入Thread类 from threading import Thread #初始化全局变量 g_sum = 0 sum = 499995000000 def child_thread(): global g_sum for i in range(100000): g_sum = g_sum + i if __name__ == "__main__": threads = [Thread(target=child_thread) for i in range(100)] for t in threads: t.start() #启...
utils.py
# -*- coding: utf-8 -*- import contextlib import errno import hashlib import importlib import json import os import sys from atomicwrites import atomic_write import click import click_threading from . import cli_logger from .. import DOCS_HOME, exceptions from ..sync import IdentConflict, StorageEmpty, SyncConflic...
client.py
from bottle import route, run, request, static_file, Bottle, response import hash_ring import sys, getopt import yaml import os import requests import json from argparse import ArgumentParser from optparse import OptionParser import time import socket import random from multiprocessing import Process, Queue from dxf im...
system_test.py
''' Copyright (c) 2019, Arm Limited and Contributors SPDX-License-Identifier: Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requ...
upnp.py
import logging import threading from queue import Queue from typing import Optional try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) class UPnP: thread: Optional[threading.Thread] = None queue: Queue = Queue() def __init__(self): def run(): t...
test_logging.py
#!/usr/bin/env python # # Copyright 2001-2010 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copy...
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...
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, ...
old_webdemo.py
#!/usr/bin/env python import sys import os import threading import traceback import json import multiprocessing import subprocess import http import html import urllib import argparse from .aserver import AsyncCache, AsyncTCPServer, AsyncHTTPRequestHandler from ..fpbench import fpcparser from ..arithmetic import nat...
MicrosoftTeams.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import requests from distutils.util import strtobool from flask import Flask, request, Response from gevent.pywsgi import WSGIServer import jwt import time from threading import Thread from typing import...
BOSSMAN.py
import socket, threading server_private_key = "8d6fsdfh39ur893uruf86we7f58734y uihuhUYGIUDHS*&AD9d8 3yuh78y(*iu(d*&D" def handle_messages(connection: socket.socket): ''' Receive messages sent by the server and display them to user ''' while True: try: msg = connecti...
observer.py
import threading # import mutex import rospy from diagnostic_msgs.msg import DiagnosticArray, DiagnosticStatus class Observer(object): def __init__(self, name, loop_rate_hz=1): self._name = name self._rate = rospy.Rate(loop_rate_hz) self._seq = 1 self._lock = threading.Lock() ...
example_4_forces_control.py
#!/usr/bin/env python ########################################################################## # MIT License # # Copyright (c) 2013-2017 Sensel, Inc. # # 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...
generate_clsim_table.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=wrong-import-position, invalid-name, no-member, no-name-in-module # pylint: disable=import-error """ Create a Retro table: Propagate light outwards from a DOM and tabulate the photons. Uses CLSim (tabulator) to do the work of photon propagation. """ # TO...
Meridian_console_v22_0415.py
# #!/usr/bin/python3 # coding: UTF-8 # もしくは #!/usr/bin/env python など環境に合わせて #2022.02.05 UDP通信動作は安定。 #2022.02.05 COMMAND WINDOWのPOWERチェックボックスでサーボ電源ON #2022.02.05 上記サーボ電源ON中にスライドバー操作でサーボ動作(ただしスライドバーが小さいため大まかな動作確認のみに利用可) #2022.04.05 コードを少し整理整頓 #2022.04.14 各経路でのエラーの検知と表示の機能を搭載 #2022.04.14 ROSのパブリッシュボタンを追加。ROSのサブスクライブは未実装。...
test_sigma_dut.py
# Test cases for sigma_dut # Copyright (c) 2017, Qualcomm Atheros, Inc. # # This software may be distributed under the terms of the BSD license. # See README for more details. import logging logger = logging.getLogger() import os import socket import subprocess import threading import time import hostapd from utils i...
test_connection.py
from __future__ import with_statement from __future__ import absolute_import from test.UdsTest import UdsTest from udsoncan.connections import * from test.stub import StubbedIsoTPSocket import socket import threading import time import unittest try: _STACK_UNVAILABLE_REASON = u'' _interface_name = u'...
treebot.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time,random,sys,json,codecs,threading,glob,requests,urllib cl = LINETCR.LINE() cl.login(token="Eoxe8DekCfJya0GNjEBc.yT2ChqpRlJtFWnXILcd8Ra.L6jRYlaLE1yyWh0OFL6TmeegZujAU0VvBrZE3uSwta0=") cl.loginResult() ...
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...
1.py
import tkinter.ttk as ttk from tkinter import * from tkinter import filedialog from pystray import MenuItem as item import pystray from PIL import Image import tkinter as tk from multiprocessing import Process from CheckFilesFrame import DocFree, Create class Frame(): def __init__(self): self.imag...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
client.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 15 12:36:25 2019 @author: liuhaowen """ import socket import threading import json # json.dumps(some)打包 json.loads(some)解包 import tkinter import tkinter.messagebox from tkinter.scrolledtext import ScrolledText # 导入多行文本框用到的包 import time import r...
query_load.py
from urlparse import urlparse import httplib, sys, multiprocessing num_processes = int(sys.argv[1]) series_name = sys.argv[2] print num_processes headers = {"Content-type": "application/json", "X-Auth-Token": "HPAuth10_dfd2a6394b90b13c77cc06c68064ca5763b58ba7e05399d9ffe23d2df2524838" } ourl = 'http://localhost:8086...
followMarkerWithMotor.py
#Move marker towards marker center with stepper motors from videoUtils import CaptureVideo from motor import MotorNema from control import generateCommands, Kp #import firstOrderSystem #import zeroOrderSystem import threading import time import numpy as np import cv2 import cv2.aruco as aruco import markerUtil import t...
I2TCP_client.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: i2cy(i2cy@outlook.com) # Filename: I2TCP_client # Created on: 2021/1/10 import socket import threading import sys import time import uuid from hashlib import md5 VERSION = "1.1" class logger: # Logger def __init__(self, filename=None, line_end="lf", ...
pretty_progress.py
# coding=utf-8 from __future__ import absolute_import, division, print_function, unicode_literals try: from Queue import Empty # for python 2 except ImportError: from queue import Empty # for python 3 from multiprocessing import Process, Queue from os import environ from os.path import join from re import su...
learner.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...
Markdown-Image-Clipboard.py
# gui for starting and stopping the websocket client # by oran collins # github.com/wisehackermonkey # oranbusiness@gmail.com # 20210215 import os import json import time import requests import websocket import pyperclip from dotenv import load_dotenv load_dotenv() PUSHBULLET_API_KEY = os.getenv("PUSHBULLETAPI") ...
p1.py
from multiprocessing import Process numbers = [3, 4, 5, 6, 7, 8] def cube(x): for x in numbers: print('%s cube is %s' % (x, x**3)) if __name__ == '__main__': p1 = Process(target=cube, args=('x',)) p1.start() p1.join() print ("Exiting main")
Test.py
import tkinter as tk import threading class App(): def __init__(self, master): self.isrecording = False self.button = tk.Button(main, text='rec') self.button.bind("<Button-1>", self.startrecording) self.button.bind("<ButtonRelease-1>", self.stoprecording) self.butto...
native.py
from __future__ import ( unicode_literals, absolute_import, print_function, division, ) nstr = str str = type('') import io import os import mmap import errno import struct import warnings from time import sleep from threading import Thread, Event, Lock from collections import Counter from . impor...
test_threadlocal.py
# coding: utf-8 import threading, logging logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)-8s %(filename)s:%(lineno)-4d: %(message)s', datefmt='%Y-%m-%d %H:%M:%S') local_school = threading.local() def process_student(): # 获取当前线程关联的student std ...
heleus.py
#!/usr/bin/env python3 import argparse import asyncio import bz2 import datetime import logging import os import platform import sys import threading import time import uuid from concurrent.futures import TimeoutError, ThreadPoolExecutor from hashlib import sha256 import aredis import dill import discord from discord...
test__threading_monkey_in_thread.py
# We can monkey-patch in a thread, but things don't work as expected. from __future__ import print_function import threading from gevent import monkey import gevent.testing as greentest class Test(greentest.TestCase): @greentest.ignores_leakcheck # can't be run multiple times def test_patch_in_thread(self):...
list_generator.py
#!/bin/python3 # executing this script will generate a lot of errors, ignore them # errors in threads only close the thread that got the error from dns import resolver from threading import Thread from ipaddress import ip_address from urllib.request import urlretrieve as download res = resolver.Resolver(configure=Fal...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-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 multiwallet. Verify that a bsvcoind node can load multiple wallet files """ from decimal import D...
statreload.py
import os import signal import sys import time import multiprocessing HANDLED_SIGNALS = ( signal.SIGINT, # Unix signal 2. Sent by Ctrl+C. signal.SIGTERM, # Unix signal 15. Sent by `kill <pid>`. ) class StatReload: def __init__(self, logger): self.logger = logger self.should_exit = Fals...
example19.py
""" 扩展性系统性能 - 垂直扩展 - 增加单节点处理能力 - 水平扩展 - 将单节点变成多节点(读写分离/分布式集群) 并发编程 - 加速程序执行 / 改善用户体验 耗时间的任务都尽可能独立的执行,不要阻塞代码的其他部分 - 多线程 1. 创建Thread对象指定target和args属性并通过start方法启动线程 2. 继承Thread类并重写run方法来定义线程执行的任务 3. 创建线程池对象ThreadPoolExecutor并通过submit来提交要执行的任务 第3种方式可以通过Future对象的result方法在将来获得线程的执行结果 也可以通过done方法判定线程是否执行结束 - 多进程 - 异步I/O """ i...
worker_manager.py
""" A manager for multiple workers. -- kandasamy@cs.cmu.edu """ # pylint: disable=abstract-class-little-used # pylint: disable=invalid-name # pylint: disable=no-member from argparse import Namespace from multiprocessing import Process import numpy as np import os from sets import Set import shutil import time # Lo...
Excel2db.py
# -*- coding: utf-8 -*- # @Time : 2019/1/27 下午4:11 # @Author : shiwei-Du # @Email : dusw0214@126.com # @File : Excel2db.py # @Software: PyCharm import sys import pandas as pd from sqlalchemy import create_engine import configparser import threading import argparse import os from lib.Log import Log config = c...
mldb_wrapper.py
# mldb_wrapper.py # Copyright (c) 2015 mldb.ai inc. All rights reserved. # This file is part of MLDB. Copyright 2015 mldb.ai inc. All rights reserved. # Plugin loader for Python plugins; injectible python part # https://bugs.python.org/issue32573 ; affects unittest import sys if not hasattr(sys, 'argv'): sys.argv...
raspibrew.py
# Copyright (c) 2012 Stephen P. Smith # Copyright (c) 2012 Stephen P. Smith # # 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...
event_demo.py
import threading import time # 创建事件 event = threading.Event() def drive(name): i = 0 while True: i = i + 1 print(name + "正在行驶中,行驶了" + str(i * 60) + "Km") time.sleep(1) event.wait() print(name + '通过了红灯') # 红绿灯信号 def sign(): print("绿灯初始化") # 将 flag 设为 True,通知所...
portscanner.py
# coding=utf-8 # Author: calfcrusher@inventati.org import optparse import socket from socket import * from threading import * def connect(targethost, targetports): """Connect function""" # A simple semaphore provides us a lock to prevent other threads from printing on stdout screenLock = Semaphore(valu...
utils.py
# -*- coding: utf-8 -*- """ Various useful functions """ # Author: Remi Flamary <remi.flamary@unice.fr> # # License: MIT License import multiprocessing from functools import reduce import time import numpy as np from scipy.spatial.distance import cdist import sys import warnings from inspect import signature __time...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import print_function import copy import errno import fnmatch import hashlib import logging import multiprocessing import os import re import salt import signal import sys import threading import time import traceback impo...
data_plane.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...
__init__.py
""" The top level interface used to translate configuration data back to the correct cloud modules """ import copy import glob import logging import multiprocessing import os import signal import time import traceback from itertools import groupby import salt.client import salt.config import salt.loader import salt.sy...
run_experiment.py
import atexit import sacred import argparse import time import math import subprocess import shutil import os import json import threading import requests import glob from configs import fetch_model_params import socket import subprocess import queue import sys import signal parser = argparse.ArgumentParser() parser....
utils.py
import logging import os import subprocess import sys import time from multiprocessing import Process import git import yaml from ms.config import Config log = logging.getLogger(__name__) # Config BASE_DIR = os.path.abspath(os.path.expanduser(Config.get('BASE_DIR'))) DOCKER_COMPOSE_FILE = Config.get( 'DOCKER_CO...
main.py
import argparse import collections import dataclasses import enum import heapq import importlib import importlib.util import inspect import linecache import multiprocessing import multiprocessing.queues import os import os.path import queue import re import shutil import signal import sys import textwrap import time im...
server.py
import threading import socket import sys import ssl from sirup import var, logger, handler def deamon(proto, port): if proto == "tcp": try: print("{} {} Starting TCP SIP deamon on Port {}".format( var.info, var.ts(), var.tcp_port)) s = socket.socket(socket.AF_INET,...
build-all.py
import os import csv import shutil import subprocess import threading class RunSubprocess(object): """ a generic class to control a subprocess with threads """ def __init__(self, cmd): """ constructor """ self.cmd = cmd self.process, self.thread = None, None ...
conftest.py
# pylint: skip-file import pytest import shlex import os import py.path import sys import tempfile import textwrap import subprocess import traceback from gitrevise.odb import Repository from contextlib import contextmanager from threading import Thread, Event from http.server import HTTPServer, BaseHTTPRequestHandler...
myBlockChain.py
import hashlib import time import csv import random from http.server import BaseHTTPRequestHandler, HTTPServer from socketserver import ThreadingMixIn import json import re from urllib.parse import parse_qs from urllib.parse import urlparse import threading import cgi import uuid from tempfile import NamedTemporaryFile...
load.py
# coding=utf-8 """The actual loading of SNOMED data into the database""" from __future__ import absolute_import import multiprocessing import os import shutil import logging import contextlib import wrapt from sqlalchemy import text from sil_snomed_server.app import db from sil_snomed_server.config.config import based...
test_thruster_manager_proportional_correct.test.py
#!/usr/bin/env python3 # Copyright (c) 2020 The Plankton Authors. # All rights reserved. # # This source code is derived from UUV Simulator # (https://github.com/uuvsimulator/uuv_simulator) # Copyright (c) 2016-2019 The UUV Simulator Authors # licensed under the Apache license, Version 2.0 # cf. 3rd-party-licenses.txt ...
SocketServer1.py
#!/usr/bin/env python #-*- coding:utf-8 -*- import socket from multiprocessing import Process # 买手机 server = socket.socket(socket.AF_INET,socket.SOCK_STREAM) # 重用地址,防止 server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # 绑卡 server.bind(('127.0.0.1',8080)) # 监听客户端的上限 server.listen(4) def talk(conn,addr): ...
btdownloadgui.py
#!/usr/bin/env python # Written by Bram Cohen and Myers Carpenter # Modifications by various people # see LICENSE.txt for license information import sys import os import re import time import random import socket import hashlib import threading import traceback from binascii import hexlify from webbrowser import open...
tests.py
""" // TODO: Write tests for retry_async // TODO: Custom Viewer for Manhwa and Manhua // TODO: redux integration // TODO: Drive refresh every 35 minutes // TODO: Mongo db implementation TODO: async.run_in_exector for drive uploads. TODO: site revamp TODO: httpobject for drive auth TODO: Add support for multiple sites "...
onnxruntime_test_python.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -*- coding: UTF-8 -*- import unittest import os import numpy as np import onnxruntime as onnxrt import threading class TestInferenceSession(unittest.TestCase): def get_name(self, name): if os.path.exists(...
flask_web.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os from threading import Thread from flask import Flask from flask import flash from flask import redirect, render_template, url_for, session from flask_bootstrap import Bootstrap from flask_mail import Mail, Message from flask_migrate import Migrate, Mig...
pi_controller.py
import os import time import traceback import sys from datetime import date, datetime from tanager_tcp.tanager_server import TanagerServer from tanager_tcp.tanager_client import TanagerClient from threading import Thread from pi_feeder import goniometer INTERVAL = 0.25 CONFIG_LOC = os.path.join(os.path.expanduser("...
cursor_wrapper.py
import logging from threading import Thread from time import time from django.db.backends.utils import CursorWrapper from .log_object import SqlLogObject, settings log = logging.getLogger('dl_logger') class CursorLogWrapper(CursorWrapper): def execute(self, sql, params=None): return self.log_query(super(...
scheduler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ | This file is part of the web2py Web Framework | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) Background processes made simple --------------------------------- """ from __future__ import print_fu...
test_gc.py
import unittest import unittest.mock from test.support import (verbose, refcount_test, run_unittest, cpython_only, start_threads, temp_dir, requires_type_collecting, TESTFN, unlink, import_module) from test.support.script_helper import assert...
dropcheck_report.py
# -*- coding:utf-8 -*- import subprocess import multiprocessing as mp import time import os import json import yaml CONFIG_PATH = 'config.yaml' REPORT_PATH = 'dat/dropcheck_report.json' def open_config(): '''Get DNS address from config''' default_config = {'address': {'dns_v4_prime': '1.1.1.1', 'dns_v4_s...
__init__.py
import random import binascii import string import re import os import pyevmasm as EVMAsm from .. import Manticore from ..exceptions import EthereumError, DependencyError, NoAliveStates from ..core.smtlib import ConstraintSet, Operators, solver, BitVec, Array, ArrayProxy from ..platforms import evm from ..core.state i...
test_dataloader.py
import math import sys import errno import os import ctypes import faulthandler import torch import gc import time import signal import unittest import itertools import warnings import tempfile from torch import multiprocessing as mp from torch.utils.data import ( ChainDataset, ConcatDataset, DataLoader, ...
test_flask_redis_sentinel.py
# Copyright 2015, 2016, 2017 Exponea s r.o. <info@exponea.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
__init__.py
from threading import Event, RLock class CountdownLatch: def __init__(self, count): assert count >= 0 self._lock = RLock() self._count = count def dec(self): with self._lock: assert self._count > 0 self._count -= 1 # Return inside lock to...
vec_env.py
import redis import time import subprocess # from torch.multiprocessing import Process, Pipe import multiprocessing as mp def start_redis(): print('Starting Redis') subprocess.Popen(['redis-server', '--save', '\"\"', '--appendonly', 'no']) time.sleep(1) def start_openie(install_path): print('Startin...
algo_one.py
from functools import reduce from sys import * import numpy as np import random as r import socket import struct import subprocess as sp import threading from threading import Thread import ast import time import datetime as dt import os import psutil from netifaces import interfaces, ifaddresses, AF_INET import paho.m...
includes.py
import json import os import random import sys import time from multiprocessing import Process, Pipe import threading import redis from numpy.random import default_rng import numpy as np from skimage.io import imread from skimage.transform import resize sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../...