source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_ssl.py | import sys
import pytest
import threading
import socket as stdlib_socket
import ssl
from contextlib import contextmanager
from functools import partial
from OpenSSL import SSL
import trustme
from async_generator import asynccontextmanager
import trio
from .. import _core
from .._highlevel_socket import SocketStream... |
jobs.py | # -*- coding: utf-8 -*-
#
# 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
#... |
identification.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
__author__ = 'muwfm'
import tkinter as tk
from tkinter import ttk
from tkinter.filedialog import *
import tkinter.messagebox
import pymysql
from PIL import Image, ImageTk, ImageGrab
from hyperlpr import *
import cv2
import threading
from threading import Thread
import lib.img... |
core.py | import inspect
import logging
import sys
import time
from typing import Callable
from threading import Thread
import dill
from clint.textui import puts, indent, colored
from slack import RTMClient
from machine.vendor import bottle
from machine.dispatch import EventDispatcher
from machine.plugins.base import MachineB... |
__init__.py | '''
Set up the Salt integration test suite
'''
# Import Python libs
import re
import os
import sys
import time
import shutil
import pprint
import logging
import tempfile
import subprocess
import multiprocessing
from hashlib import md5
from datetime import datetime, timedelta
try:
import pwd
except ImportError:
... |
scriptinfo.py | import os
import sys
from copy import copy
from functools import partial
from tempfile import mkstemp
import attr
import logging
import json
from pathlib2 import Path
from threading import Thread, Event
from .util import get_command_output, remove_user_pass_from_url
from ....backend_api import Session
from ....config... |
pydevd.py | '''
Entry point module (keep at root):
This module starts the debugger.
'''
import sys # @NoMove
if sys.version_info[:2] < (2, 6):
raise RuntimeError('The PyDev.Debugger requires Python 2.6 onwards to be run. If you need to use an older Python version, use an older version of the debugger.')
import atex... |
app.py |
from flask import Flask
from flask.blueprints import Blueprint
from flask_cors import CORS
from anuvaad_auditor.loghandler import log_info
import routes
import config
from utilities import MODULE_CONTEXT
import threading
from kafka_wrapper import KafkaTranslate
from db.database import connectmongo
server = Flask(__n... |
test_donemail.py | import email
import smtplib
import subprocess
import threading
from mock import ANY, Mock
import six
import pytest
from donemail import donemail, main
BOB = 'bob@example.com'
@pytest.fixture(autouse=True)
def monkeypatch_smtplib(monkeypatch):
monkeypatch.setattr('smtplib.SMTP', Mock())
@donemail(BOB)
def ad... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
server.py | import threading, time, sys, getopt, json, queue, nslookup
from config import *
from debug_utils import *
from commer import CommerOnServer
from msg import Msg
from flow_control import FlowControlServer
def get_wip_l(domain):
query = nslookup.Nslookup()
record = query.dns_lookup(domain)
log(DEBUG, "", dns_response... |
zeromq.py | """
Zeromq transport classes
"""
import errno
import hashlib
import logging
import os
import signal
import sys
import threading
from random import randint
import salt.ext.tornado
import salt.ext.tornado.concurrent
import salt.ext.tornado.gen
import salt.ext.tornado.ioloop
import salt.log.setup
import salt.payload
impo... |
process_replay.py | #!/usr/bin/env python3
import capnp
import os
import sys
import threading
import importlib
import time
if "CI" in os.environ:
def tqdm(x):
return x
else:
from tqdm import tqdm # type: ignore
from cereal import car, log
from selfdrive.car.car_helpers import get_car
import selfdrive.manager as manager
import ... |
test_async_friendly_queue.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 ... |
backtester_tickm.py | import os
import sys
import sqlite3
import pandas as pd
from matplotlib import pyplot as plt
from multiprocessing import Process, Queue
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from utility.setting import db_tick, db_backtest
from utility.static import now, timedelta_sec, strp_time, ... |
mainwindow.py | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Spyder, the Scientific Python Development Environment
=====================================================
Developped and maintained by the Spyder Pro... |
SelectAngle_UDP.py | # encoding=utf-8
import socket # 引入套接字
import threading # 引入并行
import pymysql
import struct
import serial
import matplotlib.pyplot as plt
import datetime
import math
plt.ion() # 开启一个画图的窗口
ax1 = [] # 定义一个 x 轴的空列表用来接收动态的数据
ax2 = []
ach1 = [] # 定义一个 y 轴的空列表用来接收动态的数据
ach2 = []
ach3 = []
ach4 = []
ach = []
count_tim... |
24var.py | #!/usr/bin/env python3
# -*- config: utf-8 -*-
#Вариант 24
import math
from threading import Thread
def sm_first(x, n):
return math.cos(n*x)*n/(4*(n**2)-1)
def first(x, n):
n = n
x = x
eps = 1.0E-7
previous = 0
current = sm_first(x, n)
n += 1
test = - 1/4 - ... |
room.py | # -*- coding:utf-8 -*-
import drrrobot
import os
import threading
import time
from urllib.request import URLopener
import os
name = 'pamonha'
icon = 'zaika'
file_name = 'niji.cookie'
url_room = 'https://drrr.com/lounge'
niji = drrrobot.Bot(name=name,icon=icon)
# Night Tips Thread
t_tips = threading.Thread(target=... |
plan_party.py | #uses python3
import sys
import threading
# This code is used to avoid stack overflow issues
sys.setrecursionlimit(10**6) # max depth of recursion
threading.stack_size(2**26) # new thread will get stack of such size
class Vertex:
def __init__(self, weight):
self.weight = weight
self.children = ... |
test_read_parsers.py | # This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) 2013-2015, Michigan State University.
# Copyright (C) 2015-2016, The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... |
process.py | from multiprocessing import Process, Manager
from microse.app import ModuleProxyApp
from microse.rpc.server import RpcServer
import tests.app.config as config
import asyncio
import os
import sys
import ssl
import pathlib
import nest_asyncio
if sys.platform == "linux":
nest_asyncio.apply()
app = ModuleProxyApp("... |
xla_client_test.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
opentherm.py | import re
from threading import Lock, Thread
import logging
log = logging.getLogger(__name__)
# Default namespace for the topics. Will be overwritten with the value in
# config
topic_namespace="value/otgw"
# Parse hex string to int
def hex_int(hex):
return int(hex, 16)
# Pre-compile a regex to parse valid OTGW-... |
conftest.py | import sys
from base64 import b64encode
from importlib import import_module
from multiprocessing import Process
from time import sleep
import pytest
from flask_socketio import SocketIO
from flask.testing import FlaskClient
from tests import tear_files, init, endpoint
from tests.seeders import seed_admin
injector = ... |
mayatools_batchgui.py | import os
import threading
import time
import sys
import shutil
import traceback
import subprocess
import socket
import json
from maya import cmds
def log(msg, *args):
if args:
msg = msg % args
sys.__stderr__.write('[mayatools.batchgui:client] %s\n' % msg)
sys.__stderr__.flush()
def setup():
... |
repl.py | """Interact with a Fish REPL.
"""
import os
import sys
import subprocess
from subprocess import PIPE
from threading import Thread
import tempfile
try:
from queue import Queue
except ImportError:
from Queue import Queue
def write_thread(q, f):
while True:
data = q.get()
f.write(data)
... |
impl_rabbit.py | # Copyright 2011 OpenStack Foundation
#
# 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 l... |
server.py | #!/usr/bin/env python3
#CS456 Assignment #1 - Server
#Daiyang Wang
#20646168
#Parameters: None
#Purpose: After client initiation, negotiate a transmission port <r_socket> via TCP.
# Wait for a message transmission via UDP on <r_socket>.
# Once received, reverse the message and send it back to the client.
# The... |
igra.py | import tkinter as tk
import threading
import time
# Definiramo konstante, s katerimi bomo dostopali do podatkov o prvem in drugem
# igralcu, ki bodo shranjene v arrayu, zato torej 0 in 1.
IGRALEC_1 = 0
IGRALEC_2 = 1
# Definiramo konstante, ki dolocajo globino posameznega algoritma.
MINIMAX_GLOBINA = 3
MINIMAXPP_GLOBI... |
calculator.py | from RestrictedPython import compile_restricted
from RestrictedPython import Eval
from RestrictedPython import Guards
from RestrictedPython import safe_globals
from RestrictedPython import utility_builtins
from multiprocessing import Process, Manager
import time
import os # os is unavailable in user code scope e... |
crawler.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import os
import re
import sys
import json
import requests
import argparse
import time
import codecs
import threading
from bs4 import BeautifulSoup
from six import u
__version__ = '1.0'
# if python 2, disable verify ... |
submitty_autograding_worker.py | #!/usr/bin/env python3
import os
import time
import signal
import shutil
import json
from submitty_utils import dateutils
import multiprocessing
import contextlib
import traceback
import tempfile
import zipfile
from autograder import autograding_utils
from autograder import grade_item
# =============================... |
run.py | import multiprocessing
from time import sleep
from datetime import datetime, time
from logging import INFO
from vnpy.event import EventEngine
from vnpy.trader.setting import SETTINGS
from vnpy.trader.engine import MainEngine
from vnpy.gateway.ctp import CtpGateway
# from vnpy.app.cta_strategy import CtaStrategyApp
fr... |
record.py | #!/usr/bin/env python
import pyaudio
import wave
import multiprocessing
from tkinter import *
from time import sleep
import sys
import datetime
import os
import argparse
class App():
def __init__(self, master, queue, save_file, recording_process):
# Init stuff
frame = Frame(master)
... |
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... |
common_utils.py | r"""Importing this file must **not** initialize CUDA context. test_distributed
relies on this assumption to properly run. This means that when this is imported
no CUDA calls shall be made, including torch.cuda.device_count(), etc.
torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported.... |
variable_scope.py | # Copyright 2015 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... |
test_query_node_scale.py | import random
import threading
import time
import pytest
from base.collection_wrapper import ApiCollectionWrapper
from base.utility_wrapper import ApiUtilityWrapper
from common.common_type import CaseLabel, CheckTasks
from customize.milvus_operator import MilvusOperator
from common import common_func as cf
from commo... |
transferd.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This modules is a wrapper of the transferd process.
Transferd is reponsible for the communication between the two partnering nodes in a QKD protocol.
It allows us to do messaging and file transfer.
Copyright (c) 2020 Mathias A. Seidler, S-Fifteen Instruments Pte. Ltd... |
object_storage_bulk_restore.py | # coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
controller.py | import time, uuid
import smtplib
import json
import http.client
import urllib
import subprocess
import logging
from threading import Thread, get_ident
import uptime
from flask import Flask, make_response, jsonify, request, send_from_directory, abort
app = Flask(__name__)
from email.mime.text import MIMEText
from emai... |
athenad.py | #!/usr/bin/env python3
import base64
import hashlib
import io
import json
import os
import sys
import queue
import random
import select
import socket
import threading
import time
import tempfile
from collections import namedtuple
from functools import partial
from typing import Any
import requests
from jsonrpc import ... |
util.py | #
# Copyright (C) 2012-2021 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
from collections import deque
import contextlib
import csv
from glob import iglob as std_iglob
import io
import json
import logging
import os
import py_compile
import re
import socket
try:
import ssl
... |
_channel.py | # Copyright 2016, Google 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 copyright
# notice, this list of conditions and the f... |
run.py | #!/usr/bin/env python3
import logging
import os
from os import path as osp
import sys
import time
from multiprocessing import Process, Queue
import cloudpickle
import easy_tf_log
from drlhp.deprecated.a2c import logger, learn
from drlhp.deprecated.a2c import CnnPolicy, MlpPolicy
from drlhp.deprecated.params import pa... |
test_rest_v2_0_0.py | import json
import subprocess
import sys
import time
import unittest
from multiprocessing import Process
import requests
from dateutil.parser import parse
from test.apiv2.rest_api import Podman
PODMAN_URL = "http://localhost:8080"
def _url(path):
return PODMAN_URL + "/v2.0.0/libpod" + path
def ctnr(path):
... |
dataloader.py | import os
import sys
import time
import cv2
import torch
import numpy as np
import torch.multiprocessing as mp
import torch.utils.data as data
import torchvision.transforms as transforms
from PIL import Image
from threading import Thread
from multiprocessing import Queue as pQueue
from torch.autograd import Variable
... |
main.py | #!/usr/bin/env python
import time, os, threading, socket
## For simplicity's sake, we'll create a string for our paths.
GPIO_MODE_PATH= os.path.normpath('/sys/devices/virtual/misc/gpio/mode/')
GPIO_PIN_PATH=os.path.normpath('/sys/devices/virtual/misc/gpio/pin/')
GPIO_FILENAME="gpio"
htmlfile = open("index.html")
htm... |
optitrack_state.py | #!/usr/bin/python
"""
MIT License
Copyright(c) 2019 Michail Kalaitzakis (Unmanned Systems and Robotics Lab, University of South Carolina, USA)
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 with... |
time.py | import os
import time
from contextlib import suppress
from datetime import timezone as tz
from typing import Union
from astropy import units as u
from astropy.time import Time
from loguru import logger
from panoptes.utils import error
def current_time(flatten=False, datetime=False, pretty=False):
""" Convenience... |
TestPoseReceive.py | import rulr.Nodes
import rulr.Components.RigidBody
import rulr.Components.View
import falcon
from wsgiref import simple_server
import json
import atexit
import socket
import threading
SERVER_PORT = 8000 + 0
def try_port(port):
print("Testing if port {} is available".format(port))
sock = socket.soc... |
rstat.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import os
import signal
import sys
from multiprocessing import Process
from flask_login import LoginManager
from pathlib import Path
from rstatmon.general import Settings
from rstatmon.database import User, db, DBInit
from rstatmon.statdata import routine
... |
2.logging.py | import logging
from multiprocessing import Process, log_to_stderr
def test():
print("test")
def start_log():
# 把日记输出定向到sys.stderr中
logger = log_to_stderr()
# 设置日记记录级别
# 敏感程度:DEBUG、INFO、WARN、ERROR、CRITICAL
print(logging.WARN == logging.WARNING) # 这两个是一样的
level = logging.INFO
logger.s... |
postgres_publisher.py | import json
import logging
from time import time
from threading import Thread, Lock
import psycopg2
import psycopg2.errorcodes
from psycopg2.extras import execute_values, DictCursor
from collections import OrderedDict
from cloudify._compat import queue
from cloudify.constants import EVENTS_EXCHANGE_NAME, LOGS_EXCHANG... |
conftest.py | """
pytest configuration and fixtures
"""
from multiprocessing import Process
import os
import pytest
from .http_server import main as start_test_server
REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
def pytest_configure(config): # pylint: disable=unused-argument
"""Set some envir... |
crawler.py | #!/usr/bin/env python3
import os
import re
import bs4
import lxml
import json
import asyncio
import requests
import threading
import tldextract
from datetime import date
requests.packages.urllib3.disable_warnings()
R = '\033[31m' # red
G = '\033[32m' # green
C = '\033[36m' # cyan
W = '\033[0m' # white
Y = '\033[33m'... |
syncServer.py | import logging
import sys
import pickle
import random
import math
from threading import Thread
from server import Server, gateway
from .record import Record, Profile
class SyncServer(Server):
"""Synchronous federated learning server."""
def boot(self):
logging.info('Booting {} server...'.format(self.c... |
utils.py | # Copyright (c) Facebook, Inc. and its affiliates.
# 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.
import ipaddress
import re
import socket
from datetime import timedelta
from threading import Event, Thread
from ... |
pfsense.py | from itertools import chain
import threading
from time import sleep
from os import path
from errbot import BotPlugin, botcmd, arg_botcmd, webhook, ValidationException
import tailer
from resolver import DNSCache
from log import LogParser
CONFIG_TEMPLATE = {
'LOG_FILE': '/does/not/exist', # pfSense log file to... |
cavstool.py | #!/usr/bin/env python3
# Copyright(c) 2022 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import struct
import logging
import asyncio
import time
import subprocess
import ctypes
import mmap
import argparse
import socketserver
import threading
import netifaces
# Globa... |
programs.py | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Running programs utilities."""
from __future__ import print_function
# Standard library imports
from ast import literal_eval
from getpass import getu... |
server.py | """Fix TCP server module."""
import errno
import socket
import select
import threading
from six.moves import queue as Queue
from testplan.common.utils.timing import (TimeoutException,
TimeoutExceptionInfo,
wait)
from testplan.common.u... |
debugger_unittest.py | from collections import namedtuple
from contextlib import contextmanager
import json
try:
from urllib import quote, quote_plus, unquote_plus
except ImportError:
from urllib.parse import quote, quote_plus, unquote_plus # @UnresolvedImport
import re
import socket
import subprocess
import threading
import time
i... |
gg_data_set.py | import smalltrain as st
from dateutil.parser import parse as parse_datetime
from datetime import timezone
from datetime import timedelta
from dateutil.relativedelta import relativedelta
from datetime import datetime
import time
import pandas as pd
import numpy as np
import math
import random
import csv
import os
impor... |
client.py | #!/usr/bin/env python
#
# Copyright 2014 Huawei Technologies Co. Ltd
#
# 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 ... |
SimilarityFinder.py | import math
from threading import Thread
import networkx as nx
import numpy as np
import pandas as pd
from PySide6.QtCore import Signal
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from LoadedSongs import LoadedSongs
from Song import Song
from gui.... |
alerts.py | import requests as r
import cv2
import base64
from threading import Thread
def async_post(x, y, frame):
img = encode_image(frame)
result = r.post("http://openarms-alerts.000webhostapp.com/post-alert.php", data={'coor_x': x, 'coor_y': y, 'image': img})
print(result.content)
def post_alert(x, y, frame):
... |
camera_ros.py | #!/usr/bin/env python
import socket
import numpy as np
import cv2
import os
import time
import struct
import sys
import rospy
from std_msgs.msg import String, Float32
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
from rospy.numpy_msg import numpy_msg
import threading
class Camera(o... |
VideoGet.py | from threading import Thread
import cv2
class VideoGet:
"""
Class that continuously gets frames from a VideoCapture object
with a dedicated thread.
"""
def __init__(self, src=0):
self.stream = cv2.VideoCapture(src)
(self.grabbed, self.frame) = self.stream.read()
self.stoppe... |
node.py | # Ant
#
# Copyright (c) 2012, Gustav Tiger <gustav@tiger.name>
#
# 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, copy, m... |
train_sampling_unsupervised.py | import os
import dgl
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import dgl.multiprocessing as mp
import dgl.function as fn
import dgl.nn.pytorch as dglnn
import time
import argparse
from torch.nn.parallel import DistributedDataParallel
import ... |
interface.py | from time import sleep
import pygame
import sys
import threading
class Mouse(pygame.sprite.Sprite):
def __init__(self,path):
super().__init__()
self.image = pygame.image.load(path)
self.rect = self.image.get_rect()
def update(self):
self.rect.center = pygame.mouse.get_pos()
cl... |
test_hyperopt.py | from __future__ import print_function
import eqpy_hyperopt.hyperopt_runner as hr
from hyperopt import hp, base, tpe, rand
import numpy as np
import math
import threading
import eqpy
import ast
import unittest
def math_sin_func(params):
retvals = []
#print("len params: {}".format(len(params)))
for p in... |
MTRF64USBAdapter.py | import logging
from enum import IntEnum
from serial import Serial
from struct import Struct
from time import sleep
from threading import *
from queue import Queue, Empty
class Command(IntEnum):
OFF = 0,
BRIGHT_DOWN = 1,
ON = 2,
BRIGHT_UP = 3,
SWITCH = 4,
BRIGHT_BACK = 5,
SET_BRIGHTNESS =... |
manage_test_session.py | import os
import sys
import threading
from consolemenu import ConsoleMenu, Screen
from consolemenu.items import FunctionItem
from flexlogger.automation import Application, TestSessionState
def main(project_path):
"""Interactively manage the state of the FlexLogger project test session.
Launch FlexLogger, op... |
rpc.py | #
# Copyright 2021 Logical Clocks AB
#
# 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 ag... |
tcp_server_multi_process.py | from multiprocessing import Process
from tcp_server_single_process import TcpServer
class TcpServer_muilti_process(TcpServer):
def __init__(self):
self.case_num = 0
def listen_loop(self, main_socket):
try:
while True:
print("---main process: wait for the next client... |
tkvideo.py | """Play moviepy video clips with tkinter"""
import threading
from time import perf_counter, sleep
from PIL import Image, ImageTk
import main
class TkVideo:
def __init__(self, clip, label, loop=0, size=(640, 360), hz=0):
"""The main class
Args:
clip (moviepy.editor.VideoFileClip): The ... |
blastparse_mt3.py | '''
PLNCPRO
This files reads the blastx output and extracts features
for each query. This takes as input the blast output in the following format
"qseqid sseqid pident evalue qcovs qcovhsp score bitscore qframe sframe"
this output is generated by blast command:
./blastx -query ex.fa -db unirefdb -strand plus -evalue 1e... |
task.py | import datetime
import threading
import logging
import time
from . import exceptions
ONE_MINUTE = datetime.timedelta(minutes=1)
def time_match(d, datespec):
for spec in ["year", "month", "day", "dayofweek", "hour", "minute"]:
if spec in datespec:
val = datespec[spec]
target = get... |
test_server.py | import os
from multiprocessing.managers import DictProxy
from pathlib import Path
from unittest.mock import Mock, ANY
import requests
import time
import tempfile
import uuid
from typing import List, Text, Type, Generator, NoReturn, Dict
from contextlib import ExitStack
from _pytest import pathlib
from aioresponses i... |
renderer_mp.py | import logging
from threading import Thread
import numpy as np
from omegaconf import OmegaConf
import multiprocessing
from multiprocessing import Process, Queue
from .renderer import Renderer as _Renderer
logger = logging.getLogger(__name__)
def worker(parent_to_child_q, child_to_parent_q, width, height, background,... |
serial_service.py | import time
import serial
import threading
def serial_service(serial_dict):
# Connect to uno board and sim board
sim_serial = serial.Serial("/dev/ttyAMA0", 19200, timeout=1)
uno_serial = serial.Serial("/dev/ttyUSB0", 115200, timeout=1)
# Check the connection
if uno_serial.isOpen():
serial... |
__init__.py | #!/bin/env python
#
# pgstorm
#
# Load testing for PostgreSQL
#
################################################################################
import sys
import time
import argparse
import psycopg2
import logging
from typing import Callable
from threading import Thread
log = logging.getLogger(__name__)
class Test(... |
basewebsocket.py | # basewebsocket.py
# Mohammad Usman
#
# This class is to be used as the parent for the MarketWebsocket and
# OrderWebsocket
from .cached import Cached
from .debugly import typeassert
from threading import Thread
from websocket import create_connection, WebSocketConnectionClosedException
import json
class BaseWebSocke... |
sparse_conditional_accumulator_test.py | # Copyright 2015 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... |
test_enum.py | import enum
import inspect
import pydoc
import unittest
from collections import OrderedDict
from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto
from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
from test import support
try:
import threading
except ImportError... |
mockup.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
A Mockup script for NyzoVerifier client
(c) EggdraSyl - EggPool.net
"""
import random
import sys
import re
from time import sleep
from threading import Thread
from nyzostrings.nyzostringencoder import NyzoStringEncoder
from nyzostrings.nyzostringpublicidentifier im... |
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... |
sender.py | import json
import pika
import threading
import time
class InformationSender(object):
def __init__(self, smTracker, user, passwd, ip, sendIntervalMinutes, logger):
self.smTracker = smTracker
self.user = user
self.passwd = passwd
self.ip = ip
self.thread = None
s... |
test_queue_operations.py | import pytest
import time
import queue
import multiprocessing
from pymulproc import errors
from pymulproc import mpq_protocol, factory
from unittest.mock import patch
@pytest.fixture
def test_comm():
queue_factory = factory.QueueCommunication()
return queue_factory.parent(timeout=0.1)
def test_queue_api_pa... |
at_produce.py | #@+leo-ver=5-thin
#@+node:ekr.20040915085351: * @file ../plugins/at_produce.py
#@+<< docstring >>
#@+node:ekr.20050311110307: ** << docstring >>
''' Executes commands in nodes whose body text starts with @produce.
WARNING: trying to execute a non-existent command will hang Leo.
To use, put in the body text of a node:... |
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.utils import xyxy2xywh, xywh2... |
rest.py | import common, features
import contextlib, requests, subprocess, threading, time
from urllib.parse import quote_plus
from bibliopixel.util import pid_context
FEATURES = 'browser',
START_BP = 'bp', '--loglevel=error', common.make_project('rest.yml')
STOP_BP = 'bp', 'shutdown'
ROOT = 'http://localhost:8787/'
PAUSE = 1
... |
test_driver.py | import threading
import unittest
from cbopensource.driver import threatconnect
from test.utils.threatconnect_mock_server import get_mocked_server
class TestTcDriverMockedServer(unittest.TestCase):
def setUp(self):
self.mock_tc_server = get_mocked_server("test/data")
kwargs = {"sources": "*",
... |
util_features_mp.py | import os
import sys
import multiprocessing as mp
from ctypes import c_float
import numpy as np
import util
import calc_features_mp
import util_batch
import util_meta
import util_morphology
def loadFeatureComputationData(networkDir):
data = {}
data["neurons"] = util_meta.loadNeuronProps(os.path.join(networkDi... |
inference_video.py | """
Inference video: Extract matting on video.
Example:
CUDA_VISIBLE_DEVICES=0 python3 inference_video.py \
--model-type mattingrefine \
--model-backbone resnet50 \
--model-backbone-scale 0.25 \
--model-refine-mode sampling \
--model-refine-sample-pixels 80000 \
--m... |
train_taobao_processed_allfea.py | #coding:utf-8
import numpy as np
from data_iterator import DataIterator
import tensorflow as tf
from model_taobao_allfea import *
import time
import random
import sys
import json
from utils import *
import multiprocessing
from multiprocessing import Process, Value, Array
from wrap_time import time_it
from data_loader i... |
AlienClient.py | import sys
import time
import socket
import threading
import random
import datetime
from MainWin import HeartbeatPort, NotifyPort
from Utils import readDelimitedData
from AutoDetect import GetDefaultHost
DEFAULT_HOST = GetDefaultHost()
from xml.dom.minidom import parseString
CmdPort = 53161
testTags = '''e200101886... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.