source
stringlengths
3
86
python
stringlengths
75
1.04M
oai_kpa_interface_backend.py
from PyQt5 import QtGui from PyQt5.QtWidgets import QWidget, QTableWidgetItem import threading import time import json import os.path from . import oai_kpa_interface_gui from . import utils from . import oai_kpa_interface class OAI_KPA_Interface_controller(QWidget, oai_kpa_interface_gui.Ui_Form): def __init__(se...
drone_sample_controller_pictures.py
#!/usr/bin/env python import ConfigParser #to parse config file with drone and employer's addresses and keys import cv2 #for image converting import ipfshttpclient #to send data to IPFS import os #to locate files import rospy #Python client library for ROS import subprocess #to call shell commands from terminal and us...
test_http.py
# 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, software # distributed under the Li...
start_and__monitor.py
''' Copyright 2019-present Open Networking Foundation SPDX-License-Identifier: Apache-2.0 ''' import zmq import time import threading import sys import signal import os old_stats = {"in_router" : {}, "out_router" : {}} new_stats = {"in_router" : {}, "out_router" : {}} def createDir(dir): try: if not...
cctv.py
import sys, time, argparse, re, threading import pyfiglet #pip'i içe aktar import iş parçacığından içe aktarma Kilidi from colorama import init termcolor ithal renkli lib'lerden masscanscanner'ı masscan olarak içe aktarın libs ithalat satıcısından lib'lerden saldırı rotalarını içe aktar lib'lerden saldırı kimlik bilgil...
conftest.py
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
day27-4 线程之间执行是无序的.py
# 结论:线程之间执行是无序的,具体调用哪个线程是由CPU决定的 import threading import time def task(): time.sleep(1) # 获取当前线程 print(threading.current_thread()) if __name__ == '__main__': # 循环创建大量线程 for i in range(10): # 每循环一次创建一个子线程 sub_thread = threading.Thread(target=task) # 启动子线程对应任务 sub_th...
artnet.py
""" Home Assistant support for Art-Net/DMX lights over IP Date: 2018-08-14 Homepage: https://github.com/jnimmo/hass-artnet Author: James Nimmo """ import asyncio import logging import socket from struct import pack from threading import Thread import time from homeassistant.const import (CONF_DE...
Episode 08 - Multiprocessing in Windows.py
import time from multiprocessing import Process def ask_user(): start = time.time() user_input = input('Enter your name: ') greet = f'Hello {user_input}, nice to see you here..!' print(greet) print(f'ask_user, {time.time() - start}') def complex_calculation(): start = time.time() print('...
master.py
#!/usr/bin/python3 import time import sys from datetime import datetime import csv import threading from multiprocessing import Process import configparser import fileinput import RPi.GPIO as GPIO import numpy as np import os import board import busio import adafruit_ads1x15.ads1015 as ADS import adafruit_ads1x15.ad...
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 os_helper from test.support import socket_helper from test.support import warni...
bridge_acclimt4-2.py
#!/usr/bin/env python3 import argparse import carla # pylint: disable=import-error import math import numpy as np import time import threading from cereal import log from multiprocessing import Process, Queue from typing import Any import cereal.messaging as messaging from common.params import Params from common.numpy...
test_execute.py
# coding: utf-8 import collections.abc as collections_abc from contextlib import contextmanager from contextlib import nullcontext import copy from io import StringIO import re import threading from unittest import mock from unittest.mock import call from unittest.mock import Mock from unittest.mock import patch impor...
c6dwifi.py
import ctypes import socket import threading import time import sys from zeroconf import ServiceBrowser, Zeroconf import logging logger = logging.getLogger('c6dwifi') logger.setLevel(logging.INFO) libgphoto_names = ['libgphoto2.so.6', 'libgphoto2.6.dylib'] class GPhotoError(Exception): def __init__(self, result,...
train.py
import argparse import logging import math import os import random import time from copy import deepcopy from pathlib import Path from threading import Thread import numpy as np import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_sche...
test_cassandra.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...
exporter.py
import time import os import sys import signal import argparse import threading import faulthandler from wsgiref.simple_server import make_server, WSGIRequestHandler, WSGIServer try: from urllib import quote_plus from BaseHTTPServer import BaseHTTPRequestHandler from SocketServer import ThreadingMixIn ...
exp_orbiting.py
"""Makes BlueBot around two vertically stacked lights Contains generic vision based functions that can be used elsewhere including homing and depth control. Also contains depth control using the depth sensor and logger functions. Attributes: caudal (): Fin object for caudal fin depth_ctrl (bool): Depth contro...
solution.py
import os import threading import queue import time from utils.grid_tools_2d import Point, Vector from utils.intcode_computer import IntCodeComputer, get_program import curses debug_log = "debug.txt" class Terminal: tiles = { 0: " ", 1: "█", 2: "▒", 3: "=", 4: "*", }...
advokado.py
#!/usr/bin/env python#!/usr/bin/env python # -*- coding: utf-8 -*- import random import schedule as schedule import telebot import configparser import re import time from datetime import datetime, timedelta import traceback import threading from database import DataBase # import drawer #чекнуть что с этой залупой con...
1194021_M. RIZKY_D4 TI - 3A_UTS SISTER.py
import logging import multiprocessing import threading from time import sleep from random import randrange LOG_FORMAT = '%(asctime)s %(threadName)-17s %(levelname)-8s %(message)s' logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) foods = [] condition = threading.Condition() num_chef = 3 chef = ['Chef 1', 'Ch...
mqtt_tcp_example_test.py
import re import os import sys import socket from threading import Thread import struct import time from tiny_test_fw import DUT import ttfw_idf msgid = -1 def get_my_ip(): s1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s1.connect(("8.8.8.8", 80)) my_ip = s1.getsockname()[0] s1.close() re...
async_optimization.py
import time import random from bayes_opt import BayesianOptimization from bayes_opt.util import UtilityFunction, Colours import asyncio import threading try: import json import tornado.ioloop import tornado.httpserver from tornado.web import RequestHandler import requests except ImportError: ...
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 = True class Protocol(Enum): IMAGE = 0 VIDEO = 1 CSI = 2 V4L2 = 3 RTS...
base_camera.py
import time import threading try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident class CameraEvent(object): """An Event-like class that signals all active clients when a new frame is ...
settings_20210906115137.py
""" Django settings for First_Wish project. Generated by 'django-admin startproject' using Django 3.2. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathli...
worker_daemon.py
from threading import Thread import Pyro4 from pbt.network import Daemon @Pyro4.expose class WorkerDaemon(Daemon): def __init__(self, worker): self.worker = worker self.pyro_daemon = None @property def worker_id(self): return self.worker.worker_id def start(self): s...
agent_simulator.py
import os import random import socket import sys import time import multiprocessing import argparse import uuid import yaml import metric_simulator from monascaclient import client from monascaclient import ksclient from monascaclient import exc wait_time = 30 no_wait = False number_of_agents = int(os.environ.ge...
boss.py
import numpy as np import os import pdb import matplotlib.pyplot as plt from pydl.pydlutils import yanny from pyvista import imred, spectra, sdss from tools import match,plots from ccdproc import CCDData import multiprocessing as mp def visit(planfile,tracefile=None) : """ Reduce BOSS visit Driver for par...
threading-simpleargs.py
#!/usr/bin/env python # -*- coding: utf8 -*- import threading def worker(num): """thread worker function""" print 'worker: %s' % num return threads = [] for i in range(5): t = threading.Thread(target=worker, args=(i, )) threads.append(t) t.start()
forin.py
from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from kivy.uix.button import Button from kivy.uix.textinput import TextInput from kivy.uix.gridlayout import GridLayout from kivy.config import Config from kivy.uix.switch import Switch import random from kivy.lan...
gatecoin.py
from bitfeeds.socket.restful import RESTfulApiSocket from bitfeeds.exchange import ExchangeGateway from bitfeeds.market import L2Depth, Trade from bitfeeds.util import Logger from bitfeeds.instrument import Instrument from bitfeeds.storage.sql_template import SqlStorageTemplate import time import threading from functoo...
util.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import stat import shutil import re import time import struct import zipfile import lhafile import operator import threading import hashlib import subprocess import StringIO import io import traceback import datetime import ctypes ...
worker.py
from contextlib import contextmanager from datetime import datetime import getpass import logging from multiprocessing import Process import os import platform import signal import sys import time import random from pymongo.errors import ConnectionFailure from mtq.log import MongoStream, MongoHandler from mtq.utils i...
config.py
import sys import webbrowser from os.path import exists, join from shutil import copyfile, copytree from threading import Thread from time import sleep from django.apps import AppConfig from django.conf import settings from requests import get as requests_get class PyplanAppConfig(AppConfig): name = 'pyplan.pypl...
display_Run.py
import cv2 import _thread import time import multiprocessing as mp from luma.core.interface.serial import i2c from luma.core.render import canvas from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106 from time import sleep from PIL import Image cap= cv2.VideoCapture('/home/pi/Downloads/videoplayback...
proxier.py
import atexit from concurrent import futures from dataclasses import dataclass import grpc import logging from itertools import chain import json import socket import sys from threading import Event, Lock, Thread, RLock import time import traceback from typing import Callable, Dict, List, Optional, Tuple import ray fr...
csv_to_mr.py
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
tunnel.py
"""Basic ssh tunnel utilities, and convenience functions for tunneling zeromq connections. Authors ------- * Min RK """ #----------------------------------------------------------------------------- # Copyright (C) 2010-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full...
http_utils.py
# coding: utf-8 from __future__ import unicode_literals from bottle import HTTPError, ServerAdapter from functools import partial, wraps from threading import Thread RETRY_AFTER_HEADER = str('Retry-After') def abort(code, message=None, headers=None): """ Abort a request and send a response with the given c...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS # environment import ftplib import asyncore import asynchat import socket import io import errno import os import threading import time try: import ssl except ImportError: ssl = None from u...
GoBackN.py
import socket import math import time import threading from Helpers import PacketState, calc_checksum, lose_the_packet, make_ack_packet, print_progress_bar PACKET_SIZE = 200 HEADER_SIZE = 12 SERVER_PORT_NO = None PLP = None WINDOW_SIZE = None MAX_SEQ_NO = None main_lock = threading.Lock() threads = [] state = { ...
main.py
import cv2 import pyautogui import time import numpy as np import keyboard from sentdex import PressKey, ReleaseKey, W, A, S, D import imutils import threading CHARACTER_POSITION = [190, 301] CAPTURE_AREA = ((433, 400), (950, 893)) QUIT = False # We loop in-game until this is set to True. ALLOWED_KEYS ...
instance.py
#!/usr/bin/env python # encoding: utf-8 """ instance.py - manage the behaviour on an individual instance Created by Dave Williams on 2016-07-05 """ import sys import os import traceback import time import optparse import urllib.request import multiprocessing as mp import boto from . import run ## Reporting to SQS...
bigpipe_response.py
import enum import json import logging import queue import sys import threading import traceback from django.http import StreamingHttpResponse from django.http.response import HttpResponseBase from bigpipe_response.bigpipe import Bigpipe from bigpipe_response.bigpipe_render_options import BigpipeRenderOpt...
execute.py
import contextlib import json import mimetypes import os import subprocess import sys import threading import time import traceback from binaryornot.check import is_binary from collections import deque from datetime import datetime, timedelta from pathlib import Path from textwrap import dedent from .server import Se...
fritzbox_callmonitor.py
""" A sensor to monitor incoming and outgoing phone calls on a Fritz!Box router. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.fritzbox_callmonitor/ """ import logging import socket import threading import datetime import time import re import v...
main.py
from process import CustomProcess from multiprocessing import Process import random import time # Create the processes process1 = CustomProcess('Process 1') process2 = CustomProcess('Process 2') process3 = CustomProcess('Process 3') processes = [process1, process2, process3] if __name__ == '__main__': print('Pro...
mufaintervals.py
import time, threading import math import datetime import mufadb as db import mufabattle as mb import mufagenerator as mg StartTime=time.time() def hourly_content_generation(): mg.generate_random_dungeons() mg.dungeon_monsters_generate() mg.global_monsters_generate() def action() : print('action ! -...
unittest_targets.py
#!/usr/bin/env python3 # # Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # # 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 # ...
WrappedVisualizationWindow.py
import pickle import time import threading from PyQt5 import QtWidgets from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton, QApplication, QMessageBox) from .VisualizationWindow import VisualizationWindow import sys sys.path.append("...") from backend import ModuleManipulator class WrappedVisualizationWin...
processor.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
send_policy.py
from threading import Thread from time import sleep, time #import face_recognition import requests #import numpy as np import yaml import os class SendPolicy: def __init__(self) -> None: """ Initialize SendPolicy module, establishing some vars. """ self.ready = True ...
Test_time_RAM_CPU.py
from subprocess import call from Select_15_min import process_stop import threading import psutil import os import time import csv def llamada(programa,parametros): i = 0 params = "" while (i<len(parametros)): params = params + parametros[i] + " " return_code = call([programa, params]) retu...
hislip_server.py
# -*- coding: utf-8 -*- """ @author: Lukas Sandström """ from __future__ import absolute_import, division, print_function, unicode_literals import logging import struct import threading from cStringIO import StringIO from pprint import pprint import socket try: import SocketServer as socketserver except Import...
ClientStart.py
#!/usr/bin/env python2 import __builtin__ import os __builtin__.process = 'client' # Temporary hack patch: __builtin__.__dict__.update(__import__('pandac.PandaModules', fromlist = ['*']).__dict__) from direct.extensions_native import HTTPChannel_extensions from direct.extensions_native import Mat3_extensions from dir...
gthread.py
import aio import inspect # mark not started but no error aio.error = None aio.paused = False aio.fd = {} aio.pstab = {} def _shutdown(): print(__file__, "_shutdown") # https://docs.python.org/3/library/threading.html#threading.excepthook # a green thread # FIXME: fix wapy BUG 882 so target can be None too i...
TProcessPoolServer.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
loader.py
import logging import os import sys import threading log = logging.getLogger( __name__ ) def download_prepare( directory ): """""" log.info( 'Creating dumps directory' ) os.popen( 'mkdir -p %s' % directory ) def dump_download( url, directory ): """""" # extract filename from url filename = u...
email.py
from flask_mail import Message from app import mail from flask import render_template from app import app from threading import Thread from flask_babel import _ def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_mail(subject, sender, recipients, text_body, html_body): msg ...
core.py
# -*- coding: utf-8 -*- import io import os import subprocess import sys import time from collections import defaultdict from collections import deque from copy import deepcopy from typing import Any as AnyType from typing import Callable from typing import DefaultDict from typing import Deque from typing import Dict f...
script.py
import humanaction_client import argparse from threading import Thread import time from imutils.video import FileVideoStream import imutils ap = argparse.ArgumentParser() ap.add_argument("-v", "--video", required=True, help="path to input video file") args = vars(ap.parse_args()) def imshoww(): print("[I...
10sb.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time,random,sys,json,codecs,threading,glob cl = LINETCR.LINE() cl.login(qr=True) cl.loginResult() ki = LINETCR.LINE() ki.login(qr=True) ki.loginResult() kk = LINETCR.LINE() kk.login(qr=True) kk.loginRe...
receiver.py
from collections import deque from enum import Flag from os import read from threading import Thread import cv2 as cv from net import connection frames = deque() def get(): if (len(frames)>0): return frames.popleft() else: return None def save(frame): # import cv2 as cv # with open("...
main.py
#!/usr/bin/env python3 import os import sys import cv2 import copy import pathlib import threading import shutil import numpy as np import pyqtgraph as pg import pandas as pd from plotting import auto_draw from preProcess import preprocess from pupil_tracker import auto_tracker from glint_tracker import g_auto_tracker ...
RUN_ME_Flouroscence.py
######### #Imports# ######### # Python Basics import sys import os import ast from threading import Thread import time # Interfacing if sys.version_info[0] == 3: # for Python3 import tkinter as tk else: # for Python2 import Tkinter as tk # Image process import PIL.Image, PIL.ImageTk from matplotlib.bac...
test_engine_py3k.py
import asyncio from sqlalchemy import Column from sqlalchemy import create_engine from sqlalchemy import delete from sqlalchemy import event from sqlalchemy import exc from sqlalchemy import func from sqlalchemy import inspect from sqlalchemy import Integer from sqlalchemy import select from sqlalchemy import String f...
TempChange.py
import threading import time def check_energy(): """ Gets the mass and change information from list (version 2 will use other process) Then calculates the energy needed (in Joules) & displays Finally checks if user is finished, if not re-run after 1 seconds WE ARE USING: A count of 24 with ...
logger.py
import collections import threading import traceback import json from subprocess import PIPE, Popen, check_output import paho.mqtt.client as mqtt try: # Transitional fix for breaking change in LTR559 from ltr559 import LTR559 ltr559 = LTR559() except ImportError: import ltr559 from bme280 import BME...
server.py
#!/usr/bin/env python3 import socket import threading # The port that we want to bind to our server PORT = 5050 # IP address of your computer # SERVER = socket.gethostbyname(socket.gethostname()) SERVER = "127.0.0.1" ADDR = (SERVER, PORT) # Specification of my own custom protocol HEADER_SIZE = 64 FORMAT = "utf-8" DI...
system.py
""" Copyright 2018 Banco Bilbao Vizcaya Argentaria, S.A. 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 ...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import queue as pyqueue import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import struct import operator import test.support import test.support.script_...
run_folder.py
import multiprocessing import os, sys import numpy as np import runner import time def main(folder_path: str, gpus: str, parallel_runs=3, num_reruns=3): gpus = gpus.strip().split(',' if ',' in gpus else ';') parallel_runs = int(parallel_runs) num_reruns = int(num_reruns) assert parallel_runs % len(gp...
electronic_control_unit.py
import logging import can from can import Listener import time import threading try: # Python27 import Queue as queue except ImportError: # Python35 import queue import j1939 logger = logging.getLogger(__name__) class ElectronicControlUnit(object): """ElectronicControlUnit (ECU...
tests.py
import io import json from django.db.models.signals import * from django.test import TestCase, override_settings from django_signals_cloudevents import send_cloudevent, default_handler import os from django_fake_model import models as f from django.db import models from http.server import BaseHTTPRequestHandler, HT...
ping2_advanced.py
#! /usr/bin/env python3 # -*-coding:utf-8 -*- # @Time : 2019/06/16 16:44:29 # @Author : che # @Email : ch1huizong@gmail.com # 多队列和多线程池, 会把活动的结果加入到arping队列 import re from threading import Thread import subprocess from queue import Queue num_ping_threads = 3 num_arp_threads = 3 in_queue = Queue() out_queue = Queu...
test_config.py
import asyncio import copy import pytest import random import yaml from shibgreen.util.config import create_default_shibgreen_config, initial_config_file, load_config, save_config from shibgreen.util.path import mkdir from multiprocessing import Pool, TimeoutError from pathlib import Path from threading import Thread ...
MessengerMDApp.py
import os import socket as st import sys from datetime import datetime from functools import partial from socket import socket from threading import Thread from typing import Any from encryption import create_rsa_files, new_cipher from kivy_imports import ( Builder, Clock, Config, Keyboard, ObjectP...
lisp-rtr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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...
test_sampling.py
# test_sampling.py # -*- coding: utf8 -*- # vim:fileencoding=utf8 ai ts=4 sts=4 et sw=4 # Copyright 2009 National Research Foundation (South African Radio Astronomy Observatory) # BSD license - see LICENSE for details """Tests for the katcp.sampling module. """ from __future__ import absolute_import, division, pri...
exec_utils.py
#! /usr/bin/env python # Standard Imports import select import subprocess import time import tempfile import pickle import itertools import multiprocessing from datetime import datetime from collections import OrderedDict from threading import Thread from queue import Queue, Empty # Lib Imports from .file_utils impor...
uwhscores_comms.py
import requests import threading from functools import lru_cache class UWHScores(object): def __init__(self, base_address='https://uwhscores.com/api/v1/', mock=False): self._base_address = base_address self._mock = mock self._fail_handler = lambda x : print(x) def login(self, username,...
env.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the...
gallery.py
from matrix import* import random import time from original import draw_matrix import LED_display as LMD import threading from score import ScoreBlk from score import Score def LED_init(): ## LED에 불빛이 들어오게 하는 함수 thread=threading.Thread(target=LMD.main, args=()) ...
event.py
# -*- encoding: utf-8 -*- """ @File :event.py @Desc :事件引擎 @Date :2022-03-03 10:48 """ from collections import defaultdict from time import sleep from threading import Thread from queue import Queue,Empty from .constant import EVENT_TIMER class Event: def __init__(self, etype, data = None): ...
server.py
import socket # simple, but powerfrul socket library import threading # library to create threads # defining host and port host_ip = '127.0.0.1' # local machine ip here, but if you're in a domain or something like that put the ip here port = 5555 # this is a port that uses tcp and this is why it was chosen, tcp makes ...
vm_util.py
# Copyright 2014 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...
unpackAPK.py
from __future__ import absolute_import '''Copyright 2015 LinkedIn 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...
submoduletestServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
make_adj_lexicons.py
import time import random import constants import seeds from socialsent import util from socialsent import polarity_induction_methods from socialsent.historical import vocab from multiprocessing import Queue, Process from Queue import Empty from socialsent.representations.representation_factory import create_represent...
Driver_socket.py
# # Created on Wed Sep 22 2021 # Author: Owen Yip # Mail: me@owenyip.com # # Socket number: # RpLidar is 5450, IMU is 5451, Driver is 5452 # import numpy as np import os,sys pwd = os.path.abspath(os.path.abspath(__file__)) father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + "..") sys.path.append(father...
run.py
import argparse from threading import Thread, Event from app.acceptor import app from app.rest_api import api, configure_rest_api from app.acceptor_configuration.configuration_factory import shared.configurationFactory from app.controllers.implementations.MessageHolder import MessageHolder from app.controller...
test_replication.py
"""TestCases for distributed transactions. """ import os import time import unittest from test_all import db, test_support, have_threads, verbose, \ get_new_environment_path, get_new_database_path #---------------------------------------------------------------------- class DBReplication(unittest.TestCase...
sketchStars.py
from threading import Thread import WonderPy.core.wwMain from WonderPy.core.wwConstants import WWRobotConstants STAR_NUM_POINTS = 5 STAR_EDGE_LENGTH_CM = 50 class MyClass(object): def on_connect(self, robot): """ start threads which emit robot commands based on their own timing, rather than...
main.py
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: main.py Description : 运行主函数 Author : JHao date: 2017/4/1 ------------------------------------------------- Change Activity: 2017/4/1: ----------------------------------------...
cryptopia.py
from befh.restful_api_socket import RESTfulApiSocket from befh.exchanges.gateway import ExchangeGateway from befh.market_data import L2Depth, Trade from befh.util import Logger from befh.instrument import Instrument from befh.clients.sql_template import SqlClientTemplate from functools import partial from datetime impo...
events.py
"""Leaf 事件机制实现""" import threading import multiprocessing as mp from collections import namedtuple from typing import Optional, List, Callable, NoReturn from . import modules from .error import Error from .wrapper import thread from .algorithm import Node, Tree class ReachedMaxReg(Error): """达到最大注册数量限制""" c...
camera_pi.py
import time import io import threading import picamera class Camera(object): thread = None # background thread that reads frames from camera frame = None # current frame is stored here by background thread last_access = 0 # time of last client access to the camera def initialize(self): if ...
edgetpu.py
import os import datetime import hashlib import multiprocessing as mp import numpy as np import pyarrow.plasma as plasma import tflite_runtime.interpreter as tflite from tflite_runtime.interpreter import load_delegate from frigate.util import EventsPerSecond, listen def load_labels(path, encoding='utf-8'): """Loads ...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...