source
stringlengths
3
86
python
stringlengths
75
1.04M
test_smtplib.py
import asyncore import email.mime.text import email.utils import socket import smtpd import smtplib import io import re import sys import time import select import unittest from test import support, mock_socket try: import threading except ImportError: threading = None HOST = support.HOST if sys.platform ==...
__init__.py
"""restartsh - """ __version__ = '0.1.0' __author__ = 'fx-kirin <fx.kirin@gmail.com>' __all__ = [] import logging import threading import time import delegator logger = logging.getLogger('restartsh') def restart_thread(cmd, flag, interval=0): while not flag.is_set(): logger.info('Start [CMD]:%s', cmd)...
tcp.py
# -*- coding: utf-8 -*- ''' TCP transport classes Wire protocol: "len(payload) msgpack({'head': SOMEHEADER, 'body': SOMEBODY})" ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import errno import logging import os import socket import sys import time import threading...
test_runner.py
#!/usr/bin/env python3 # Copyright (c) 2014-2019 The Bitcoin Core developers # Copyright (c) 2017 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Run regression test suite. This module calls down into ind...
browser.py
# -*- coding: utf-8 -*- # # This file is part of urlwatch (https://thp.io/2008/urlwatch/). # Copyright (c) 2008-2021 Thomas Perl <m@thp.io> # 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....
GameScene.py
import threading import time from pygame import Rect from engine.Animation import Animation from engine.const import * from engine.Obstacle import Obstacle from engine.Player import Player from engine.Settings import Settings from engine.Track import Track from .Scene import Scene from .ScoreScene import ScoreScene ...
portal_configure.py
""" Copyright (c) 2015 SONATA-NFV ALL RIGHTS RESERVED. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
async_1.py
import webbrowser import socket import asyncio import threading url = "https://libgen.is/" async def fetch(i): #sock = socket.socket() r, w = await asyncio.open_connection( 'libgen.is', 80) request = 'GET {} HTTP/1.0\r\nHost: libgen.is\r\n\r\n'.format(url) w.write(request.encod...
model_logging.py
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, generate_interval=5...
connection.py
import io import logging import random import struct import sys import threading import time import uuid from collections import OrderedDict from hazelcast import six, __version__ from hazelcast.config import ReconnectMode from hazelcast.core import AddressHelper, CLIENT_TYPE, SERIALIZATION_VERSION from hazelcast.erro...
mapplot.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
test_mainwindow.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © Spyder Project Contributors # # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) # ----------------------------------------------------------------------------- """ Te...
AttackUp_arp.py
from PyQt4.QtGui import * from PyQt4.QtCore import * from os import getcwd,popen,chdir,walk,path,remove,stat,getuid from Module.DHCPstarvation import frm_dhcp_Attack,conf_etter from platform import linux_distribution from re import search import threading from shutil import copyfile class frm_update_attack(QMainWindow)...
app.py
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import sys, glob, os sys.path.insert(0, glob.glob(os.path.abspath(os.path.dirname(__file__)) + '/../../tools/thrift-0.9.3/lib/py/build/lib*')[0]) from controllers import * from controllers.Parser import ...
fps.py
import time import random import threading while True: globals()['sec'] = 0 globals()['count'] = 0 def count_up(): while globals()['sec'] != 1: 21762138476832437**31324 globals()['count'] += 1 x = threading.Thread(target=count_up) x.start() time.sleep(1) glob...
run_graph_stats.py
import socket from exec_utilities import time_out_util from config import * from exec_utilities.exec_utils import * from multiprocessing import Process def run_exp(env_tag=knl_tag, with_c_group=True, data_path_tag=graph_stat_exec_tag): hostname = socket.gethostname() with open('config.json') as ifs: ...
BackgroundWorker.py
# # BackgroundWorker.py # # (c) 2020 by Andreas Kraft # License: BSD 3-Clause License. See the LICENSE file for further details. # # This class implements a background process. # from Logging import Logging import threading, time class BackgroundWorker(object): def __init__(self, updateIntervall, workerCallback): ...
capes_scraper.py
import os import sqlite3 import requests import sys import traceback import shutil from threading import Thread, Lock from requests.exceptions import Timeout from settings import DATABASE_PATH, HOME_DIR, MAX_RETRIES from settings import CAPES_URL, CAPES_HTML_PATH CAPES_HOST = 'cape.ucsd.edu' CAPES_ACCEPT = 'html' ...
ssh.py
import sys import time from threading import Lock, Thread from random import randint from netmiko import SSHDetect, ConnectHandler import pprint import os from pathlib import Path try: local_dir = os.path.dirname(os.path.realpath(__file__)) except Exception: local_dir = os.getcwd() DEVICE_FILE_PATH = str(Path...
auto.py
# This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # 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...
worker.py
"""Embedded workers for integration tests.""" from __future__ import absolute_import, unicode_literals import os import threading from contextlib import contextmanager from celery import worker from celery.result import _set_task_join_will_block, allow_join_result from celery.utils.dispatch import Signal fr...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import unittest.mock import queue as pyqueue import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import subprocess import struct import operator import p...
__init__.py
import struct, socket, threading, json, os, pickle from essentials import tokening import essentials import copy import time from hashlib import sha1 import base64 import time import six PYTHONIC = "python based" WEBONIC = "web based" LEGACY = "legacy" def SocketDownload(sock, data, usage=None): """ Helpe...
text_client.py
# Copyright 2017 Mycroft AI Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
NodeServer.py
from bottle import route, run, request import dill import threading node = None @route('/conf', method='POST') def put_conf(): data = request.body.read() conn = data.split(',') node.set_master(conn[0], int(conn[1])) print "POST on node server to set master conn {0}:{1}".format(conn[0], conn[1]) @r...
realtime2.py
import re import os import kirk import numpy as n import time import pickle import threading import thread import scapy.all as sca import scapy_ex import channel_hop def trimmean(arr, percent): n = len(arr) k = int(round(n*(float(percent)/100)/2)) return n.mean(arr[k+1:n-k]) def parsePacket(pkt): if p...
_a4c_start.py
from cloudify import ctx from cloudify.exceptions import NonRecoverableError from cloudify.state import ctx_parameters as inputs import subprocess import os import re import sys import time import threading import platform from StringIO import StringIO from cloudify_rest_client import CloudifyClient from cloudify im...
terminal.py
# from KF.server_kalman_filter import Stack, Track import numpy as np # import dlib import os, sys import argparse import requests from multiprocessing import Process, Queue import time # Cloud Server URL = 'http://yaolaoban.eva0.nics.cc:5000/detect' # global varibles # this_file_path = os.path.dirname(os.path.abspath...
Camera.py
# Camera Class # Brandon Joffe # 2016 # # Copyright 2016, Brandon Joffe, 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....
run_integration_tests.py
from multiprocessing import Process, Manager, Queue import time import snekpro.api as api from snekpro.integration_tests.mock_tag_pro_env import MockTagProExtMutliAgentEnv def main(): print("Starting snekpro") manager = Manager() game_states = manager.list() keypresses = Queue() config = {"game_s...
androidServer.py
import socket import sys import threading class Server: def __init__(self, port, relay): self.port = port self.running = False self.thread = threading.Thread(target = self.__startServer) self.thread.setDaemon(True) # dies with main thread self.sock = socket.socket(socket....
game.py
# Hello, this is the main file from advent import * import time import os import __future__ import sys import threading game = Game() def end(self, actor, noun, words): print "\n\n\nWell done! \nYou completed the Libary Escape Game!\n\n\n" time.sleep(2) print """|@@@@| |####| |@@@@| |####| |@@@@| ...
init_dask.py
import sys import argparse import time import threading import subprocess import socket from mpi4py import MPI from azureml.core import Run from notebook.notebookapp import list_running_servers def flush(proc, proc_log): while True: proc_out = proc.stdout.readline() if proc_out == '' and proc.poll() is not ...
day11-2.py
import queue import threading class Intcode: def __init__(self, instructions, inputBuffer=queue.Queue(), outputBuffer=queue.Queue()): self.instructions = instructions self.inputBuffer = inputBuffer self.outputBuffer = outputBuffer self.relativeBase = 0 self.instructions.ex...
plugs_test.py
# Copyright 2016 Google Inc. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agre...
federated_learning_keras_consensus_FL_sidelink.py
from DataSets import RadarData from DataSets_tasks import RadarData_tasks from consensus.consensus_v4 import CFA_process from consensus.parameter_server_v2 import Parameter_Server # use only for consensus , PS only for energy efficiency # from ReplayMemory import ReplayMemory import numpy as np import os import tensorf...
publishers.py
import sys import time from requests import get from multiprocessing import Process from publisher import run_publisher from stats import * def run_producers(procs, count: int, duration, hosts, topics): # Get unique IDs for the producers public_ip = get('https://api.ipify.org').text addr_part = public_ip....
leetcode.py
import json import logging import re import time import os from threading import Semaphore, Thread, current_thread try: from bs4 import BeautifulSoup import requests inited = 1 except ImportError: inited = 0 try: import vim except ImportError: vim = None LC_BASE = os.environ['LEETCODE_BASE_U...
interface.py
# Copyright (c) 2016 Ansible by Red Hat, Inc. # # 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...
test_memmap.py
# -*- coding: utf-8 -*- # ================================================================ # Don't go gently into that good night. # # author: klaus # description: # # ================================================================ import multiprocessing import numpy as np def print_matrix(filename): matr...
qactabase.py
import copy import datetime import json import os import re import sys import threading import time import uuid import pandas as pd import pymongo import requests import asyncio from qaenv import (eventmq_amqp, eventmq_ip, eventmq_password, eventmq_port, eventmq_username, mongo_ip, mongo_uri) from Q...
commandsocket.py
# 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 writing, software # distributed under t...
backend.py
import json import logging import os import queue import signal import socket import threading from datetime import timedelta from types import TracebackType from typing import Optional, Type import requests import sqlalchemy.orm from common.constants import ADMIN_UUID, CURRENCY_TO_BLOCKCHAIN, Blockchain, Currency fro...
test_flight.py
# -*- coding: utf-8 -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "...
multi_gpu.py
import multiprocessing as mp import traceback from contextlib import contextmanager import six import tensorflow as tf from tfsnippet.utils import (is_tensor_object, is_tensorflow_version_higher_or_equal) from .misc import cached __all__ = ['detect_gpus', 'average_gradients', 'MultiGPU']...
autopwn_sense.py
#!/usr/bin/env python2 # Author: Alamot (Antonios Tsolis) import re import sys import time from pwn import * import signal, thread import requests, urllib3 signal.signal(signal.SIGINT, signal.SIG_DFL) DEBUG = False RHOST="10.10.10.60" RPORT=443 LHOST="10.10.14.5" LPORT=60001 if DEBUG: context.log_level = 'debug' ...
test_deproxy.py
#!/usr/bin/python import deproxy import unittest import threading import logging import socket import argparse import time from unittest import skip deproxy_port_base = 9999 deproxy_port_iter = None def get_next_deproxy_port(): global deproxy_port_iter if deproxy_port_iter is None: def deproxy_port...
master.py
import copy import logging import math import os import random import sys import uuid from threading import Thread from time import sleep import rpyc from rpyc.utils.server import ThreadedServer from conf import BLOCK_SIZE, REPLICATION_FACTOR, \ DEFAULT_MINION_PORTS, DEFAULT_MASTER_PORTS, LOG_DIR class MasterSe...
nvda_service.py
#nvda_service.py #A part of NonVisual Desktop Access (NVDA) #Copyright (C) 2009-2011 NV Access Inc #This file is covered by the GNU General Public License. #See the file COPYING for more details. from ctypes import * from ctypes.wintypes import * import threading import win32serviceutil import win32service ...
common.py
#!/usr/bin/env python # Copyright 2021 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
lifoQueues.py
import threading import queue import random import time def mySubscriber(queue): while not queue.empty(): item = queue.get() if item is None: break print("{} removed {} from the queue".format(threading.current_thread(), item)) queue.task_done() myQueue = queue.LifoQueue() for i in range(10):...
DarkFb.py
# -*- coding: utf-8 -*- import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize from multiprocessing.pool import ThreadPool try: import mechanize except ImportError: os.system('pip2 install mechanize') else: try: import requests except ImportEr...
gulp.py
import sublime import sublime_plugin import traceback import codecs import os from datetime import datetime from threading import Thread import json import webbrowser is_sublime_text_3 = int(sublime.version()) >= 3000 if is_sublime_text_3: from .base_command import BaseCommand from .settings import Settings ...
run_win.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import re import time import shutil import subprocess from threading import Thread from datetime import datetime from api import douyu_opencdn from utils.common import makesure_dir from utils.common import kill_pid from utils.common import list_only_dir from utils....
test_memusage.py
import decimal import gc import itertools import multiprocessing import weakref import sqlalchemy as sa from sqlalchemy import ForeignKey from sqlalchemy import inspect from sqlalchemy import Integer from sqlalchemy import MetaData from sqlalchemy import select from sqlalchemy import String from sqlalchemy import test...
process.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import, with_statement import copy import os import sys import time import errno import types import signal import logging import threading import contextlib import subprocess import multiprocessing import multiprocessing.util # Import salt...
build.py
#!/usr/bin/env python # Copyright 2020 The Defold Foundation # Licensed under the Defold License version 1.0 (the "License"); you may not use # this file except in compliance with the License. # # You may obtain a copy of the License, together with FAQs at # https://www.defold.com/license # # Unless required by applica...
ofsubject.py
#! /usr/bin/env python3 """This module will define the Of functionality for pub-sub-python package """ __version__ = '1.0.0.1' __author__ = 'Midhun C Nair <midhunch@gmail.com>' __maintainers__ = [ 'Midhun C Nair <midhunch@gmail.com>', ] from threading import Thread from uuid import uuid4 from time import sleep ...
HiwinRA605_socket_ros_test_20190626103751.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import HiwinRA605_s...
runner.py
#!/usr/bin/env python from __future__ import unicode_literals import os import re import time import django.core.exceptions from datetime import datetime, timedelta from threading import Thread from decimal import Decimal import paho.mqtt.subscribe as subscribe from django.core.management.base import BaseCommand imp...
standalone.py
"""Support for standalone client challenge solvers. """ import collections import functools import http.client as http_client import http.server as BaseHTTPServer import logging import socket import socketserver import threading from typing import List from acme import challenges from acme import crypto_util logger =...
Worker.py
import os import sys from pathlib import Path from subprocess import Popen, PIPE from threading import Thread from time import sleep from bin.Setup import Setup from bin.Utils import Utils, Singleton @Singleton class Worker: current_process = None tmp_files = [] def manage_command(self, form): t...
wallet.py
import copy, hashlib, json, logging, os import time from .device import Device from .key import Key from .util.merkleblock import is_valid_merkle_proof from .helpers import der_to_bytes from .util.base58 import decode_base58 from .util.descriptor import Descriptor, sort_descriptor, AddChecksum from .util.xpub import ge...
runner.py
import threading import time # Main class class Runner: def __init__(self, transport, telemetry, plots, plotsLock, topics): self.transport = transport self.telemetryWrapper = telemetry self.plots = plots self.plotsLock = plotsLock self.topics = topics self.thread =...
_techreview-textEditor.py
""" ################################################################################ PyEdit 2.1: a Python/tkinter text file editor and component. Uses the Tk text widget, plus GuiMaker menus and toolbar buttons to implement a full-featured text editor that can be run as a standalone program, and attached as a co...
mainThreading.py
# Main.py with threading! # Python program to illustrate the concept # of threading # importing the threading module import threading import smbus #import SMBus module of I2C import RTIMU from time import sleep #import import adafruit_gps import time import struct import board import busio import...
datasets.py
from __future__ import absolute_import, print_function, division import logging import os import tornado.web import yaml from tornado import gen from threading import Thread from .common import BaseHandler from ..web_datasets import DATASETS class RefreshHandler(BaseHandler): @tornado.web.authenticated def g...
worker.py
from contextlib import contextmanager import atexit import faulthandler import hashlib import inspect import io import json import logging import os import redis import sys import threading import time import traceback from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union # Ray modules from ra...
dirTrav.py
#!/usr/bin/python #ONLY WEB HAS BEEN IMPLEMENTED #If /usr/share/dotdotpwn/Reports exists, dotdotpwn will automatically put raw results in there for you #Reconscan.py creates the Reports directory for you import sys import os import subprocess from subprocess import CalledProcessError import argparse import multiproce...
delete_sg.py
''' Destroy all security groups (find from ZStack database). @author: Youyk ''' import zstackwoodpecker.operations.resource_operations as res_ops import zstackwoodpecker.operations.config_operations as con_ops import zstackwoodpecker.operations.net_operations as net_ops import zstackwoodpecker.operations.account_op...
Chap10_Example10.18.py
from threading import Thread daemonchk = False def disp(): if daemonchk: print('Display function only if it is daemon thread') else: print("Non-daemon thread") threadobj = Thread(target = disp) print("Before setting thread as daemon: ", threadobj.isDaemon()) if threadobj.isDaemon(): daemonc...
multi_threading_ref.py
import threading import time start = time.perf_counter() def do_something(): print('\nSleeping for 1 second') time.sleep(1) print('\nDone sleeping') t1 = threading.Thread(target=do_something) t2 = threading.Thread(target=do_something) t1.start() t2.start() t1.join() t2.join() finish...
MemMappedRemoteScreen.py
import urllib import BinLib from PIL import Image from threading import Thread RAM = [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32] """ RAM for screen Memory mapped each cell is one row of pixels """ buffer = Image.new("L",(16,16)) def screen(): global buffer while True: for x in xrange(16): ...
dropbox.py
#!/usr/bin/python # # Copyright (c) Dropbox, Inc. # # dropbox # Dropbox frontend script # This file is part of nautilus-dropbox 1.6.2. # # nautilus-dropbox is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, eithe...
zoltar.py
import logging, coloredlogs from threading import Thread from random import choice from modules.config import * from modules.database import Database from modules.timer import Timer database = Database(db_host, db_user, db_pass, db_name, db_autocommit) database.database_connection() class Zoltar: CommandMain = 'zo...
resolution.py
import asyncio import time import threading from message_passing_tree.prelude import * from message_passing_tree import MathAgent from .fp import Matrix from .algebra import AdemAlgebra from .module import FDModule from . import RustResolution import rust_ext RustResolutionHomomorphism = rust_ext.Resolut...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from __future__ import with_statement import sys import time import random import unittest from test import test_support try: import threading except ImportError: ...
live_webcam.py
#!/usr/bin/env python import json import cv2 import os import tensorflow as tf import time import numpy as np import keras import datetime import argparse from keras import backend as K from keras.models import load_model from keras.models import model_from_json from copy import copy from threading import Thread from t...
bartender_sh1106.py
from luma.core.interface.serial import i2c from luma.core.render import canvas from luma.oled.device import sh1106, ssd1306 from PIL import ImageFont, ImageDraw, Image import time import sys import RPi.GPIO as GPIO import json import threading import traceback # from dotstar import Adafruit_DotStar from menu import Me...
Pre_Build.py
""" @file Pre_Build.py @author IR @brief This script preprocesses source files for use with Log_t @version 0.1 @date 2020-11-11 @copyright Copyright (c) 2020 This script works by first duplicating source files to the build folder. \n Then it scans each file for calls to a Log function and modifies them as follows. \n...
protocol_radio.py
from .exceptions import PacketRadioError, OmnipyTimeoutError, RecoverableProtocolError, StatusUpdateRequired from podcomm.packet_radio import TxPower from podcomm.protocol_common import * from .pr_rileylink import RileyLink from .definitions import * from threading import Thread, Event, RLock import binascii import tim...
base_service.py
from threading import Thread, Event import logging import sys # pylint: disable=invalid-name logger = logging.getLogger('grab.spider.base_service') # pylint: enable=invalid-name class ServiceWorker(object): def __init__(self, spider, worker_callback): self.spider = spider self.thread = Thread( ...
teos.py
#!/usr/bin/python3 import os import subprocess import threading import time import re import pathlib import shutil import pprint import json import shutil import sys import eosfactory.core.errors as errors import eosfactory.core.logger as logger import eosfactory.core.utils as utils import eosfactory.core.setup as se...
OpDialogue.py
########################################################################## # # Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved. # Copyright (c) 2011-2012, John Haddon. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted prov...
input_test.py
import threading import argparse def get_input(): angle0 = float(input()) return angle0 for i in range(10): if i%2==0: print("type : ") input_thread = threading.Thread(target=get_input) input_thread.start()
no_tracker.py
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import import sys #sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') import os import datetime from timeit import time import warnings import cv2 import numpy as np import argparse from PIL import Ima...
system_api.py
# coding: utf-8 import psutil import time import os import re import math import json from flask import Flask, session from flask import request import db import mw import requests import config_api from threading import Thread from time import sleep def mw_async(f): def wrapper(*args,...
generate_game_numpy_arrays.py
import multiprocessing import numpy as np import pandas as pd import pickle import py7zr import shutil from settings import * HALF_COURT_LENGTH = COURT_LENGTH // 2 THRESHOLD = 1.0 def game_name2gameid_worker(game_7zs, queue): game_names = [] gameids = [] for game_7z in game_7zs: game_name = game...
index.py
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import hashlib import logging import os import shutil import subprocess import tempfile try: from threading import Thread except ImportErr...
recording_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 us...
StateUtils.py
# Copyright 2020 The KNIX 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
controller.py
import numpy as np import math import time import threading class Controller_PID_Point2Point(): def __init__(self, get_state, get_time, actuate_motors, params, quad_identifier): self.quad_identifier = quad_identifier self.actuate_motors = actuate_motors self.get_state = get_state se...
views.py
# project/users/views.py ################# #### imports #### ################# from flask import render_template, Blueprint, request, redirect, url_for, flash, abort from sqlalchemy.exc import IntegrityError from flask_login import login_user, current_user, login_required, logout_user from flask_mail import Message ...
daemon.py
import os import sys import pwd import subprocess import threading import json import socket import pipes import time ENVIRON = {'PATH': '/bin:/usr/bin'} config = json.load(open('config.json')) open_session_lock = threading.Lock() def auth_helper(username, token): cmd = ['ssh', '-o', 'StrictHostKeyChe...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test weid shutdown.""" from test_framework.test_framework import BitcoinTestFramework from test_framework.u...
user_input_monitor.py
import subprocess import logging from .adapter import Adapter class UserInputMonitor(Adapter): """ A connection with the target device through `getevent`. `getevent` is able to get raw user input from device. """ def __init__(self, device=None): """ initialize connection :...
server.py
#!/usr/bin/env python import socket #import socket module import time import threading import cv2 import base64 #camera = cv2.VideoCapture(0) def sendData(client): while(True): #grabbed, frame = camera.read() #frame = cv2.resize(frame, (640, 480)) #encoded, buffer = cv2.imencode('.jpg', frame)...
async_calls.py
# Copyright 2019-2020 Stanislav Pidhorskyi # # 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 i...
advanced-reboot.py
# # ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";...
support.py
""" Assorted utilities for use in tests. """ from __future__ import print_function import cmath import contextlib import enum import errno import gc import math import os import shutil import subprocess import sys import tempfile import time import io import ctypes import multiprocessing as mp from contextlib import c...