source
stringlengths
3
86
python
stringlengths
75
1.04M
tests.py
# -*- coding: utf-8 -*- # Unit and doctests for specific database backends. from __future__ import unicode_literals import copy import datetime from decimal import Decimal import re import threading import unittest import warnings from django.conf import settings from django.core.exceptions import ImproperlyConfigure...
propagate.py
# Procfile # web: gunicorn propagate:app --log-file - # web: gunicorn webapp.propagate:app --log-file - from flask import Flask, request, jsonify import os import re import sys import threading import time from . import config from . import trigger # @TODO improve error handling/exceptions # @TODO implement p...
continuecrawl.py
import os import sys import time # from flask import Flask import urllib import threading import time # from urllib import urllib.parse # import urllib.parse import bs4 import requests from pprint import pprint from logger import logger from collections import Counter # http://localhost:8080/wikipedia_en_simple_al...
debug_many.py
import json import os import pathlib import random import shutil import threading from datetime import datetime import superannotate as sa from PIL import Image, ImageDraw, ImageFont random.seed(datetime.now()) def return_json(): """returns dict""" data_json = { 'metadata': { ...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "I'm alive" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()
test_urllib.py
"""Regresssion tests for urllib""" import urllib.parse import urllib.request import urllib.error import http.client import email.message import io import unittest from unittest.mock import patch from test import support import os try: import ssl except ImportError: ssl = None import sys import tempfile from nt...
forking1.py
import multiprocessing as mp import socket HOST, PORT = '0.0.0.0', 8888 ADDR = (HOST, PORT) def handle_client(c): req = c.recv(1024) if not req: c.close() return req_lines = req.split(b'\r\n') method, path, version = req_lines[0].decode().split() print(method, path, version) ...
log_consumer.py
"""Log consumers are responsible for fetching chia logs and propagating them to subscribers for further handling. This abstraction should provide an easy ability to switch between local file reader and fetching logs from a remote machine. The latter has not been implemented yet. Feel free to add it. """ # std import ...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2019 The Tokyocoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test tokyocoind shutdown.""" from test_framework.test_framework import TokyocoinTestFramework from t...
workers_manager.py
import importlib import inspect import threading from functools import partial from distutils.version import LooseVersion from apscheduler.schedulers.background import BackgroundScheduler from interruptingcow import timeout from pytz import utc from const import DEFAULT_COMMAND_TIMEOUT from exceptions import WorkerTi...
server.py
import http.server import os import bpy from threading import Thread, current_thread from functools import partial def ServeDirectoryWithHTTP(directory='.'): hostname = 'localhost' port = 8000 directory = os.path.abspath(directory) handler = partial(http.server.SimpleHTTPRequestHandler, directory=dire...
pscanner2.py
import threading from queue import Queue import time import socket import sys print_lock = threading.Lock() if (len(sys.argv) != 2): print("Usage: # python3 pscanner2.py <ipaddress>") exit(0) #scan_port = [21,22,25,53,80,88,135,139,389,443,445,3389] scan_port = [21,22,23,25,53,80,88,110,123,135,139,143,389,443...
test_autodiff.py
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
main.py
#!/usr/bin/python from p4app import P4Mininet from p4app import P4Mininet, P4Program from mininet.topo import Topo from mininet.node import CPULimitedHost from mininet.link import TCLink from mininet.net import Mininet from mininet.log import lg from mininet.util import dumpNodeConnections, custom from mininet.cli imp...
pdHelloWorldServer.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...
manager.py
from secrets import token_hex from threading import Thread from typing import Dict import socketio from consoles.sports import Football class FootballManager: '''Football Game State Manager''' def __init__(self, home_team, home_mascot, home_color, visitor_team, visitor_mascot, visitor_color, com_port) -> Non...
bacnet_scan.py
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2020, Battelle Memorial Institute. # # 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...
event_predict.py
import sys,os sys.path.append("..") import numpy as np import tensorflow as tf from example import bert_classifier_estimator from bunch import Bunch from data_generator import tokenization from data_generator import tf_data_utils from model_io import model_io from example import feature_writer, write_to_tfrecords, clas...
server.py
import pickle import random import select import socket import threading import traceback import functools import server_board_state class Server(): def __init__(self): # number of bytes of the header message self.HEADER = 64 self.PORT = 5050 # arbitrary port number, may have to consid...
live_response_api.py
from __future__ import absolute_import import json import random import string import threading import time import logging from collections import defaultdict import shutil from cbapi.errors import TimeoutError, ObjectNotFoundError, ApiError, ServerError from cbapi.six import itervalues from concurrent.futures impor...
guithread.py
""" GUI threading helpers """ import threading import time import Queue try: import glib except ImportError: import gobject as glib __all__ = ['run_in_gui_thread', 'run_later_in_gui_thread', 'assert_gui_thread', 'start_thread', 'run_in_background', 'SingleRunner'] def run_in_gui_thread(...
speech_client.py
import speech_recognition from gtts import gTTS import os import queue import websocket from threading import Thread import threading import time from tempfile import TemporaryFile import wave, sys, pyaudio # import pygame from enum import Enum recognizer = speech_recognition.Recognizer() class ClientState(Enum): ...
worker.py
from threading import Thread def do_in_background(target, args): thread = Thread(target=target, args=args) thread.start()
nui.py
"""Natural User Interface for the Morseus app.""" import itertools import threading import time from PIL import Image from kivy.clock import Clock from kivy.uix.camera import Camera from kivy.uix.gridlayout import GridLayout from kivy.uix.textinput import TextInput from kivy.properties import ( BooleanProperty, ...
utils.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...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum.util import bfh, bh2u, UserCancelled, UserFacingException from electrum.bip32 import BIP32Node from electrum import constants from electrum.i18n import...
main.py
# references # https://www.thepythoncode.com/article/send-receive-files-using-sockets-python # https://www.csestack.org/python-oserror-winerror-10022-invalid-argument-was-supplied/ # https://stackoverflow.com/questions/53136368/sending-multiple-files-python-using-socket # https://linuxhint.com/python_socket_file_transf...
databackup.py
""" 数据备份 需求: 1、文件到这里 一份给ES 一份给自己 按国家端口保存,按大小打包, zip保存到另外一个文件夹 稳定性,扩展性和效率 by judy 2020/08/31 """ from pathlib import Path import threading import json from queue import Queue import traceback import time from shutil import copyfile import zipfile import shutil class FileInfo(object): def __init__(self, ssize, c...
train_pg_f18.py
""" Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017 Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany """ import numpy as np import tensorflow as tf import gym import logz import os import time im...
epg.py
import os import json import time import datetime from collections import OrderedDict from multiprocessing import Process from fHDHR.origin import origin_epg from .epgtypes import blocks, zap2it class EPG(): def __init__(self, settings, channels): self.config = settings self.channels = channels ...
test_fft.py
import functools import unittest import pytest import numpy as np import cupy from cupy import testing from cupy.fft import config from cupy.fft.fft import _default_plan_type import six def nd_planning_states(states=[True, False], name='enable_nd'): """Decorator for parameterized tests with and wihout nd plann...
lock.py
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) """These tests ensure that our lock works correctly. This can be run in two ways. First, it can be run as a node-local t...
index.py
from multiprocessing import Process segs = {} res = {} def raw_set(seg, exp, val): if val in res[seg]: if len(exp) >= len(res[seg][val]): return res[seg][val] = exp def set(seg, exp): val = int(eval(exp)) # print(exp, val) raw_set(seg, exp, val) def set_ans(seg, exp): ...
basic_2.py
import uuid import multiprocessing def my_function(): print 'My Unique Id: {0}'.format(uuid.uuid1()) if __name__ == '__main__': process = multiprocessing.Process(target=my_function) process.start()
test.py
import json import os.path as p import random import socket import threading import time import logging import io import string import ast import math import avro.schema import avro.io import avro.datafile from confluent_kafka.avro.cached_schema_registry_client import ( CachedSchemaRegistryClient, ) from confluent...
Atlas.py
""" MIT License Copyright (c) 2018 Claude SIMON (https://q37.info/s/rmnmqd49) 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 ...
campi_controller.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- mqtt_host = 'mqtt.home' import paho.mqtt.client as paho import platform import sys import os #import urllib2 import time from subprocess import call import struct import socket import threading import fcntl import json try: mqtt = paho.Client(client_id=socket.gethostna...
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...
test_concurrency.py
import random import threading import time from sqlalchemy import Column from sqlalchemy import exc from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy.orm import clear_mappers from sqlalchemy.orm import declarative_base from sqlalchemy.orm import declared_att...
curses_ui_test.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
base.py
# -*- coding: utf-8 -*- ''' # ショートカットキーを押した時、押している間、離した時に何かをするスクリプト # このスクリプト起動時のキー押下状態保存してそのキーの持続状態を判定している # #  持続時間中に何かをするのでないのであれば、このようなスクリプトを使用するの #  でなく素直に2つコマンド用意し同じキーに on press / on release としてそれぞれ #  のコマンドを割り当てるほうが良い # #  winapi 使用するので win 専用 # # # maya が大変不安定になるので覚悟キめること # # # 以下の実装...
ytdl.py
import os if "downloads" not in os.listdir(): os.mkdir("downloads") import threading import queue import youtube_dl import player ydl_opts = { "format": "bestaudio/best" } ydl = youtube_dl.YoutubeDL(ydl_opts) q = queue.Queue() def worker(): while True: item = q.get() ...
compare_WalltoallCNOT_qng.py
import qiskit import numpy as np import sys sys.path.insert(1, '../') import qtm.base, qtm.constant, qtm.nqubit, qtm.fubini_study, qtm.encoding import importlib import multiprocessing def run_walltoall(num_layers, num_qubits): n_walltoall = qtm.nqubit.calculate_n_walltoall(num_qubits) thetas = np.ones(num_lay...
WebFuzzer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This material is part of "The Fuzzing Book". # Web site: https://www.fuzzingbook.org/html/WebFuzzer.html # Last change: 2019-11-20 17:33:09+01:00 # #!/ # Copyright (c) 2018-2019 Saarland University, CISPA, authors, and contributors # # Permission is hereby granted, free...
markdown-link-checker.py
import re import requests import logging import argparse import sys import os import time from threading import Thread logging.basicConfig(filename="markdown-link-checker.log", format="%(asctime)-15s %(levelname)-8s %(message)s") log = logging.getLogger("__main__") log.setLevel(logging.INFO) def create_argparse(): ...
app.py
""" Flask web server module """ from threading import Thread import webbrowser import json from flask import Flask, jsonify, request from waitress import serve import config from update.update_facade import UpdateFacadeFactory from web.api.net_worth import NetWorthAPI from web.api.iban_list import IbanListAPI from web....
model.py
from asyncore import dispatcher_with_send from concurrent.futures import thread import imp import multiprocessing from queue import Queue from neuron import States import wirelessNode import neuronNetworks from configure import config from multiprocessing import Process from multiprocessing import Value import numpy as...
saving_agent.py
"""Provides flexible saving capabilities for alfred3 experiments. .. moduleauthor:: Paul Wiemann <paulwiemann@gmail.com>, Johannes Brachem <jbrachem@posteo.de> """ import queue import logging import threading import time import os import json import copy import re from abc import ABC, abstractmethod from configparse...
ViewManager.py
# Manage recorded 3D views using a list of named views # For more information about the RoboDK API: # Documentation: https://robodk.com/doc/en/RoboDK-API.html # Reference: https://robodk.com/doc/en/PythonAPI/index.html #------------------------------------------------------- from robolink import * from robodk imp...
api.py
from app import app from flask import request, jsonify import threading import requests from app.aspect.aspect_extraction import AspectExtraction from app.aspect.aspect_knowlege_base import AspectKnowledgeBase from app.aspect.utils import seq_to_vec, sentence_segmenter import threading import os import time import gens...
email_utils.py
""" This file handles email traffic caused by the kelp website, which is used to verify user accounts or reset user passwords. The email credentials can be set up in the configuration file. """ import smtplib import threading from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import ...
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_cintamani.cintamani_ps_util import (PSPossibleDoubleSpendError, ...
backend.py
# # Copyright (c) 2021, NVIDIA CORPORATION. # # 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 ...
cloud_motion_demo.py
import numpy as np import os, glob from matplotlib import pyplot as plt import camera as cam import time, sys import stat_tools as st from scipy.ndimage import morphology,filters, measurements ####more efficient than skimage from scipy import signal from skimage.morphology import remove_small_objects # from skimage im...
T3.py
from threading import Thread, Lock import logging import webview from time import sleep from TurtleNetwork import run_server, PORT server_lock = Lock() logger = logging.getLogger(__name__) def url_ok(url, port): # Use httplib on Python 2 from http.client import HTTPConnection try: conn = HTTPCo...
bot.py
import logging import threading import queue import sqlalchemy from slackclient import SlackClient from bot import config from bot.listener import SlackListener from bot.responder import SlackResponder from bot.handler import Handler from bot.scheduler import Scheduler from bot.markov.middleware import MarkovifyMiddl...
test_collection.py
import numpy import pandas as pd import pytest from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from utils.util_pymilvus import * prefix = "collection" exp_name = "name" exp_schema = "schema" exp_nu...
dt.py
# -*- coding:utf-8 -*- # # Tencent is pleased to support the open source community by making QTA available. # Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. # Licensed under the BSD 3-Clause License (the "License"); you may not use this # file except in compliance with the License. You may ...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
broker.py
import os import argparse import threading import time from util.subscription_manager import SubscriptionManager import util.logger as logger from util.listeners import * from util.configreader import BrokerConfigReader as ConfigReader from util.client_manager import ClientManager if __name__ == "__main__": # Lis...
utility.py
import os import math import time import datetime from multiprocessing import Process from multiprocessing import Queue import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import imageio import torch import torch.optim as optim import torch.optim.lr_scheduler as lrs class time...
scripts_regression_tests.py
#!/usr/bin/env python """ Script containing CIME python regression test suite. This suite should be run to confirm overall CIME correctness. """ import glob, os, re, shutil, signal, sys, tempfile, \ threading, time, logging, unittest, getpass, \ filecmp from xml.etree.ElementTree import ParseError LIB_DIR =...
multi_process_runner.py
# Lint as: python3 # Copyright 2019 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 ...
views.py
import logging import json import coreapi import coreschema from django.shortcuts import get_object_or_404 from django.db.models import Q from rest_framework import permissions, status from rest_framework.decorators import api_view, permission_classes, schema from rest_framework.response import Response from rest_frame...
controlpanelupdated.py
import threading from PyQt5.QtWidgets import QApplication import tello import time import cv2 from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import * from PyQt5.QtCore import * import traceback, sys # Create Billy global billy billy = tello.Tello() # Put Tello into command mode billy.send("command...
test_postgresql.py
import datetime import mock # for the mock.call method, importing it without a namespace breaks python3 import os import psycopg2 import shutil import subprocess import unittest from mock import Mock, MagicMock, PropertyMock, patch, mock_open from patroni.async_executor import CriticalTask from patroni.dcs import Clu...
run.py
# -*- coding: utf-8 -*- #!/usr/bin/env python """ D:\soft\vse_windows_GPU\vse\Python\python.exe .\run.py "E:\system\待下载" 嵌套字幕提取的命令行运行 @Author : hank """ import argparse import multiprocessing from multiprocessing import process import os import sys import cv2 # import pdb # reload(sys) # sys.setdefaultencoding('utf...
server.py
import socket import time import threading import tkinter as tk import os import time import random import pickle board = [" " for x in range(9)] def printBoard(): '''prints the tic tac toe board''' print ( " | | ") print (" "+board[0]+" | "+board[1]+" | "+board[2]+" ") print (" | ...
reader.py
# Copyright (c) 2019 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...
connection.py
import os import json import time import hashlib import tempfile import requests import threading from bs4 import BeautifulSoup from elasticsearch_kibana_cli import __title__ as NAME from elasticsearch_kibana_cli import __cli_name__ as CLI_NAME from elasticsearch_kibana_cli import __version__ as VERSION from elastics...
test_read_committed_update_misses_rows.py
############## # Setup Django import django django.setup() ############# # Test proper import threading import time import pytest from django.db.models import F from django.db import connection, transaction from app.models import Sock @pytest.mark.django_db def test_read_committed_update_misses_rows(): # We ...
test_search_20.py
import pytest from time import sleep from base.client_base import TestcaseBase from utils.util_log import test_log as log from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from utils.utils import * from common.constants import * prefix = "se...
example_rpc_client.py
import re import os import random from lxml import etree import time from PyWeChatSpy.command import * from PyWeChatSpy.games import TruthOrDare from PyWeChatSpy.proto import spy_pb2 from threading import Thread from adiosRobot.adiosRobot import chengyujielong, rjcsdrz from google.protobuf.descriptor import FieldDesc...
requester.py
import socket import sys import time import threading import errno try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setblocking(0) except socket.error: print 'Failed to create socket' sys.exit() host = 'localhost'; port = 8888; msg = '__client__' s.sendto(msg, (host, port)) ping_counte...
views.py
# Copyright (C) 2018 Intel Corporation # # SPDX-License-Identifier: MIT import os import errno import shutil import json import traceback import requests import zipfile from cvat.apps.engine.models import Comments import time import django_rq import re from threading import Thread from django.views...
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...
Detect.py
import sys import cv2 as cv import time from .MVL import MVL from .WebcamVideoStream import WebcamVideoStream from threading import Thread import os.path import uvicorn, asyncio, cv2 from vidgear.gears.asyncio import WebGear from vidgear.gears.asyncio.helper import reducer class Detect: def __init__(self, ne...
test_ufuncs.py
from __future__ import print_function import functools import itertools import re import sys import warnings import threading import numpy as np import numba.unittest_support as unittest from numba import types, typing, utils, typeof, numpy_support, njit from numba.compiler import compile_isolated, Flags, DEFAULT_FL...
test_setup.py
"""Test component/platform setup.""" # pylint: disable=protected-access import asyncio import os from unittest import mock import threading import logging import voluptuous as vol from homeassistant.core import callback from homeassistant.const import EVENT_HOMEASSISTANT_START, CONSTRAINT_FILE import homeassistant.co...
test_calling_gates_from_threads.py
import threading from eqsn import EQSN def test_call_single_qubit_gate_from_threads(): eqsn = EQSN() def call_X_gate_n_times(_id, n): for _ in range(n): eqsn.X_gate(_id) id1 = str(1) eqsn.new_qubit(id1) n = 99 nr_threads = 5 thread_list = [] for _ in range(nr_thre...
index.py
import urllib.request from urllib.parse import parse_qs, urlsplit, urlunsplit, urlencode import urllib.error import http.client import shutil import time import threading import os import tempfile import subprocess from datetime import date import re import itertools import traceback import functools import random impo...
plugin_scheduler.py
# code for cores isolation was inspired by Tuna implementation # perf code was borrowed from kernel/tools/perf/python/twatch.py # thanks to Arnaldo Carvalho de Melo <acme@redhat.com> from . import base from .decorators import * import tuned.logs import re from subprocess import * import threading import perf import se...
gen_index.py
from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC # for local hosting, since selenium requires a hosted page to work ...
email.py
from flask_mail import Message from flask import render_template from ctip import app, mail from threading import Thread def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_password_reset_email(user): token = user.get_reset_password_token() send_email('NYUCTIP Password ...
image_seg_data.py
""" Data layer to load images and semantic labels from a list of images. The prototxt could include the following parameters: 1. batch_size: Number of data points in each batch 2. im_size: Size of the image to be used. It will resize the image after loadingW 3. image_dir: Directory where images are presen...
repository.py
import atexit import os import re import subprocess import tempfile import threading import time from contextlib import contextmanager from pathlib import Path from typing import Callable, Dict, Iterator, List, Optional, Tuple, Union from tqdm.auto import tqdm from huggingface_hub.constants import REPO_TYPES_URL_PREF...
integration_test.py
""" Integration test for the ingestion-server. Spins up Docker containers, loads 1000 images into the upstream database, and ensures that the data has been copied and indexed downstream. """ import logging import pathlib import platform import subprocess import time import unittest from multiprocessing import Process,...
motion_detection.py
""" Motion Detection using OpenCV This program uses some code from: http://www.steinm.com/blog/motion-detection-webcam-python-opencv-differential-images/ """ import smtplib import io import datetime import socket import cv2 import threading import time import os import sys import re from email.mime.multipart import ...
test_closing.py
from fixtures import * # noqa: F401,F403 from flaky import flaky from pyln.client import RpcError from shutil import copyfile from utils import ( only_one, sync_blockheight, wait_for, DEVELOPER, TIMEOUT, account_balance, first_channel_id, basic_fee ) import os import queue import pytest import re import threa...
webcamvideostream.py
# import the necessary packages from threading import Thread import cv2 class WebcamVideoStream: def __init__(self, src=0, name="WebcamVideoStream"): # initialize the video camera stream and read the first frame # from the stream self.stream = cv2.VideoCapture(src) (self.grabbed, self.frame) = self.stream.rea...
cli_window.py
import shlex import subprocess import threading import queue from typing import List from dash import Dash from dash.dependencies import Input, Output, State from dash.exceptions import PreventUpdate import dash_core_components as dcc import dash_html_components as html import visdcc def enqueue_output(out, queue_: ...
HoloScan.py
import os import ui import sys import math import time import shutil import socket import dialogs import console import zipfile import urllib.request from objc_util import * from threading import Event, Thread from socketserver import ThreadingMixIn from http.server import BaseHTTPRequestHandler, HTTPServer try: impor...
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...
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.base import CommandErro...
smtp.py
import smtplib import os import sys from email.mime.application import MIMEApplication from PyQt5.QtWidgets import QApplication , QMainWindow ,QFileDialog , QListWidget,QListWidgetItem ,QTreeWidgetItem ,QMessageBox from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mim...
net.py
import hashlib import logging import threading import zmq from ast import literal_eval from core.consensus.block_generate import NewBlockOfTimes from core.consensus.vote_compute import VoteCount from core.consensus.node_management import NodeManager from core.consensus.data import ApplicationForm, VoteMessage, WaitGal...
pymigrate.py
#!/usr/bin/env python3 from slickrpc import Proxy import queue from threading import Thread import threading import time from slickrpc import Proxy import sys import datetime import os import json import re import platform import calendar def selectRangeInt(low,high, msg): while True: try: nu...
test_logging.py
# Copyright 2001-2017 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...
threads.py
from threading import Thread import os from examples.performance.speedup import timer import time def replace_in_file(filename, from_value, to_value): print(f"Processing {filename}") with open(filename, 'r') as f: file_data = f.read() file_data = file_data.replace(from_value, to_value) with op...