source
stringlengths
3
86
python
stringlengths
75
1.04M
SerialUDPBridge.py
import serial #Serial port API http://pyserial.sourceforge.net/pyserial_api.html import socket import time from threading import Thread def recvUDP(sock,SerialIOArduino): while True: data, addr = sock.recvfrom(1280) # Max recieve size is 1280 bytes print "UDP received message:", data.strip() ...
character.py
from collections import deque from threading import Thread from blessed import Terminal from pynput.keyboard import Key, Listener from .abstractdungeonentity import AbstractDungeonEntity term = Terminal() class Character(AbstractDungeonEntity): """This describes a character""" def __init__(self, *args, **...
utils.py
#!/usr/bin/env python import sys import array import numpy as np from skimage.color import rgb2gray from skimage.transform import resize from skimage.io import imread import matplotlib.pyplot as plt import matplotlib.image as mpimg from inputs import get_gamepad import math import threading def resize_image(img)...
worker_run_state.py
import docker import glob import logging import os import threading import time import traceback import codalab.worker.docker_utils as docker_utils from collections import namedtuple from pathlib import Path from codalab.lib.formatting import size_str, duration_str from codalab.worker.file_util import remove_path, g...
gui.py
import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk from algorithms import * import threading algsSwitcher = { 0: bubblesort, 1: countingsort, 2: insertionsort, 3: radixsort, 4: quicksort, 5: bogosort } listToSort = [] # 0. speed, 1. change count, 2. thread stopping event, 3. who's setting ...
scheduler_job.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
rostopic_names_test.py
#!/usr/bin/env python3 from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings import os # from PyQt5.QtDataVisualization import (Q3DSurface, Q3DScatter, Q3DTheme, QAbstract3DGraph, # QHeightMapSurfaceDataProxy, QSurface3DSeries, QSurfaceDataItem, # ...
validate.py
#!/usr/bin/env python3 import argparse import os import atexit import textwrap import time import tempfile import threading import subprocess import barrier import finishedSignal import signal import random import time from enum import Enum from collections import defaultdict, OrderedDict BARRIER_IP = 'localhost'...
database.py
from itertools import permutations try: from Queue import Queue except ImportError: from queue import Queue import threading from peewee import * from peewee import Database from peewee import FIELD from peewee import attrdict from peewee import sort_models from .base import BaseTestCase from .base import Dat...
writer.py
import os import time from threading import Thread from queue import Queue import cv2 import numpy as np import torch import torch.multiprocessing as mp from alphapose.utils.transforms import get_func_heatmap_to_coord from alphapose.utils.pPose_nms import pose_nms from alphapose.face.face import face_process from al...
console.py
#!/usr/bin/env python # Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # Ignore indention messages, since legacy scripts use 2 spaces instead of 4. # pylint: disable=bad-indentation,docstring-section-in...
reader.py
from . import gpu_dev_count, cpu_dev_count try: import queue as Queue except ImportError: import Queue from threading import Thread dev_count = gpu_dev_count if gpu_dev_count > 0 else cpu_dev_count def yield_pieces(data, distribute_strategy, batch_size): """ Args: distribute_strategy: support...
test_util.py
# Copyright 2015 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...
serve.py
import sys, json, threading, time, os import flask import config app = flask.Flask(__name__) port = int(sys.argv[1]) if len(sys.argv) == 2 else 80 class g: daily_counts = [] def load_data(): while True: with open(os.path.expanduser(config.config_dict['out_path'])) as f: json_text = f.read() g.da...
sensor.py
import os import requests import dns.message import dns.query import dns.rdatatype import random from time import sleep import peewee as pw from datetime import datetime, timezone import threading import traceback import json global sec_working sec_working = [] db = pw.SqliteDatabase('sensor.db', pragmas={ 'j...
wifijammer.py
#!/usr/bin/env python import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up Scapy from scapy.all import * conf.verb = 0 # Scapy I thought I told you to shut up import os import sys import time from threading import Thread, Lock from subprocess import Popen, PIPE from signal import SIGINT,...
main.py
""" mlperf inference benchmarking tool """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import array import collections import json import logging import os import sys import threading import time from queue import Queue import mlperf_l...
__main__.py
import sys import websocket import threading import time from binance import Client from wenmoon.Config import Config from wenmoon.Bot import Bot from wenmoon.strategies.macd_rsi_strategy import Strategy # Get configurations config = Config() # Log into the binance client API using the supplied api key and secret b...
pickletester.py
import collections import copyreg import dbm import io import functools import os import math import pickle import pickletools import shutil import struct import sys import threading import unittest import weakref from textwrap import dedent from http.cookies import SimpleCookie try: import _testbuffer except Impo...
8 coroutine async_&_await.py
import time import asyncio from queue import Queue from threading import Thread def start_loop(loop): # 一个在后台永远运行的事件循环 asyncio.set_event_loop(loop) loop.run_forever() async def do_sleep(x, queue, msg=""): await asyncio.sleep(x) queue.put(msg) queue = Queue() new_loop = asyn...
road_speed_limiter.py
import json import os import select import threading import time import socket import fcntl import struct from threading import Thread from cereal import messaging from common.numpy_fast import clip from common.realtime import sec_since_boot from selfdrive.config import Conversions as CV CAMERA_SPEED_FACTOR = 1.05 c...
ClientConnection.py
import socket import getpass from threading import Thread """This module taces care of the server-specific logic.""" class ClientConnection: """Base class which takes care of initializing the client \ for either chat or transfer.""" def __init__(self, server_ip, client_ip, callbacks): self.serv...
__init__.py
""" objectstore package, abstraction for storing blobs of data for use in Galaxy. all providers ensure that data can be accessed on the filesystem for running tools """ import abc import logging import os import random import shutil import threading import time from collections import OrderedDict import yaml from g...
server.py
#imports import socket import threading class ChatServer: clients_list = [] last_received_message = "" def __init__(self): self.server_socket = None self.create_listening_server() #listen for incoming connection def create_listening_server(self): self.server_so...
mqtt.py
"""Support for MQTT input/output.""" import json import socket import threading import time from collections import defaultdict from queue import Queue from typing import Any, Dict, List import pydash from rhasspy.actor import RhasspyActor from rhasspy.events import ( MqttConnected, MqttDisconnected, Mqtt...
__init__.py
# -*- coding: UTF-8 -*- #virtualBuffers/__init__.py #A part of NonVisual Desktop Access (NVDA) #This file is covered by the GNU General Public License. #See the file COPYING for more details. #Copyright (C) 2007-2015 NV Access Limited, Peter Vágner import time import threading import ctypes import collection...
sound.py
import arcade from game.constants import * import time import threading class Sound: def __init__(self): self.path_sound_list = [FLY_SOUND_EAT, FLY_SOUND_DEATH, SPIDER_SOUND_EAT, SPIDER_SOUND_DEATH, ...
abstraction.py
import socket from threading import Thread from typing import Optional, List from ..WP.api import ChunckedData, ReceiveThread, TimeLock defaultTimeout: float = 180.0 # 超时时间,是各方法的默认参数 def default_timeout(timeout=None) -> float: """ Get or set the default timeout value. Parameter: - float or `None`...
scheduler_head.py
#!/usr/bin/env python #-*- encoding: utf-8 -*- """ """ from __future__ import print_function from __future__ import division from multiprocessing import Process import numpy as np import multiprocessing import argparse import psutil import socket import time import tqdm import sys import re import os import config ...
notifier.py
# =============================================================================== # Copyright 2013 Jake Ross # # 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/licens...
devserver.py
from __future__ import absolute_import, print_function, unicode_literals import atexit import logging import os import subprocess import sys from threading import Thread from django.contrib.staticfiles.management.commands.runserver import Command as RunserverCommand from django.core.management import call_command fro...
proxy_server.py
# This proxy support HTTP and also HTTPS. # Because of TLS/SSL protocol, it is impossible to read messages or cache data in HTTPS connection # This proxy server can only run on Linux 2.5+ system import socket import os import threading import select import hashlib import traceback bind_host = ('0.0.0.0', 8080) bind_nu...
FinalProjectServer.py
# imports import socket import threading class ChatServer: clients_list = [] last_received_message = "" def __init__(self): self.server_socket = None self.create_listening_server() # listen for incoming connection def create_listening_server(self): self.server_socket = ...
manager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import vim import os import sys import time import operator import itertools import threading import multiprocessing from functools import partial from functools import wraps from .instance import LfInstance from .cli import LfCli from .utils import * from .fuzzyMatch impo...
track_thread.py
from threading import Thread from streaming import Start_stream from time import sleep th = Thread(target=Start_stream) th.start() while(1): sleep(5) print('d')
tree.py
#!/usr/bin/env python3 import threading import random import os import time mutex = threading.Lock() tree = list(open('tree2.txt').read().rstrip()) def colored_dot(color): if color == 'red': return f'\033[91m●\033[0m' if color == 'green': return f'\033[92m●\033[0m' if color == 'yellow': ...
test_futures.py
import os import subprocess import sys import threading import functools import contextlib import logging import re import time import gc import traceback from StringIO import StringIO from test import test_support from concurrent import futures from concurrent.futures._base import ( PENDING, RUNNING, CANCELLED, C...
utils.py
# Copyright 2021 Alibaba Group Holding Limited. 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 ...
mtime_file_watcher.py
#!/usr/bin/env python # # Copyright 2007 Google 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 o...
main.py
import sys from threading import Thread from PySide2.QtWidgets import (QApplication, QPushButton, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QComboBox, QSplitter, QSpacerItem, QSizePolicy, QGraphicsView, QGraphicsScene) from PySide2.QtCore import Slot, Qt, QRectF, QRect, Signal from PySide2...
test_browser.py
# coding=utf-8 # Copyright 2013 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. import argparse import json import multiprocessing imp...
bubble.py
from __future__ import print_function import sys sys.path = [p for p in sys.path if p.startswith('/')] __name__ = '__bubble__' sys.modules[__name__] = sys.modules.pop('__main__') def debug(msg): print(msg, file=sys.stderr) # Reshuffle fds so that we can't break our transport by printing to stdout import os # inp...
sanitylib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fu...
fast.py
import netifaces import socket import time import threading from essentials import socket_ops_v2 as socket_ops from essentials.network_ops import Get_GW, Get_IP class Device(object): def __init__(self, ip, data): self.ip = ip self.discovery_data = data @property def json(self): ...
tsproxy.py
#!/usr/bin/env python """ Copyright 2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicab...
example_test.py
import re import os import socket import BaseHTTPServer import SimpleHTTPServer from threading import Thread import ssl from tiny_test_fw import DUT import ttfw_idf import random server_cert = "-----BEGIN CERTIFICATE-----\n" \ "MIIDXTCCAkWgAwIBAgIJAP4LF7E72HakMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n"\ ...
common.py
# -*- coding: utf-8 -*- import json, subprocess, threading, sys, platform, os PY3 = sys.version_info[0] == 3 JsonLoads = PY3 and json.loads or (lambda s: encJson(json.loads(s))) JsonDumps = json.dumps def STR2BYTES(s): return s.encode('utf8') if PY3 else s def BYTES2STR(b): return b.decode('utf8') if PY3 e...
MyWebServer.py
# coding:utf-8 import socket import re import sys from multiprocessing import Process from MyWebFramework import Application # 设置静态文件根目录 HTML_ROOT_DIR = "./html" WSGI_PYTHON_DIR = "./wsgipython" class HTTPServer(object): """""" def __init__(self, application): """构造函数, application指的是框架的app""" ...
prometheus_aci_exporter.py
#!/usr/bin/env python3 import argparse from http.server import BaseHTTPRequestHandler, HTTPServer from itertools import chain import logging import re import signal from socketserver import ThreadingMixIn from threading import Thread import time from typing import Any, Callable, Dict, Iterable, List, Optional, Pattern,...
xlink_wrapper.py
""" Allows API of xlink driver C library to be called in Python. Copyright (C) 2019-2022 Intel Corporation SPDX-License-Identifier: Apache-2.0 """ import logging import threading import os from typing import Callable, Optional from ctypes import * import time from inbm_vision_lib.constants import XLINK_L...
InputPlotWindow.py
from __future__ import division, unicode_literals, print_function, absolute_import from zprocess import Process import pyqtgraph as pg import numpy as np from qtutils import inmain_decorator import qtutils.qt.QtGui as QtGui import zmq from labscript_utils.labconfig import LabConfig import threading from labscr...
websocket.py
import asyncio import json import logging import os from threading import ( Thread, ) from types import ( TracebackType, ) from typing import ( Any, Optional, Type, Union, ) from platon_typing import ( URI, ) from websockets.client import ( connect, ) from websockets.legacy.client impor...
app.py
from flask import Flask, request, render_template, abort, redirect, url_for import asyncio, random, threading app = Flask(__name__) sessions = {} clear_loop = asyncio.new_event_loop() def thread_clear(): asyncio.set_event_loop(clear_loop) clear_loop.run_forever() def clear_session(id): del sessions[id] ...
test_utils.py
# -*- coding: utf-8 -*- import json import os import shutil import tempfile import time import zipfile import multiprocessing import contextlib from unittest import mock from django import forms from django.conf import settings from django.forms import ValidationError from django.test.utils import override_settings ...
store.py
import datetime import json import threading import uuid from collections import defaultdict from copy import deepcopy from dictdiffer import diff from inspect import signature from multiprocessing import Lock from pathlib import Path from tzlocal import get_localzone from .logger import logger from .settings import ...
threadLocal.py
# -*- coding: utf-8 -*- import threading local_school = threading.local() def process_student(): print 'Hello, %s (in %s)' % (local_school.student, threading.current_thread().name) def process_thread(name): local_school.student = name process_student() t1 = threading.Thread(target=process_thread, args...
letmecrawl.py
from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals from six import with_metaclass import json import time import logging import threading import pkg_resources from .sources import Source from .models import OrderedTabl...
mdns_example_test.py
import re import os import sys import socket import time import struct import dpkt import dpkt.dns from threading import Thread, Event # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, # we need to set environment variable `TEST_FW_PATH`, # then get and insert `TEST_FW_PATH` to ...
argononed.py
#!/usr/bin/python3 import smbus import RPi.GPIO as GPIO import os import sys import time import psutil import json import subprocess from threading import Thread import paho.mqtt.client as mqtt import yaml rev = GPIO.RPI_REVISION if rev == 2 or rev == 3: bus = smbus.SMBus(1) else: bus = smbus.SMBus(0) MQTT_C...
local_job_service.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...
client.py
from __future__ import annotations import asyncio import time from datetime import datetime from io import BytesIO from threading import Thread from typing import Union, List, TYPE_CHECKING from .abc import Client from .enums import HistoryMode from .http import SyncHTTPClient, AsyncHTTPClient from .siren import Sire...
queue_runner.py
# Copyright 2015 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...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
mysingleton2_with_lock.py
#!usr/bin/python # -*- coding:utf8 -*- # 加上锁 import time import threading class Singleton(object): _instance_lock = threading.Lock() def __init__(self): time.sleep(1) print(self) def __new__(cls, *args, **kwargs): with cls._instance_lock: if not hasattr(cls, '_instanc...
store.py
import datetime import json import threading import uuid from collections import defaultdict from copy import deepcopy from dictdiffer import diff from inspect import signature from threading import Lock from pathlib import Path from tzlocal import get_localzone from .logger import logger from .settings import CACHE_...
vngate.py
# encoding: utf-8 import urllib import sys import json from time import time, sleep from threading import Thread import urllib.parse as urlparse from datetime import datetime import base64 import hmac import hashlib import json import gzip, binascii, os import http.client as httplib import traceback import ssl from v...
zmirror.py
#!/usr/bin/env python3 # coding=utf-8 import os import sys import re import copy import zlib import sched import queue import base64 import random import traceback import ipaddress import threading from fnmatch import fnmatch from time import time, sleep, process_time from html import escape as html_escape from dateti...
async_task_manager.py
import queue from threading import Thread from typing import Any, Callable, ContextManager, Iterable, Mapping, Optional from ..utils import get_logger log = get_logger(__name__) STOP = -1 STOP_TASK = ( STOP, STOP, STOP, ) class Queue(queue.Queue): def clear(self): with self.mutex: ...
3.07.py
""" Code illustration: 3.07 Tkinter and Threading ********************** New modules imported here: - threading New methods defined here: - play_in_thread() - toggle_play_button_state() Method modified here: - start_play() - _...
util.py
import logging from threading import Thread from functools import wraps logger = logging.getLogger() logger.setLevel(logging.DEBUG) stream_handler = logging.StreamHandler() formatter = logging.Formatter("[%(filename)s] %(levelname)s | %(message)s") stream_handler.setFormatter(formatter) logger.addHandler(stream_handl...
Aircrack.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Aircrack.py # # Copyright 2013 Brandon Knight <kaospunk@gmail.com> # # 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 reta...
kb_hisat2Server.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...
conftest.py
"""Fixtures and setup / teardown functions Tasks: 1. setup test database before starting the tests 2. delete test database after running the tests """ import os import copy import random from collections import namedtuple from logging import getLogger from logging.config import dictConfig import pytest from pymongo ...
__init__.py
import contextlib import datetime import errno import inspect import multiprocessing import os import re import signal import socket import subprocess import sys import tempfile import threading from collections import namedtuple from enum import Enum from warnings import warn import six import yaml from six.moves imp...
tk_raw_image_analy_ver1.0(bera1).py
## 영상 처리 및 데이터 분석 툴 from tkinter import *; import os.path ;import math from tkinter.filedialog import * from tkinter.simpledialog import * ## 함수 선언부 def loadImage(fname) : global window, canvas, paper, filename, inImage, outImage, inW, inH, outW, outH fsize = os.path.getsize(fname) # 파일 크기 확인 inH...
kutil.py
# Copyright (c) 2020, 2021, Oracle and/or its affiliates. # # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ # # Kubernetes (kubectl) utilities # Use kubectl instead of the API so we go through the same code path as an end-user import os import subprocess impor...
frontend_server_ros_demo.py
#!/usr/bin/env python import flask import math import rospy from piksi_rtk_msgs import msg import time import threading POSE_TEMPLATE = """<?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"> <Document> <Style id="gecko_ico...
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...
mutiThreadReqHttp.py
import threading, time def run(num): print("子线程%s开始..." % (threading.current_thread().name)) time.sleep(2) print(num) time.sleep(2) # current_thread 返回一个当前线程的实例 print("子线程%s结束..." % (threading.current_thread().name)) if __name__ == '__main__': print("主线程%s启动..." % (threadin...
test_functools.py
import abc import builtins import collections import copy from itertools import permutations import pickle from random import choice import sys from test import support import time import unittest import unittest.mock from weakref import proxy import contextlib try: import threading except ImportError: threadin...
custom_run_local.py
import asyncio import subprocess from multiprocessing import Process import os import json from typing import List, Set from pathlib import Path from collections import deque from arenaclient.proxy.frontend import GameRunner from arenaclient.proxy.server import run_server class RunLocal: def __init__(self): ...
detect_obj.py
import sys import cv2 import time from multiprocessing import Process from multiprocessing import Queue from PIL import Image from screen import Screen from camera import MyCamera, RawCapture from labels import Labels from classify import classify_frame from display import set_window, set_bonding_box, s...
manager.py
import os import sys import time from collections import defaultdict from multiprocessing import Process, Lock, Manager processes = [ ] file = open('article', mode = 'r') lines = file.read().split('.') file.close() manager = Manager() bag = manager.dict() lock = manager.Lock() delims = manager.list([',', ';', ':', '...
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 DBReplicationManager(unittest.Te...
main_program.py
import tkinterGUI import voiceRecognition import threading class main_program(): def __init__(self): voice_thread = threading.Thread(target = voiceRecognition.main, args = "") gui_thread = threading.Thread(target = tkinterGUI.GUIapp, args = "") print ("stahting") voice_thread.start() print ("between sta...
saltmod.py
# -*- coding: utf-8 -*- ''' Control the Salt command interface ================================== This state is intended for use from the Salt Master. It provides access to sending commands down to minions as well as access to executing master-side modules. These state functions wrap Salt's :ref:`Python API <python-ap...
tb_watcher.py
""" tensorboard watcher. """ import glob import logging import os import queue import socket import sys import threading import time from typing import Any, TYPE_CHECKING import wandb from wandb import util from wandb.sdk.interface.interface import GlobStr from wandb.viz import CustomChart from . import run as inter...
get_label_from_xml.py
# coding=utf-8 import xml.etree.ElementTree as ET import sys import os import glob import shutil import cv2 from multiprocessing import Pool from multiprocessing import Manager from multiprocessing import Process import numpy as np import pickle def restore_file(path): df = open(path, 'rb') file = pickle.load...
recalibrate.py
import logging from multiprocessing import JoinableQueue, Process from pathlib import Path from typing import Iterable, Union, Optional import numpy as np import pandas as pd from pyimzml.ImzMLParser import ImzMLParser from pyimzml.ImzMLWriter import ImzMLWriter from msi_recal.evaluate import EvalPeaksCollector from ...
rpigpio.py
from apama.eplplugin import EPLAction, EPLPluginBase, Correlator, Event, Any from gpiozero import LightSensor import threading, queue class Job(object): """ Jobs to be executed asynchronously @param fn a functor to execute """ def __init__(self, pin, threshold, fn): self.pin = pin self.threshold = threshold...
test_threadsafety.py
""" A little note on how these tests work: Almost all asyncio objects are not thread-safe, as per the official doc. This includes `asyncio.Queue`. This queue is used for k8s-event posting. K8s-events are posted via ``kopf.event()`` and similar calls, and also via ``logger.info()`` for per-object logging messages. Th...
cron_app.py
#encoding:utf-8 import datetime import csv import logging from multiprocessing import Process import time import yaml from croniter import croniter from supplier import supply logger = logging.getLogger(__name__) def read_own_cron(own_cron_filename, config): with open(own_cron_filename) as tsv_file: ...
BeatNet.py
# This is the BeatNet user script. First, it extracts the spectral features and then # feeds them to one of the pre-trained models to get beat/downbeat activations. # Therefore, it infers beats and downbeats based on one of the two offline and online inference models. import os import torch import numpy as np f...
ws_client_playaudio.py
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
test_p2p_grpform.py
# P2P group formation test cases # Copyright (c) 2013-2014, Jouni Malinen <j@w1.fi> # # This software may be distributed under the terms of the BSD license. # See README for more details. import logging logger = logging.getLogger() import time import threading import Queue import os import hostapd import hwsim_utils ...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import (verbose, import_module, cpython_only, requires_type_collecting) from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys import cosmo _thread = import_module('...
server.py
#!/usr/bin/env python import sys import io import os import shutil from subprocess import Popen, PIPE from string import Template from struct import Struct from threading import Thread from time import sleep, time from http.server import HTTPServer, BaseHTTPRequestHandler from wsgiref.simple_server import make_server ...
singleton.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # ---------------------------------------- # 保证一个程序只有一个实例在运行。 # 例如,防止 crontab 调用两个程序实例。 # # 使用方法: # >>> import singleton # >>> lockfile = "/tmp/<app>.lock" # >>> instance = singleton.SingleInstance(lockfile) # will sys.exit(-1) if other instance is running # # 参考: # http:...
gui.py
from tkinter import * import time import tkinter.messagebox from bot import chat import pyttsx3 import threading saved_username = ["You"] window_size="400x400" class ChatInterface(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.master = master # sets default bg...
cli.py
# Copyright (c) 2017 Sony Corporation. 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 applicabl...