source
stringlengths
3
86
python
stringlengths
75
1.04M
http.py
import socket import requests from lxml.html import fromstring import datetime import sys import ipaddress import threading import os BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[1;94m', '\033[1;91m', '\33[1;97m', '\33[1;93m', '\033[1;35m', '\033[1;32m', '\033[0m' class ThreadManager(object): i = 0 d...
test_s3_blob_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...
testsuite_utils.py
""" testsuite_utils.py Methods used throughout the test suite for testing. """ import socket from threading import Thread try: # python 2 from BaseHTTPServer import HTTPServer except ImportError: # python 3 from http.server import HTTPServer def get_free_port(): """ Find a free port Return a po...
base_test.py
# -*- coding: utf-8 -*- import copy import datetime import json import threading import elasticsearch import mock import pytest from elasticsearch.exceptions import ConnectionError from elasticsearch.exceptions import ElasticsearchException from elastalert.enhancements import BaseEnhancement from elastalert.enhanceme...
test_html.py
from functools import partial from importlib import reload from io import ( BytesIO, StringIO, ) import os from pathlib import Path import re import threading from urllib.error import URLError import numpy as np import pytest from pandas.compat import is_platform_windows from pandas.errors import ParserError ...
myLed.py
import threading import gpiozero import myUtil import time import random import mySerial from myLog import log, elog, slog HIGH = 1 # we can't use anything lower or a clear flickering will show. We can't use PiGPIO (which supports HW PWM), because it will interfere with the Amp. LOW = 0.5 OFF = 0 def getValue(): my...
test_interrupt.py
import os import signal import tempfile import time from threading import Thread import pytest from dagster import ( DagsterEventType, Field, ModeDefinition, String, execute_pipeline_iterator, pipeline, reconstructable, resource, seven, solid, ) from dagster.core.errors import D...
helperclient.py
import random from multiprocessing import Queue from queue import Empty import threading from coapthon.messages.message import Message from coapthon import defines from coapthon.client.coap import CoAP from coapthon.messages.request import Request from coapthon.utils import generate_random_token import socket __author...
info_controller.py
import threading import time from tkinter.constants import * from pyphone import controllers from pyphone.controllers.controller import Controller class InfoController(Controller): def __init__(self, panel): super().__init__(panel) self._update_thread = threading.Thread(target=self._update_worke...
main.pyw
from threading import Thread, Event from queue import Queue from tkinter import Tk, ttk from time import sleep as wait from loggingFramework import Logger import requests import json import sys logger = Logger() def handle_exception(etype, value, traceback): logger.logException(value) quit() sys.excepthook = handl...
main.py
# Copyright 2020, Digi International Inc. # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIM...
smbrelayx.py
#!/usr/bin/env python # SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved. # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # SMB Relay Module # # Author: # Alberto Solino (@agso...
ngrok.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #** # ######### # trape # ######### # # trape depends of this file # For full copyright information this visit: https://github.com/jofpin/trape # # Copyright 2018 by Jose Pino (@jofpin) / <jofpin@gmail.com> #** import sys import os, platform import subprocess import socket ...
__init__.py
import threading import time from collections import OrderedDict, defaultdict from concurrent import futures from functools import partial from queue import SimpleQueue from typing import NamedTuple, Callable from spherov2.controls.v1 import Packet as PacketV1 from spherov2.controls.v2 import Packet as PacketV2 from s...
geemap.py
"""Main module for interactive mapping using Google Earth Engine Python API and ipyleaflet. Keep in mind that Earth Engine functions use both camel case and snake case, such as setOptions(), setCenter(), centerObject(), addLayer(). ipyleaflet functions use snake case, such as add_tile_layer(), add_wms_layer(), add_mi...
agent.py
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright (c) 2015, Battelle Memorial Institute # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistrib...
canmonitor.py
#!/usr/bin/env python3 import argparse import curses import sys import threading import traceback from .source_handler import CandumpHandler, InvalidFrame, SerialHandler should_redraw = threading.Event() stop_reading = threading.Event() can_messages = {} can_messages_lock = threading.Lock() thread_exception = None...
20_tessellation.py
import sys, os #get path of script _script_path = os.path.realpath(__file__) _script_dir = os.path.dirname(_script_path) pyWolfPath = _script_dir if sys.platform == "linux" or sys.platform == "linux2": print "Linux not tested yet" elif sys.platform == "darwin": print "OS X not tested yet" elif sys.platform ==...
suisnail.py
""" Suicidal Snail Author: Min RK <benjaminrk@gmail.com> """ from __future__ import print_function import sys import threading import time from pickle import dumps, loads import random import zmq from zhelpers import zpipe # --------------------------------------------------------------------- # This is our subscri...
notification.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the Apache 2.0 License. import os import threading import http.server import queue import json from contextlib import contextmanager from loguru import logger as LOG class PostQueueRequestHandler(http.server.BaseHTTPRequestHandler): de...
_testing.py
import bz2 from collections import Counter from contextlib import contextmanager from datetime import datetime from functools import wraps import gzip import operator import os from shutil import rmtree import string import tempfile from typing import Any, Callable, ContextManager, List, Optional, Type, Union, cast imp...
util.py
# # Module providing various facilities to other parts of the package # # multiprocessing/util.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # # Modifications Copyright (c) 2020 Cloudlab URV # import traceback import socket import weakref import redis import pymemcache impor...
val.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Validate a trained YOLOv5 model accuracy on a custom dataset Usage: $ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640 """ import argparse import json import os import sys from pathlib import Path from threading import Thread import numpy as...
train_dain.py
import sys import os import time import threading import torch from torch.autograd import Variable import torch.utils.data from lr_scheduler import * import cv2 import numpy from AverageMeter import * from loss_function import * import datasets import balancedsampler import networks from my_args import args import ...
short_letter_data.py
# Run file to collect data when exposed to random letter from data import * from tkinter import * import os import random as r import threading import numpy as np # Set values for data wait_time = 1000 # How long to wait in between exposures expose_time = 1000 # How long letter should be exposed # Letters to be sam...
test_random.py
from __future__ import division, absolute_import, print_function import numpy as np from numpy.testing import ( TestCase, run_module_suite, assert_, assert_raises, assert_equal, assert_warns) from numpy import random from numpy.compat import asbytes import sys import warnings class TestSeed(TestCase...
datasets.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Dataloaders and dataset utils """ import glob import hashlib import json import os import random import shutil import time from itertools import repeat from multiprocessing.pool import Pool, ThreadPool from pathlib import Path from threading import Thread from zipfile im...
spark.py
import copy import threading import time import timeit import traceback from hyperopt import base, fmin, Trials from hyperopt.base import validate_timeout, validate_loss_threshold from hyperopt.utils import coarse_utcnow, _get_logger, _get_random_id try: from pyspark.sql import SparkSession from pyspark.util ...
_cronjobs.py
from typing import Callable, List, Union from datetime import datetime, time from time import sleep from functools import partial from re import compile, match, Match, Pattern from threading import Thread from croniter import CroniterBadCronError, croniter class CronBit: _parent: 'CronBuilder' _val: Union[Lis...
exo1.py
from random import shuffle,randrange from time import sleep from threading import Thread import dummy0, dummy1 latence = 0.001 permanents, deux, avant, apres = {'rose'}, {'rouge','gris','bleu'}, {'violet','marron'}, {'noir','blanc'} couleurs = avant | permanents | apres | deux passages = [{1,4},{0,2},{1,3},{2,7},{0,5,...
base.py
import base64 import hashlib from six.moves.http_client import HTTPConnection import io import json import os import threading import traceback import socket import sys from six.moves.urllib.parse import urljoin, urlsplit, urlunsplit from abc import ABCMeta, abstractmethod from ..testrunner import Stop from .protocol ...
webtransport_h3_server.py
import asyncio import logging import os import ssl import threading import traceback from urllib.parse import urlparse from typing import Any, Dict, List, Optional, Tuple # TODO(bashi): Remove import check suppressions once aioquic dependency is resolved. from aioquic.buffer import Buffer # type: ignore from aioquic....
harness.py
#!/usr/bin/env python # # Copyright (c) 2015, Jason L. Wright <jason@thought.net> # 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 copyri...
kaldi_io.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2014-2019 Brno University of Technology (author: Karel Vesely) # Licensed under the Apache License, Version 2.0 (the "License") from __future__ import print_function from __future__ import division import numpy as np import sys, os, re, gzip, struct ########...
table_test.py
import pytest import mro import connection as con from datetime import datetime, date from threading import Thread, Event class table1(mro.table.table): column1 = mro.data_types.integer('column1', 0, not_null=False, is_updateable=True, get_value_on_insert = False, is_primary_key = False) column2 = mro.data_...
utils.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
Dragon-v1.2.py
#Dragon-v1.2 by Mr.BV #Jangan Recode asw import os, sys, time, random from sys import exit as keluar from time import sleep as waktu from random import random as acak from random import choice as pilih from sys import stdout from os import system m = '\x1b[1;91m' h = '\x1b[1;92m' k = '\x1b[1;93m' b = '\x1b[1;94m' u = '...
context.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...
PTT.py
import sys import time import re import threading import progressbar import socket import array import paramiko from paramiko import ECDSAKey from uao import Big5UAOCodec uao = Big5UAOCodec() try: from . import Util from . import Version from . import ErrorCode from . import Information except SystemE...
android.py
import sys import threading import requests import os import socket import time from Queue import * from threading import Thread if len(sys.argv) < 3: sys.exit("\033[37mUsage: python "+sys.argv[0]+" [list] [output]") ips = open(sys.argv[1], "r").readlines() output = sys.argv[2] queue = Queue() que...
pyusb_v2_backend.py
# pyOCD debugger # Copyright (c) 2019 Arm Limited # SPDX-License-Identifier: Apache-2.0 # # 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 # # ...
app.py
""" Copyright (c) 2022 Cisco and/or its affiliates. This software is licensed to you under the terms of the Cisco Sample Code License, Version 1.1 (the "License"). You may obtain a copy of the License at https://developer.cisco.com/docs/licenses All use of the material herein must be in accordance with the t...
scratch.py
from PIL import Image #THis was more about making the directory path and not building the plausible path def get_destination_path(self): while not self.cached_destination_path: # sort out which root directory to use when searching for result project_root_dir_prefix, project_num_prefix = ArchiverHelp...
test.py
from udp_arduino_server import wait_for_connection, server_sock, info from threading import Thread udp_thread = Thread(target=wait_for_connection) udp_thread.start() while True: cmd = raw_input() if cmd == 'exit': break print info
main.py
import tkinter as tk import threading import imageio import sys from termcolor import colored from PIL import Image, ImageTk from time import time, sleep import os import tempfile import ffmpy import shutil import gc ############################################################################### # 状态参数 ###############...
multiprocess.py
import random import multiprocessing as mp def random_integer(output): """Generate a random integer in [0, 9] Args: output: multiprocessing queue """ integer = random.randint(0, 9) output.put(integer) def main(): output = mp.Queue() processes = [] for _ in range(4): ...
onedrive.py
from __future__ import print_function from builtins import str from builtins import object import base64 import random import os import re import time from datetime import datetime import copy import traceback import sys import json from pydispatch import dispatcher from requests import Request, Session # Empire impor...
common.py
from ..common import * # NOQA import inspect import json import os import random import subprocess import ssl import time import requests import ast import paramiko import rancher import pytest from urllib.parse import urlparse from rancher import ApiError from lib.aws import AmazonWebServices from copy import deepcop...
gather.py
import argparse import os import urllib2 import re import codecs from threading import Thread from HTMLParser import HTMLParser DOMAIN = "songmeanings.com/" ARTIST_PATH = 'artist/view/songs/' def start_new_thread(task, arg): thread = Thread(target=task, args=(arg,)) thread.start() def write_to_file(path, d...
run.py
#!/usr/bin/python # -*- coding:utf-8 -*- import sys import os import time import math import random import logging import logging.config import datetime import hashlib import base64 import multiprocessing import results import Util import s3PyCmd import myLib.cloghandler class User: doc = """ This is use...
__init__.py
""" # an API for Meshtastic devices Primary class: SerialInterface Install with pip: "[pip3 install meshtastic](https://pypi.org/project/meshtastic/)" Source code on [github](https://github.com/meshtastic/Meshtastic-python) properties of SerialInterface: - radioConfig - Current radio configuration and device setting...
PoseFromCorrespondences.py
#!/usr/bin/env python # # Copyright (C) 2009 Rosen Diankov # # 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...
test_base.py
import os import tornado.ioloop import tornado.httpserver import multiprocessing import unittest from selenium import webdriver from selenium.webdriver.firefox.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support impo...
scan_ip.py
''' Scan device ip address in the name network Author: Viki (a) Vignesh Natarajan https://vikiworks.io ''' import os import socket import multiprocessing import subprocess from multiprocessing import Process, Queue import signal import time from time import sleep import sys import threading debug = Fal...
multiprocessing.py
""" → Python Multiprocessing - multiprocessing = runnig tasks in parallel on different cpu cores, bypasses GIL used for thread better for cpu bound tasks (heavy cpu usage) better for io bound tasks(waiting around) """ import time from multiprocessing import Process, cpu_count ...
check_mongodb.py
#!/usr/bin/env python #coding:utf-8 import os import sys import string import time import datetime import MySQLdb import pymongo import bson import logging import logging.config logging.config.fileConfig("etc/logger.ini") logger = logging.getLogger("lepus") path='./include' sys.path.insert(0,path) import functions as f...
control.py
import collections, functools, sys, threading from . extractor import Extractor from .. project import construct, importer from .. util.log_errors import LogErrors from .. util import deprecated, flatten, log from .. util.threads import runnable from . routing import ActionList, Routing class Control(runnable.Runnabl...
preview.py
# coding=utf-8 # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
database.py
class Shell(object): def __init__(self: object) -> None: self.listener: dict = { 'tcp': 'rlwrap nc -lvvnp {lport}', 'udp': 'rlwrap nc -u -lvvnp {lport}', } self.database: dict = { 'linux': { 'tcp': { 'awk': ( ...
kubeless.py
#!/usr/bin/env python import os import imp import json import logging import datetime from multiprocessing import Process, Queue import bottle import prometheus_client as prom try: import queue except: import Queue as queue mod = imp.load_source('function', '/kubeless/%s.py' % os.geten...
EWSO365.py
import random import string from typing import Dict import dateparser import chardet import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import sys import traceback import json import os import hashlib from io import StringIO import logging import warnings import email...
app.py
# # This file is: # Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com> # # MIT License # import os from electroncash_gui.ios_native.monkeypatches import MonkeyPatches from electroncash.util import set_verbosity from electroncash_gui.ios_native import ElectrumGui from electroncash_gui.ios_native.utils import...
rocoto_viewer.py
#!/usr/bin/env python # ##@namespace rocoto_viewer # @brief A Curses based terminal viewer to interact and display the status of a Rocoto Workflow in real time. # # @anchor rocoto_viewer ## This Python script allows users to see and interact with a running Rocoto Workflow in real time. # \image html pythonCurses.jpeg "...
worker_ps_interaction_test.py
import os import unittest from threading import Thread import numpy as np import tensorflow as tf from elasticdl.proto import elasticdl_pb2 from elasticdl.python.common.args import parse_worker_args from elasticdl.python.common.constants import DistributionStrategy from elasticdl.python.common.hash_utils import int_t...
server_from_net.py
#!/usr/bin/env python """ Utility functions to create server sockets able to listen on both IPv4 and IPv6. """ __author__ = "Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>" __license__ = "MIT" import os import sys import socket import select import contextlib def has_dual_stack(sock=None): """Return True if...
HXTool.py
# -*- coding: utf-8 -*- """ Created on 9-Mar-2018 Updated on 29-Apr-2020 @author: Kiranraj(kjogleka), Himanshu(hsardana), Komal(kpanzade), Avinash(avshukla) """ import warnings warnings.filterwarnings('ignore') import subprocess import paramiko import threading import time import datetime import logging ...
ppo_continuous_multiprocess2.py
''' Multi-processing version of PPO continuous v2 ''' import math import random import gym import numpy as np import torch torch.multiprocessing.set_start_method('forkserver', force=True) # critical for make multiprocessing work import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from ...
api.py
from datetime import datetime from functools import wraps from flask import Blueprint, request, current_app import os import dcp.mp.shared as shared from dcp import db from collections import deque import time from dcp.models.data import CollectedData from dcp.models.collection import BCICollection bp = Blueprint('a...
__init__.py
""" Basic connectivity and control for Noon Home Room Director and Extension switches. Note that this API is not supported by Noon, and is subject to change or withdrawal at any time. """ __author__ = "Alistair Galbraith" __copyright__ = "Copyright 2018, Alistair Galbraith" import logging import requests import we...
raspiNucleo.py
import serial.tools.list_ports, serial import datetime, sys, types, os, time, threading, shelve import dialog """interfaccia di comunicazione Raspberry NucleoSTM Questo modulo permette la coomunicazione tra STMnucleo e Raspberry tramite porta usb per comandare un'interfaccia sensori e raccogliere dati in file csv il...
tfrecorder_builder.py
import tensorflow as tf import os import math, json import sys from core import dataset_utils import shutil import glob from multiprocessing import Process import numpy as np import random def _get_dataset_filename(dataset_name, output_dir, phase_name, shard_id, num_shards): output_filename = '%s_%s_%05d-of-%05d....
start.py
# Copyright BigchainDB GmbH and BigchainDB contributors # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 import logging import setproctitle import bigchaindb from bigchaindb.lib import BigchainDB from bigchaindb.core import App from bigchaindb.parallel_validation impor...
ntlmrelayx.py
#!/opt/impacket-impacket_0_9_20/bin/python3 # SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved. # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # Generic NTLM Relay Module # # A...
rawframe_display.py
import sys import functools import signal import select import socket import pickle import time import struct import numpy as np import matplotlib.pyplot as plt from multiprocessing import Process, Queue sys.path.append('../dhmsw/') import interface PLOT = True headerStruct = struct.Struct('III') class guiclient(obje...
test_fx.py
import builtins import contextlib import copy import functools import inspect import math import numbers import operator import os import pickle import sys import torch import traceback import warnings import unittest from math import sqrt from torch.multiprocessing import Process from torch.testing import FileCheck fr...
expup.py
#=============================================================# # # # EL EXPRESO DEL DEPORTE # # ExpUp - Image Uploader # #-------------------------------------------------------------# ...
installwizard.py
import sys import os from PyQt4.QtGui import * from PyQt4.QtCore import * import PyQt4.QtCore as QtCore import electrum_vtc as electrum from electrum_vtc import Wallet, WalletStorage from electrum_vtc.util import UserCancelled, InvalidPassword from electrum_vtc.base_wizard import BaseWizard from electrum_vtc.i18n imp...
graph_tap_difficulty.py
import numpy as np import threading import math import pyqtgraph from pyqtgraph.functions import mkPen from pyqtgraph.Qt import QtGui, QtCore from osu_analysis import StdScoreData from app.data_recording.data import RecData class GraphTapDifficulty(QtGui.QWidget): __calc_data_event = QtCore.pyqtSignal(object,...
__init__.py
import logging import paramiko import requests import asyncio import aiohttp import sys import telnetlib from io import StringIO from os import getcwd, chdir, popen from threading import Thread from time import sleep from typing import Any, Dict, List from socketserver import BaseRequestHandler from urllib3.exceptions ...
display.py
# -*- coding: utf-8 -*- import PySimpleGUI as sg import threading import time W = 30 # name width last_correct = 'baniverse' def open_leaderboard(): while True: event, value = leaderboard.read() if event == sg.WIN_CLOSED: break leaderboard.close() def update_leaderboard(players...
primary.py
#!/usr/bin/env python #Copyright (c) 2015,2016 Joseph D. Steinmeyer (jodalyst), Jacob White, Nick Arango #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 with...
settings_20210906111039.py
""" Django settings for First_Wish project. Generated by 'django-admin startproject' using Django 3.2. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathli...
fun.py
from sense_hat import SenseHat from time import sleep from random import randint import sys from subprocess import Popen import threading sense = SenseHat() default_rotation = 0 menu = ['4','6','8', '10','12','20'] angles = [180, 270, 0, 90, 180, 270, 0, 90, 180] current_position = 1 def arrB(turn = True): r = (2...
thread-key-gen.py
# Copyright (C) Jean-Paul Calderone # See LICENSE for details. # # Stress tester for thread-related bugs in RSA and DSA key generation. 0.12 and # older held the GIL during these operations. Subsequent versions release it # during them. from threading import Thread from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, PKe...
proc_endpoint.py
""" SNR framework for scheduling and task management Node: Task queue driven host for data and endpoints AsyncEndpoint: Generate and process data for Nodes Relay: Server data to other nodes """ import signal from time import time from typing import Callable from multiprocessing import Process from snr.endpoint import...
utils.py
from bitcoin.core import COIN # type: ignore from bitcoin.rpc import RawProxy as BitcoinProxy # type: ignore from bitcoin.rpc import JSONRPCError from contextlib import contextmanager from pathlib import Path from pyln.client import RpcError from pyln.testing.btcproxy import BitcoinRpcProxy from collections import Or...
reloader.py
""" The reloader that autodetects file changes for debugging Since we ditched the old werkzeug server, this is the code that allowed it to refresh automatically. (Ripped from https://github.com/mitsuhiko/werkzeug/blob/1a21e27a99331d854cec9174a1fc0fcd9717a673/werkzeug/_reloader.py) """ import sys import os import sub...
email.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from . 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._get_current_object() msg = Mess...
events.py
# Copyright (c) 2021 cyb3rdog # Based on Anki Vector Python SDK # # 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 in the file LICENSE.txt or at # # https://www.apache.org/licenses/LICENSE-2.0 ...
command_handler.py
import threading import pyperclip from colorama import Fore from vlcyt.lyrics_scraper import get_lyrics class CommandHandler: """ Handles user input for VLCYT """ _help_commands = ["?", "help"] _volume_commands = ["volume", "v"] _skip_commands = ["skip", "s", "next", "n", "forward", "f"] _...
025_convert_video_to_time-lapse.py
import pathlib import queue import threading import cv2 import json # グローバル変数を示す INPUT_FILE = "" TIME_LAPSE_FRAME_RATE = 0 OUTPUT_FRAME_RATE = 0 OUTPUT_WIDTH = 0 OUTPUT_HEIGHT = 0 DISPLAY_STRING = "" def convert_time(ct_time): """Convert seconds to hours, minutes, and seconds. Args: ct_time (int/...
test.py
from multiprocessing import Process,Queue import os import time q = Queue() def _write(q): print('Process(%s) is writing...' % os.getpid()) while 1: time.sleep(2) url = 100 q.put(url) print('Put %s to queue...' % url) if __name__ == "__main__": p = Process(target=_write,...
primes.py
import multiprocessing from itertools import count PRIMES_PER_PROCESS = 16 def check_divisbility(primes, number): return all(number % x for x in primes) def checker(primes, in_potentials, out_primes, out_potentials): maximum = primes[-1] ** 2 while True: potential = in_potentials.get() ...
pyinstall.py
#!C:\Users\sinsu\PycharmProjects\pythonProject1\venv\Scripts\python.exe import sys import os import optparse import pkg_resources import urllib2 import urllib import mimetypes import zipfile import tarfile import tempfile import subprocess import posixpath import re import shutil try: from hashlib import md5 except...
magnetBatchSampler.py
import cv2 import time import numpy as np import mxnet as mx import mxnet.ndarray as nd from enum import Enum from dataProcessor.imageProcessor import ImageProcessor from dataProcessor.imageSampler import ImageSampler from dataProcessor.miningTypes import MiningTypes from multiprocessing import Process, Queue class ...
val.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Validate a trained YOLOv5 model accuracy on a custom dataset Usage: $ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640 """ import argparse import json import os import sys from pathlib import Path from threading import Thread import numpy as...
chat_queue.py
import threading import queue # Queue for python 2 import pytwitcherapi session = ... # we assume an authenticated TwitchSession channel = session.get_channel('somechannel') client = pytwitcherapi.IRCClient(session, channel, queuesize=0) t = threading.Thread(target=client.process_forever) t.start() try: while ...
build_docs.py
import glob import os import shutil from pathlib import Path from subprocess import check_output from threading import Thread from typing import Dict, Union, Optional, Set, List, Sequence, Mapping from git import Git from ruamel.yaml import YAML # type: ignore from constants import ABS_PATH_OF_TOP_LEVEL_DIR from scr...
lcarsde-logout.py
#!/usr/bin/env python3 import gi import psutil import os import subprocess from multiprocessing import Process gi.require_version("Gtk", "3.0") from gi.repository import Gtk, Gio, GLib css = b''' .button { min-height: 38px; font-family: 'Ubuntu Condensed', sans-serif; font-weight: 600; font-size: 18px...
test_connection.py
from test.UdsTest import UdsTest from udsoncan.connections import * from test.stub import StubbedIsoTPSocket import socket import threading import time import unittest try: _STACK_UNVAILABLE_REASON = '' _interface_name = 'vcan0' import isotp import can s = isotp.socket() s.bind(_interface_name,rxid...