source
stringlengths
3
86
python
stringlengths
75
1.04M
training_tracker.py
import copy import gzip import json import os import time from collections import defaultdict from os.path import isdir, join, dirname, realpath import threading import numpy as np import torch from torch import nn from tralo.log import log import multiprocessing as mp from tralo.utils import count_parameters, sha1_h...
test_models.py
import unittest from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\ QuestionSet, AnswerPaper, Answer, Course, StandardTestCase,\ StdIOBasedTestCase, FileUpload, McqTestCase, AssignmentUpload,\ LearningModule, LearningUnit, Lesson, LessonFile, CourseStatus from yaksh.code_server import(Se...
dag_processing.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...
test_device.py
import threading import unittest import pytest import six from cupy import cuda from cupy import testing class TestDeviceComparison(unittest.TestCase): def check_eq(self, result, obj1, obj2): if result: assert obj1 == obj2 assert obj2 == obj1 assert not (obj1 != obj2...
TestPythonParaViewWeb.py
#/usr/bin/env python # Global python import import exceptions, traceback, logging, random, sys, threading, time, os # Update python path to have ParaView libs build_path='/Volumes/SebKitSSD/Kitware/code/ParaView/build-ninja' sys.path.append('%s/lib'%build_path) sys.path.append('%s/lib/site-packages'%build_path) # Pa...
nonblocking_stream_reader.py
# idea from http://eyalarubas.com/python-subproc-nonblock.html from queue import Queue, Empty from threading import Thread class NonBlockingStreamReader: def __init__(self, stream): self._stream = stream self._queue = Queue() self._thread = None self.closed = True def start(se...
dataset.py
# Copyright 2020 - 2021 MONAI Consortium # 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 wri...
VelvetServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
test_solvers.py
# Copyright (c) AIRBUS and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations import pytest import inspect from enum import Enum from typing import NamedTuple, Optional from math import sqrt fr...
junit_cmd_wrapper.py
#!/usr/bin/env python import argparse import logging import string import subprocess import sys import time import xml.etree.cElementTree as ElementTree from io import BytesIO from threading import Thread logger = logging.getLogger('ta-junit-wrapper') class TeeBytesIO(BytesIO): """duplicate each write command to...
miniterm.py
#!/usr/bin/env python #very simple serial terminal #http://pyserial.sf.net package required #input characters are sent directly, received characters are displays as is #baudrate and echo configuartion is done through globals: #<cliechti@gmx.net> import sys, os, serial, threading, getopt #EXITCHARCTER = '\x1b' #ESC ...
stitch_demo.py
import numpy as np import os,sys, glob from matplotlib import pyplot as plt import camera as cam import stat_tools as st from scipy.ndimage import morphology,filters, sobel ####more efficient than skimage from skimage.morphology import remove_small_objects from collections import deque import multiprocessing,subproces...
saliency.py
from __future__ import division import concurrent import os import sys import time from threading import Thread sys.path.append('/Users/rodrigobresan/Documents/dev/github/anti_spoofing/spoopy/spoopy') import math import networkx as nx # import matplotlib.pyplot as plt import numpy as np import scipy.spatial.distanc...
tracker.py
import os import numpy as np import math import cv2 import onnxruntime import time import queue import threading import copy from similaritytransform import SimilarityTransform from retinaface import RetinaFaceDetector from remedian import remedian def resolve(name): f = os.path.join(os.path.dirname(__file__), nam...
test_tracer.py
# -*- coding: utf-8 -*- """ tests for Tracer and utilities. """ import contextlib import multiprocessing import os from os import getpid import threading from unittest.case import SkipTest import warnings import mock import pytest import six import ddtrace from ddtrace.constants import ENV_KEY from ddtrace.constants ...
fields.py
import re from pathlib import Path from threading import Thread from django.conf import settings from django.core.files.storage import FileSystemStorage from django.db import models from django.db.models.signals import post_delete from .widgets import CKEditor5Widget def delete_images(instance): for field in in...
Client.py
import asyncio import time import threading from .HTTPSCLIENT import HTTPClient, opcode from .Log import Log from .Guild import Guild class Client: def __init__(self, Log = False): """ The Client class to instantiate a Discord Client. Parameters ---------- Optiona...
connection_manager_4edge.py
import socket import threading import pickle import codecs from concurrent.futures import ThreadPoolExecutor from .core_node_list import CoreNodeList from .message_manager import ( MessageManager, MSG_CORE_LIST, MSG_PING, MSG_ADD_AS_EDGE, ERR_PROTOCOL_UNMATCH, ERR_VERSION_UNMATCH, OK_WITH...
kademlia.py
from logging import debug, error from queue import Empty, Queue from random import randint from threading import Semaphore, Thread from time import sleep from rpyc import Connection, discover, Service from rpyc.utils.factory import DiscoveryError from .bucket_table import BucketTable from .contact import Contact from ....
gamepad-remapper.py
#!/usr/bin/python3 -u import nativemessaging as nm import os import threading import subprocess import sys import json import pyautogui # prevent pygame from printing and breaking nativemessaging os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "" import pygame dirs = {"neg": -1, "pos": 1} axes = {"x": 0, "y": 1} def sen...
gemini.py
import asyncio import base64 import hashlib import hmac import json import os import queue import ssl import time import traceback from datetime import date, datetime, timedelta from threading import Thread from typing import Dict, List, Optional, Tuple import pandas as pd import requests import websocket from pytz im...
appt.py
from flask import Flask, render_template, Response, request, abort, jsonify import cv2 from flask_cors import CORS import os import animus_client as animus import animus_utils as utils import sys import logging import numpy as np import atexit import time import threading import socketio import simplejpeg stopFlag = Fa...
YIBInfoService.py
from math import exp import sys import frappe import threading from frappe.database.database import enqueue_jobs_after_commit import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry from money_transfer.money_transfer.service.utils import background, get_service...
whatsapp.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys; sys.dont_write_bytecode = True; import os; import signal; import base64; import math; import time; import datetime; import json; import io; from time import sleep; from threading import Thread; from Crypto.Cipher import AES; from Crypto.Hash import SHA256; imp...
chunkystreamsocket.py
#!/usr/bin/env python3 # vim ts=4,fileencoding=utf-8 # SPDX-License-Identifier: Apache-2.0 # SPDXID: pymisclib-1 # PackageCopyrightText: © Copyright 2012-2022 by Christian Dönges <cd@platypus-projects.de> # PackageDownloadLocation: None # PackageHomePage: https://github.com/cdoenges/pymisclib # PackageName: pymisclib #...
cbas_secondary_indexes.py
import threading import random from TestInput import TestInputSingleton from cbas.cbas_base import CBASBaseTest class CBASSecondaryIndexes(CBASBaseTest): def setUp(self): self.input = TestInputSingleton.input if "default_bucket" not in self.input.test_params: self.input.test_params.upd...
plotter_simulator.py
import plotter_controller import threading import random import time import PIL.Image import PIL.ImageDraw import numpy as np import sys import step_file_data_provider import math class PlotterSimulator: def __init__(self, step_time, phys_time, image_output_dir=None, save_stats=True): self.image_time_step = 1 / 60 ...
srv_asyncio.py
from select import select from socket import socket,inet_aton,getfqdn,gethostname,gethostbyname_ex,AF_INET, SOCK_STREAM, SOCK_DGRAM, SOL_SOCKET,SO_REUSEADDR,SOL_IP, IP_DROP_MEMBERSHIP,IP_ADD_MEMBERSHIP,INADDR_ANY,IP_MULTICAST_TTL,IP_MULTICAST_LOOP from threading import Thread,Condition try: from queue import Queu...
multiprocess_testing.py
#!/usr/bin/env python # coding=utf-8 # Copyright © 2016 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space> # # 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.a...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test BGLd shutdown.""" from test_framework.test_framework import BGLTestFramework from test_framework.util ...
input_manager.py
from config.config import REPEAT_DELAY, REPEAT_RATE, IS_WINDOWS import time import pyautogui pyautogui.FAILSAFE = False pyautogui.PAUSE = 0.0 if (IS_WINDOWS == True): import pydirectinput pydirectinput.FAILSAFE=False pydirectinput.PAUSE = 0.0 import threading # Managers sending inputs to manipulate the key...
test_concurrent_futures.py
import test.support # Skip tests if _multiprocessing wasn't built. test.support.import_module('_multiprocessing') # Skip tests if sem_open implementation is broken. test.support.import_module('multiprocessing.synchronize') from test.support.script_helper import assert_python_ok import contextlib import itertools imp...
core.py
############################################################################# # # Pyro Core Library # # This is part of "Pyro" - Python Remote Objects # which is (c) Irmen de Jong - irmen@razorvine.net # ############################################################################# from __future__ import with_stateme...
utils.py
# coding=utf-8 """Shared utility functions""" import argparse import collections import functools import glob import inspect import itertools import os import re import subprocess import sys import threading import unicodedata from enum import ( Enum, ) from typing import ( TYPE_CHECKING, Any, Callable,...
local_test.py
#!/bin/python3 import subprocess import time import struct import sys import threading import socket import os #shellcode = b"\x04\x00\r4\x06\x00\x084\x00\xa2\t<\x00\x80)5\x00\xa3\n<$\x00J5\x00\x00\x0b4\x00\x00\"\x8d\x00\x00\x00\x00\x00\x00B\xad\x04\x00)%\x04\x00J%\x01\x00k%\xf9\xffm\x15\x00\x00\x00\x00\x00\xa3\x0c< ...
word2vec_optimized.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...
crucible.py
import logging try: from Queue import Empty except: from queue import Empty from redis import StrictRedis import time from time import time, sleep from threading import Thread # @modified 20190522 - Task #3034: Reduce multiprocessing Manager list usage # Use Redis sets in place of Manager().list to reduce memor...
distributed.py
HELP="""All related to distributed compute and atomic read/write Thread Safe Process Safe Lock Mechanism """ import os, sys, socket, platform, time, gc,logging, random ############################################################################################### from utilmy.utilmy import log, log2 def h...
fritzbox_callmonitor.py
""" A sensor to monitor incoming and outgoing phone calls on a Fritz!Box router. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.fritzbox_callmonitor/ """ import logging import socket import threading import datetime import time import re import v...
standalone_test.py
"""Tests for acme.standalone.""" import multiprocessing import os import shutil import socket import threading import tempfile import unittest import time from contextlib import closing from six.moves import http_client # pylint: disable=import-error from six.moves import socketserver # type: ignore # pylint: disab...
xlink_windows_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 import sys from typing import Callable from ctypes import * import time from inbm_vision_lib.constants import XLINK_...
email.py
from threading import Thread from flask_mail import Message from app import app, mail def send(recipient, subject, body): """ Send a mail to a recipient. The body is usually a rendered HTML template. The sender's credentials has been configured in the config.py file. """ sender = app.config['ADMIN...
test_integration.py
import logging import os import subprocess import sys import mock import pytest import ddtrace from ddtrace import Tracer from ddtrace import tracer from ddtrace.constants import MANUAL_DROP_KEY from ddtrace.constants import MANUAL_KEEP_KEY from ddtrace.internal.runtime import container from ddtrace.internal.writer i...
SwiftRoute.py
#!/usr/bin/env python """ @author Jesse Haviland """ import swift as sw import websockets import asyncio from threading import Thread import webbrowser as wb import json import http.server import socketserver from pathlib import Path import os from queue import Empty import numpy as np import time import sys def s...
Hiwin_RT605_ArmCommand_Socket_20190627161324.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 i...
test_context.py
from typing import List, Protocol from roles import RoleType from roles.context import context, in_context class Account(Protocol): balance: float def withdraw(self, amount: float) -> None: ... def deposit(self, amount: float) -> None: ... class PaymentAccount: def __init__(self, ...
main.py
#!/bin/python3 import threading import os from http_server import run_http_server if __name__ == "__main__": PORT = int(os.environ.get('PORT', '8080')) HTTP_THREAD = threading.Thread(target=run_http_server, args=(PORT,)) HTTP_THREAD.daemon = True HTTP_THREAD.start() threading.Event().wait()
ActionQueue.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 use this ...
ip_proxies.py
# -*- coding: utf-8 -*- """ 四进程爬虫,爬取orcid网址的信息,转存至info表 @Author: lushaoxiao @Date: 2019/3/31 @IDE: PyCharm """ import requests from bs4 import BeautifulSoup from random import choices import multiprocessing as mp import re import os import csv import time import random import json from mysql import connector import uui...
1_graph_classification.py
""" Single Machine Multi-GPU Minibatch Graph Classification ======================================================= In this tutorial, you will learn how to use multiple GPUs in training a graph neural network (GNN) for graph classification. This tutorial assumes knowledge in GNNs for graph classification and we recomm...
GUI MUSIC PLAYER.py
""" Music Player ---------------------------------------- """ import os import threading import time import tkinter.messagebox from tkinter import * from tkinter import filedialog from tkinter import ttk from ttkthemes import themed_tk as tk from mutagen.mp3 import MP3 from pygame import mixer root = tk.ThemedTk() root...
live_stream_client.py
import pickle import socket import struct from threading import Thread class LiveStreamClient: def __init__(self): self.client_socket = None self.receive_thread = None self.image_callbacks = [] def connect(self, ip_address: str, port: int): self.receive_thread = Thread(target...
D3ADW!F!.py
#!/usr/bin/python3 import signal from time import sleep as timeout from scapy.all import * from pyfiglet import figlet_format from scapy.layers.dot11 import Dot11Beacon, Dot11ProbeResp, Dot11, Dot11Deauth, Dot11Elt, Dot11AssoReq, Dot11Auth from termcolor import colored from multiprocessing import Process import logging...
iprof_app.py
# This is a modified version of: # http://sourceforge.net/p/imvu/code/HEAD/tree/imvu_open_source/tools/pstats_viewer.py import os import pstats import sys import traceback import time import webbrowser import fnmatch import threading from six import StringIO import tornado.ioloop import tornado.web def launch_b...
host_state.py
""" Global shared state about the host. """ import threading import utils import time import sys CLIENT_VERSION = '1.0.3-L' class HostState(object): def __init__(self): self.host_ip = None self.host_mac = None self.gateway_ip = None self.packet_processor = None self.us...
mininet_tests.py
#!/usr/bin/env python3 """Mininet tests for FAUCET.""" # pylint: disable=too-many-lines # pylint: disable=missing-class-docstring,missing-function-docstring # pylint: disable=too-many-arguments import binascii import collections import copy import itertools import ipaddress import json import os import random import...
timed_quiz.py
#!/usr/bin/python3 # imports {{{ import logging import threading import time import datetime import sys import tty, termios import random import argparse import atexit # }}} ################## Global stuff ################## {{{ x0 = 0 y0 = 0 sec = 0 sec_inc = 1 lock=threading.Lock() # Set up unbuffered read fr...
miner.py
import time import hashlib import json import requests import base64 from flask import Flask, request from multiprocessing import Process, Pipe import ecdsa from miner_config import MINER_ADDRESS, MINER_NODE_URL, PEER_NODES node = Flask(__name__) class Block: def __init__(self, index, timestamp, data, previous_...
test_cli.py
import datetime import getpass import json import logging import os import re import tempfile import threading import unittest import uuid from functools import partial import pytest from tests.waiter import util, cli @pytest.mark.cli @pytest.mark.timeout(util.DEFAULT_TEST_TIMEOUT_SECS) class WaiterCliTest(util.Wait...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import absolute_import, print_function import os import re import sys import copy import time import types import signal import fnmatch import logging import threading import traceback import multiprocessing from random imp...
scheduler_job.py
# -*- coding: utf-8 -*- # # 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 #...
isql_rest_async.py
try: import queue except ImportError: import Queue as queue import threading import urllib from itoolkit.transport import HttpTransport from itoolkit import * class iDB2Async(): def __init__(self, isql): self.itran = HttpTransport('http://yips.idevcloud.com/cgi-bin/xmlcgi.pgm','*NONE','*NONE') self.it...
test_weakref.py
import gc import sys import unittest import collections import weakref import operator import contextlib import copy import threading import time import random from test import support from test.support import script_helper, ALWAYS_EQ from test.support import gc_collect # Used in ReferencesTestCase.test_ref_created_d...
download.py
# ============================================================================= # # EZID :: download.py # # Batch download. # # Downloads are created by a single daemon thread. The download # creation process is designed to be restartable at any point: if the # server is restarted, the current download resumes where i...
test_debugger.py
import pytest import textwrap import ctypes import os import windows import windows.generated_def as gdef import windows.native_exec.simple_x86 as x86 import windows.native_exec.simple_x64 as x64 from conftest import generate_pop_and_exit_fixtures, pop_proc_32, pop_proc_64 from pfwtest import * proc32_debug = genera...
handler.py
# -*- coding: utf-8 -*- """ proxy.py ~~~~~~~~ ⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging. :copyright: (c) 2013-present by Abhinav Singh and contributors. :license: BSD, see LICENSE...
select_nyt.py
#!/usr/bin/env python from nltk.corpus.reader import XMLCorpusReader import os import sys from collections import defaultdict #from multiprocessing import Process, Queue, cpu_count ### Functions to create extractors ### def make_filter_extractor(base_extractor, reject_cond, feature_name, al...
process-state.py
#!/usr/bin/env python # Copyright (c) 2019 AT&T Intellectual Property. # Copyright (c) 2019 Nokia. # # 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/li...
stock_evaluator.py
import time from yahoo_fin.stock_info import * import json import numpy_financial as npf import pandas as pd import numpy import traceback import csv import random import stopit from concurrent.futures import ThreadPoolExecutor, as_completed import logging import queue import threading import socket import requests RA...
measurePerformance.py
# ######################################################################## # Copyright 2016 Advanced Micro Devices, Inc. # # ######################################################################## import sys import argparse import subprocess import itertools import re#gex import os from threading import Timer, Thread...
email.py
# -*- coding: utf-8 -*- from threading import Thread from flask import current_app, render_template from flask_mail import Message from .extensions import mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(to, subject, template, **kwargs): app = current_app._g...
app.py
from flask import Flask, request, jsonify import logging import sys import threading from web import util from web.api import timeseries try: assert False sys.exit('ERROR asserts disabled, exiting') except AssertionError: pass logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) app = Flask(__name...
pabot.py
#!/usr/bin/env python # Copyright 2014->future! Mikko Korpela # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
view_audio.py
#!/usr/bin/env python3 ################################################################################################### # # Project: Embedded Learning Library (ELL) # File: view_audio.py # Authors: Chris Lovett, Chuck Jacobs # # Requires: Python 3.x, numpy, tkinter, matplotlib # ###########################...
aoiklivereload.py
# coding: utf-8 """ Live reloader that detects module file changes and reloads the program. """ from __future__ import absolute_import # Standard imports import os import subprocess import sys import threading import time # External imports from watchdog.events import FileSystemEventHandler from watchdog.observers im...
vodloader.py
from twitchAPI.types import VideoType from time import sleep from threading import Thread import logging from vodloader_video import vodloader_video from vodloader_status import vodloader_status from youtube_uploader import YouTubeOverQuota, youtube_uploader import datetime import pytz import os class vodloader(objec...
piped.py
# # Copyright (c) 2015 Autodesk 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 l...
test_container.py
# global import os import queue import pickle import pytest import random import numpy as np import multiprocessing # local import ivy from ivy.container import Container import ivy_tests.test_ivy.helpers as helpers def test_container_list_join(dev, call): container_0 = Container({'a': [ivy.array([1], dev=dev)],...
reltestbase.py
# -*- coding: utf-8; -*- ############################################################################## # # Copyright (c) 2008 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this...
ProcessChapter9.py
# encoding:UTF-8 import os import random import time from multiprocessing import Process, Pool, Queue __author__ = 'Hope6537' # multiprocessing模块提供了一个Process类来代表一个进程对象,下面的例子演示了启动一个子进程并等待其结束: def run_proc(name): print 'Run child process %s (%s)...' % (name, os.getpid()) if __name__ == '__main__': print 'Par...
scheduler_job.py
# -*- coding: utf-8 -*- # # 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 #...
run.py
import os import gym import time import torch import numpy as np import numpy.random as rd from copy import deepcopy from elegantrl.replay import ReplayBuffer, ReplayBufferMP from elegantrl.env import PreprocessEnv """[ElegantRL](https://github.com/AI4Finance-LLC/ElegantRL)""" class Arguments: def __init__(self,...
server.py
from flask import Flask, redirect, url_for, render_template from threading import Thread app = Flask('') @app.route('/') def main(): return render_template('index.html') def run(): app.run(host='0.0.0.0', port=8080) def server(): server = Thread(target=run) server.start()
create_threads.py
#!/usr/bin/python # This multithreading program creates five threads # and each thread prints "Hello World" with a two-second interval import threading import time def HelloWorld(): """User defined Thread function""" print("Hello World") return def Main(): threads = [] # Threads list needed when we use a b...
cli.py
from __future__ import print_function import re import decimal import argparse import pandas as pd from multiprocessing import Pool, TimeoutError, Queue, Process, Manager from Queue import Empty import utils class Cli(object): def __init__(self, argv): self.opts = self._parse_args(argv) self._up...
two-tasks.py
#!/usr/bin/env python """ Two progress bars that run in parallel. """ import threading import time from quo.progress import ProgressBar def main(): with ProgressBar(title="Two tasks") as pb: # Two parallal tasks. def task_1(): for i in pb(range(100)): time.sleep(0.05) ...
tests_tflite.py
import numpy as np from includes import * ''' python -m RLTest --test tests_tflite.py --module path/to/redisai.so ''' def test_run_tflite_model(env): if not TEST_TFLITE: env.debugPrint("skipping {} since TEST_TFLITE=0".format(sys._getframe().f_code.co_name), force=True) return con = get_con...
test_pin_thread.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...
process.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os import tempfile import subprocess import tensorflow as tf import numpy as np import tfimage as im import threading import time import multiprocessing edge_pool = None parser = argp...
pool_multiprocessing.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from multiprocessing import Pool, Process, Queue, Pipe # Queue 线程安全 # from multiprocessing.dummy import Pool, Process, Queue, Pipe # thread from time import sleep import threading def f(x): # print(threading.currentThread().getName(), threading.currentThread().ide...
idebench.py
import importlib import json import csv import time import hashlib import multiprocessing import statistics import numpy as np import os from common.schema import Schema from common.vizgraph import VizGraph from common.vizrequest import VizRequest from common.operation import Operation from optparse import OptionParser...
test_capture.py
import contextlib import io import os import subprocess import sys import textwrap from io import UnsupportedOperation from typing import BinaryIO from typing import Generator import pytest from _pytest import capture from _pytest.capture import _get_multicapture from _pytest.capture import CaptureManager from _pytest...
run.py
#!/usr/bin/env python import argparse import webbrowser from multiprocessing import Process, Queue from threading import Thread import subprocess from app import create_app from app.utils.misc import get_os, get_executable from app.utils.session_key import SessionKey processes = {} queue = Queue(5) def main(): ...
file_lock_machine_test.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 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. """lock_machine.py related unit-tests. MachineManagerTest tests MachineManager. """ from __future__ impo...
focus.py
import multiprocessing import os import pylibmc import pyodbc from raven import Client import signal import time from logger import logger from secrets import secrets if 'DEVELOPMENT' in os.environ: raven = Client() else: raven = Client(secrets['SENTRY_DSN']) def main(): # How frequent to attempt connec...
test_ibm_job.py
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
main.py
#!/usr/bin/env python3 import argparse import operator import threading import numpy as np from time import sleep import cv2 import depthai as dai import socket from common.config import NN_IMG_SIZE from common.cscore_stream import CsCoreStream from pipelines import goal_edge_depth_detection, object_edge_detection i...
main.py
import logging import queue import threading from threading import Thread from tkinter import ttk, DISABLED, NORMAL, NSEW from tkinter.scrolledtext import ScrolledText import tkinter as tk from tkinter import N, W, S, E, Tk, BooleanVar import validators from bavli_reports.report_worker import do_report_work logger =...
main.py
import threading from tkinter.filedialog import * from pytube import YouTube, request # dark mode : def darkmode(): global btnState if btnState: btn.config(image=offImg, bg="#CECCBE", activebackground="#CECCBE") root.config(bg="#CECCBE") txt.config(text="Dark Mode: OFF", bg="#CECCBE") ...
base.py
import argparse import base64 import copy import itertools import json import multiprocessing import os import re import sys import threading import time import uuid from collections import OrderedDict from contextlib import ExitStack from typing import ( Optional, Union, Tuple, List, Set, Dict,...