source
stringlengths
3
86
python
stringlengths
75
1.04M
train_abstractive.py
# # Original version by Yang Liu. # Modifications by Andreas Marfurt <andreas.marfurt@idiap.ch> # #!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import torch from transformers import BertTokenizer ...
safaribooks.py
#!/usr/bin/env python3 # coding: utf-8 import re import os import sys import json import shutil import pathlib import getpass import glob import logging import argparse import requests import traceback import datetime import signal import collections from requests import Request from html import escape from random impo...
HTTPControl.py
from http.server import HTTPServer, BaseHTTPRequestHandler from socketserver import ThreadingMixIn from termcolor import colored from datetime import datetime, timedelta import json import re import threading import time import urllib.parse import math from ww import f class ThreadingSimpleServer(ThreadingMixIn, HTTP...
main.py
import argparse import threading import time import base64 from flask import Flask, request, jsonify from UGATIT import UGATIT from utils import * class State: # Device ID (typically 0) video_device_id = 0 # can alternatively be a RTSP endpoint # video_device_id = 'http://192.168.0.1:8080/video/mjpeg'...
bot.py
import os import re import redis import requests import telebot import threading import time import traceback import ujson import vk import wget from PIL import Image from telebot import types from credentials import token, vk_app_id from vk_messages import VkMessage, VkPolling vk_threads = {} vk_dialogs = {} VK_AP...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import print_function import copy import errno import fnmatch import hashlib import logging import multiprocessing import os import re import salt import signal import sys import threading import time import traceback impo...
bebop_controller_q.py
#!/usr/bin/env python import rospy import numpy as np import math import threading import sys, select, tty, termios import csv import tf import time import random import waypoints import state_manager import qagent from nav_msgs.msg import Odometry from std_msgs.msg import String from std_msgs.msg import Empty from st...
bomber.py
#!/usr/bin/env python from datetime import datetime import os import hashlib import sys import time import threading import string import random import base64 import urllib.request import urllib.parse try: import requests except ImportError: print('[!] Error: some dependencies are not installed') print('Ty...
server.py
import socket from gpiozero import MotionSensor from gpiozero import LED from time import sleep from threading import Thread ############################################################# # define variables ############################################################# global light global cycleNumber global pinPIR...
cli.py
""" This module contains the command line interface for snakeviz. """ from __future__ import print_function import argparse import os import random import socket import sys import threading import webbrowser from pstats import Stats try: from urllib.parse import quote except ImportError: from urllib import q...
M2_Theading_with_Locks.py
from threading import Thread, Lock # ---- Conventional Lock ------ # Locks are basically used for thread synchronization. Without them, there might be inconsistent data # when multiple threats try to acquire the data the same time. thread_lock = Lock() # Not good practice, but create a global variable my_global_va...
thread.py
import logging import threading from edera.exceptions import ExcusableError from edera.flags import InterThreadFlag from edera.worker import Worker class ThreadWorker(Worker): """ A worker that runs in a separate thread. Attributes: thread (Thread) - the thread created by the worker """ ...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2021 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 multiwallet. Verify that a blinkhashd node can load multiple wallet files """ from decimal import...
netview.py
# Copyright (c) 2003-2015 CORE Security Technologies # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # Author: # beto (@agsolino) # # Description: # The idea of this script is to get a list of the sess...
rl_scheduler.py
import os import json import time import pickle import logging import threading import multiprocessing as mp from collections import OrderedDict import mxnet as mx from .resource import DistributedResource from ..utils import (save, load, mkdir, try_import_mxboard, tqdm) from ..core import Task from ..core.decorator ...
augment_trajectories.py
import os import sys sys.path.append(os.path.join(os.environ['ALFRED_ROOT'])) sys.path.append(os.path.join(os.environ['ALFRED_ROOT'], 'gen')) import json import glob import os import constants import cv2 import shutil import numpy as np import argparse import threading import time import copy import random from utils....
ssh.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/12/29 17:20 # @Author : Alvin # @File : ssh.py import paramiko from threading import Thread # from tools import get_key_obj import socket import json class SSH: def __init__(self, websocker, message): self.websocker = websocker se...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CHECKING from...
LocalDispatcher.py
########################################################################## # # Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
aclTest.py
# Copyright 2017-present Open Networking Foundation # # 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 ag...
airflow_scheduler_utils.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 u...
SeraFLOOD.py
'''' MIT License Copyright (c) 2021 Sera Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,...
engine.py
""" Event-driven framework of vn.py framework. """ from collections import defaultdict from queue import Empty, Queue from threading import Thread from time import sleep from typing import Any, Callable EVENT_TIMER = "eTimer" class Event: """ Event object consists of a type string which is used by event...
time_series.py
import pandas as pd import time from multiprocessing import Process import os from generate_sound import * dirname = os.path.dirname(__file__) DATA_FILE = os.path.join(dirname, '../data/ride6.csv') ride_df = pd.read_csv(DATA_FILE) sampling_rate = 10 if __name__ == '__main__': pm1 = 0 pm2_5 = 0 pm10 = 0 ...
veraCryptWrapper.py
# Copyright (C) 2013-2014 Reinhard Stampp # This file is part of - http://fortrace.fbi.h-da.de # See the file 'docs/LICENSE' for copying permission. # Added by Thomas Schaefer in 2019 from __future__ import absolute_import from __future__ import print_function import getpass import time try: import logging i...
autonomous_docking copy.py
#!/usr/bin/env python # Copyright 2022 Szymon Ciemała, Paweł Wojaczek from logging import error from numpy.core.numeric import full from geometry_msgs import msg import rospy from rospy.exceptions import ROSTimeMovedBackwardsException from std_msgs.msg import Float64 from sensor_msgs.msg import JointState, Imu, Range...
liveDownloader.py
import time from datetime import datetime import threading import Common import os import requests session = requests.session() def download(): while Common.api.isLive and not Common.forceNotDownload: if not Common.streamUrl: Common.appendError("Download with No StreamUrl Specific") ...
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.util_pymilvus import * from common.constants import * pref...
registerar.py
from random import choice from string import digits from threading import Thread from SIP.src.peer.server.server import server from SIP.src.packet.request.request import request from SIP.src.packet.response.response import response from SIP.src.database.database import database from SIP.src.peer.client.client import cl...
OVF.py
#!/usr/bin/env python """ Script pour déployer une VM TAT1 dont on a récupéré les informations Ecrit par Benoit BARTHELEMY benoit.barthelemy2@open-groupe.com """ import atexit import datetime import re import ssl from argparse import ArgumentParser from getpass import getpass from os import path from sys import exit ...
pika.py
import json import logging import os import time import typing from collections import deque from threading import Thread from typing import Callable, Deque, Dict, Optional, Text, Union, Any from rasa.constants import ( DEFAULT_LOG_LEVEL_LIBRARIES, ENV_LOG_LEVEL_LIBRARIES, DOCS_URL_EVENT_BROKERS, ) from ra...
datasets.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Dataloaders and dataset utils """ import glob import hashlib import json import math 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 fro...
master.py
''' This module contains all of the routines needed to set up a master server, this involves preparing the three listeners and the workers needed by the master. ''' # Import python libs import os import re import time import errno import fnmatch import signal import shutil import stat import logging import hashlib imp...
app.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Author : HuJi <jihu.hj@alibaba-inc.com> # Datetime : 2021/12/20 3:41 下午 # User : huji # Product : PyCharm # Project : link import logging import os import threading from typing import Optional, Union, Dict, Collection import _frida import frida from colora...
equationConnector.py
""" Created on Sep 19 15:32 2019 @author: nishit """ import json import threading from senml import senml from IO.summationPub import SummationPub from utils_intern.messageLogger import MessageLogger logger = MessageLogger.get_logger_parent(parent="connector") class EquationConnector(SummationPub): def __init_...
node_e.py
from definitions import * import os import utility as util import socket import threading from packet import * from known_hosts import * from struct import * import math routing_table_update_progress = False class ThreadedNode: def __init__(self, port=None, host=None): if host is None: self.h...
train.py
import argparse import datetime import json import logging import math import os import random import time from copy import deepcopy from pathlib import Path from threading import Thread # from aiUtils import aiUtils import uuid import numpy as np import torch.distributed as dist import torch.nn as nn import torch.nn....
silvia-pi.py
#!/usr/bin/python def scheduler(dummy,state): import time import sys import schedule from datetime import datetime sys.stdout = open("scheduler.log", "a") sys.stderr = open("scheduler.err.log", "a") print("Starting scheduler thread ...") last_wake = 0 last_sleep = 0 last_sched_switch = 0 whil...
tasks.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python from collections import OrderedDict, namedtuple, deque import errno import functools import importlib import json import logging import os from io import StringIO from contextlib import redirect_stdout import shutil import stat...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Copyright (c) 2017-2020 The Raven Core developers # Copyright (c) 2021 The Bagi Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test bagi...
test_sycl_queue_manager.py
# Data Parallel Control (dpctl) # # Copyright 2020-2021 Intel 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....
serverfedrep.py
import wandb from flcore.clients.clientfedrep import clientFedRep from flcore.servers.serverbase import Server from utils.data_utils import read_client_data from threading import Thread import torch import torchvision.transforms as transforms import torchvision import numpy as np class FedRep(Server): def __init__...
main.py
# Portions of code used in this file and implementation logic are based # on lightgbm.dask. # https://github.com/microsoft/LightGBM/blob/b5502d19b2b462f665e3d1edbaa70c0d6472bca4/python-package/lightgbm/dask.py # The MIT License (MIT) # Copyright (c) Microsoft Corporation # Permission is hereby granted, free of charg...
test_browser.py
import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex from runner import BrowserCore, path_from_root, nonfastcomp from tools.shared import * # User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to # run using another browser com...
test_slm.py
import unittest import time import json import yaml import threading from multiprocessing import Process from son_mano_slm.slm import ServiceLifecycleManager from sonmanobase.messaging import ManoBrokerRequestResponseConnection class testSlmRegistrationAndHeartbeat(unittest.TestCase): """ Tests the registrati...
Test_Sensors_Threads.py
import time import threading from robworld.RobotThymio2 import RobotThymio2 from robworld.RobotEPuck import RobotEPuck """ Robot thymio2: Sensores de Proximidad: 0: frontal izquierdo izquierdo 1: frontal izquierdo 2: frontal frontal 3: frontal derecho 4: frontal derecho der...
gui_instance.py
#!/usr/bin/env python import os import threading from math import log import wx import wx.aui import wx.py.editwindow import wx.stc as stc from chips.compiler.types import size_of from chips.compiler.register_map import rregmap, frame import chips.compiler.profiler as profiler from chips.compiler.exceptions import S...
utils.py
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2019, 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...
ecshop-getshell.py
#coding:utf-8 #Author:LSA #Description: ecshop rce(user.php) #Date:20180902 import requests import optparse import os import datetime import Queue import threading import sys from bs4 import BeautifulSoup from requests.packages import urllib3 reload(sys) sys.setdefaultencoding('utf-8') lock = threading.Lock() q0 =...
test_poll.py
# expected: fail # Test case for the os.poll() function import os import random import select try: import threading except ImportError: threading = None import time import unittest from test.test_support import TESTFN, run_unittest, reap_threads, cpython_only try: select.poll except AttributeError: ra...
Async_Game.py
import numpy as np import Queue from threading import Thread import time from timeit import default_timer as timer import Game as game move_queue = Queue.Queue() score_queue = Queue.Queue() class AGame(game.Game): def rabbit_turn(self): new_pos = self.take_turn(0) move_queue.put([0,...
dhcp_starvation.py
from scapy.all import * from time import sleep from threading import Thread class DHCPStarvation(object): def __init__(self): # Generated MAC stored to avoid same MAC requesting for different IP self.mac = [""] # Requested IP stored to identify registered IP self.ip = [] def han...
graph_models.py
import networkx as nx import pandas as pd from itertools import combinations import tempfile import sys import os from biograph.constants import valid_amino_3 class GraphModel: def __init__(self): self.G = nx.Graph() def generate_graph(self, protein, params): raise NotImplementedError def ...
ch03_listing_source.py
import threading import time import unittest import redis ONE_WEEK_IN_SECONDS = 7 * 86400 VOTE_SCORE = 432 ARTICLES_PER_PAGE = 25 ''' # <start id="string-calls-1"/> >>> conn = redis.Redis() >>> conn.get('key') #A >>> conn.incr('key') #B 1 #B >>> conn.incr('key', ...
run.py
import queue import subprocess import threading from typing import IO, List def _read_stream(stream: IO, queued_lines: queue.Queue): """Reads a stream into a queue.""" for line in stream: try: queued_lines.put(line.decode().strip()) except UnicodeDecodeError: queued_lin...
lamplighter.py
import json import random import threading import time import requests COUNT = 50 # LIGHTSHOST = 'xmas.local' LIGHTSHOST = 'localhost' LOCK = threading.Lock() def dot(colour, interval): """Continually light a randomly-chosen pixel with a weighted interval.""" while True: index = random.randint(0, CO...
automated_driving_with_fusion2.py
"""Defines SimpleSensorFusionControl class ---------------------------------------------------------------------------------------------------------- This file is part of Sim-ATAV project and licensed under MIT license. Copyright (c) 2018 Cumhur Erkan Tuncali, Georgios Fainekos, Danil Prokhorov, Hisahiro Ito, James Kap...
BiAffineModel.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import random import threading import h5py import util from util import * import time class KnowledgePronounCorefModel(object): def __init__(self, config): self.config = config self.conte...
test_wsgiref.py
from unittest import mock from test import support from test.test_httpservers import NoLogRequestHandler from unittest import TestCase from wsgiref.util import setup_testing_defaults from wsgiref.headers import Headers from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler from wsgiref import ut...
rconprotocol.py
import socket, os, sys, binascii, time, datetime, threading, logging, importlib import re """ Rcon protocol class. Used to establish the connection and to send keep-alive packages Also it provides some default commands, like kickAll, sendChat , lockServer, etc... The module loader <loadmodule(name, class)> allows the...
behaviors.py
# -*- coding: UTF-8 -*- #NVDAObjects/behaviors.py #A part of NonVisual Desktop Access (NVDA) #This file is covered by the GNU General Public License. #See the file COPYING for more details. #Copyright (C) 2006-2013 NV Access Limited, Peter Vágner """Mix-in classes which provide common behaviour for particular t...
multiprocessng_sample.py
import multiprocessing as mp # this sample launch N parallel processes def work(queue, data): total = 0 for x in data: total += x queue.put(total) if __name__ == "__main__": data = [[1,2,3], [4,5,6]] queue = mp.Queue() workers = [] for d in data: worker = mp.Process(tar...
hello.py
from flask import Flask, request, render_template, session, redirect, url_for, flash from flask_script import Manager, Shell from flask_bootstrap import Bootstrap from flask_moment import Moment from flask_wtf import FlaskForm from wtforms import StringField, SubmitField from wtforms.validators import Required from fla...
train_stac_yolo.py
import argparse import logging import math import os import random import sys import time import warnings from copy import deepcopy from pathlib import Path from threading import Thread import numpy as np import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torc...
run_robot.py
import numpy as np import time from src.IMU import IMU from src.Controller import Controller from src.JoystickInterface import JoystickInterface from src.State import State, BehaviorState from gongneungdynamics.Config import Configuration from gongneungdynamics.Kinematics import four_legs_inverse_kinematics from multip...
test_pipeline.py
import secrets import sys import multiprocessing as mp import pytest import zmq import perwez size = 1024 * 1024 topic = "asd" def _producer_block(data, url, hwm, public): w = perwez.SendSocket(url, topic, zmq.PUSH, hwm=hwm, public=public) while True: cnt = 0 w.poll() while not w.fu...
test_sycl_queue_manager.py
# Data Parallel Control (dpctl) # # Copyright 2020-2021 Intel 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....
SLOReader.py
########################################################################## # # Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redis...
views.py
import os import sys import threading import subprocess from subprocess import check_output import uuid from flask import Flask from flask import render_template, url_for, abort, jsonify, request from app import app import inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) p...
Zydra.py
#!/usr/bin/env python import optparse import zipfile import rarfile # need unrar tools import itertools import string import os import crypt import pyfiglet from termcolor import cprint, colored import time import term # py-term from datetime import timedelta import sys import threading import shutil import subproce...
all_news_pa_toutiao.py
import time import math import pymongo import requests import hashlib import threading from queue import Queue import pandas as pd from fake_useragent import UserAgent class PaTouTiao(object): def __init__(self, mid, user_agent): self.mid = mid self.url = 'https://www.toutiao.com/c/user/article/' ...
install_utils.py
import getopt import re import subprocess import sys import threading import time import os from couchbase_helper.cluster import Cluster sys.path = [".", "lib"] + sys.path import testconstants from remote.remote_util import RemoteMachineShellConnection, RemoteUtilHelper from membase.api.rest_client import RestConnecti...
__init__.py
import os import threading import time from flask import current_app, jsonify, request, render_template from werkzeug.exceptions import HTTPException from app.views.v2 import BaseResource def after_request(response): response.headers['X-Content-Type-Options'] = 'nosniff' response.headers['X-Frame-Options'] ...
test_timer.py
__doc_all__ = [] import unittest import random import threading import socket import sys import time import exceptions import datetime import traceback import thread from cogen.common import * from cogen.core.coroutines import debug_coroutine from base import priorities, proactors_available class T...
HorarioTelevisivo_G.py
from tkinter import * import os import threading import random import time import sys from tkinter import ttk from tkinter import filedialog from tkinter import messagebox import tkinter def Programa(): global numeroTeles global numeroIntegrantes global telesGrafo global TelesEnUso global teles global pasillo g...
ExperimentApp.py
from random import choice import random from PIL import ImageDraw, Image as img import threading import numpy as np import torch from torchvision import models, transforms import os import sys import logging import PyQt5 from PyQt5 import QtWidgets from PyQt5 import QtGui, QtCore from PyQt5.QtCore import...
test_logging.py
# Copyright 2001-2016 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...
test_shell_interactive.py
#!/usr/bin/env impala-python # encoding=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 Licen...
pattern.py
# Copyright 2018 Flight Lab authors. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
abinit_tasks_src.py
import os import shutil import inspect import logging import collections import errno import threading import subprocess import time from monty.json import MSONable, MontyDecoder from monty.os.path import which from pymatgen.util.serialization import json_pretty_dump, pmg_serialize from abipy.flowtk.utils import Direc...
tpu_estimator.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
dataframe_viewer.py
import sys import threading import os import numpy as np import pandas as pd from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import Qt from pandasgui.store import PandasGuiStore, PandasGuiDataFrameStore import pandasgui import logging logger = logging.getLogger(__name__) class DataFrameViewer(QtWidge...
join_simple_example.py
import time from threading import Thread def child(): print("Child Thread doing work...") time.sleep(5) print("Child Thread done...") def parent(): t = Thread(target=child, args=([])) t.start() print("Parent Thread is waiting...") t.join() print("Parent Thread is unblocked...") par...
dev_test_parallel.py
from lattice.grid import * #def test_realfield(): Grid = LatticeParallel(grid=[20,20,20,20],pgrid=[2,2,2,1]) # # # RealField = LatticeReal(lattice=Grid) # # # RealField.fill_value(3) # # # RealField2 = LatticeReal(lattice=Grid) # # # RealField2.fill_value(2) # MatrixField = LatticeVectorRealMatrix(lattice=Grid,Nd=2,...
keep_alive.py
#code to connect uptimerobot.com to this repl to keep it online from flask import Flask from threading import Thread app = Flask("") @app.route("/") def home(): return "MonarchBot is online on webserver" def run(): app.run(host = "0.0.0.0", port = 8080) def keep_alive(): t = Thread(target = run) t.s...
ExperimentServer.py
import os import time import grpc import multiprocessing import traceback import numpy as np from signal import signal, SIGTERM from concurrent import futures from threading import Lock from readerwriterlock import rwlock import tensorboardX from malib.rpc.chunk import deserialize, recv_chunks, deserialize_image from...
test_query_cancelling.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2012-2021 Snowflake Computing Inc. All rights reserved. # import logging import time from logging import getLogger from threading import Lock, Thread import pytest from snowflake.connector import errors logger = getLogger(__name__) logging.basicConfig(...
minicap.py
import os import io import sys import time import threading from Queue import Queue import cv2 from PIL import Image import numpy as np from alize.exception import * from alize.cmd import run from blue.utility import * from blue.utility import LOG as L class PatternMatchObject(object): def __init__(self, _targ...
registrar_common.py
''' DISTRIBUTION STATEMENT A. Approved for public release: distribution unlimited. This material is based upon work supported by the Assistant Secretary of Defense for Research and Engineering under Air Force Contract No. FA8721-05-C-0002 and/or FA8702-15-D-0001. Any opinions, findings, conclusions or recommendations ...
test_list_jy.py
import unittest import random import threading import time from test import test_support if test_support.is_jython: from java.util import ArrayList from java.lang import String class ListTestCase(unittest.TestCase): def test_recursive_list_slices(self): x = [1,2,3,4,5] x[1:] = x s...
tk_plot_example.py
from Tkinter import * import math, random, threading, time class StripChart: def __init__(self, root): self.gf = self.makeGraph(root) self.cf = self.makeControls(root) self.gf.pack() self.cf.pack() self.Reset() def makeGraph(self, frame): self.sw =...
event.py
#!/usr/bin/python3 import json import time import warnings from collections import OrderedDict from pathlib import Path from threading import Lock, Thread from typing import Callable, Dict, Iterator, List, Optional, Sequence, Tuple, Union, ValuesView import eth_event from eth_event import EventError from web3._utils ...
start_api_integ_base.py
import shutil import uuid from typing import Optional, Dict from unittest import TestCase, skipIf import threading from subprocess import Popen import time import os import random from pathlib import Path from samcli.commands.local.cli_common.invoke_context import ContainersInitializationMode from tests.testing_utils ...
utils.py
# -*- coding:utf-8 -*- # Copyright 2020 Huawei Technologies Co., Ltd # # 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 requ...
model_logging.py
import tensorflow as tf import numpy as np import scipy.misc import threading try: from StringIO import StringIO # Python 2.7 except ImportError: from io import BytesIO # Python 3.x class Logger: def __init__(self, log_interval=50, validation_interval=200, ...
Main.py
# BUG: # Reihenfolge wird bei Suche nicht anerkannt # Frische Notizen verschwinden wenn von processing auf on-hold und zurück. # Notizen werden also lokal nicht gespeichert from woocommerce import API import json import datetime from datetime import date import dateutil.parser import time import calendar import pyco...
drowsiness detection_v2.py
import cv2 import os from tensorflow.python.keras.models import load_model import numpy as np from time import sleep import threading import RPi.GPIO as GPIO #Disable warnings (optional) GPIO.setwarnings(False) #Select GPIO mode GPIO.setmode(GPIO.BCM) #Set buzzer - pin 2 as output #Set IR sensor - pin 5 as input buzzer...
client.py
import sys import socket import msvcrt # this works on windows, on linux do pip install getch and replace with import getch import console_colors import threading def handle_recv(s): while True: byte = s.recv(1) if len(byte) == 0: break print(byte.decode('ascii'), end='', flus...
resolve_hostnames.py
from __future__ import unicode_literals from datetime import timedelta, datetime import threading import logging from Queue import Queue, Empty import dns from dns.resolver import NoAnswer, NXDOMAIN, Timeout, NoNameservers from dns.rdtypes.ANY.NS import NS as NS_class from dns.rdtypes.IN.A import A as A_class from c...
scheduler.py
import logging import heapq import functools import threading from datetime import datetime class Scheduler: """ class Scheduler to schedule threaded tasks USAGE: scheduler = Scheduler() scheduler.schedule(func, startts, *args) scheduler.periodic(5, test, 'test_message') ...