source
stringlengths
3
86
python
stringlengths
75
1.04M
participant_state_machine.py
"""Module implementing the networked Participant using gRPC.""" import threading import time from enum import Enum, auto from typing import Dict, List, Tuple from grpc import Channel, insecure_channel from numproto import ndarray_to_proto, proto_to_ndarray from numpy import ndarray from xain_sdk.cproto.coordinator_p...
optonome.py
# globals task = None exit_flag = False wrt_file = None counts_prev = None counts_now = None interval = 1 n_measurements = 0 def clear_screen(): import os os.system('cls') return def set_interval(): import sys global interval if sys.argv.__len__() < 2: return interval = flo...
UR10eController_Always_Connected.py
# Copyright (c) 2019 by liuxiaobo. All Rights Reserved. # !/usr/bin/python # coding=utf-8 import numpy as np import socket import struct import time import math import sys import os from queue import Queue import threading # _root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # sys.path.append(_r...
test_threading.py
import threading import unittest from time import sleep from pybreaker import CircuitBreaker, CircuitBreakerListener from types import MethodType class CircuitBreakerThreadsTestCase(unittest.TestCase): """ Tests to reproduce common synchronization errors on CircuitBreaker class. """ def setUp(self): ...
runas.py
#!/usr/bin/env python3 import os, sys import urllib.request import threading # URL_UCD é a URL canônica do arquivo UnicodeData.txt mais atual URL_UCD = 'http://www.unicode.org/Public/UNIDATA/UnicodeData.txt' def analisar_linha(linha): campos = linha.split(';') código = int(campos[0], 16) nome = campos[1...
main.py
# Copyright 2019 Graphcore Ltd. import argparse from collections import deque, namedtuple import json import math import multiprocessing import numpy as np import os import tensorflow as tf import time from tensorflow.python.ipu import loops, ipu_infeed_queue, ipu_compiler, ipu_optimizer, \ ...
vlctest2.py
import glob import time import socket from threading import Thread class Player(): def __init__(self): self.is_initiated = False self.SEEK_TIME = 20 self.MAX_VOL = 512 self.MIN_VOL = 0 self.DEFAULT_VOL = 256 self.VOL_STEP = 13 self.current_vol = self.DEFAULT_...
micro_controller.py
import RPi.GPIO as GPIO import time import sys import signal from math import pi, fabs, cos, sin from alphabot import AlphaBot import multiprocessing R = 0.034 # wheel radius (m) 6,6 cm r = 0.0165 #wood wheel radious L = 0.132 # distance between wheels Ab = AlphaBot() Ab.stop() vmax = 80 vmin= 45 #for wr the e...
Log.py
import base64 import binascii import datetime import logging import threading from dredge_logger import backup from dredge_logger import dataHandler from dredge_logger import dweetUpdater from dredge_logger import fileHandler from dredge_logger.config import config _logger = logging.getLogger(__name__) def saveFile...
BlueskyScan.py
# BlueskyScan.py from bluesky import RunEngine from ophyd.status import Status import sys import logging import threading import zmq import asyncio import time import numpy as np from psdaq.control.ControlDef import ControlDef from psdaq.control.ControlDef import scan_pull_port class BlueskyScan: def __init__(se...
test_drop_collection.py
import pdb import pytest import logging import itertools from time import sleep import threading from multiprocessing import Process from utils import * from constants import * uniq_id = "drop_collection" class TestDropCollection: """ ****************************************************************** Th...
k8s_startup_script.py
#!/usr/bin/env python """ This script will be executed at the VM startup time. - It will download the proxy and panda queue from Google instance metadata - It will download the pilot wrapper from github and execute it - It will upload the pilot logs to panda cache """ import requests try: import subprocess32 as s...
SentenceTransformer.py
import json import logging import os import shutil import stat from collections import OrderedDict from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional import requests import numpy as np from numpy import ndarray import transformers from huggingface_hub import HfApi, HfFolder, Repository, hf_...
align.py
#!/usr/bin/python import os import threading import fasta import subprocess VERBOSE = False # True NUM_THREADS = 1 # BLASTN_E_VALUE = "1e-8" def getCommandOutput(command, exedir = None): if exedir != None: os.chdir( exedir ) #child = os.popen(command) #data = child.read() task = subprocess....
ServerMain.py
import sys import cv2 as cv from cv2 import isContourConvex import numpy as np import time import threading from PyQt5.QtCore import Qt, QThread, pyqtSignal,QDateTime,QMutex,QStringListModel from PyQt5.QtGui import QIcon,QImage,QPixmap from PyQt5.QtWidgets import QDialog, QApplication, Q...
serve.py
#!/usr/bin/env python import SocketServer import SimpleHTTPServer import json import glob import os import sys import threading import time import subprocess import re PORT = 8000 watchDirs = ['index.html', 'js/*', 'css/*'] compileDirs = ['src/*.ts', 'lib/ts-types/*.ts'] compileCmd = r'tsc --outDir js/ --sourcemap --...
syncer.py
IP = '127.0.0.1' PORT = 51001 URL = 'http://192.168.1.2/generic-iot/api.php' import json import socket import requests import multiprocessing as mp # import schedule import time def get_gw_id(): return "gw19" def init_client(fd): setName = {'cmd': 'setName', 'args': {'name': get_gw_id()}} subscription =...
test_dist_graph_store.py
import os os.environ['OMP_NUM_THREADS'] = '1' import dgl import sys import numpy as np import time import socket from scipy import sparse as spsp from numpy.testing import assert_array_equal from multiprocessing import Process, Manager, Condition, Value import multiprocessing as mp from dgl.heterograph_index import cre...
compare_Walltoall_adam.py
import qiskit import numpy as np import sys sys.path.insert(1, '../') import qtm.base, qtm.constant, qtm.ansatz, qtm.fubini_study, qtm.encoding import importlib import multiprocessing importlib.reload(qtm.base) importlib.reload(qtm.constant) importlib.reload(qtm.ansatz) importlib.reload(qtm.fubini_study) def run_wall...
main.py
import copy import json import logging import os import re import signal import sys import threading import traceback from distutils.version import StrictVersion import numpy as np import pyqtgraph as pg import serial.tools.list_ports from PyQt5 import QtCore, QtWidgets from PyQt5.QtCore import pyqtSignal from PyQt5....
merge_pdf.py
from urllib2 import Request,urlopen from pyPdf import PdfFileWriter,PdfFileReader from StringIO import StringIO import time,datetime import threading class PdfDownloader: def __init__(self): self.pdfList = [] def dPdf(self,url,i): remoteFile = urlopen(Request(url)).read() memoryFile = StringIO(remoteFile) ...
gps.py
#!/usr/bin/env python3 import sys sys.path.append('lib') import os import logging import threading import time import serial # GPS import serial import pynmea2 class GPS(): port = None callbackAfterData = None baudrate = 9600 position = None speedkmh = None def __init__(self, ...
grpc_server.py
from concurrent import futures import grpc import logging import threading import queue import upf from UPF_pb2 import PlanMessage, PlanOrHRequest, State import UPF_pb2_grpc class UPFServicer(UPF_pb2_grpc.UPFServicer): def __init__(self): UPF_pb2_grpc.UPFServicer.__init__(self) self.lock = threa...
die-hard-server.py
#!/usr/local/bin/python import SocketServer import BaseHTTPServer import threading import time import signal import ssl import sys # A Python server for simulating different health scenarios. # Useful for testing health checking. # Optional parameters store. optional = dict() # A response helper. def construct_h...
resource_sharer.py
# # We use a background thread for sharing fds on Unix, and for sharing sockets on # Windows. # # A client which wants to pickle a resource registers it with the resource # sharer and gets an identifier in return. The unpickling process will connect # to the resource sharer, sends the identifier and its pid, and...
test019.py
import webview import threading import time """ This example demonstrates how to toggle fullscreen mode programmatically. """ def toggle_fullscreen(): # wait a few seconds before toggle fullscreen: time.sleep(5) webview.toggle_fullscreen() if __name__ == '__main__': t = threading.Thread(target=tog...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
event_tests.py
import os import time import unittest import threading import classad import htcondor SAMPLE_EVENT_TEXT = """\ 006 (23515.000.000) 04/09 17:55:39 Image size of job updated: 260 1 - MemoryUsage of job (MB) 252 - ResidentSetSize of job (KB) ... """ class TestEventReader(unittest.TestCase): de...
utility.py
import os import math import time import datetime from multiprocessing import Process from multiprocessing import Queue # import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import imageio import torch import torch.optim as optim import torch.optim.lr_scheduler as lrs from pa...
test_callbacks.py
import os import multiprocessing import numpy as np import pytest from csv import Sniffer import shutil from keras import optimizers from keras import initializers from keras import callbacks from keras.models import Sequential, Model from keras.layers import Input, Dense, Dropout, add from keras.layers.convolutional ...
advanced-reboot.py
# # ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";...
lreval_mpi.py
#!/usr/bin/env python """ DMLC submission script, MPI version """ import argparse import sys import os import subprocess import tracker from threading import Thread parser = argparse.ArgumentParser(description='DMLC script to submit dmlc job using MPI') parser.add_argument('-n', '--nworker', required=True, type=int, ...
foo.py
# Python 3.3.3 and 2.7.6 # python fo.py from threading import Thread import threading # Potentially useful thing: # In Python you "import" a global variable, instead of "export"ing it when you declare it # (This is probably an effort to make you feel bad about typing the word "global") lock = threading.Lock() i =...
test_itertools.py
import unittest from test import support from itertools import * import weakref from decimal import Decimal from fractions import Fraction import operator import random import copy import pickle from functools import reduce import sys import struct import threading import gc maxsize = support.MAX_Py_ssize_t minsize = ...
phenotype_etl.py
"""Phenotype ETL.""" import logging import uuid import multiprocessing from etl import ETL from etl.helpers import ExperimentalConditionHelper from files import JSONFile from transactors import CSVTransactor from transactors import Neo4jTransactor class PhenoTypeETL(ETL): """Phenotype ETL.""" logger = logg...
log_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import sys import json import logging import logging.handlers import time import threading import re from datetime import datetime from enum import Enum, unique from logging import StreamHandler from queue import Queue from .rest_uti...
main.py
import DenavitHartenberg as dh import Dynamics as dy import Kinematics as k import Movements as mv import multiprocessing as mp import numpy as np from Plot import * import random import Robot from sympy import * if __name__ == '__main__': """ 1. Creates robot's generalized coordinates (as two dimensional array)...
handler.py
import io import json import logging import socket import struct import threading import traceback import weakref import paramiko import tornado.web from tornado.ioloop import IOLoop from tornado.options import options from webssh.utils import ( is_valid_ip_address, is_valid_port, is_valid_hostname, to_bytes, to_s...
http.py
#!/usr/bin/env python3 # MIT License # # Copyright (C) 2020, Entynetproject. 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 lim...
test_operator.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
download.py
""" Download images from planet.com API """ import configparser import json import queue import time import multiprocessing as mp import os import requests from requests.auth import HTTPBasicAuth import progressbar # pylint: disable=E0401 CONFIG = configparser.ConfigParser() CONFIG.read('config.ini') ITEM_TYPE = "P...
test_run.py
import contextvars import functools import platform import sys import threading import time import types import warnings from contextlib import contextmanager, ExitStack from math import inf from textwrap import dedent import attr import outcome import sniffio import pytest from async_generator import async_generator ...
__init__.py
"""Helper methods for various modules.""" import collections from itertools import chain import threading import queue from datetime import datetime import re import enum import socket import random import string from functools import wraps from types import MappingProxyType from .dt import datetime_to_local_str, utcn...
delete.py
from telegram.ext import CommandHandler, run_async import threading from telegram import Update from bot import dispatcher, LOGGER from bot.helper.telegram_helper.message_utils import auto_delete_message, sendMessage from bot.helper.telegram_helper.filters import CustomFilters from bot.helper.telegram_helper.bot_comman...
driver.py
#!/usr/bin/env python """Hit the fibo test site with many simultaneous requests.""" import threading import time import urllib import sys url = 'https://fibo.ndbdemo.prom.corp.google.com/fibo' def main(): num = 10 try: num = int(sys.argv[1]) except Exception: pass threads = [] for i in range(num)...
dataloader.py
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
agent_websocket.py
import logging import os import json import socket import queue import threading import traceback import time import requests import websocket from platform_agent.executors.batch_send import BatchSender from platform_agent.lib.ctime import now from platform_agent.agent_api import AgentApi from platform_agent.config.l...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum.util import bfh, bh2u, UserCancelled, UserFacingException from electrum.bip32 import BIP32Node from electrum import constants from electrum.i18n import...
videorecorder.py
from dataclasses import dataclass from io import BytesIO from typing import Optional import time, logging, os, traceback import gi gi.require_version('Gst', '1.0') gi.require_version('GstBase', '1.0') from gi.repository import Gst from greplin import scales from rdflib import URIRef from rx.subject import BehaviorSub...
app.py
######### Chi.Bio Operating System V1.0 ######### #Import required python packages from cProfile import run import os import random import time import math from flask import Flask, render_template, jsonify from threading import Thread, Lock import threading import numpy as np from datetime import datetime, date import...
coordinator.py
import sys import queue import threading import json import collections import os from spirecomm.spire.game import Game from spirecomm.spire.screen import ScreenType from spirecomm.communication.action import Action, StartGameAction def read_stdin(input_queue): """Read lines from stdin and write them to a queue ...
cameraWeb.py
#!/usr/bin/env python # Python libs import sys, time # numpy and scipy import numpy as np from scipy.ndimage import filters # OpenCV import cv2 # Ros libraries import roslib import rospy # Ros Messages from sensor_msgs.msg import CompressedImage import string,cgi,time from os import curdir, sep from BaseHTTPServer impo...
debug.py
# -*- coding: utf-8 -*- """ debug.py - Functions to aid in debugging Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more infomation. """ from __future__ import print_function import sys, traceback, time, gc, re, types, weakref, inspect, os, cProfile, threading from . import pt...
tpu_estimator.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...
test_operator.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
freedomwall.py
r""" ______ _ | ____| | | | |__ _ __ ___ ___ __| | ___ _ __ ___ | __| '__/ _ \/ _ \/ _` |/ _ \| '_ ` _ \ | | | | | __/ __/ (_| | (_) | | | | | | |_| |_| \___|\___|\__,_|\___/|_| |_| |_| \ \ / / | | | ...
webhook.py
# Copyright (c) 2020. Lena "Teekeks" During <info@teawork.de> from typing import Union, Tuple, Callable from .helper import build_url, TWITCH_API_BASE_URL, get_uuid, get_json import requests from aiohttp import web import threading import asyncio from uuid import UUID from datetime import datetime import logging from ...
fts_throttler.py
# -*- coding: utf-8 -*- # Copyright 2019-2021 CERN # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
test_num_threads.py
# -*- coding: utf-8 -*- from __future__ import print_function, absolute_import, division import sys import os import re import multiprocessing import unittest import numpy as np from numba import (njit, set_num_threads, get_num_threads, prange, config, threading_layer, guvectorize) from numba.np.u...
JB_Contig_TestServer.py
#!/usr/bin/env python from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, InvalidRequestError from jso...
osc.py
# This is a modified version of OSC Mode that supports sending lamp updates to the graphical # OSC client. This has been modified from an earlier version written by Brian Madden. # Unfortunately, this version has not been generated from Brian's latest version, and as # such some functionality from his latest is like...
SD_AWG_Async.py
# -*- coding: utf-8 -*- import threading import queue import sys from typing import Dict, List, Union, Optional, TypeVar, Callable, Any, cast import time import logging from functools import wraps import numpy as np from .SD_Module import keysightSD1, result_parser from .SD_AWG import SD_AWG from .memory_manager impo...
tests.py
############################################################################## # # Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
common.py
"""Test the helper method for writing tests.""" import asyncio import functools as ft import os import sys from unittest.mock import patch, MagicMock, Mock from io import StringIO import logging import threading from contextlib import contextmanager from homeassistant import core as ha, loader, config_entries from hom...
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...
lldbbridge.py
############################################################################ # # Copyright (C) 2016 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. # # Commercial License Usage # Licensees holding valid commercial Qt licenses may use this file in # accordance with the co...
Multithreading.py
# Python program to illustrate the concept # of threading # importing the threading module import threading def print_cube(num): """ function to print cube of given num """ print(" Cube: {}".format(num * num * num)) def print_square(num): """ function to print square of given num """ ...
run_engine.py
import asyncio from datetime import datetime import sys from warnings import warn from inspect import Parameter, Signature from itertools import count from collections import deque, defaultdict, ChainMap from enum import Enum import functools import inspect from contextlib import ExitStack import threading import weakr...
servers.py
# Copyright 2014 The Oppia 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 applicable ...
manager.py
#!/usr/bin/env python """Manage data servers.""" import atexit import os import readline import time import urlparse import urllib3 from urllib3 import connectionpool # pylint: disable=unused-import,g-bad-import-order from grr.client import client_plugins # pylint: enable=unused-import,g-bad-import-order from grr....
geolocation.py
# -*- coding: utf-8 -*- """ geosources.geolocation ~~~~~~~~~~~~~~~~~~~ A module to connect and collect information from geolocation sources. This module contains the main functions to check and acquire information from all the geolocation sources and check for cache. It primarily contains the code...
app.py
# -*- coding: utf-8 -*- """Module to manage AiiDAlab apps.""" import errno import io import logging import os import shutil import sys import tarfile import tempfile from contextlib import contextmanager from dataclasses import asdict, dataclass, field from enum import Enum, Flag, auto from itertools import repeat fro...
interpreter.py
# Copyright 2019 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to ...
producer.py
import collections import logging from multiprocessing import Process, Queue, Manager try: # Python 3 import queue except ImportError: import Queue as queue import sys import time import boto3 import six log = logging.getLogger(__name__) def sizeof(obj, seen=None): """Recursively and fully calculate...
__init__.py
# -*- coding: UTF-8 -*- #virtualBuffers/__init__.py #A part of NonVisual Desktop Access (NVDA) #This file is covered by the GNU General Public License. #See the file COPYING for more details. #Copyright (C) 2007-2015 NV Access Limited, Peter Vágner import time import threading import ctypes import collection...
measurePerformance.py
# ######################################################################## # Copyright 2013 Advanced Micro Devices, 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.apach...
server.py
import logging import threading from socket import socket, AF_INET, SOCK_STREAM, timeout class Server: def __init__(self, host: str, port: int, backlog: int) -> None: self.HOST = host self.PORT = port self.BACKLOG = backlog self.TIMEOUT = 0.2 self.client_response = None ...
ep_obj_visualize_2d.py
''' Visualize the computed Pareto policies in the performance space. By double-click the point in the plot, it will automatically open a new window and render the simulation for the selected policy. ''' import argparse import matplotlib.pyplot as plt from matplotlib.backend_bases import MouseButton import numpy as np ...
sensor.py
#!/usr/bin/env python """ Copyright (c) 2014-2018 Miroslav Stampar (@stamparm) See the file 'LICENSE' for copying permission """ from __future__ import print_function # Requires: Python >= 2.6 import sys sys.dont_write_bytecode = True import core.versioncheck import inspect import math import mmap import optpars...
backend.py
# # Copyright (c) 2021, NVIDIA 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 applicable law or agreed ...
tfrecord_to_mr.py
# Copyright 2020 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 applicable law or agreed to...
pharm_attack.py
#!/usr/bin/env python3 # coding: utf-8 """ Author: Kuan Ju, Chen ID: 0711529 Date: 2021/04/22 """ from scapy.all import * import time import netfilterqueue import threading import os # global variables attacker_ip = "" gateway_ip = '' gateway_mac = '' victim_ip = [] victim_mac = [] queueNum = ...
main.py
from video import Webcam from boost import Boost from solver import Solver import threading boost = Boost() webcam = Webcam() solver = Solver(boost, webcam) print("Avaliable commands:") print("s - solve the cube") print("r - rotate bed clockwise") print("l - rotate bed counter-clockwise") print("t - tilt") pr...
server_test.py
import wx import socket import threading from datetime import datetime import time from ctypes import * HOST = '127.0.0.1' # Standard loopback interface address (localhost) PORT = 9911 # Port to listen on (non-privileged ports are > 1023) SIZE_DATA_ASCII_MAX = 32 SIZE_DATA_TCP_MAX = 200 class Data(Union): ...
network.py
import asyncio import websockets import queue import multiprocessing import socket import json class Client: def __init__(self, receive_queue: multiprocessing.Queue, send_queue: multiprocessing.Queue): self.receive = receive_queue self.send = send_queue self.connection = None self....
balance_server.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
api_server.py
#!/usr/bin/env python3 """ API server to run the JSON-RPC and REST API. Uses servers specified in protocol.xxx.json files Print the help and all possible arguments: ./api-server.py -h Run using TestNet with JSON-RPC API at port 10332 and REST API at port 8080: ./api-server.py --testnet --port-rpc 10332 --p...
test_apiserver.py
# -*- coding: utf-8 -*- """ tests.apiserver ~~~~~~~~~~~~ Tests cobra.api :author: 40huo <git@40huo.cn> :homepage: https://github.com/WhaleShark-Team/cobra :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2018 Feei. All rights reserved """ import json import mu...
event_processor.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
datasets_old.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, xywh2xyxy help_url =...
server.py
import sys import time import json import logging import requests import argparse from importlib import import_module from flask import Flask, request from threading import Thread, Event from ibots import base logger = logging.getLogger('CONTROL') PERIOD = 5 RETRY_NETWORK = 20 class Waiter: def __init__(self, ...
server.py
from msilib.schema import Error import selectors import socket import threading import connectionHandler from exceptions import InitilizationError class Server: ACCEPT_CONNECTION = 0 READ_FROM_CLIENT = 1 def __init__(self, port): self.port = port self.selector = selectors.DefaultSelector...
simpleMalwareDropper.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #Tests the office dropper of the malware component import sys import time import logging import subprocess import threading import paramiko try: from fortrace.core.vmm import Vmm from fortrace.utility.logger_helper import create_logger from fortrace.core.vmm i...
netcdf.py
#!/usr/bin/env pytest # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test NetCDF driver support. # Author: Frank Warmerdam <warmerdam@pobox.com> # #############################################################...
app.py
import asyncio import logging import threading from enum import Enum from functools import wraps from time import sleep from typing import Dict, Tuple import click import yaml from aiohttp import web from schemathesis.cli import CSVOption async def success(request): return web.json_response({"success": True}) ...
SparkMQTTStage2_1.py
######################################################################## # This is implementation for Cloud + Edge = iotx Stage 2. Cloud is represented # by Apache Spark and Edge computing framework is Calvin. Apache Spark is # receiving temperature data from Calvin via MQTT (pub/sub model). This # program tracks seque...
test_streams.py
"""Tests for streams.py.""" import gc import os import queue import pickle import socket import sys import threading import unittest from unittest import mock from test.support import socket_helper try: import ssl except ImportError: ssl = None import asyncio from test.test_asyncio import utils as test_utils ...
scanbackup.py
""" 1、文件到这里 一份给ES 一份给自己 新增ES旧索引入库 在继承原有功能的基础上 重构备份程序,按照数据内的 国家-当前时间(年-月-日) 如果按照数据内的时间的话也会面临和按国家端口备份的问题 不用再分端口了 create by judy 20201217 """ from pathlib import Path import threading import json from queue import Queue import traceback import datetime import time from shutil import copyfile import zipfile import shutil ...
debuggee.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root # for license information. from __future__ import absolute_import, division, print_function, unicode_literals import atexit import locale import os import struct import subprocess i...
deepstream_test_rtsp_probe.py
#!/usr/bin/env python3 ################################################################################ # Copyright (c) 2020, NVIDIA CORPORATION. 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"),...