source
stringlengths
3
86
python
stringlengths
75
1.04M
h01.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: h01.py Author: Scott Yang(Scott) Email: yangyingfa@skybility.com Copyright: Copyright (c) 2021, Skybility Software Co.,Ltd. All rights reserved. Description: """ import multiprocessing import os import subprocess import time def test1(): while True: ...
classifier_rpc_worker_subsets_with_multiproc_2nd_cmpr_face_recog.py
"""An example of how to use your own dataset to train a classifier that recognizes people. """ # MIT License # # Copyright (c) 2016 David Sandberg # # 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 S...
v2Validation.py
#C1949699 # # import math import random import re import time from cv2 import INTER_AREA, INTER_BITS, INTER_CUBIC, INTER_LANCZOS4, INTER_LINEAR, INTER_LINEAR_EXACT, INTER_MAX, imread, imshow, waitKey import numpy as np import cv2 import os from multiprocessing import Process, Manager data_path = os.getcwd() dataset_pa...
driver_util.py
"""Scripts for drivers of Galaxy functional tests.""" import http.client import logging import os import random import re import shlex import shutil import signal import string import subprocess import sys import tempfile import threading import time from urllib.parse import urlparse import nose.config import nose.co...
test_enum.py
import enum import inspect import pydoc import unittest from collections import OrderedDict from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto from io import StringIO from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL from test import support try: import threading except ImportError...
example_control_vapix.py
import cv2 import sys import threading from sensecam_control import vapix_control ip = '000.000.000.000' login = 'login' password = 'password' exit_program = 0 def event_keyboard(k): global exit_program if k == 27: # esc exit_program = 1 elif k == ord('w') or k == ord('W')...
dispyadmin.py
#!/usr/bin/python2 """ This file is part of dispy; see https://dispy.org for details. """ import sys import os import socket import threading import json import cgi import time import ssl import re import hashlib import struct import collections import traceback import pycos from pycos import Task, AsyncSocket, seria...
multiprocess_iterator.py
from typing import Iterable, Iterator, List, Optional import logging from torch.multiprocessing import Manager, Process, Queue, get_logger from allennlp.common.checks import ConfigurationError from allennlp.data.instance import Instance from allennlp.data.iterators.data_iterator import DataIterator, TensorDict from a...
websockets.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # 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...
test.py
from __future__ import print_function from json import loads from time import time from multiprocessing import Process, JoinableQueue, cpu_count from threading import Thread from six.moves import range, zip from stat_parser.paths import TEST_DAT, TEST_KEY from stat_parser.parser import Parser from stat_parser.eval_par...
simple_lander3d.py
#!/usr/bin/env python3 ''' 3D Copter-Lander with simplified state and demands Copyright (C) 2020 Simon D. Levy MIT License ''' import numpy as np import gym from gym import spaces from gym.utils import seeding, EzPickle from gym_copter.dynamics.djiphantom import DJIPhantomDynamics class Lander3DS...
processmonitor.py
#!/usr/bin/env python import json from psutil import Process, NoSuchProcess from time import time, sleep from threading import Thread from supervisoragent.procstat import CPUStats from supervisoragent.ws import WebSocketConnection STATE_MAP = { 'STOPPED': 0, 'STARTING': 10, 'RUNNING': 20, 'BACKOFF': 3...
test.py
#!/usr/bin/env python # # Copyright 2008 the V8 project authors. 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 # noti...
bert_perf_test.py
#------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. #-------------------------------------------------------------------------- # This tool measures the inference performance of onnxruntime or onnxrunt...
server.py
import sys import threading import re import traceback from . import threads from . import core class FakeIO(object): def __init__(self, port, type, forward=None): self.port = port self.type = type self.forward = forward def write(self, msg): self.port.sock.sendall('%s: %s\n...
test_base.py
#!/usr/bin/python """ (C) Copyright 2019-2022 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...
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. """Profiler using data collected from a Monsoon power meter. http://msoon.com/LabEquipment/PowerMonitor/ Data collected is a namedtuple of (amps, volts), at...
pyrep.py
from pyrep.backend import sim, utils from pyrep.objects.object import Object from pyrep.objects.shape import Shape from pyrep.textures.texture import Texture from pyrep.errors import PyRepError import os import sys import time import threading from threading import Lock from typing import Tuple, List class PyRep(obje...
logger_file.py
#!/bin/env python import sys import uuid import time import signal import logging from argparse import ArgumentParser from logging.handlers import RotatingFileHandler from threading import Thread class LoggerManager: def __init__(self, args): # KB to bytes self.max_bytes = (args.size * 1000) ...
_server_adaptations.py
# Copyright 2016 gRPC authors. # # 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...
driver.py
# # Copyright 2021 Logical Clocks AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
udpserver.py
""" Listen on all interfaces for udp requests. This class processes all timing and control requests from all clients and send sync packages accordingly. """ import socket from logging import getLogger from collections import namedtuple from select import select from threading import Thread from raopy.util import Even...
foggycam.py
"""FoggyCam captures Nest camera images and generates a video.""" from urllib.request import urlopen import pickle import urllib import json from http.cookiejar import CookieJar import os from collections import defaultdict import traceback from subprocess import Popen, PIPE import uuid import threading import time fr...
runIDP-fusion.py
#!/usr/bin/env python import sys, os, re import threading import string ################################################################################ ######### GetPathAndName ########## # Break a path+filename into its components # # Pre: Takes a filename # Post: Return the path and filename strings # Modifies: ...
servers_test.py
# Copyright 2019 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 ...
learn.py
#!/usr/bin/python3 import json import csv from random import shuffle import warnings import pickle import gzip import operator import time import logging import math from threading import Thread import functools import multiprocessing # create logger with 'spam_application' logger = logging.getLogger...
simple_2way.py
"""Small example OSC server anbd client combined This program listens to serveral addresses and print if there is an input. It also transmits on a different port at the same time random values to different addresses. This can be used to demonstrate concurrent send and recieve over OSC """ import argparse import rando...
dmlc_ssh.py
#!/usr/bin/env python """ DMLC submission script by ssh One need to make sure all slaves machines are ssh-able. """ import argparse import sys import os import subprocess import tracker import logging from threading import Thread class SSHLauncher(object): def __init__(self, args, unknown): self.args = a...
gen_w_and_launch_gazebo.py
from cgi import test import pickle import time import threading import os import sys import rospy from kill_functions import * from topographic_map_from_world_tree import topological_graph_from_world_tree from mine_topological_map.graph import Graph from mine_topological_map.drawing import GraphDrawing from subt_world...
backupmanager.py
import json import os import random import time import threading from multiprocessing import Process from assemblyline.common import forge from assemblyline.common.uid import get_random_id from assemblyline.odm.models.error import ERROR_TYPES from assemblyline.remote.datatypes.hash import Hash from assemblyline.remo...
udp_load_balancer_test.py
import socket import unittest from redis import Redis from threading import Thread from time import sleep import subprocess import os import signal class UdpLoadBalancerTestCase(unittest.TestCase): LOAD_BALANCER_PORT = 8137 SERVERS_LIST = [ ('localhost', 9239), ('127.0.0.1', 9240), ('1...
transfer.py
#!/usr/bin/env python """Upload and download support for apitools.""" from __future__ import print_function import email.generator as email_generator import email.mime.multipart as mime_multipart import email.mime.nonmultipart as mime_nonmultipart import io import json import mimetypes import os import threading impo...
proxyIpSpider.py
# -*- coding: UTF-8 -*- import urllib3 import threading import json import os from bs4 import BeautifulSoup """ 高匿代理Ip爬虫 """ class ProxyIpSpider: url = 'http://www.xicidaili.com/nn/' page = 1 headers = { 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, lik...
sdkserver.py
# Copyright 2017,2018 IBM Corp. # # 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 agr...
crazyflie_class.py
import sys import tty import time import signal import struct import termios import argparse import threading import bluepy as b import numpy as np try: import os if os.environ['BOARD'] == 'Ultra96': os.environ["DISPLAY"] = ":0" except KeyError: pass from pynput.keyboard import Key, Listener, Contro...
regen.py
#!/usr/bin/env python3 import bz2 import os import time import multiprocessing from tqdm import tqdm import argparse # run DM procs os.environ["USE_WEBCAM"] = "1" import cereal.messaging as messaging from cereal import car from cereal.services import service_list from cereal.visionipc.visionipc_pyx import VisionIpcSer...
app.py
import logging import multiprocessing as mp from data import LapData from incoming import read_incoming_tags from outgoing import send_outgoing_notifications logging.basicConfig( filename='relay.log', level=logging.DEBUG, format='%(asctime)s %(levelname)s %(module)s %(message)s' ) if __name__ == '__main...
manager.py
#!/usr/bin/python from flask import Flask from flask import request import threading import json import update import time import sys, getopt app = Flask(__name__) servers_file='/etc/haproxy/servers.json' lb_port = 80 SECONDS_TO_EXPIRE = 30 serversi = {} def read_servers_json_file(): global servers s = json.loa...
pythonbuild.py.launcher.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
test_groups.py
import json import time from threading import Thread from socksync.errors import SockSyncErrors from test import helpers def test_constructor_subscribe_remote(socket, remote_groups): for group in remote_groups: assert group.subscribed def test_subscribe_remote(socket, remote_groups): for group in r...
phpdaemon.py
import sublime import os import json import subprocess import threading import socket import time # sends a remote command to the php daemon # and returns the result def runRemoteCommandInPHPDaemon(prefs, command, args, aSync=False): payload = {} payload['cmd'] = command payload['args'] = args json_st...
GUI_queues_put_get_loop_endless_threaded.py
''' May 2017 @author: Burkhard A. Meier ''' #====================== # imports #====================== import tkinter as tk from tkinter import ttk from tkinter import scrolledtext from tkinter import Menu from tkinter import messagebox as msg from tkinter import Spinbox from time import sleep import Ch04_Code...
main.py
from PySide2.QtCore import QSettings from PySide2.QtWidgets import QApplication, QMainWindow, QMessageBox, QLabel from riden import Riden from ridengui.serial import open_serial from ridengui.settings import open_general from ridengui.ui import Ui_MainWindow from threading import Lock, Thread import signal import sys ...
pabot.py
#!/usr/bin/env python # Copyright 2014->future! Mikko Korpela # # 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 ...
test_ibm_job.py
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
vngateio_ws.py
# encoding: utf-8 import json from time import time, sleep from threading import Thread from datetime import datetime import base64 import hmac import hashlib import json import gzip, binascii, os import urllib , requests import websocket import time from vnpy.trader.vtFunction import systemSymbolToVnSymbol ,...
views.py
from django.shortcuts import HttpResponse from rest_framework.exceptions import MethodNotAllowed from rest_framework.viewsets import GenericViewSet from rest_framework.mixins import RetrieveModelMixin, CreateModelMixin, ListModelMixin from rest_framework.response import Response from utils import views from wxpy imp...
dvrk_mtm_cartesian_impedance.py
#!/usr/bin/env python # Author: Anton Deguet # Date: 2017-07-22 # (C) Copyright 2017-2022 Johns Hopkins University (JHU), All Rights Reserved. # --- begin cisst license - do not edit --- # This software is provided "as is" under an open source license, with # no warranty. The complete license can be found in licen...
vujade_multiprocess.py
""" Dveloper: vujadeyoon E-mail: sjyoon1671@gmail.com Github: https://github.com/vujadeyoon/vujade Title: vujade_multiprocess.py Description: A module for multi-processing """ import os import time from multiprocessing import Process from multiprocessing import Queue class _BaseMultiProcess: def __init__(self,...
bot_utils.py
import logging import re import threading import time from bot import download_dict, download_dict_lock LOGGER = logging.getLogger(__name__) MAGNET_REGEX = r"magnet:\?xt=urn:btih:[a-zA-Z0-9]*" URL_REGEX = r"(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+" class MirrorStatus: STATUS_UPLOADING = "𝗨𝗽�...
utils.py
''' Class for using separate thread for video streaming through web camera''' import cv2 from threading import Thread class WebcamVideoStream: def __init__(self, src=0): self.stream = cv2.VideoCapture(src,cv2.CAP_DSHOW) (self.grabbed, self.frame) = self.stream.read() self.stopped = False d...
wsdump.py
#!c:\users\ryan\python~1\roomrs~1\roomrs~1\scripts\python.exe import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding = getattr(sys....
run_wfe_sv_dualthread_laptop.py
#!/usr/bin/python3 ''' Run Wait_for_edge program ''' import cv2 import numpy as np import time import threading # import RPi.GPIO as GPIO # from ubi_test import post_request def save_video_len(video_len): print('Starting cam 1') video_frames = [] cap = cv2.VideoCapture(0) fps = cap.get(cv2.CAP_PR...
PoseQueue.py
import time from threading import Thread class PoseQueue(object): """ A PoseQueue collects translation vectors over time so that we can apply a probablistic model to where the expected position is of an aruco marker. - aruco_id <int>: the aruco_id associated with the Pose ...
server2.py
import pdb # for debuggin import pprint # for pretty print import subprocess # for running exec code import os # for deleting temp file import multiprocessing # for server threading import socket # for communication import signal # for killin...
RunnerHandler.py
import os import sys import types import pickle import base64 import traceback import threading import fcntl import struct from io import BytesIO from contextlib import contextmanager from functools import wraps __copyright__ = 'Copyright (C) 2019, Nokia' TOKEN = b'+7_<sf80UBtd%umz' SIZE_PACKER = struct.Struct('!I')...
listener_daemon.py
import threading, time, subprocess from bluetooth import * server_sock=BluetoothSocket( RFCOMM ) server_sock.bind(("",PORT_ANY)) server_sock.listen(1) port = server_sock.getsockname()[1] uuid = "c3091f5f-7e2f-4908-b628-18231dfb5034" advertise_service( server_sock, "PiRecorder", service_id = uuid, ...
toio.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #toio BLE sample (with Adafruit_BluefruitLE) #auther: mizumasa import os import math import time import threading import numpy as np import toio_util import toio_message from toio_config import * from toio_tracer import TOIO_TRACER, SPEED_BALANCER, FPS_CONTROL...
__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Han Xiao <artex.xh@gmail.com> <https://hanxiao.github.io> import sys import threading import time import uuid from collections import namedtuple import numpy as np import zmq from zmq.utils import jsonapi __all__ = ['__version__', 'BertClient'] # in the future client ...
test_stream.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020-2021 Alibaba Group Holding Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
copyutil.py
# cython: profile=True # 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 # "...
SafeShutdown.py
import RPi.GPIO as GPIO import os import time from multiprocessing import Process #initialize pins powerPin = 3 #pin 5 ledPin = 14 #TXD resetPin = 2 #pin 13 powerenPin = 4 #pin 5 #initialize GPIO settings def init(): GPIO.setmode(GPIO.BCM) GPIO.setup(powerPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(resetPin...
rbk_validate.py
#!/usr/bin/python from __future__ import print_function import rubrik_cdm import sys import getpass import getopt import datetime import pytz import time import urllib3 import json urllib3.disable_warnings() import threading try: import queue except ImportError: import Queue as queue from random import randran...
driver.py
from flask import Flask, request, json from datetime import datetime import toml import logging import requests import threading import hashlib import time class Driver: def __init__(self, port, servers, bldg_ns): self._port = port self._servers = servers self._server_updated = {srv: False...
device_report_client.py
"""gRPC client to send device result""" import threading import grpc from forch.proto.grpc.device_report_pb2_grpc import DeviceReportStub from forch.proto.devices_state_pb2 import DevicesState, Device from utils import dict_proto _SERVER_ADDRESS_DEFAULT = '127.0.0.1' _SERVER_PORT_DEFAULT = 50051 class DeviceRepor...
plotproc.py
import multiprocessing as mp import queue import matplotlib as mpl mpl.use("tkagg") import matplotlib.pyplot as plt import time from .plothyst import plothyst #def _f_proc(q, **kwargs): # """Process target function""" # _Plotter(q, **kwargs) class _Plotter(mp.Process): """Core plotting object. Controlled by...
controller.py
import functools import inspect import json import re from copy import copy, deepcopy from datetime import datetime from logging import getLogger from threading import Thread, Event, RLock from time import time from typing import Sequence, Optional, Mapping, Callable, Any, List, Dict, Union, Tuple from attr import att...
test_threads.py
import threading import queue as stdlib_queue import time import os import signal import pytest from .. import _core from .. import Event from ..testing import wait_all_tasks_blocked from .._threads import * from .._timeouts import sleep from .._core.tests.test_ki import ki_self async def test_do_in_trio_thread(): ...
module_rss.py
from __future__ import unicode_literals, print_function, division import feedparser import dataset from twisted.internet.reactor import callLater from threading import Thread import twisted.internet.error import logging logger = logging.getLogger("module_rss") DATABASE = None updater = None botref = None config = {} ...
watcher.py
from __future__ import absolute_import import sys # Ensure we don't have the wandb directory in the path to avoid importing our tensorboard # module. This should only happen when wandb is installed with pip -e or pip install ...#egg=wandb for path in sys.path: if path.endswith("/client/wandb"): sys.path.re...
cron.py
import sched import threading import time from typing import Callable from typing import Dict from typing import Optional import uuid import zulip from lib import common from lib.events import EventGenerator from lib.state_handler import StateHandler class Cron: """ Provides a cron-like interface for other c...
webserver.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "I'm alive" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()
producer_consumer_compare.py
# -*- coding: utf8 -*- __author__ = 'wangqiang' import queue import threading import time import asyncio ''' 比较同步模式和异步模式下,生产者消费者模型的耗时情况 ''' def original_producer_consumer(tcount): def producer(q, tcount): for i in range(0, tcount): q.put(i) def consumer(q, tcount): st = time.tim...
test_s3boto3.py
import gzip import pickle import threading from datetime import datetime from textwrap import dedent from unittest import mock, skipIf from urllib.parse import urlparse from botocore.exceptions import ClientError from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core....
notification.py
from hoverset.platform import PLATFORM, WINDOWS import threading import time import os if PLATFORM == WINDOWS: import win32api import win32con import win32gui # noinspection PyBroadException class WindowsNotification: # Inspired by Jithu R Jacob windows10Toast library def __init__(self): ...
model.py
import os import logging import sys import time import json import redis import attr import io import multiprocessing as mp import importlib import importlib.util import inspect from typing import Dict from abc import ABC, abstractmethod from datetime import datetime from itertools import tee from contextlib import co...
webqq_client.py
# -*- coding: UTF-8 -*- import json import webqq_utils from webqq_protocol_gen import WebQQProtocolGenerator from webqq_data_parse import WebQQDataParse import cv2 import matplotlib.pyplot as plt import urllib2 import cookielib import os import tempfile import threading # 65 二维码失效(应该,重新获取登录二维码) STATUS_QR_CHECK_INVALI...
register_comb_daybyday.py
#============================================================ # GREGISTERING+IMCOMBINE DAY BY DAY WITHIN 30 MIN # 2019.06.24. CREATED BY Gregory S.H. Paek #============================================================ from astropy.io import fits import numpy as np import os, sys, glob import alipy import time import ast...
slave.py
# coding=utf-8 import random import threading import time import numpy as np from utils.connection import HOST, PORT from utils.slaveHandler import Handler def multiply(source): slaveRows = source[0] slaveMat = source[1] vect = source[2] taskTime = [] taskValue = [] taskIndex = [] rowNum...
workpool.py
"""!Contains the WorkPool class, which maintains pools of threads that perform small tasks.""" ##@var __all__ # List of symbols exported by "from produtil.workpool import *" __all__=["WorkPool","WrongThread"] import threading, collections, time import produtil.pipeline, produtil.sigsafety class WrongThread(Exception)...
subproc_vec_env.py
import os import multiprocessing from collections import OrderedDict from typing import Sequence import gym import numpy as np from neorl.rl.baselines.shared.vec_env.base_vec_env import VecEnv, CloudpickleWrapper def _worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper....
self_play.py
""" Holds the worker which trains the chess model using self play data. """ import os from collections import deque from concurrent.futures import ProcessPoolExecutor from datetime import datetime from logging import getLogger from multiprocessing import Manager from threading import Thread from time import time from c...
leo_cloud.py
""" leo_cloud.py - synchronize Leo subtrees with remote central server Terry N. Brown, terrynbrown@gmail.com, Fri Sep 22 10:34:10 2017 This plugin allows subtrees within a .leo file to be stored in the cloud. It should be possible to support various cloud platforms, currently git and systems like DropBox are supporte...
learmcode.py
#!/usr/bin/env python from time import sleep import serial import binascii from multiprocessing import Process, Queue FRAME_HEADER = 0x55 CMD_SERVO_MOVE = 0x03 CMD_ACTION_GROUP_RUN = 0x06 CMD_ACTION_GROUP_STOP = 0x07 CMD_ACTION_GROUP_SPEED = 0x0B CMD_GET_POSITIONS = 0x15 CMD_GET_BATTERY_VOLTAGE = 0x0F BATTERY_VOLTAGE...
client.py
# -*- coding: utf-8 -*- from threading import Thread from socket import * import threading, time def client(server_ip, port): c = socket(AF_INET, SOCK_STREAM) # 套接字对象一定要加到函数内,即局部名称空间内,放在函数外则被所有线程共享,则大家公用一个套接字对象,那么客户端端口永远一样了 try: c.connect((server_ip, port)) c.send(('%s say hello %s' % (threa...
pyroslib.py
################################################################################ # Copyright (C) 2016-2020 Abstract Horizon # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License v2.0 # which accompanies this distribution, and is available at # http...
logger.py
import six from traceback import format_exc from datetime import datetime from six.moves.queue import Queue import threading import logging import socket import json import time import ssl LOG_QUEUE_SIZE = 5000 BACKOFF_INITIAL = 0.1 BACKOFF_MULTIPLE = 1.2 INTERNAL_LOG = logging.getLogger('clay_internal') class TC...
server.py
from __future__ import ( absolute_import, unicode_literals, ) import argparse import atexit import codecs import importlib import logging import logging.config import os import random import signal import sys import threading import time import traceback from types import FrameType from typing import ( Any...
server.py
import os import socket import threading from crypto import * HOST = input("Host: ") PORT = int(input("Port: ")) server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((HOST, PORT)) server.listen() print(f'Server is Up and Listening on {HOST}:{PORT}') clients = [] usernames = [] de...
object_detector.py
import numpy as np import cv2 import socket import threading import time class ObjectDetector(threading.Thread): def __init__(self, vs, detector, messenger, on_finish, debug_ip, debug_port): super().__init__() self.vs = vs self.detector = detector self.messenger = messenger ...
callbacks_test.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
stlplater.py
#!/usr/bin/env python3 # This file is part of the Printrun suite. # # Printrun 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 3 of the License, or # (at your option) any later version. # # Pri...
engine.py
# (C) Copyright 1996- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernment...
main.py
# -*- coding: utf-8 -*- """ Created on Tue Jul 11 18:48:04 2017 @author: Yugal """ from keras.models import model_from_json from keras.preprocessing.image import ImageDataGenerator import cv2 import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np import threading fro...
tcp_proxy.py
#!/usr/bin/env python3 import argparse import socket import subprocess import sys import threading parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-r', '--rhost', type=str, dest='rhost', default='127.0.0.1', help='remote host address') parser.add_argument(...
Copied Turret.py
try: import cv2 except Exception as e: print("Warning: OpenCV not installed. To use motion detection, make sure you've properly configured OpenCV.") import time import thread import threading import atexit import sys import termios import contextlib import imutils import RPi.GPIO as GPIO from Adafruit_MotorHA...
util.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 Thomas Voegtlin # # 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...
datapostgres.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright Kitware 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 ...
test_httplib.py
import errno from http import client import io import itertools import os import array import re import socket import threading import warnings import unittest TestCase = unittest.TestCase from test import support from test.support import socket_helper here = os.path.dirname(__file__) # Self-signed cert file for 'lo...
vm_util_test.py
# Copyright 2018 PerfKitBenchmarker 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...