source
stringlengths
3
86
python
stringlengths
75
1.04M
communication.py
import logging import time import json import threading from collections import namedtuple import paho.mqtt.client as mqtt class Communication: def __init__(self, config): self._logger = logging.getLogger(self.__class__.__name__) self._config = config self.client = mqtt.Client() ...
server.py
#!/usr/bin/env python import socket from threading import Thread import numpy as np import os import argparse import config import util from sklearn.externals import joblib import traceback from keras.applications.imagenet_utils import preprocess_input import time util.set_img_format() parser = argparse.ArgumentParse...
grid.py
""" Codes to submit multiple jobs to JCVI grid engine """ import os.path as op import sys import re import logging from multiprocessing import Pool, Process, Queue, cpu_count from jcvi.formats.base import write_file, must_open from jcvi.apps.base import OptionParser, ActionDispatcher, popen, backup, \ mk...
2_node_classification.py
""" Single Machine Multi-GPU Minibatch Node Classification ====================================================== In this tutorial, you will learn how to use multiple GPUs in training a graph neural network (GNN) for node classification. (Time estimate: 8 minutes) This tutorial assumes that you have read the :doc:`T...
influx_query_load.py
import simplejson as json import pycurl, sys, time, multiprocessing, threading numProcesses = int(sys.argv[1]) numQueriesPerProcess = int(sys.argv[2]) series = sys.argv[3] url = sys.argv[4] print numProcesses * numQueriesPerProcess data = "q=select value from " data += series print data def processWorker(numQuerie...
main.py
# 一本书 import base64 import sqlite3 import threading import time from _md5 import md5 from queue import Queue from random import random, randint from urllib import parse import pickle import requests from src.server import Server, req, json, config, Log from langconv import Converter from conf.baidu import BaiduAppId...
MapLoader.py
from io import BytesIO from PIL import Image from urllib import request import os from pathlib import Path import time import threading from SimpleGUICS2Pygame import simpleguics2pygame from Classes.Middle.SpriteControl.SpriteAnimator import SpriteAnimator from Classes.Base.Vector import Vector from Classes.Super.MapTi...
test_c10d_common.py
import copy import os import sys import tempfile import threading import time from datetime import timedelta from itertools import product from sys import platform import torch import torch.distributed as c10d if not c10d.is_available(): print("c10d not available, skipping tests", file=sys.stderr) sys.exit(0)...
test_remote.py
"""Test Home Assistant remote methods and classes.""" # pylint: disable=protected-access import asyncio import threading import unittest from unittest.mock import patch import homeassistant.core as ha import homeassistant.bootstrap as bootstrap import homeassistant.remote as remote import homeassistant.components.http...
multi_logging.py
from logging.handlers import RotatingFileHandler import multiprocessing, threading, logging, sys, traceback class MultiProcessingLog(logging.Handler): def __init__(self, name, mode, maxsize, rotate): logging.Handler.__init__(self) self._handler = RotatingFileHandler(name, mode, maxsize, rotate) ...
client.py
''' Function: 联机对战客户端 Author: Charles 微信公众号: Charles的皮卡丘 ''' import socket import pygame import random import threading from ..misc import * from PyQt5 import QtCore from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * from itertools import product '''客户端''' class GobangClien...
emulator.py
# encoding: utf8 import os import sys import json import copy import psutil import threading import netifaces import socket import time import signal import Tkinter as tk from macdivert import MacDivert from tkMessageBox import showerror, showwarning from enum import Defaults from tkFileDialog import askopenfilename, ...
Bot.py
import threading import discord from discord.ext import commands from discord.ext.commands.core import has_permissions from discord import * import os,json import time as times import requests #MODIFY DATA PREFIX="YOUR PREFIX HERE" TOKEN="YOUR TOKEN HERE" intents=discord.Intents.all() client=commands.Bot(command_pref...
action.py
import threading from time import sleep class ActionQueue(object): IDLE = "idle" RUNNING = "running" STOPPED = "stopped" def __init__(self, parent): self.parent = parent self.queue = [] def make_thread_fnc(self): def thread_fnc(): i = 0 while self.p...
compute_FIDs.py
#!/usr/bin/env python3 """ Computes the FID between different datasets. You need a script that takes paths to two dataset can computes the FID from it as an executable. Example: https://github.com/mseitzer/pytorch-fid/blob/master/fid_score.py """ import subprocess import threading NUM_THREADS = 8 def main(): c...
sendNotify.py
# !/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 2021/10/31 # @Author : Oreomeow # @Modify : MashiroF # @File : sendNotify.py # @Software: PyCharm import base64 import hashlib import hmac import json import os import re import sys import threading import time import urllib.parse im...
controller.py
import pygame import globvar import monte_carlo import logging import threading import time class HexController(): def __init__(self): self.STOPMSG = pygame.USEREVENT + 1 self.mouse_pos = (-1, -1) self.pos_on_board = None self.on_button = (False, None) self.buttons = {"ne...
onnxruntime_test_python.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -*- coding: UTF-8 -*- import gc import os import platform import sys import threading import unittest import numpy as np from helper import get_name import onnxruntime as onnxrt from onnxruntime.capi.onnxruntime_pybind11_...
TestDebugger.py
# Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. # # WSO2 Inc. licenses this file to you 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/...
utils.py
import sys import os import base64 import time import binascii import select import pathlib import platform import re from subprocess import PIPE, run from colorama import Fore, Style,init from pyngrok import ngrok import socket import threading import itertools import queue banner = """\033[1m\033[91m ...
main.py
# WEB P CONVERTER BY BIG SECRET. PLEASE DO NOT REDISTRIBUTE OR SELL. # This software may not be resold, redistributed or otherwise conveyed to a third party import traceback import threading import os import sys from PIL import Image, UnidentifiedImageError from PyQt5.QtCore import * from PyQt5.QtWidgets import * from...
simulation.py
import threading import numpy as np from src.side import ( Side ) from src.event_generator import ( EventTypes, EventGenerator, event_generation_loop ) def run_market_data_simulation(config, state): # Create threads that create the market events threads = [] # Create buy limit order add...
app.py
# Imports for client import os from flask import Flask, render_template, redirect, url_for, request, flash from flask_bootstrap import Bootstrap from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileAllowed, FileRequired from wtforms import StringField, PasswordField, BooleanField, SelectField from ...
test_database_service.py
from __future__ import absolute_import from unittest import TestCase from database.memory_db import MemoryDB from database.database_service import database_service from database.database_service import DBClient from service.server import config import time, ast, os, json, requests from multiprocessing import Process ...
build_image_data.py
# Copyright 2016 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 by applicable law or a...
run-spec-test.py
#!/usr/bin/env python3 # Author: Volodymyr Shymanskyy # Usage: # ./run-spec-test.py # ./run-spec-test.py ./core/i32.json # ./run-spec-test.py ./core/float_exprs.json --line 2070 # ./run-spec-test.py ./proposals/tail-call/*.json # ./run-spec-test.py --exec "../build-custom/wasm3 --repl" # # Running WASI veris...
utils.py
# -*- coding: utf-8 -*- # Copyright 2012-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...
Console.py
############################################################################### # # # <legal_notice> # * BSD License 2.0 # * # * Copyright (c) 2021, MaxLinear, Inc. # * # * Redistribution and use in source and binary forms, with or without # * modification, are permitted provided that the following conditions ar...
darknet1.py
#!python3 ''' ############################## ### Receive Video stream ##### ### from Android client ####### ### Use yolo to do detect #### ## (return a message to the mobile device) ## ############################## ''' from ctypes import * import math import random import os import socket import time import cv2 impor...
interrupt.py
from distrilockper import Config from distrilockper.lock_helper import DistributerLockHelper import _thread config = Config() config.use_single_server().set_config(host='0.0.0.0', port=6379) helper = DistributerLockHelper() helper.create(config) class ticketSalse(): def __init__(self): self.ticket_count = 1 ...
postprocess.py
"""Postprocesses data across dates and simulation runs before aggregating at geographic levels (ADM0, ADM1, or ADM2).""" import argparse import gc import glob import logging import os from multiprocessing import JoinableQueue, Pool, Process from pathlib import Path import numpy as np import pandas as pd import tqdm f...
multi_process_agents.py
#!/usr/bin/env python import multiprocessing import rospy from geometry_msgs.msg import Twist from math import pow, atan2, sqrt import numpy as np from turtle_instance_laser_death_star import TurtleBot ''' Description: This python file is responsible for creating multiple turtlebot instances by using multiprocessin...
test_changes.py
# -*- coding: utf-8 - # # This file is part of couchdbkit released under the MIT license. # See the NOTICE for more information. # __author__ = 'benoitc@e-engura.com (Benoît Chesneau)' import threading import time try: import unittest2 as unittest except ImportError: import unittest from couchdbkit import * f...
mqtt.py
# Copyright 2021 Nokia # Licensed under the BSD 3-Clause Clear License. # SPDX-License-Identifier: BSD-3-Clear import paho.mqtt.client as mqtt import a10.structures.identity import a10.asvr.db.configuration import threading import time def on_disconnect(client, userdata, rc): logging.info("disconnecting reason ...
base.py
# Copyright 2014 ETH Zurich # Copyright 2018 ETH Zurich, Anapaya Systems # # 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 b...
kernel.py
from queue import Queue from threading import Thread from ipykernel.kernelbase import Kernel import re import subprocess import tempfile import os import os.path as path class RealTimeSubprocess(subprocess.Popen): """ A subprocess that allows to read its stdout and stderr in real time """ def __init...
simulation.py
import logging import constant import time import random from threading import Thread from tkinter import * from enum import Enum class State(Enum): '''Simulation states''' NOT_INITIALIZED = 1 INITIALIZED = 2 STARTED = 3 class Simulation: '''Simulation of a diffusion limited aggregation.''' ...
threds_watcher.py
from threading import Thread import time a = 0 # global variable def thread1(threadname): global a b = a print(f'a {a}, b {b}') for k in range(50): print(f'a {a}, b {b}') if b != a: print(f'changed a {a}, b {b}') b = a time.sleep(0.1) thread1 = Thread(t...
new_server.py
import socket, cv2, pickle,struct,traceback,threading import time from Car import Car from tkinter import * #GPIO stufffff car=Car() # tkinter stufffffff angle = 1540 quit=False bnfflag=True def throttlethread(): def assign_throttle(val): car.setthrottle(int(val)) def bnffunc(): global...
bg_blender.py
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
__init__.py
''' This Module is One to Make Your Code Shorter. High API Will Make You Feel You're Ordering And Machine Is Doing! Also There is Collection of most usefull function and methods from popular modules of python. (Read Help of Functions) Official Documention Will Be Added Soon. ''' ''' Written By RX Last Update: 1-15-2021...
chat_bot.py
import socket import pickle import time from threading import Thread from Crypto.Hash import SHA1 from pythonping import ping class Bot: def __init__(self, port, options=None, botName=None): self.addr = '' self.port = int(port) self.udpSocket = socket.socket(socket.AF_INET, socket.SOCK_DG...
test__fileio.py
# Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the Apache 2.0 License. # See the LICENSE file in the project root for more information. ''' Tests for CPython's _fileio module. ''' import os import sys import time import threading import unittest f...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
massreport.py
############################################################### # ███████╗ █████╗ ████████╗██╗ ██╗██████╗ ███╗ ██╗███████╗ # ██╔════╝██╔══██╗╚══██╔══╝██║ ██║██╔══██╗████╗ ██║██╔════╝ # ███████╗███████║ ██║ ██║ ██║██████╔╝██╔██╗ ██║█████╗ # ╚════██║██╔══██║ ██║ ██║ ██║██╔══██╗██║╚██╗██║██╔══╝ # ██...
scheduler.py
import time from multiprocessing import Process from proxypool.api import app from proxypool.getter import Getter from proxypool.tester import Tester from proxypool.db import RedisClient from proxypool.setting import * class Scheduler(): def schedule_tester(self, cycle=TESTER_CYCLE): """ 定时测试代理 ...
1.py
import threading from time import sleep,ctime loops=[2,4] class ThreadFunc(object): def __init__(self,func,args,name=''): self.name=name self.func=func self.args=args def __call__(self): self.res=self.func(*self.args) def loop(nloop,nsec): ...
server.py
#!/usr/bin/env python3 import dns.exception import dns.flags import dns.message import dns.rcode import dns.rdataclass import dns.rdatatype import dns.resolver import json import math import os import pickle import redis import socket import socketserver import struct import sys import threading import time allowed_r...
finalpsyblast.py
#!/usr/bin/env python ''' phyST This program takes a protein family code (i.e. 1.A.1) as input, then searches for the alignment sequence of the first protein in that family (i.e. 1.A.1.1.1), then psi-blasts this sequence, and finally outputs the number of protein homologues from every phylum found as well a...
futuGateway.py
# encoding: UTF-8 ''' 富途证券的gateway接入 ''' import json from collections import OrderedDict from threading import Thread from time import sleep from datetime import datetime from copy import copy from futuquant import (OpenQuoteContext, OpenHKTradeContext, OpenUSTradeContext, RET_ERROR, RET_OK, ...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
videoio.py
from pathlib import Path from enum import Enum from collections import deque from urllib.parse import urlparse import subprocess import threading import logging import cv2 LOGGER = logging.getLogger(__name__) WITH_GSTREAMER = False#True class Protocol(Enum): IMAGE = 0 VIDEO = 1 CSI = 2 V4L2 = 3 ...
test_context.py
import logging import threading import mock import pytest from ddtrace.context import Context from ddtrace.ext.priority import AUTO_KEEP from ddtrace.ext.priority import AUTO_REJECT from ddtrace.ext.priority import USER_KEEP from ddtrace.ext.priority import USER_REJECT from ddtrace.span import Span from tests import ...
WikiExtractor.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ============================================================================= # Version: 3.0 (July 22, 2020) # Author: Giuseppe Attardi (attardi@di.unipi.it), University of Pisa # # Contributors: # Antonio Fuschetto (fuschett@aol.com) # Leonardo Souza (lsouza@amte...
modem.py
#!/usr/bin/env python """ High-level API classes for an attached GSM modem """ import sys, re, logging, weakref, time, threading, abc, codecs from datetime import datetime from .serial_comms import SerialComms from .exceptions import CommandError, InvalidStateException, CmeError, CmsError, InterruptedException, Time...
telloCV.py
""" tellotracker: Allows manual operation of the drone and demo tracking mode. Requires mplayer to record/save video. Controls: - tab to lift off - WASD to move the drone - space/shift to ascend/descent slowly - Q/E to yaw slowly - arrow keys to ascend, descend, or yaw quickly - backspace to land, or P to palm-land -...
SceneNodeTest.py
########################################################################## # # Copyright (c) 2012, John Haddon. All rights reserved. # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
ipythonwidget.py
import os import csv import time from threading import Thread from IPython.core.display import display, HTML from traitlets import Unicode, Dict, default from ipywidgets import DOMWidget, Layout, widget_serialization class CatboostIpythonWidget(DOMWidget): _view_name = Unicode('CatboostIpythonWidgetView').tag(syn...
build_environment.py
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) """ This module contains all routines related to setting up the package build environment. All of this is set up by packa...
core.py
import os import dill import time import pprint import random import signal import inspect import logging import platform from typing import * from tqdm import tqdm from pathos.pools import ProcessPool from multiprocessing import Process from multiprocessing.managers import SyncManager from ..misc import * from ..man...
serve.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and 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 argparse import binascii import os import socket import sys import tempfile impor...
infolog.py
import atexit import json from datetime import datetime from threading import Thread from urllib.request import Request, urlopen _format = '%Y-%m-%d %H:%M:%S.%f' _file = None _run_name = None _slack_url = None def init(filename, run_name, slack_url=None): global _file, _run_name, _slack_url _close_logfile() _file...
tcp-server.py
#!/usr/bin/env python # coding: utf-8 import socket import threading bind_ip = '0.0.0.0' bind_port = 9999 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((bind_ip, bind_port)) # 最大连接数5 server.listen(5) print('[*] Listening on %s:%d' % (bind_ip, bind_port)) # 线程函数 def handle_client(client_s...
select_ticket_info.py
# -*- coding=utf-8 -*- import datetime import random import os import socket import sys import threading import time import TickerConfig import wrapcache from agency.cdn_utils import CDNProxy, open_cdn_file from config import urlConf, configCommon from config.TicketEnmu import ticket from config.configCommon import sea...
VMes_IO.py
from spiderNest.preIntro import * from MiddleKey.redis_IO import RedisClient from config import SYS_AIRPORT_INFO_PATH, REDIS_KEY_NAME_BASE import threading path_ = SYS_AIRPORT_INFO_PATH def save_login_info(VMess, class_): """ VMess入库 class_: ssr or v2ray """ # redis loaded # RedisClient().ad...
test_gevent_process.py
import time from gevent import monkey monkey.patch_all() from multiprocessing import Process print(6666) def f(x): print(x) time.sleep(10000) if __name__ == '__main__': [Process(target=f, args=(2,)).start() for i in range(2)]
xkcd_download_multithread.py
#! python3 # Download every single XKCD comic - multithreaded version import bs4, requests, os, threading, time #url = 'http://xkcd.com' os.makedirs('xkcd', exist_ok=True) # exist_ok prevents from exception if folder already exists def download_xkcd(start, end): for url_number in range(start, end): ...
threads.py
from abc import abstractmethod, ABCMeta from threading import Event, Thread class CustomThread(object): __metaclass__ = ABCMeta def __init__(self): self._task = None self._before_task = self.dummy_task self._after_task = self.dummy_task self._task_args = [] self._task...
console.py
''' Created on 15/09/2015 @author: david ''' import time from threading import Thread class ConsoleLink(object): ''' Emulates a link showing the output trough the console ''' def __init__(self): self._emulatedProcessingTime = 3 def setEmulatedProcessingTime(self, time): ...
test_lock.py
# -*- coding: utf-8 -*- # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import pytest from conda.lock import DirectoryLock, FileLock, LockError from os.path import basename, exists, isfile, join def test_filelock_passes(tmpdir): """ Normal test on file lock """ package_...
multiprocess_stress.py
import sys import argparse import socket from socket import error as SocketError from multiprocessing import Process, Queue import requests import json import random import time import metrics import select from sys import stdout from termcolor import colored #Time Constants NOW = 1404776380 ONE_YEAR_AGO = 1404776380 ...
heatmaps_test.py
import base64 import json import logging import time import zlib import requests from RLBotServer import start_server from backend.blueprints.spa_api.service_layers.replay.enums import HeatMapType from backend.tasks.add_replay import save_replay from tests.utils.killable_thread import KillableThread from tests.utils....
__init__.py
# Copyright 2019 Atalaya Tech, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing,...
rexpand.py
# -*- coding: utf-8 -*- import click import time import threading import sys from sagar.crystal.derive import cells_nonredundant, ConfigurationGenerator from sagar.io.vasp import read_vasp, write_vasp from sagar.crystal.structure import symbol2number as s2n CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) ...
platform.py
import multiprocessing as mp import cv2 import time import msvcrt def handleRtspVideo(id, q): #cap = cv2.VideoCapture("rtsp://%s:%s@%s//Streaming/Channels/%d" % (name, pwd, ip, channel)) cap = cv2.VideoCapture(id) while True: is_opened, frame = cap.read() q.put(frame) if is_opened...
slave_starter.py
import sys, os, time, json sys.path.append(os.getcwd()) from material_process.clip.clip_master import ClipMaster from material_process.clip.clip_worker import ClipWorker from material_process.audio.audio_master import AudioMaster from material_process.audio.audio_worker import AudioWorker from material_process.image.im...
dumping_callback_test.py
# Copyright 2019 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_arpack.py
from __future__ import division, print_function, absolute_import __usage__ = """ To run tests locally: python tests/test_arpack.py [-l<int>] [-v<int>] """ import warnings import threading import numpy as np from numpy.testing import assert_allclose, \ assert_array_almost_equal_nulp, run_mod...
background_logs.py
import threading from robot.api.logger import BackgroundLogger logger = BackgroundLogger() def log_from_main(msg): logger.info(msg) def log_from_background(msg, thread=None): t = threading.Thread(target=logger.info, args=(msg,)) if thread: t.setName(thread) t.start() def log_background_m...
live_predict.py
from sys import argv import cv2 import mediapipe as mp import itertools import numpy as np import time from collections import deque from multiprocessing import Queue, Process from queue import Empty import atexit from math import ceil from pathlib import Path import holistic import common USE_HOLISTIC = False PRIN...
vessel.py
""" 回测容器模块, 回测 """ import os from threading import Thread from time import sleep from ctpbee.log import VLogger from ctpbee.looper.data import VessData from ctpbee.looper.interface import LocalLooper from ctpbee.cprint_config import CP class LooperApi: def __init__(self, name): self.name = name def ...
server.py
# Copyright 2020 Center for Intelligent and Networked Systems, Department of Automation, Tsinghua University, Beijing, China. # This program is distributed under the Apache license 2.0. # Supported by National Key Research and Development Project of China (No. 2017YFC0704100 entitled New generation intelligent building...
tests.py
# -*- coding: utf-8 -*- # Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. from __future__ import unicode_literals import copy import os import re import shutil import tempfile import threading import time import unittest import warnings from django.conf import settings ...
monsoon_profiler.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import csv import multiprocessing import os import sys from telemetry.core import exceptions from telemetry.core import util from telemetry.core.platform im...
client.py
import socket import sys import threading PORT = 8999 HEADER = 128 FORMAT = 'utf-8' DISCONNECT_MESSAGE = '!DISCONNECT' SERVER = '192.168.0.27' ADDR = (SERVER, PORT) def input_thread(): while True: msg = input() if not len(msg) > 0: continue send(msg) if msg == DISCONNE...
netdisco_wrapper.py
""" Periodically start netdisco and extract naming info about the network. """ import json import requests import stat import subprocess from netdisco.discovery import NetworkDiscovery import os import threading import time import utils BASE_BINARY_PATH = 'https://github.com/noise-lab/netdisco-python-wrapper/raw/ma...
cli.py
# -*- coding: utf-8 -*- import configparser import random import sys import time from pathlib import Path from threading import Thread from urllib.parse import urlparse import click from . import __version__ from .controllers import Cache from .controllers import CastState from .controllers import get_chromecasts fro...
Hiwin_RT605_ArmCommand_Socket_20190627175041.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
shadow.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0. import argparse from awscrt import auth, io, mqtt, http from awsiot import iotshadow from awsiot import mqtt_connection_builder from concurrent.futures import Future import sys import threading import traceback ...
multifield_anserini.py
import os import math import json import tempfile import itertools import time import re import shutil import threading import contextlib from multiprocessing.pool import ThreadPool from functools import lru_cache from pytools import memoize_method import onir from onir import indices from onir.interfaces import trec f...
main.py
from spotify import DOWNLOADMP3 as SONGDOWNLOADER import telepot import spotify import requests import threading token = '1898871071:AAGQ1zoSHAZPVgzWIznZelLoHedC5inbUgI' bot = telepot.Bot(token) sort = {} def txtfinder(txt): a = txt.find("https://open.spotify.com") txt = txt[a:] return txt def cantfin...
test_payload.py
# -*- coding: utf-8 -*- ''' :codeauthor: Pedro Algarvio (pedro@algarvio.me) tests.unit.payload_test ~~~~~~~~~~~~~~~~~~~~~~~ ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import time import errno import threading import datetime # Import Salt Testing li...
PlaybackDetector.py
import time import tkinter as tk import HandTrackModule import math import Player import cv2 import numpy as np import threading import os class PlaybackDetector(): def __init__(self,mode=False,maxHands=1,detectionCon=0.5,trackCon=0.5): self.handDetector=HandTrackModule.handDetector(mode,maxHands,detectio...
Processing.py
#! /usr/bin/env python #-----------------------------------------# # Copyright [2015] [Kelcey Jamison-Damage] # 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.or...
ultrasonic.py
import RPi.GPIO as GPIO import time import threading from servos import Servos, ServoEnd, ServoDirection class DistanceSensors: def __init__(self): self.GPIO_FRONTTRIGGER = 20 self.GPIO_BACKTRIGGER = 5 self.GPIO_FRONTECHO = 6 self.GPIO_BACKECHO = 12 FRONTSERVO = 6 ...
runtests.py
#!/usr/bin/env python from __future__ import print_function import atexit import base64 import os import sys import re import gc import heapq import locale import shutil import time import unittest import doctest import operator import subprocess import tempfile import traceback import warnings import zlib import glo...
agentBruteForce.py
#!/usr/bin/env python3 ''' Brute Force Attack Agent ''' import sys,os import validators import re, random from furl import * from urllib.parse import urlparse import time, signal from multiprocessing import Process import threading import stomp import re from daemonize import Daemonize from os.path import basename fro...
droplet.py
from __future__ import annotations from dataclasses import dataclass, field from ..digitaloceanapi.droplets import Droplets from ..digitaloceanapi.volumes import Volumes from .action import * from .snapshot import * from .size import * from .volume import * from .account import * from ..common.cloudapiexceptions impor...
DevGui.py
#!/usr/bin/env python3 ############################################################################## ## This file is part of 'ATLAS ALTIROC DEV'. ## It is subject to the license terms in the LICENSE.txt file found in the ## top-level directory of this distribution and at: ## https://confluence.slac.stanford.edu/d...
httpserver.py
#!/usr/bin/python # -*-coding: utf8 -*- import threading from BaseHTTPServer import HTTPServer from SocketServer import ThreadingMixIn from httpserverhandler import HttpServerHandler class ThreadedHTTPServer(ThreadingMixIn, HTTPServer): """Handle requests in a separate thread.""" class HttpServer(): def __...