source
stringlengths
3
86
python
stringlengths
75
1.04M
test_base.py
#!/usr/bin/python """ (C) Copyright 2019-2021 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent """ import os import time from datetime import datetime, timedelta import multiprocessing import threading import random from filecmp import cmp from apricot import TestWithServers from general_utils import r...
windows.py
from ...third_party import WebsocketServer # type: ignore from .configurations import ConfigManager from .configurations import WindowConfigManager from .diagnostics import DiagnosticsCursor from .diagnostics import DiagnosticsWalker from .diagnostics import ensure_diagnostics_panel from .logging import debug from .lo...
spade_bokeh.py
# -*- coding: utf-8 -*- import asyncio from threading import Thread from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop from bokeh.application import Application from bokeh.application.handlers import FunctionHandler from bokeh.server.server import BaseServer from bokeh.server.tornado import ...
__init__.py
"""Support for functionality to download files.""" import logging import os import re import threading import requests import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.util import sanitize_filename _LOGGER = logging.getLogger(__name__) ATTR_FILENAME = "filename" ATTR_...
Interface.py
from os import system from time import sleep import threading class Interface: def __init__(self, interface): self.name = interface self.hopperRunning = False self.hopperThread = None def enableMonitor(self): system("ifconfig {0} down && iwconfig {0} mode monitor && ifconfig {0}...
thread_example.py
# -*- codiing:utf-8 -*- """ thread example """ __author__="aaron.qiu" import time, threading # 新线程执行的代码: def loop(): print('thread %s is running...' % threading.current_thread().name) n = 0 while n < 5: n = n + 1 print('thread %s >>> %s' % (threading.current_thread().name, n)) time...
receiver.py
#!/usr/bin/env python from sqlite3 import DatabaseError import rospy from geometry_msgs.msg import PoseStamped from nav_msgs.msg import Path import threading import socket import time class Receiver(object): def __init__(self, addr='127.0.0.1', port=23334): self.sock = socket.socket(socket.AF_INET, socket....
DayDayUp.py
# 1.retrying模块使用 ~~~python import requests from retrying import retry headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) " "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36" } @retry(stop_max_attempt_number=3) def _parse_url(url): pri...
local_server.py
"""Launch.""" import threading import waitress import werkzeug.serving import build.build_fed as build_fed @werkzeug.serving.run_with_reloader def serve(): """Run waitress, but reload with file system changes.""" def builder_thread(): build_fed.build('dnstwister/static/') build_fed.monitor('...
main.py
import json from threading import Thread import pygame import websocket import time from math import floor from init_state import InitState from utils import COLORS, get_sprite_surface console_size = console_width, console_height = 320, 240 console_size_final = console_width * 4, console_height * 4 pixel_size = wid...
old_ssh.py
import logging import os import socket import sys import time import traceback from queue import Queue from threading import Thread from tlz import merge from tornado import gen logger = logging.getLogger(__name__) # These are handy for creating colorful terminal output to enhance readability # of the output genera...
greenhouse.py
#!/usr/bin/python # -*- coding: utf-8 -*- # greenhouse.py """ main script for greenhouse bot using telegram.ext as Python framework for Telegram Bot API https://core.telegram.org/api#bot-api original: author: Stefan Weigert http://www.stefan-weigert.de/php_loader/raspi.php adapted: Thomas Kaulke, kaulketh@gmail....
mainmenuview.py
import arcade import logging from ..gameconstants import SCREEN_WIDTH, SCREEN_HEIGHT, GAME_PATH from multiprocessing import Process, Queue from .gameview import GameView from ..networking.net_interface import Pipe import os from textwrap import dedent DATA_PATH = f"{GAME_PATH}/data" def networking(forward, feedba...
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 from collections import namedtuple from functools import partial from typing import Any import requests from jsonrpc import JSONRPCResponseM...
log.py
# Copyright (c) 2021 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 applic...
scheduler_job.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...
speaker_embed.py
import csv import functools import multiprocessing import os import threading import numpy as np import pyworld import soundfile as sf import torch from scipy import stats class EmbedModel1d(torch.nn.Module): def __init__(self, n_freq, n_frames): super(EmbedModel1d, self).__init__() self...
execute_test_content.py
import os import sys from threading import Thread import requests from demisto_sdk.commands.test_content.ParallelLoggingManager import \ ParallelLoggingManager from demisto_sdk.commands.test_content.TestContentClasses import ( BuildContext, ServerContext) SKIPPED_CONTENT_COMMENT = 'The following integrations...
micro_controller.py
import RPi.GPIO as GPIO import time import random import sys import signal import csv 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 = 1...
download.py
import os import random import zipfile import argparse import zipfile import urllib.request as req import ssl from threading import Thread from multiprocessing import SimpleQueue as Queue #from multiprocessingSimpleQueue import SimpleQueue as Queue #from queue import SimpleQueue as Queue def unzip(zip_filepath, dest_...
demo.py
from multiprocessing import Process, Queue from eightqueens import eightqueens def eight_queens(n: int, find_all: bool = True, visualize: bool = False): if visualize: from gui import gui q = Queue() visualization = Process(target=gui.visualize_search, args=(n, (q),)) visualization...
supervisor.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...
apkleaks.py
#!/usr/bin/env python3 import io import json import logging.config import os import re import shutil import sys import tempfile import threading from contextlib import closing from distutils.spawn import find_executable from pathlib import Path from pipes import quote from urllib.request import urlopen from zipfile im...
awsJobStore.py
# Copyright (C) 2015 UCSC Computational Genomics Lab # # 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 o...
server.py
# -*- coding: utf-8 -*- import asyncio import multiprocessing import os from functools import partial from signal import SIG_IGN, SIGINT, SIGTERM, Signals from signal import signal as signal_func from socket import SO_REUSEADDR, SOL_SOCKET, socket from xTool.log.log import logger from xTool.utils.processes import ct...
screencanvas.py
import win32api, win32con, win32gui, win32ui import ctypes from typing import List import threading import time import string import uuid import ctypes import queue from . import rectangle, win32_contants def draw_loop(_queue: queue.Queue): while True: try: canvas = _queue.get(block=True, timeo...
testing.py
"""Pytest fixtures and other helpers for doing testing by end-users.""" from contextlib import closing import errno import socket import threading import time import pytest from six.moves import http_client import cheroot.server from cheroot.test import webtest import cheroot.wsgi EPHEMERAL_PORT = 0 NO_INTERFACE = ...
dataprocessor.py
import os import util.tokenizer import util.vocabutils as vocab_utils from tensorflow.python.platform import gfile from random import shuffle from multiprocessing import Process, Lock import time from math import floor class DataProcessor(object): def __init__(self, max_vocab_size, source_data_path, processed...
utils_test.py
import asyncio import collections import gc from contextlib import contextmanager, suppress import copy import functools from glob import glob import io import itertools import logging import logging.config import os import queue import re import shutil import signal import socket import subprocess import sys import te...
task_manager.py
#!/usr/bin/env python import os import sys from os import _exit, getenv from sys import stderr #from version import gversion PROGRAM_INFO = "VddbAsync task_manager 1.2.1.0" if len(sys.argv) > 1: print PROGRAM_INFO sys.exit(0) path = getenv('MW_HOME') if path == None: stderr.write("MW_HOME not set in env...
logcat.py
import subprocess import logging import copy from .adapter import Adapter class Logcat(Adapter): """ A connection with the target device through logcat. """ def __init__(self, device=None): """ initialize logcat connection :param device: a Device instance """ s...
tab.py
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import os import json import logging import warnings import threading import functools import websocket from .exceptions import * try: import Queue as queue except ImportError: import queue __all__ = ["Tab"] logger =...
TFFPNotifier.py
from .NotifierClass import Notifier import twitter from datetime import datetime, timedelta import time import threading class TFFPNotifier(Notifier): def __init__(self,cfgParser,insec): self.header = insec try: self.screenname = cfgParser.get(insec,"username").strip() except: self.screenname = '' sel...
subscribe.py
# coding=utf-8 import zmq import threading import uuid from google.protobuf.message import DecodeError from fysom import Fysom import machinetalk.protobuf.types_pb2 as pb from machinetalk.protobuf.message_pb2 import Container class Subscribe(object): def __init__(self, debuglevel=0, debugname='Subscribe'): ...
road_speed_limiter.py
import json import os import select import threading import time import socket import fcntl import struct from threading import Thread from cereal import messaging from common.params import Params from common.numpy_fast import clip, mean from common.realtime import sec_since_boot from selfdrive.config import Conversion...
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import os from threading import Thread import logging import pickle import time import subprocess from functools import wraps from telegram.ext import Updater from telegram.ext import CommandHandler from telegram.ext import MessageHandler, Filters from telegram...
test.py
import threading import time import pytest from helpers.cluster import ClickHouseCluster cluster = ClickHouseCluster(__file__) node1 = cluster.add_instance('node1', main_configs=['configs/logs_config.xml'], with_zookeeper=True, ma...
test_caching.py
import datetime import gzip from itertools import count import os curdir = os.path.join(os.getcwd(), os.path.dirname(__file__)) import sys import threading import time import urllib import cherrypy from cherrypy._cpcompat import next, ntob, quote, xrange from cherrypy.lib import httputil gif_bytes = ntob( 'GIF89a...
OnlineSubsystemPythonServer.py
# Copyright (c) 2019 Ryan Post # This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. # Permission is granted to anyone to use this software for any purpose, including commercial applications, and ...
test.py
# neuralmagic: no copyright # flake8: noqa # fmt: off # isort: skip_file import argparse import json import os from pathlib import Path from threading import Thread import numpy as np import torch import yaml from tqdm import tqdm from models.experimental import attempt_load from utils.datasets import create_dataloa...
crowded_calculate.py
import requests import time from threading import Thread from multiprocessing import Process import os,sys _head = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36' } url = "http://www.tieba.com" def count(x, y): # 使程序完成150万计算 ...
mnist.py
# Copyright 2019 The FastEstimator 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 appl...
gdal2tiles.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ****************************************************************************** # $Id$ # # Project: Google Summer of Code 2007, 2008 (http://code.google.com/soc/) # Support: BRGM (http://www.brgm.fr) # Purpose: Convert a raster into TMS (Tile Map Service) tiles in a di...
singleton.py
""" Taken from https://github.com/pycontribs/tendo/blob/master/tendo/singleton.py on 01/01/2021 and modified to remove error message """ from multiprocessing import Process import os import sys import tempfile if sys.platform != "win32": import fcntl class SingleInstanceException(BaseException): pass cla...
main_autoencoder.py
import os import queue import threading from time import sleep import numpy as np import tensorflow as tf from tensorflow.python.training.adam import AdamOptimizer from env import MultiArmTorqueEnvironment from models import autoencoder_seq N_ITERATIONS = 10000 N_JOINTS = 2 SEQ_LEN = 16 BATCH_SIZE = 1024 * 16 MOTION...
_polling.py
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import logging import time import threading import uuid from typing import TYPE_CHECKING from azure.core.polling import PollingMethod, LROPoller from azure.core.excepti...
base.py
#!/usr/bin/env python3 # Software License Agreement (BSD License) # # Copyright (c) 2020, UFACTORY, Inc. # All rights reserved. # # Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com> import re import time import math import threading try: from multiprocessing.pool import ThreadPool except...
grbl.py
# -*- coding: utf-8 -*- # # Copyright (c) 2021 Jason Engman <jengman@testtech-solutions.com> # Copyright (c) 2021 Adam Solchenberger <asolchenberger@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal...
TaskServer.py
# -*- coding: utf-8 -*- #**************************************************************************************** # File: TaskServer.py # # Copyright: 2013 Ableton AG, Berlin. All Rights reserved #**************************************************************************************** import threading from _Fram...
__init__.py
import re import argparse from ..gateware.clockgen import * __all__ = ["GlasgowAppletError", "GlasgowApplet", "GlasgowAppletTool"] class GlasgowAppletError(Exception): """An exception raised when an applet encounters an error.""" class _GlasgowAppletMeta(type): def __new__(metacls, clsname, bases, namesp...
learner.py
from abc import abstractmethod, ABC from typing import Tuple, Optional import glob import os import shutil import signal import threading import time from collections import OrderedDict, deque from os.path import join from queue import Empty, Queue, Full from threading import Thread import numpy as np import psutil im...
main.py
#coding:utf8 import sys import config from ws_server import WebSocketServer import log from ws_server import WebSocketMsgHandler from pubsub import SubscribeManager from pubsub import Publisher import signal import json from charts import ChartAgent from datasets import DBChartAgent from threading import Thread import ...
test_InfoExtractor.py
#!/usr/bin/env python from __future__ import unicode_literals # Allow direct execution import io import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeYDL, expect_dict, expect_value, http_server_port from youtube_dlc.compat im...
callbacks.py
from abc import abstractmethod import requests from tensortrade.env.default.renderers import PlotlyTradingChart import threading from tensortrade.core.component import Component from tensortrade.core.base import TimeIndexed from tensortrade.env.generic import EpisodeCallback import time class LoggingCallback(EpisodeCa...
run_ours.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from os.path import join, dirname sys.path.insert(0, join(dirname(__file__), '../../')) import simulator simulator.load('/home/wang/CARLA_0.9.9.4') import carla sys.path.append('/home/wang/CARLA_0.9.9.4/PythonAPI/carla') from agents.navigation.basic_agent impor...
base.py
import argparse import base64 import copy import itertools import json import os import re import sys import threading import time import uuid import warnings from collections import OrderedDict from contextlib import ExitStack from typing import Optional, Union, Tuple, List, Set, Dict, overload, Type from .builder im...
test_kafka.py
# (C) Datadog, Inc. 2010-2016 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) # stdlib import threading import time from types import ListType import unittest import os import mock # 3p from nose.plugins.attrib import attr # project from aggregator import MetricsAggregator import logging ...
ex1.py
import threading from eSSP.constants import Status from eSSP import eSSP # Import the library from time import sleep # Create a new object ( Validator Object ) and initialize it ( In debug mode, so it will print debug infos ) validator = eSSP(com_port="/dev/ttyUSB0", ssp_address="0", nv11=False, debug=True) def ev...
brain.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import time import threading from event_emitter import EventEmitter from pybot.user import User class Brain(EventEmitter): """ Represents somewhat persistent storage for the robot. Extend this. Returns a new Brain with no external storage. """ def __...
backend.py
# -*- coding: utf-8 -*- import ast import builtins import copy import functools import importlib import inspect import io import logging import os.path import pkgutil import pydoc import re import signal import site import subprocess import sys import tokenize import traceback import types import warnings from collect...
conftest.py
import pytest from time import sleep from threading import Thread import bitcoind_mock.conf as conf from bitcoind_mock.bitcoind import BitcoindMock from bitcoind_mock.auth_proxy import AuthServiceProxy def bitcoin_cli(): return AuthServiceProxy( "http://%s:%s@%s:%d" % (conf.BTC_RPC_USER, conf.BTC_RPC_PAS...
main.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import threading import signal import math import os import time from environment.environment import Environment from model.model import UnrealModel from train....
email.py
from flask import current_app,render_template from flask_mail import Mail,Message import threading from .extensions import mail def async_send_mail(app,msg): with app.app_context(): mail.send(msg) #发送邮件 def send_mail(subject,to,temname,**kwargs): app = current_app._get_current_object() #通过当前app对象的代理...
book.py
#!/usr/bin/env python # Copyright (c) 2018, DIANA-HEP # 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 ...
base_test_rqg.py
import paramiko from basetestcase import BaseTestCase import os import zipfile import Queue import json import threading from memcached.helper.data_helper import VBucketAwareMemcached from rqg_mysql_client import RQGMySQLClient from membase.api.rest_client import RestConnection, Bucket from couchbase_helper.tuq_helper ...
single_sim.py
from multiprocessing import Queue, Process import time from bnx import BNX from false_sites import FalseSites from molecule_generator import MoleculeGenerator, Molecule from optical_variation import OpticalVariation from optics import Optics class SingleSim: def __init__(self, args, bnx_path, genome, irate, erang...
main.py
# -*- coding: utf-8 -*- import re import json import urllib import time import traceback import calendar import sys import datetime import random # 这段代码是用于解决中文报错的问题 reload(sys) sys.setdefaultencoding("utf8") from Queue import Queue from threading import Thread import threading from datetime import date from dateutil.r...
main.py
# Copyright 2020 Google Research. 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 law...
cheap_image.py
import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mi import matplotlib.tri as tri from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure from kivy.clock import Clock from kivy.uix.widget import Widget from kivy.core.window import Win...
__init__.py
"""Rhasspy command-line interface""" import argparse import asyncio import io import json import logging # Configure logging import logging.config import os import sys import threading import time import wave from typing import Any from rhasspy.audio_recorder import AudioData from rhasspy.core import RhasspyCore from ...
subscriber.py
#!/usr/bin/env python # Copyright 2019 Google 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...
drfujibot.py
import sys import socket import datetime import urllib import glob import random import threading import types import time import random import drfujibot_irc.bot import drfujibot_irc.strings import os import drfujibot_pykemon.exceptions import drfujibot_pykemon.request import drfujibot_pykemon.api import re import json...
dataloader_iter.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...
test_url.py
import gzip import http.server import threading import unittest import wfdb.io._url class TestNetFiles(unittest.TestCase): """ Test accessing remote files. """ def test_requests(self): """ Test reading a remote file using various APIs. This tests that we can create a file obj...
utils.py
#================================================================ # # File name : utils.py # Author : PyLessons # Created date: 2020-09-27 # Website : https://pylessons.com/ # GitHub : https://github.com/pythonlessons/TensorFlow-2.x-YOLOv3 # Description : additional yolov3 and yolov4 functio...
utils.py
import openstack import functools from multiprocessing import Process # openstack.enable_logging(debug=True) import logging # Logging Parameters logger = logging.getLogger(__name__) file_handler = logging.handlers.RotatingFileHandler( 'katana.log', maxBytes=10000, backupCount=5) stream_handler = logging.StreamHand...
AudioSupervisor.py
#!/usr/bin/python from __future__ import unicode_literals import json, sys from socketIO_client import SocketIO import time from time import sleep from threading import Thread from hardware import * from modules.logger import * import RPi.GPIO as GPIO import os GPIO.setmode(GPIO.BCM) # Configs: t_session_timout = 9...
serialplotter.py
import sys # For exception details import os import serial # Serial comms import matplotlib # Graph library import matplotlib.pyplot as plt # Plotting matplotlib.use("TkAgg") # Set GUI for matplotlib from matplotlib.backends.backend_tkagg import FigureCanvasT...
test_browser.py
# coding=utf-8 # Copyright 2013 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. from __future__ import print_function import argparse ...
gameservers.py
import sys import os import inspect currentdir = os.path.dirname(os.path.abspath( inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0, parentdir) import gevent.monkey gevent.monkey.patch_all() import time import logging from threading import Thread from steam.enums...
TelnetLoader.py
import sys, re, os, socket, time from multiprocessing import Process if len(sys.argv) < 2: sys.exit("\033[37mUsage: python "+sys.argv[0]+" [list]") cmd="" #payload to send info = open(str(sys.argv[1]),'a+') def readUntil(tn, string, timeout=8): buf = '' start_time = time.time() while time.time() - st...
p4execution.py
# SPDX-FileCopyrightText: 2020-2021 CASTOR Software Research Centre # <https://www.castor.kth.se/> # SPDX-FileCopyrightText: 2020-2021 Johan Paulsson # SPDX-License-Identifier: Apache-2.0 import os import logging import time import threading from benchexec import systeminfo from p4.p4_run_setup import P4SetupHandler...
multiprocessing4_efficiency_comparison.py
# View more 3_python 1_tensorflow_new tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial import multiprocessing as mp import threading as td import time def job(q): res = 0 fo...
_export.py
#!/usr/bin/env python from __future__ import print_function import collections, csv, ctypes, datetime, json, math, multiprocessing, numbers import optparse, os, platform, tempfile, re, signal, sys, time, traceback from . import errors, net, query, utils_common try: unicode except NameError: unicode = str tr...
dns_server_client.py
import threading from time import sleep class DNSServerClient: CLIENT_POLL_INTERVAL = 0.1 RECEIVE_SIZE = 1024 MESSAGE_END = '<END>' def __init__(self, client_connection, address=None): print('Created user from {}'.format(address)) self.client_connection = client_connection sel...
app.py
from flask import Flask, jsonify, request from pymongo import MongoClient from datetime import datetime from pytz import timezone import threading import time import json import os import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn import metrics from sklearn.neural...
notebook.py
import os.path as osp import sys import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import torch.hub import os import model from PIL import Image from torchvision import transforms from visualize.grad_cam import BackPropagation, GradCAM,GuidedBackPropagation import threading ...
webrequest.py
import requests import threading from multiprocessing.pool import ThreadPool import time import sys URL = "http://192.168.219.158:80/facerec" webcamStreamURL="192.168.219.142:8090/?action=snapshot" def faceAuthRequest(requestParams,retJson): res = requests.get(URL,params=requestParams,timeout=20) res.status_code re...
SPOR_BASIC_5.py
#!/usr/bin/env python3 import sys import os import re import subprocess from threading import Thread import TEST_FIO import TEST_LIB import TEST_LOG import TEST_SETUP_POS arrayId = 0 volId = 1 current_test = 0 ############################################################################ # Test Description # Multi t...
genclocks.py
#!/usr/bin/env python ''' Copyright (c) 2020 Modul 9/HiFiBerry 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, modify, me...
consumer.py
#!/usr/bin/env python import threading import pika import ast import time class ConsumeManager: def __init__(self, queue_name): # Initial setting for RabbitMQ pika_params = pika.ConnectionParameters( host='rabbitmq', connection_attempts=10, heartbeat=0 ...
api.py
import core.rest_server import time import sys import os DESCRIPTION = "turn off/on the rest api" def autocomplete(shell, line, text, state): return None def help(shell): shell.print_plain("") shell.print_plain("Turning on the REST Server:") shell.print_plain("api on (--user USERNAME --pass PASSWORD ...
main.py
from threading import * from terminal import * import listener cmd = '' if __name__ == '__main__': #terminal terminal = Terminal() terminal_thread = Thread(target=terminal.cmdloop) terminal_thread.start() #web print('Starting Webserver') listener.run()
test_bootstrap.py
"""Test the bootstrapping.""" # pylint: disable=too-many-public-methods,protected-access import tempfile from unittest import mock import threading import logging import voluptuous as vol from homeassistant import bootstrap, loader import homeassistant.util.dt as dt_util from homeassistant.helpers.config_validation i...
create_instances.py
#!/usr/bin/env python3 # # Copyright 2018 The Bazel 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 ...
core.py
""" 蓝奏网盘 API,封装了对蓝奏云的各种操作,解除了上传格式、大小限制 """ import os import pickle import re import shutil from threading import Thread from time import sleep from datetime import datetime from urllib3 import disable_warnings from random import shuffle, uniform from typing import List, Tuple from concurrent.futures import ThreadPoolE...
hc.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time,random,sys,json,codecs,threading,glob,re,ast,os,subprocess,requests cl = LINETCR.LINE() # #cl.login(qr=True) cl.login(token="EnC4WWaxlvwEmc7dcSP0.4CtAvksI2snhv2NVBSkYCa.K9u0pjo345g+5fss46dtUTn+LjHx...
main.py
import os abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) print("Working directory:", dname) os.chdir(dname) from Server.server import Server import subprocess import sys import threading import ctypes def run_as_admin(argv=None, debug=False): shell32 = ctypes.windll.shell32 if argv is ...
dispatcher.py
import threading import logging import queue import time import Pyro4 class Job(object): def __init__(self, id, **kwargs): self.id = id self.kwargs = kwargs self.timestamps = {} self.result = None self.exception = None self.worker_name = None def time_it(s...
c4.py
""" 服务端 服务器进程要先绑定一个端口监听其他客户端的请求连接 如果请求过来了,服务器与其建立连接,进行通信 服务器一般使用固定端口(80)监听 为了区分socket连接是和哪个客户端进程般的,所以需要4个参数去区分: 1. 服务器地址 2. 客户端地址 3. 服务端端口 4 客户端端口 """ import socket import threading import time s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 绑定地址 s.bind(('127.0.0.1', 8000)) # 进行监听 s.listen(5) # 等待连接的最大数量 print(...