source
stringlengths
3
86
python
stringlengths
75
1.04M
hikvision.py
""" pyhik.hikvision ~~~~~~~~~~~~~~~~~~~~ Provides api for Hikvision events Copyright (c) 2016-2020 John Mihalic <https://github.com/mezz64> Licensed under the MIT license. Based on the following api documentation: System: http://oversea-download.hikvision.com/uploadfile/Leaflet/ISAPI/HIKVISION%20ISAPI_2.0-IPMD%20Servi...
applet.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2013 Kitware 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 cop...
common.py
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python import json import yaml import logging import os import re import subprocess import stat import urllib.parse import threading import contextlib import tempfile import psutil from functools import reduce, wraps from decimal import Decimal # Django fro...
__init__.py
import os import io import sys import time import glob import socket import winreg import locale import hashlib import platform import tempfile import datetime import threading import subprocess from ctypes import windll from urllib.request import urlopen import psutil import win32gui import pythoncom import win32proc...
RecoderRobotData.py
# MIT License. # Copyright (c) 2020 by BioicDL. All rights reserved. # Created by LiuXb on 2020/11/24 # -*- coding:utf-8 -*- """ @Modified: @Description: """ import threading import time import queue from deepclaw.driver.arms import URController_rtde as URctl from deepclaw.driver.arms.ArmController import ArmControl...
test_functools.py
zaimportuj abc zaimportuj collections z itertools zaimportuj permutations zaimportuj pickle z random zaimportuj choice zaimportuj sys z test zaimportuj support zaimportuj unittest z weakref zaimportuj proxy spróbuj: zaimportuj threading wyjąwszy ImportError: threading = Nic zaimportuj functools py_functools =...
main.py
#!/usr/bin/env python3 import argparse from pathlib import Path from time import monotonic from uuid import uuid4 from multiprocessing import Process, Queue import cv2 import depthai as dai def check_range(min_val, max_val): def check_fn(value): ivalue = int(value) if min_val <= ivalue <= max_val:...
pytest_dut_monitor.py
import pytest import paramiko import threading import logging import time import os import yaml from collections import OrderedDict from datetime import datetime from .errors import HDDThresholdExceeded, RAMThresholdExceeded, CPUThresholdExceeded logger = logging.getLogger(__name__) DUT_MONITOR = "/tmp/dut_monitor....
tempo.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (C) 2017 gumblex # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as publis...
context.py
#!/usr/bin/env python3 from http import HTTPStatus from socketserver import ThreadingMixIn from urllib.parse import urlparse from ruamel.yaml.comments import CommentedMap as OrderedDict # to avoid '!!omap' in yaml import threading import http.server import json import queue import socket import subprocess import time ...
server.py
from re import A import socket from threading import Thread from datetime import datetime from pymongo import MongoClient class Server: def __init__(self, address: str, port: int, spacer:str=",", log:str=None, mongo:tuple=("", 0)): self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
test-client-concurrent-connections.py
#!/usr/bin/env python3 # Creates a ghostunnel. Ensures that multiple servers can communicate. from subprocess import Popen from multiprocessing import Process from test_common import * import socket, ssl, time, random def send_data(i, p): counter = 0 while counter < 100: r = random.random() if r < 0.4: ...
test_MMTransE_lan_mapping_15k_fk.py
import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), '../../src/MMTransE')) from MMTransE import MMTransE import time import multiprocessing from multiprocessing import Process, Value, Lock, Manager, Array import numpy as np from numpy import linalg as LA fmap = os.path.join(os.path...
test.py
#! /usr/bin/env python3 # # Copyright 2019 Garmin Ltd. or its subsidiaries # # 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...
ts_burst_example.py
#Copyright (c) 2017 Joseph D. Steinmeyer (jodalyst) #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, m...
send_file.py
import socket import json import struct import os import hashlib import multiprocessing file_path = './send/Windows.iso' file_name = os.path.basename(file_path) def transmit(cnn, addr, file_info): print(str(addr) + ' Connected') try: file_size = file_info['file_size'] header_bytes = json.dumps...
server.py
# Copyright (c) 2016 Uber Technologies, Inc. # # 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, publ...
__init__.py
from __future__ import print_function import argparse import itertools import os import random import re import shlex import string import sys import traceback import warnings from collections import OrderedDict from fnmatch import fnmatchcase from subprocess import list2cmdline from threading import Thread import pl...
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,...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
DualStepperTest.py
#!/usr/bin/python from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_StepperMotor import time import atexit import threading import random # create a default object, no changes to I2C address or frequency mh = Adafruit_MotorHAT() # create empty threads (these will hold the stepper 1 and 2 thr...
test_for_process_thread.py
# !/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/2/8 0008 23:58 # @Author : Gpp # @File : test_for_process_thread.py import threading, time # def a_thread(): # print('i am a thread') # # time.sleep(3) # print(threading.current_thread().getName()) # # # t = threading.Thread(target=a_t...
process_utils.py
from collections import namedtuple from enum import IntEnum import json import logging import signal as sig import sys from threading import Event, Thread from time import sleep from .log import LOG def reset_sigint_handler(): """Reset the sigint handler to the default. This fixes KeyboardInterrupt not gett...
kpa_backend.py
from oai_kpa_stm_data import OaiKpaSTM from oia_kpa_power_data import OaiKpaPower from oai_kpa_mpp_data import OaiKpaMPP from oai_kpa_interface import OaiDigitalModule import time import json import threading class DeviceBackend: def __init__(self, **kwargs): self.stm_id = kwargs.get('stm_id', '2071369942...
transport.py
# encoding=utf-8 """ Arbitrary size data transfers for Water Linked Underwater Modems WlUDPSocket is the interface for sending/receiving arbitrary length data (datagram) with a Water Linked Underwater Modem. This style of transfer is suitable for short messages and has low overhead at 3 bytes for each datagram (1 sta...
QATdx_adv.py
# coding:utf-8 # # The MIT License (MIT) # # Copyright (c) 2016-2018 yutiansut/QUANTAXIS # # 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 th...
__init__.py
import os # setup testing environment before anything imports app os.environ["FLASK_ENV"] = "test" from pmg import app from pmg.models import db from flask_testing import TestCase, LiveServerTestCase import multiprocessing import time import urllib.request, urllib.error, urllib.parse class PMGTestCase(TestCase): ...
port_scanner.py
#!/usr/bin/env python import socket #for socket scanning from threading import * #for threading import subprocess #to run the clean command and system exit import sys from datetime import datetime #from queue import Queue #for threading (using queues) import argparse #used for allowing command line switches ...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Baricoin client # Copyright (C) 2012 thomasv@gitorious # # 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...
ChatRoom2.0Server.py
#!/usr/bin/env python # -.- coding: utf-8 -.-y import base64 import datetime import getpass import os import Queue import socket import sqlite3 import subprocess import sys import time import threading from cmd import Cmd from Crypto.Cipher import AES from Crypto import Random #Created by Camerin Figueroa cv = "2.0" q ...
gh-views-bot.py
import sys import time import threading import requests from utils import to_int_or CURSOR_UP_ONE = '\x1b[1A' ERASE_LINE = '\x1b[2K' def request_task(url, data, headers): requests.get(url, json=data, headers=headers) def fire_and_forget(url, json={}, headers={}): threading.Thread(target=request_task, args...
test_concurrency.py
from unittest.mock import patch import pytest from time import sleep from easypy.threadtree import get_thread_stacks, ThreadContexts from easypy.concurrency import concurrent, MultiObject, MultiException @pytest.yield_fixture(params=[True, False], ids=['concurrent', 'nonconcurrent']) def concurrency_enabled_and_disa...
lte.py
import re import socket from time import sleep import mininet.node import mininet.link from mininet.log import info from mininet.util import moveIntf from mininet.cluster.link import RemoteLink class Lte (object): def __init__ (self, tdf=1, mode='Master', imsiBase=0, cellIdBase=0, ueIpBase='7.0....
threading_utils.py
# Copyright 2013 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. """Classes and functions related to threading.""" import functools import inspect import logging import os import queue import sys import threadi...
socketMethod.py
#-*- coding:utf-8 -*- import time, threading from SocketServer import TCPServer, BaseRequestHandler import traceback from PythonSocketBBS import SocketServerBBS def loop(a): print 'thread is running...' # time.sleep(1) a.serve_forever() print 'thread ended.' def socketMethod(): print 'Method ...
environment.py
import uuid, yaml, json, sys, threading, logging from threading import Thread from kubernetes import client, config, watch from kubernetes.client.rest import ApiException as K8sApiException from kubernetes.client import V1DeleteOptions from ignition.model.infrastructure import InfrastructureTask from ignition.model.fai...
stats_manager.py
# std import logging import os from datetime import datetime, timedelta from typing import List from threading import Thread from time import sleep # project from . import HarvesterActivityConsumer, FinishedSignageConsumer from .stat_accumulators.eligible_plots_stats import EligiblePlotsStats from .stat_accumulators.s...
example_test.py
import re import os import struct import socket from threading import Thread import ssl from tiny_test_fw import DUT import ttfw_idf import random import subprocess try: import BaseHTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler except ImportError: import http.server as BaseHTTPServer ...
fly_seg.py
#!/GPFS/zhangli_lab_permanent/zhuqingjie/env/py3_tf2/bin/python ''' @Time : 20/07/21 下午 06:06 @Author : zhuqingjie @User : zhu @FileName: fly_seg.py @Software: PyCharm ''' import math import random import time from pathlib import Path import cv2 import numpy as np from scipy import stats from easyFlyTracker.s...
Hiwin_RT605_ArmCommand_Socket_20190627185509.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
testing.py
from six import StringIO from six.moves.urllib.parse import urljoin from unittest import mock import ZODB import ZODB.DemoStorage import base64 import celery.contrib.testing.app import celery.contrib.testing.worker import celery_longterm_scheduler import contextlib import copy import datetime import doctest import goce...
test.py
# -*- coding: utf-8 -*- import urllib.request import urllib import re import time import random import socket import threading import requests # 抓取代理IP ip_totle = [] for page in range(2, 6): # url = 'http://ip84.com/dlgn/' + str(page) url = 'http://www.xicidaili.com/wn/' + str(page) # 西刺代理 # url = "https:...
serve.py
# # A simple webserver MEANT FOR TESTING based off of http.server. # import http.server import socketserver import os from multiprocessing import Process import generate import yaml from threading import Timer # Credit: http://stackoverflow.com/a/13151299/6388442 class RepeatedTimer(object): def __init__(self, in...
master_server.py
#!/usr/bin/env python # # Copyright 2013 Tanel Alumae """ Reads speech data via websocket requests, sends it to Redis, waits for results from Redis and forwards to client via websocket """ import sys import logging import json import codecs import os.path import uuid import time import threading import functools from ...
_utils.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...
Params.py
import sys import threading import time from polyaxon_client.tracking import Experiment from params import param_utils import params.polyaxon_parsing as pp from util.output_artifact_utils import define_prepare_mdl_path, \ define_prepare_tb_path def get_file_inputs(): while True: try: sys....
qt_worker.py
from pyqtgraph.Qt import QtCore, QtGui import traceback import sys from multiprocessing import Process, Pool, Queue, Pipe import time class WorkerSignals(QtCore.QObject): ''' Defines the signals available from a running worker thread. Supported signals are: finished No data error ...
application_runners.py
from __future__ import print_function import sys import os import uuid import shlex import threading import shutil import subprocess import logging import inspect import runpy import future.utils as utils import flask import requests from dash.testing.errors import ( NoAppFoundError, TestingTimeoutError, ...
fgoFunc.py
# Stars Cosmos Gods Animus Antrum Unbirth Anima Animusphere # 星の形.宙の形.神の形.我の形.天体は空洞なり.空洞は虚空なり.虚空には神ありき. # 地を照らし,空に在り,天上の座標を示せ. # カルディアの灯よ. # どうか今一度,旅人の標とならん事を. # ここで,Bgo運営の敗北を宣言する! # . OO---O---O-o\ # . // \ / \ / \ \\ # . OO O O O \\ # . // \ \ / / \ \\ # . oO---O---O--...
led_status.py
''' Led Status Handle the led status light Author: Tawn Kramer ''' import sys import time import threading try: import RPi.GPIO as GPIO except: print 'no RPi.GPIO support' import gpio_stub as GPIO import conf def setup(pin=23): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(pin,...
wiki_parser.py
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT # # 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 applicab...
test_index.py
import pytest from base.client_base import TestcaseBase from base.index_wrapper import ApiIndexWrapper 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 common.code_mapping import CollectionErro...
adminset_agent.py
#!/usr/bin/env python # coding=utf-8 import os, re, platform, socket, time, json, threading import psutil, schedule, requests from subprocess import Popen, PIPE import logging AGENT_VERSION = "0.21" token = 'HPcWR7l4NJNJ' server_ip = '192.168.47.130' def log(log_name, path=None): logging.basicConfig(level=logging...
controlsd.py
#!/usr/bin/env python3 import os import gc import requests import threading from cereal import car, log from selfdrive.crash import client from common.android import ANDROID, get_sound_card_online from common.numpy_fast import clip from common.realtime import sec_since_boot, set_realtime_priority, set_core_affinity, Ra...
handlers.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...
example.py
# Copyright (c) 2018 Gabriele Baldoni. # # See the NOTICE file(s) distributed with this work for additional # information regarding copyright ownership. # # This program and the accompanying materials are made available under the # terms of the Eclipse Public License 2.0 which is available at # http://www.eclipse.org/l...
ssl_loop_backup.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ loop thread to run ssl """ from SoundSourceLocalization.ssl_setup import * from SoundSourceLocalization.ssl_gcc_generator import GccGenerator from SoundSourceLocalization.ssl_actor_critic import Actor, Critic from SoundSourceLocalization.ssl_map import Map from ...
needswx.py
import sys, os, os.path, fnmatch, types, threading, time import re, copy, StringIO, csv, math, pickle from optparse_gui import OptionParser, UserCancelledError, Progress import optparse from ConfigParser import ConfigParser import wx from wx.lib.filebrowsebutton import FileBrowseButton def quotedifnec(f): if ' '...
test_threading_local.py
import sys import unittest from doctest import DocTestSuite from test import support from test.support import threading_helper import weakref # import gc # Modules under test import _thread import threading import _threading_local class Weak(object): pass def target(local, weaklist): weak = Weak() local...
cscleaner.py
from multiprocessing import Process import time import htcondor import json import logging import config import socket from sqlalchemy import create_engine from sqlalchemy.orm import Session from sqlalchemy.ext.automap import automap_base def cleanUp(): while(True): # Setup condor classes and database co...
torquelim-11-07.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2013 Stephane Caron <stephane.caron@normalesup.org> # # 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...
test_rpc.py
''' Test whether rpc works in a multithreads environemnt ''' from spartan import rpc from spartan import util import threading from multiprocessing.pool import ThreadPool port = 7278 host = "localhost" #number of threads we launch to send request on one client NUM_THREADS = 4 class EchoServer(object): def __init__...
data_flow.py
# -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import import numpy as np import threading try: # Python 2 import Queue as queue except Exception: # Python 3 import queue import tensorflow.compat.v1 as tf from . import utils class DataFlow(object): """ Data Flow...
win32gui_dialog.py
# A demo of a fairly complex dialog. # # Features: # * Uses a "dynamic dialog resource" to build the dialog. # * Uses a ListView control. # * Dynamically resizes content. # * Uses a second worker thread to fill the list. # * Demostrates support for windows XP themes. # If you are on Windows XP, and specify a '--noxp' ...
batcher.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # Modifications Copyright 2017 Abigail See # Modifications made 2018 by Logan Lebanoff # # 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 Licen...
network_pprz_tcp.py
#!/usr/bin/env python3 """ Router class is part of a thesis work about distributed systems """ __author__ = "Julie Morvan" __license__ = "MIT" __version__ = "0.1" __maintainer__ = "Julie Morvan" __email__ = "julie.morvan999@hotmail.fr" import socket, os, math, struct, sys, json, traceback, zlib, fcntl, threading, t...
dash_ppdyn.py
import ini import time import os.path from os.path import join as pjoin import numpy as np import pandas as pd import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.graph_objects as go import webbrowser # from multiprocessing impor...
StreamCameraVideo.py
# import the necessary packages from threading import Thread import cv2 import time import datetime import logging from CameraSettings import CameraSettings from CameraMemory import CameraMemory """ Implement a camera based video stream. Tested on Raspberry Pi 3B, 3B+, 4, Windows 10 Thinkpad T570, and two logitech U...
main.py
''' ┏━━━━━━━━━━━━━━━━━ ┣ 𐀀 HΞLLTΞRHΞΛD ᴄᴏʀᴘ. ┣ ©2020 ᴍᴏ-ʙᴀɴᴢᴜ ┗━━━━━━━━━━━━━━━━━ ''' from linepy import * from akad.ttypes import * from akad.ttypes import Message from akad.ttypes import ContentType as Type from akad.ttypes import TalkException from akad.ttypes import IdentityProvider, LoginResultType, LoginRequest,...
pulse_motion_server.py
#! /usr/bin/env python """ pulse_motion.py Zhiang Chen, Nov 2020 """ import rospy from std_msgs.msg import Float64 from sensor_msgs.msg import JointState import actionlib import pbr_gazebo.msg from threading import Thread from collections import deque import numpy as np from numpy import pi, sin class PulseMotion(obj...
socket.py
import time import json import websocket import threading import contextlib from sys import _getframe as getframe from .lib.util import objects class SocketHandler: def __init__(self, client, socket_trace = False, debug = False): if socket_trace: websocket.enableTrace(True) self.socket_url = "ws...
chatbox_nodb.py
import sys import telepot from telepot.delegate import per_chat_id_in, call, create_open """ $ python3.2 chatbox_nodb.py <token> <owner_id> Chatbox - a mailbox for chats 1. People send messages to your bot. 2. Your bot remembers the messages. 3. You read the messages later. This version only stores the messages in ...
dynamodump.py
#!/usr/bin/env python import argparse import json import logging import os import shutil import threading import boto.dynamodb2.layer1 import datetime import errno import sys import time import re from boto.dynamodb2.layer1 import DynamoDBConnection from botocore.exceptions import BotoCoreError import boto3 JSON_INDEN...
CntlrWinMain.py
''' Created on Oct 3, 2010 This module is Arelle's controller in windowing interactive UI mode @author: Mark V Systems Limited (c) Copyright 2010 Mark V Systems Limited, All rights reserved. ''' from arelle import PythonUtil # define 2.x or 3.x string types import os, sys, subprocess, pickle, time, locale, re, fnmatc...
recording_viewer_device.py
# Copyright 2018 Jetperch LLC # # 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,...
p2p_stress.py
import testUtils import p2p_test_peers import random import time import copy import threading from core_symbol import CORE_SYMBOL class StressNetwork: speeds=[1,5,10,30,60,100,500] sec=10 maxthreads=100 trList=[] def maxIndex(self): return len(self.speeds) def randAcctName(self): ...
stub.py
# ---------------------------------------------------------------------- # Service stub for scripts and commands # ---------------------------------------------------------------------- # Copyright (C) 2007-2020 The NOC Project # See LICENSE for details # ----------------------------------------------------------------...
wspbus.py
r"""An implementation of the Web Site Process Bus. This module is completely standalone, depending only on the stdlib. Web Site Process Bus -------------------- A Bus object is used to contain and manage site-wide behavior: daemonization, HTTP server start/stop, process reload, signal handling, drop privileges, PID ...
wsdump.py
#!/Users/tgins/Documents/PythonScripts/Book_Recommendations_App/virtual_env/bin/python2.7 import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding():...
run_multithread_sampling_iS3D.py
import csv import os import sys from multiprocessing import Process, current_process import datetime as dt import time print("### Starting multithread sampling routine ###") start_time = time.time() #number of samples nsamples = int(sys.argv[1]) print("Number of samples : " + str(nsamples) ) #number of cores reading ...
Mgmt.py
"""Mgmt System for PiCN""" import multiprocessing import os import select import socket import time from typing import Dict from PiCN.Layers.ICNLayer.ContentStore import BaseContentStore from PiCN.Layers.ICNLayer.ForwardingInformationBase import BaseForwardingInformationBase from PiCN.Layers.ICNLayer.PendingInterest...
app.py
# Copyright (c) 2018 SMHI, Swedish Meteorological and Hydrological Institute # License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit). # To use basemap you might need to install Microsoft Visual C++: https://visualstudio.microsoft.com/visual-cpp-build-tools/ import os import threading import t...
combat.py
import math import string from datetime import datetime, timedelta from util.logger import Logger from util.utils import Region, Utils from scipy import spatial from threading import Thread class CombatModule(object): def __init__(self, config, stats, retirement_module, enhancement_module): """Initializes...
queue.py
import queue import threading from queue import Queue def dispatcher(): queues = [] handles = [] def reg(fn): q = Queue() queues.append(q) t = threading.Thread(target=fn, args=(q,)) def run(): for t in handles: t.start() return reg, run reg, run = dispat...
server.py
#!/bin/python3 ''' This starts the socket server to which things connect to play the game ''' import socketserver import socket # pylint: disable=unused-import import threading import time import random import sys import logging import os.path try: import ujson as json except: import json import battlecode as ...
bigroaster.py
#!/usr/bin/python # -*- coding: iso-8859-15 -*- # # Copyright (c) 2017-2018 Mark Juric # Copyright (c) 2012-2015 Stephen P. Smith # # 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 r...
subproc_vec_env.py
import multiprocessing as mp from collections import OrderedDict from typing import Any, Callable, List, Optional, Sequence, Tuple, Type, Union import gym import numpy as np from stable_baselines3.common.vec_env.base_vec_env import ( CloudpickleWrapper, VecEnv, VecEnvIndices, VecEnvObs, VecEnvStep...
keylogger.py
# Date: 09/30/2018 # Author: Pure-L0G1C # Description: Keylogger from threading import Thread from pynput.keyboard import Key, Listener class Keylogger(object): def __init__(self): self.data = [] self.lastkey = None self.listener = None self.is_alive = True ...
instanceConfiguration_api.py
from flask.ext.socketio import emit from src.model import (ToggleKinectEnable, GetKinectEnable) from src.model.InstanceConfiguration import InstanceConfiguration from src.server import socketio from time import sleep import threading @socketio.on('create_instance_configuration') def create_instance_configuration(deta...
test_context.py
# # Copyright (c) 2015-2018 Canonical, Ltd. # # This file is part of Talisker # (see http://github.com/canonical-ols/talisker). # # 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 # regardin...
scheduler.py
import threading import time import logging logger = logging.getLogger(__name__) class Event: def __init__(self, callback, param): self.callback = callback self.param = param def trigger(self, *args): if self.param is None: self.callback(*args) else: self.callback(*args, self.param) def kill(...
happyeyeballs.py
#!/usr/bin/env python # Python implementation of RFC 6555 / Happy Eyeballs: find the quickest IPv4/IPv6 connection # See https://tools.ietf.org/html/rfc6555 # Method: Start parallel sessions using threads, and only wait for the quickest succesful socket connect # If the HOST has an IPv6 address, IPv6 is given a head s...
test_utils.py
# Copyright 2020 Google 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 writing,...
update_preview.py
from tkinter import * from tkinter import ttk import threading import os from PIL import Image, ImageTk import youtube_dl as yt def my_hook(d): global status, merged if kill_event.is_set(): print("\nTerminated") delthread = threading.Timer(3.0, lambda: os.remove(d['tmpfilename'])) delt...
printer.py
from threading import Thread from time import sleep def printer(): for i in range(3): print(i, end=" ") sleep(0.1) thr = Thread(target=printer, daemon=True) thr.start() print() # Add newline
idf_monitor.py
#!/usr/bin/env python # # esp-idf serial output monitor tool. Does some helpful things: # - Looks up hex addresses in ELF file with addr2line # - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R) # - Run flash build target to rebuild and flash entire project (Ctrl-T Ctrl-F) # - Run app-flash build target to rebuild and f...
asio_chat_client_test.py
import os import re import socket import time from threading import Thread import ttfw_idf global g_client_response global g_msg_to_client g_client_response = b'' g_msg_to_client = b' 3XYZ' def get_my_ip(): s1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s1.connect(('8.8.8.8', 80)) my_ip = s1.g...
statistics.py
import threading import discord import asyncio from time import gmtime, strftime, sleep from utils import gspread_api client = None msgid = "" channelid = "307085753744228356" msgcount = 0 async def setServerStats(): await client.wait_until_ready() await asyncio.sleep(3) while not client.is_closed: ...
temperature-monitor.py
"""Multi-channel temperature logger Reads the configuration from an associated xml file. Presents a set of webpages to display the temperature from an arbitrary number of temperature sensors as defined by the configuration. """ from flask import Flask, render_template, request from flask_restful import Api, Resource, ...
test_credentials.py
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...