source
stringlengths
3
86
python
stringlengths
75
1.04M
tk_upload_example.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Example tkinter app that uploads files and shows incoming pushes. It is not necessary to connect to a listener and listen for pushes in order to upload, but it makes the example more interesting. """ import asyncio import logging import os import sys import threading ...
console_osu4k.py
# azcamconsole config file for OSU4k import os import threading from azcam_ds9.ds9display import Ds9Display import azcam import azcam.shortcuts_console # **************************************************************** # files and folders # **************************************************************** azcam.db.s...
single_run.py
import argparse import sys from collections import deque from queue import Queue import time from ev3sim.file_helper import find_abs import yaml from ev3sim.simulation.loader import runFromConfig def single_run(preset_filename, robots, bind_addr): preset_file = find_abs(preset_filename, allowed_areas=["local", "l...
multiprocessor_example.py
import time import multiprocessing import random def job(job_id): print('Starting job: {}'.format(job_id)) # do job here sleep_time = random.uniform(5, 25) print('Sleeping job: {}, for {}'.format(job_id, sleep_time)) time.sleep(sleep_time) print('Ending job: {}'.format(job_id)) if __name__ =...
_app.py
""" websocket - WebSocket client library for Python Copyright (C) 2010 Hiroki Ohtani(liris) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, ...
scratchpad.py
# -*- coding: utf-8 -*- from threading import Thread from i3pystatus import Module import i3ipc class Scratchpad(Module): """ Display the amount of windows and indicate urgency hints on scratchpad (async). fork from scratchpad_async of py3status by cornerman Requires the PyPI package `i3ipc`. ....
vcra.py
#Project: Voice Controlled Robotic Arm #Name: Abhishek Barla #ID: 900559822 #Class: ECE 4242 - Senior Design II #Professor: Dr. Barry Grossman #GSA: Julius Chatterjee #Semester: Spring 2015 #School: Florida Institute of Technology, Melbourne, FL, USA #importing speech recognition libraries import io, o...
designer.py
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations import random, string import datetime import logging from threading import Thread import requests, json, time, re, importlib, os, hashlib, hmac logger = logging.getLogger(settings.logger) logger.setLevel(settings.lo...
step1_audio_collection.py
# -*- coding:utf-8 -*- import os import sys from os.path import dirname, join, abspath sys.path.insert(0, abspath(join(dirname(__file__), '..'))) folder_path = os.path.dirname(abspath(__file__)) import numpy as np import pyaudio from pathlib import Path import time import wave import argparse import wget import thread...
demo9.py
from queue import Queue import threading import time # q = Queue(4) 4表示最多4个 # # for x in range(4): # q.put(x) # # for x in range(4): # print(q.get()) # print(q.qsize()) def set_value(q): index = 0 while True: q.put(index) index += 1 time.sleep(1) def get_value(q): w...
SocketServer.py
import eventlet from eventlet import wsgi, websocket import socketio from VirtualWebcam import VirtualWebcam import subprocess as sp from queue import Queue from threading import Thread, Lock import traceback sio = socketio.Server() app = socketio.WSGIApp(sio) message_queue = Queue() thread = None lock = Lock() @s...
TestE2EScenarios.py
# # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # import logging from threading import Thread import time from mlos.Logger import create_logger from mlos.Examples.SmartCache import SmartCacheWorkloadGenerator, SmartCache from mlos.Examples.SmartCache.TelemetryAggregators.WorkingS...
MicrosoftTeams.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import requests from distutils.util import strtobool from flask import Flask, request, Response from gevent.pywsgi import WSGIServer import jwt import time from threading import Thread from typing import...
des_layout.py
import sys sys.dont_write_bytecode = True import PySimpleGUI as sg import matplotlib matplotlib.use('TkAgg') from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import pandas as pd import matplotlib.pyplot as plt import os import shutil import glob import controller.des.exit_button as exit_button import con...
dash_tools.py
from multiprocessing import Process import numpy as np import dash from dash import dcc from dash import html import json import pickle from plotly_scientific_plots.plotly_misc import jsonify ###Dash wrappers def dashSubplot(plots, min_width=18, # min width of column (in %). If more colum...
main.py
from market import app from tools import cls def page(): if __name__ == '__main__': app.run(debug=True, host="0.0.0.0", port=8080) def run(): page() # thread = threading.Thread(target=page) # thread.start() # code try: run() except ImportError: run() cls()
thread_pool.py
''' File: thread_pool.py Description: Thread pool management resources Date: 28/09/2017 Author: Saurabh Badhwar <sbadhwar@redhat.com> ''' from structures import ThreadPool import threading class ThreadPoolManager(object): """Lays out the interface for management of thread pool""" def __init__(self): "...
test_faster_fifo.py
import logging import multiprocessing from queue import Full, Empty from unittest import TestCase from faster_fifo import Queue ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) log = logging.getLogger('rl') log.setLevel(logging.DEBUG) log.handlers = [] # No duplicated handlers log.propagate = False # workar...
trainer_worker.py
# Copyright 2020 The FedLearner 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...
Devil.py
# Decompiled by Hacker WaSI # Upgraded By WaSeem Akram import os import sys import time import datetime import random import hashlib import re import threading import json import getpass import urllib import requests import mechanize from multiprocessing.pool import ThreadPool from requests.exceptions...
test_logging.py
# Copyright 2001-2019 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
multiprocessing_daemon.py
import multiprocessing import time import sys def daemon(): p = multiprocessing.current_process() print 'starting:', p.name, p.pid sys.stdout.flush() time.sleep(2) print 'Exiting :', p.name, p.pid sys.stdout.flush() def non_daemon(): p = multiprocessing.current_process() print 'starting:', p.name, p.pid sys....
worker_base.py
from workers.worker_persistance import * #I figure I can seperate this class into at least three parts. #I should also look into the subclass and see what uses what. # # Parts (Hierarchal relation) #1. Persistance #2. Base #3. Github/lab # Might be good to seperate the machine learning functionality into its own cl...
dump.py
#!/usr/bin/env python import sys import argparse import zmq import json from hexdump import hexdump from threading import Thread from cereal import log import selfdrive.messaging as messaging from selfdrive.services import service_list def run_server(socketio): socketio.run(app, host='0.0.0.0', port=4000) if __nam...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from el...
plumbum_helpers.py
from __future__ import absolute_import import functools import io import os import sys from os import O_CLOEXEC from os import pipe2 from subprocess import PIPE from threading import Thread from plumbum.commands import BaseCommand from plumbum.machines.base import PopenAddons from six import reraise def get_thread(...
test_adc_thread_safe.py
import threading import time import unittest import mock from greenpithumb import adc_thread_safe class AdcTest(unittest.TestCase): def setUp(self): self.counter = 0 def increment_counter(self, amount): # Increment counter in a deliberately inefficient way to invite a race # condit...
__init__.py
__author__ = "Johannes Köster" __copyright__ = "Copyright 2021, Johannes Köster" __email__ = "johannes.koester@uni-due.de" __license__ = "MIT" import os import sys import contextlib import time import datetime import json import textwrap import stat import shutil import shlex import threading import concurrent.futures...
ws_thread.py
import sys import websocket import threading import traceback import ssl from time import sleep import json import decimal import logging from market_maker.settings import settings from market_maker.auth.APIKeyAuth import generate_expires, generate_signature from market_maker.auth.APIKeyAuthWithExpires import * from ma...
tcpros_base.py
# Software License Agreement (BSD License) # # Copyright (c) 2008, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above...
camera_pi.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # camera_pi.py # # # # Raspberry Pi camera module (developed by Miguel Grinberg) 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 s...
payload.py
from pynput import keyboard import time import threading import datetime import pyscreenshot import smtplib import socket import requests import platform from email.message import EmailMessage config = {} class dspy: def __init__(self, email, pwd, time, keylog, screenshot): self.log = "" ...
ch06_listing_source.py
import bisect from collections import defaultdict, deque import json import math import os import time import unittest import uuid import zlib import redis QUIT = False pipe = inv = item = market = buyer = seller = inventory = None # <start id="_1314_14473_8380"/> def add_update_contact(conn, user, contact): ac...
licenseversion.py
#!/usr/bin/python ## Binary Analysis Tool ## Copyright 2011-2016 Armijn Hemel for Tjaldur Software Governance Solutions ## Licensed under Apache 2.0, see LICENSE file for details import os, os.path, sys, subprocess, copy, cPickle, Queue import multiprocessing, re, datetime from multiprocessing import Process, Lock fr...
simulation_1.py
import network_1 import link_1 import threading from time import sleep ##configuration parameters router_queue_size = 0 #0 means unlimited simulation_time = 1 #give the network sufficient time to transfer all packets before quitting if __name__ == '__main__': object_L = [] #keeps track of objects, so we...
neural_network_qpred.py
#!/usr/bin/env python3 """ Copyright (c) 2019 Fabien Geyer 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, modify, merge,...
console.py
''' :File: console.py :Author: Jayesh Joshi :Email: jayeshjo1@utexas.edu ''' from subprocess import Popen, PIPE, STDOUT from threading import Thread from queue import Queue from ._decorators import timeout from .exceptions import ConsoleExecTimeout class ConsoleExecutor(): ''' Simple wrapper around subproce...
splash.py
import time import tkinter as tk from multiprocessing import Process from PIL import Image, ImageTk from fishy.helper import helper from fishy.helper.config import config def show(win_loc): dim = (300, 200) top = tk.Tk() top.overrideredirect(True) top.lift() top.title("Loading...") top.res...
student_base.py
################################################################## # Copyright 2021 Lockheed Martin Corporation. # # Use of this software is subject to the BSD 3-Clause License. # ################################################################## # Student flight control base class # # This class ...
logger.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import threading import json import logging import app.util as util IOT_BASE_TOPIC = 'edge-manager-app' class Logger(object): def __init__(self, device_name, iot_params): ''' This class is res...
HomeDisplay.py
# pv display for Pi0 using python3 and PySimpleGUI import time from time import ctime from datetime import datetime import pytz import json import paho.mqtt.client as mqtt import threading PVB_Vin = ' 00.0' PVB_Vout = ' 00.0' PVB_Iin = ' 00.00' PVB_Iout = ' 00.00' S2_temp = ' 00.0' S2_hum = ' 00.0' S2_atmp = ' 0000.0...
queue_test.py
#!/usr/bin/env python "生产者和消费者线程与共享队列进行通信" import threading import time import queue NUM_CONSUMERS_INT = 2 # 消费者线程数目 NUM_PRODUCERS_INT = 4 # 生产者线程数目 NUM_MESSAGES_INT = 4 # 每个生产者存入的信息的数量 STDOUT_MUTEX = threading.Lock() # 否则打印操作可能会发生重叠 DATA_QUEUE = queue.Queue() EXIT_LISTBOOL = [False for i_int in range(NUM_PRODUCE...
test_search.py
import time import pdb import copy import logging from multiprocessing import Pool, Process import pytest import numpy as np from milvus import DataType from utils import * from constants import * uid = "test_search" nq = 1 epsilon = 0.001 field_name = default_float_vec_field_name binary_field_name = default_binary_v...
server_thread_tcp_mateus.py
#Servidor TCP import socket import rsa from threading import Thread global public_key global private_key def captura_chave_privada(): arq = open('/home/mateus/projetos/Fatec/5sem/fateclando/mateus/.chavePriMateus.txt','rb') ##carrego a chave private_key = bytes() for linha in arq: private_key ...
multiprocessing_realisation.py
import pikabu_parser_basic as base from multiprocessing import Process, Queue import argparse import time blocks = 8 def updated_parser(q, l:int, r:int): data, error_list = base.get_article_range(l, r) q.put((data, error_list)) def parallel_parser(l:int, r:int): step = int((r-l)/blocks) + 1 ths = ...
transfer.py
#!/usr/bin/env python # # Copyright 2015 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...
conftest.py
from multiprocessing import Process import pytest from .indexd_fixture import ( IndexClient, MockServer, create_user, remove_sqlite_files, run_indexd, clear_database, setup_database, wait_for_indexd_alive, wait_for_indexd_not_alive, ) # Note the . in front of indexd_fixtures for m...
backEnd.py
from django.contrib.auth.models import User from maracay.models import Product, Profile, PurchaseConfirmation, Tools, purchaseHistory from django.db import transaction import json,random, string from threading import Thread from django.template.loader import render_to_string from django.core.mail import send_mail from ...
__init__.py
import asyncio import concurrent.futures import difflib import fnmatch import functools import glob import importlib from importlib.util import find_spec import itertools import multiprocessing import os from pathlib import Path import pwd import shutil import threading import time if find_spec('pynvim'): import ...
deskwid.py
""" Author : Jay Rambhia email : jayrambhia777@gmail.com Git : https://github.com/jayrambhia gist : https://gist.github.com/jayrambhia ============================================= Name : deskwid Repo : DeskWid Git : https://github.com/jayrambhia/DeskWid version 0.1 """ # Copyright (c) 2012 Jay Rambhia # Pe...
motion.py
#!/usr/bin/python import StringIO import subprocess import os import time import smtplib from datetime import datetime from PIL import Image from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email.Utils import COMMASPACE, formatdate from email imp...
safe_bank.py
import datetime import random import time from threading import Thread, RLock from typing import List class Account: def __init__(self, balance=0): self.balance = balance def main(): accounts = create_accounts() total = sum(a.balance for a in accounts) validate_bank(accounts, total) pri...
multiprocessing_module.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ multiprocessing.dummy multiprocessing.dummy.Pool """ """ from threading import Event,Thread def f(e): print('f 0') e.wait() print('f 1') e = Event() t = Thread(target=f,args=(e,)) t.start() e.set() e.clear() """ """ import threading l = threading.loca...
idf_monitor.py
#!/usr/bin/env python # # esp-idf serial output monitor tool. Does some helpful things: # - Looks up hex addresses in ELF file with addr2line # - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R) # - Run "make flash" (Ctrl-T Ctrl-F) # - Run "make app-flash" (Ctrl-T Ctrl-A) # - If gdbstub output is detected, gdb is automa...
Trackers.py
import threading import os import time import json from python_nbt import nbt class SavesTracker: def __init__(self, path): self.path = path self.running = True self.mtime = 0 self.latestWorld = None self.savesLen = 0 self.worldList = [] self.newWorldCalls =...
example2.py
#!/usr/bin/env python import multiprocessing import time def worker(): print('new worker') time.sleep(0.5) print('end of worker') t0 = multiprocessing.Process(target = worker) t1 = multiprocessing.Process() t0.daemon = t1.daemon = True t1.run = worker print('before') t0.start() time.sleep(0.1) t1.start() prin...
regrtest.py
#! /usr/bin/python3.3 """ Usage: python -m test [options] [test_name1 [test_name2 ...]] python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]] If no arguments or options are provided, finds all files matching the pattern "test_*" in the Lib/test subdirectory and runs them in alphabetical order ...
task_space_control_with_fri.py
#!/usr/bin/env python # /*************************************************************************** # # @package: panda_siimulator_examples # @metapackage: panda_simulator # @author: Saif Sidhik <sxs1412@bham.ac.uk> # # **************************************************************************/ # /**************...
remote.py
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # 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...
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...
screen_motor.py
# ---------------------------------------------------------------------- # Author: yury.matveev@desy.de # ---------------------------------------------------------------------- """Camera motor class """ import socket import errno, time import json import logging import PyTango import threading from io import ...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
test_redis.py
# -*- coding: utf-8 -*- import threading import time import unittest from jukoro import redis URI = 'redis://localhost/2' NS = 'JuTest' TTL = 1 class Base(unittest.TestCase): db = None @classmethod def setUpClass(cls): cls.db = redis.RedisDb(URI, ns=NS) class TestRedisDb(Base): def tes...
FTPPasswordScanner.py
import threading import queue import ftplib import json import socket class Scanner(): def __init__(self): self.Url = None self.addr = None self.port = 22 self.UsernameFile = None self.PasswordFile = None self.UserpassFile = None self.Threads = 10 sel...
singleton.py
# Example of 'Singleton' design pattern (thread-safe version) from __future__ import annotations from threading import Lock, Thread from typing import Optional class UserMeta(type): """Meta class for the Singleton""" _instance: Optional[User] = None _lock: Lock = Lock() def __call__(cls, *args, **...
nosmct.py
# Andrew Piroli (c)2019-2021 # MIT LICENSE # import datetime as dtime import multiprocessing as mp import argparse import os import logging import mctlogger from concurrent.futures import ProcessPoolExecutor, wait from netmiko import ConnectHandler # type: ignore from netmiko import NetmikoAuthenticationException, N...
run_travis.py
import subprocess import threading import yaml from typing import Any, Dict, Iterable, Union returncodes = {} def execute_script(script_or_scripts: Union[str, Iterable[str]]): if isinstance(script_or_scripts, str): process = subprocess.run(script_or_scripts.split()) return process.returncode e...
main.py
# This is a sample Python script. # Press ⌃R to execute it or replace it with your code. # Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. from util.eplus_model_interface import EplusModelIndexedList import os import multiprocessing as mp FILE_DIR = os.path.dirname(__file__...
clear_app.py
import asyncio import threading from tkinter import messagebox, Entry import tkinter as tk import tkinter.font as font import tkinter.scrolledtext as scrolledtext async def start_timer(label_filename, txt_edit): """ async функция которая выполниться асинхронно в отдельном процессе """ txt_edit.f...
mavros_offboard_posctl_test.py
#!/usr/bin/env python2 #*************************************************************************** # # Copyright (c) 2015 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: #...
EventLoop.py
########################################################################## # # Copyright (c) 2011-2012, John Haddon. All rights reserved. # Copyright (c) 2011-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted prov...
test_sys.py
import unittest, test.support from test.support.script_helper import assert_python_ok, assert_python_failure import sys, io, os import struct import subprocess import textwrap import warnings import operator import codecs import gc import sysconfig import locale # count the number of test runs, used to create unique #...
streamer.py
''' Our meta-detector Streamer It converts a detector into a streaming perception system with a fixed output rate ''' import argparse, json, pickle from os.path import join, isfile, basename from glob import glob from time import perf_counter import multiprocessing as mp import traceback from tqdm impor...
manager.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...
nexar_token.py
"""Main entry point to the service.""" import base64 import hashlib import os import re import webbrowser from multiprocessing import Process from urllib.parse import parse_qs, urlparse import requests from oauthlib.oauth2 import BackendApplicationClient from oauthlib.oauth2.rfc6749.errors import MissingTokenError fro...
vnrpc.py
# encoding: UTF-8 import threading import traceback import signal import zmq from msgpack import packb, unpackb from json import dumps, loads try: import cPickle pDumps = cPickle.dumps pLoads = cPickle.loads except ImportError: # for python 3 import pickle pDumps = pickle.dumps pLoads = p...
client.py
# client.py -- Implementation of the server side git protocols # Copyright (C) 2008-2013 Jelmer Vernooij <jelmer@samba.org> # Copyright (C) 2008 John Carr # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software F...
EXE_Bomb_Windows.py
# v1.0 from pynput.mouse import Button, Controller # Importa librería Mouse import pythoncom, pyHook from winreg import * import os from getpass import getuser from multiprocessing import Process import threading import shutil import string import random def addStartup(): # function = Iniciar automati...
dispatcher.py
# scheduler.dispatcher: Scheduler logic for matching resource offers to job requests. import os import sys import math import time from threading import Thread, Event import socket from collections import deque, OrderedDict from common import * from core import * from mesosutils import * import db #from protobuf_to_d...
wsgi.py
""" WSGI config for ControlServer project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ """ import os # import asyncio # import threading from django.core.wsgi import get_wsgi_applic...
start.py
#! /usr/bin/env python import subprocess from nodes import Console import threading import time import socket # Copilot. copilot = Console("192.168.1.11", 11000) # Connection verification thread method. def piconn(): try: while True: copilot.send("status,Raspberry connected") time.sleep(5) except: raise ...
serve.py
import multiprocessing import socket from typing import Tuple import flags_and_teams import random def get_task() -> Tuple[str, str]: n1 = random.randint(-10, 10) n2 = random.randint(-10, 10) p = random.choice(["+", "-", "*"]) s = f"{n1} {p} {n2}" return (s, str(int(eval(s)))) import logging def ...
RHUBModbus.py
#!/usr/bin/env python # # Example RenewablesHUB Modbus service receiver. # # Pre-requisites: # # # apt install python-is-python3 python3-pip python3-virtualenv # # pip3 install aiohttp==3.7.4.post0 pytz requests Sphinx sphinx_rtd_theme # # mkdir -m 775 /var/log/rhubmodbus import os, sys, signal, threading, queue...
fuzzer.py
#!/usr/bin/env python3 import random import subprocess import os import re from sys import argv import threading # number of terms to generate TERM_NUM = 50 PATH_TO_C4 = os.path.join("..","build","debug", "c4") EXECUTION_COMMAND = PATH_TO_C4 + " --parse {}" FILTER_FUNC_RETURN = True FILTER_VOID_FIELD = True ONLY_NEG...
camera_in_frame.py
from PIL import Image from PIL import ImageTk import mediapipe as mp import numpy as np import tkinter as tk import threading import datetime import cv2 import os def camcam(): def camThread(): color = [] cap = cv2.VideoCapture(0) cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) #캠크기 조절 cap....
process_example.py
from multiprocessing import Process def print_func(continent='Asia'): print('The name of continent is : ', continent) if __name__ == "__main__": # confirms that the code is under main function names = ['America', 'Europe', 'Africa'] procs = [] proc = Process(target=print_func) # instantiating with...
webserver.py
import threading import logging from bottle import route, view, static_file, run, ServerAdapter, request, response import settings def start_server(pipe, cam_comm): setup(cam_comm) t = start_stopper_listener(pipe) logging.info("Starting web server...") start_listening() logging.info("Web server ...
test_state.py
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import os import shutil import sys import tempfile import textwrap import threading import time # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.h...
views.py
"""Defines a number of routes/views for the flask app.""" from functools import wraps import io import os import sys import shutil from tempfile import TemporaryDirectory, NamedTemporaryFile import time from typing import Callable, List, Tuple import multiprocessing as mp import zipfile from flask import json, jsonif...
vnrpc.py
# encoding: UTF-8 import threading import traceback import signal import zmq from msgpack import packb, unpackb from json import dumps, loads # 实现Ctrl-c中断recv signal.signal(signal.SIGINT, signal.SIG_DFL) ######################################################################## class RpcObject(object): """ ...
ThreadPool.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import queue import threading import contextlib import time import traceback StopEvent = object() class ThreadPool(object): def __init__(self, max_num): self.q = queue.Queue() # 存放任务的队列 self.max_num = max_num # 最大线程并发数 self.terminal = Fals...
__init__.py
from distutils.version import LooseVersion import logging from logging.handlers import SysLogHandler, TimedRotatingFileHandler import os from pathlib import Path import sys import queue import threading import uuid import warnings import appdirs from IPython import get_ipython from ._version import get_versions __v...
test_subprocess.py
import unittest from unittest import mock from test import support import subprocess import sys import signal import io import itertools import os import errno import tempfile import time import traceback import selectors import sysconfig import select import shutil import threading import gc import textwrap from test....
interactive.py
import asyncio import logging import os import tempfile import textwrap import uuid from functools import partial from multiprocessing import Process from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union, Set import numpy as np from aiohttp import ClientError from colorclass import Color from ras...
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development 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 ...
NatNetClient.py
import sys import time import socket import struct import timecode from threading import Thread def trace(*args): pass#' '.join([str(arg) for arg in args]) # Create structs for reading various object types to speed up parsing. ShortValue = struct.Struct('<h') IntegerValue = struct.Struct('<i') Unsig...
auto_detect.py
## ## python auto_detect.py --srcdir srcfilePath --out result --num 10 --threshold 0.80 ## --srcdir pictures for testing ## --out assign result dir ## --num numbers to simple for every dir ## --threshold ## ## ## 3 classes, class0 from none dish, class1 current dish, class2 from oth...
actions_implementation.py
import threading import time import random def timer(seconds, var, oldValue): time.sleep(int(seconds)) var['value'] = oldValue def fade_out(device): seconds = 100 for prop in device: if prop['title'] == "status": prop['value'] = "true" if prop['title'] ==...
xla_client_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...
YoctoThermistor_FISH.py
#The files/folders that need to be in the executing folder are: # yocto_api.py # yocto_temperature.py # folder: cdll #Available from the Yoctopuce website: #http://www.yoctopuce.com/EN/libraries.php Python libraries #TODO: #Make plotting function #Buffer creation is commented out. import os,sys import time impor...