source
stringlengths
3
86
python
stringlengths
75
1.04M
core_agent_state_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
task.py
""" Created on Sep 14, 2017 @author: riteshagarwal """ import copy import json import json as Json import os import random import socket import threading import time from copy import deepcopy import zlib from httplib import IncompleteRead import com.couchbase.test.transactions.SimpleTransaction as Transaction from _t...
factory.py
""" RPyC connection factories: ease the creation of a connection for the common cases) """ from __future__ import with_statement import socket from contextlib import closing from functools import partial import threading try: from thread import interrupt_main except ImportError: try: from _thread import...
bin_xsec.py
''' Bin cross sections ''' import sys, os, optparse, string, glob import numpy as np from time import gmtime, strftime import multiprocessing from multiprocessing import Pool from functools import partial parser = optparse.OptionParser() parser.add_option('-s', '--source', dest='source_files', ...
window_manager.py
""" Window Manager - manages all of the windows for the application and contains the main update loop """ from threading import Thread, Lock class WindowManager: def __init__(self): """Create a WindowManager. """ self.window_list = [] pass def ad...
rpyc_pycryptoki.py
#!/usr/bin/env python -u """ RPYC-based daemon that allows for remote execution of pycryptoki commands. Start via ``./rpyc_pycryptoki.py -i <ip> -p <port>`` or ``python rpyc_pycryptoki.py -i <ip> -p <port>`` All methods starting are useable via ``rpyc_conn.root.<method>`` All methods ending with ``_ex`` will automat...
cli.py
import ast import inspect import os import platform import re import sys import traceback import warnings from functools import update_wrapper from operator import attrgetter from threading import Lock from threading import Thread import click from werkzeug.utils import import_string from .globals import current_app ...
pipeline_ops_test.py
# Copyright 2020 Google LLC. 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 a...
unlogger.py
#!/usr/bin/env python import argparse import os import sys import zmq import time import gc import signal from threading import Thread import numpy as np from uuid import uuid4 from collections import namedtuple from collections import deque from multiprocessing import Process, TimeoutError from datetime import datetim...
tests.py
from __future__ import unicode_literals import threading from datetime import datetime, timedelta from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections from django.db.models.fields import Field from django.db.models.manager im...
worker_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
release.py
#!/usr/bin/python import re import sys import os import os.path import subprocess import shutil from datetime import * from multiprocessing import Process from utils import * try: from xml.etree.ElementTree import ElementTree except: prettyprint(''' Welcome to the Infinispan Release Script. This re...
threaded.py
from time import sleep import threading import numpy def h(i): return numpy.ones((1024, 1024, i), dtype=numpy.uint8) def child1(): return h(30) def thread1(): data = h(20) sleep(0.1) data2 = child1() sleep(0.1) threading.Thread(target=thread1).start() def main(): data = h(50) sleep...
vglOptimierungGaussSeidel.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Checking various implementations of the damas solver Versions used in this script: numba=0.34.0 python=2.7.13 """ import time as tm import threading import gc import numpy as np import numba as nb import sharedFunctions as shFncs from beamformer import gseidel1 # ...
manager.py
#!/usr/bin/env python3 import datetime import importlib import os import sys import fcntl import errno import signal import shutil import subprocess import textwrap import time import traceback from multiprocessing import Process from typing import Dict, List from common.basedir import BASEDIR from common.spinner imp...
hue_pad.py
#!/usr/bin/env python """ Control lighting effects with a MIDI Pad Controller. This script will watch for incoming MIDI events from an Akai LPD8 and use them to update lighting/color effects through a Philips Hue Bridge. """ import os import time import json import atexit import logging import threading import phue...
test_distributed_sampling.py
import dgl import unittest import os from dgl.data import CitationGraphDataset from dgl.distributed import sample_neighbors, find_edges from dgl.distributed import partition_graph, load_partition, load_partition_book import sys import multiprocessing as mp import numpy as np import backend as F import time from utils i...
axon.py
import argparse import grpc import pandas as pd import random import requests import sys import threading import torch import time import queue import validators from concurrent import futures from munch import Munch from loguru import logger from termcolor import colored from types import SimpleNamespace from typing ...
env_wrappers.py
""" Modified from OpenAI Baselines code to work with multi-agent envs """ import numpy as np import torch from multiprocessing import Process, Pipe from abc import ABC, abstractmethod from onpolicy.utils.util import tile_images class CloudpickleWrapper(object): """ Uses cloudpickle to serialize contents (other...
test_enum.py
import enum import inspect import pydoc import sys import unittest import threading from collections import OrderedDict from enum import Enum, IntEnum, StrEnum, EnumMeta, Flag, IntFlag, unique, auto from io import StringIO from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL from test import support from te...
run_py_tests.py
#!/usr/bin/env python # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """End to end tests for ChromeDriver.""" import base64 import optparse import subprocess import os import sys import socket import tem...
testcluster.py
""" Cluster API module tests """ import json import os import tempfile import unittest import urllib.parse from http.server import HTTPServer, BaseHTTPRequestHandler from threading import Thread from unittest.mock import patch from fastapi.testclient import TestClient from txtai.api import app, start # Configurati...
pyechoserver_test.py
import threading import unittest import os try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen import src.pyechoserver as pyechoserver class BasicTestCase(unittest.TestCase): def setUp(self): """Called before every test case.""" self.srv...
poet.py
import roger.api as api from flask import Flask from flask import render_template from flask import send_from_directory import socketio import eventlet import eventlet.wsgi import threading from web.util import capitalize_first_letter sio = socketio.Server() app = Flask(__name__, static_url_path='') def send_poet_li...
eBookEZ_dark.py
"""" eBookEZ_dark.py -- app that assists an eBook reader: the reader needs to select the word whose meaning they wish to find, and all they have to do is press CTRL + C or copy that text. Reader can put this app in some corner of screen, the app would always stay on top unless minimized or closed using r...
__init__.py
import logging try: from Queue import Queue # PY2 except ImportError: from queue import Queue # PY3 from threading import Thread try: from urlparse import urljoin # PY2 except ImportError: from urllib.parse import urljoin # PY3 from bs4 import BeautifulSoup import requests from requests.exceptions ...
bridge.py
# Copyright 2020 The FedLearner 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...
tracker.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...
autoreload.py
#!/usr/bin/env python3 from pyln.client import Plugin import json import os import psutil import subprocess import sys import threading import time try: # C-lightning v0.7.2 plugin = Plugin(dynamic=False) except: plugin = Plugin() class ChildPlugin(object): def __init__(self, path, plugin): ...
import_thread.py
from collections import defaultdict import threading import traceback import redis import grpc import ray from ray import ray_constants from ray import cloudpickle as pickle import ray._private.profiling as profiling import logging logger = logging.getLogger(__name__) class ImportThread: """A thread used to im...
__init__.py
"""Support for functionality to download files.""" import logging import os import re import threading import requests import voluptuous as vol from homeassistant.const import HTTP_OK import homeassistant.helpers.config_validation as cv from homeassistant.util import raise_if_invalid_filename, raise_if_invalid_path ...
manager.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2020 Fetch.AI Limited # # 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 ...
test_docxmlrpc.py
from xmlrpc.server import DocXMLRPCServer import http.client import sys from test import support threading = support.import_module('threading') import time import socket import unittest PORT = None def make_request_and_skipIf(condition, reason): # If we skip the test, we have to make a request because the # t...
TrainProxy.py
import os,datetime,random,time import tensorflow as tf from multiprocessing import Process from IutyLib.commonutil.config import Config from prx.PathProxy import PathProxy from prx.ClassProxy import ClassProxy from object.Config import CNNDivParam,CNNDivSetting import object.datasets as datasets from object.models i...
async_hal.py
import asyncio from functools import partial from re import search from threading import Thread from time import sleep import usb class ControllerError(Exception): """Controller failed to respond correctly after retries.""" class Controller: """ (Semi) Asynchronous class to represent a controller. ...
gha-webhook-listener.py
#!/usr/bin/env python # # auto-deploy listener script # # Listens for Github webhook pokes. When it gets one, downloads the artifact # from Github and unpacks it. # # Copyright 2019-2021 The Matrix.org Foundation C.I.C. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file exce...
pydev.py
#! /bin/env python # encoding=utf-8 # gusimiu@baidu.com # datemark: 20150428 # # V1.9: # Add AutoArg for smart arg parsing. # # V1.8: # Add tuple transformer to parse tuple by string format. # foreach_row support string format. # # V1.7: # Add color string # Add App. # # V1.6...
background.py
import threading from threading import Thread from vrms.hardware.arm import ArmHandler from vrms.network.mqtt import Mqtt from vrms.network.udp import Udp def arm(lock) -> None: a = ArmHandler.load_arm() a.client(lock) def mqtt(lock) -> None: m = Mqtt.load_mqtt() m.client(lock) def udp(lock) -> N...
client.py
import socket import json import pickle # remove import threading import argparse import sys import time from datetime import datetime from message import Message from streaming import createMsg, streamData # from displayBanner import displayBanner from Crypto.Cipher import PKCS1_OAEP # RSA based cipher using Optimal...
__init__.py
# Copyright The OpenTelemetry 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 agreed to in ...
sim_builder.py
# -*- coding: utf-8 -*- """ Created on Sat Feb 24 23:26:54 2018 @author: Tyler Banks """ import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.figure import Figure import os import subprocess import re import glob from c...
server_ss.py
import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web import tornado.websocket import os,re import time import json,pickle,dill import traceback from tornado.options import define, options from toy_process import _process import multiprocessing import psutil import signal import sock...
tcp_server.py
import socket import threading IP = '0.0.0.0' PORT = 9998 def main(): server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((IP, PORT)) server.listen(5) print(f'[*] Listening on {IP}:{PORT}') while True: client, address = server.accept() print(f'[*] Accepted conn...
client.py
import socket import sys import datetime import threading def listen(): while True: message = input() # ask user for input message = message.encode() # convert to something that can be sent sock.send(message) # send message sock = socket.socket() # create socket h_name = input(str("Enter the h...
scheduler.py
import time from concurrent.futures import ThreadPoolExecutor from datetime import datetime, timedelta from multiprocessing import Queue, Process from threading import Thread import pyppeteer import schedule from scylla.config import get_config from scylla.database import ProxyIP from scylla.jobs import validate_prox...
service_streamer.py
# coding=utf-8 # Created by Meteorix at 2019/7/13 import logging import multiprocessing import os import threading import time import uuid import weakref import pickle from queue import Queue, Empty from typing import List from redis import Redis from .managed_model import ManagedModel TIMEOUT = 1 TIME_SLEEP = 0.001...
Main.py
__author__ = 'LukaAvbreht' from tkinter import * from igra import * from PIL import ImageTk, Image import threading import random from algo_prisk import AlphaBetta, MiniMax, PureMonteCarloTreeSearch, MonteCarloAlphaHybrid from hevristike import hevristika_basic class tkmlin(): def __init__(self, master): ...
test_multiprocessing.py
import pytest import multiprocessing import contextlib import redis from redis.connection import Connection, ConnectionPool from redis.exceptions import ConnectionError from .conftest import _get_client @contextlib.contextmanager def exit_callback(callback, *args): try: yield finally: callba...
common.py
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python from datetime import timedelta import json import yaml import logging import os import subprocess import re import stat import subprocess import urllib.parse import threading import contextlib import tempfile import psutil from functools import reduce,...
opencvDetection.py
import cv2 import sys import logging as log import datetime as dt import time import math import threading import queue from captureImage import captureImage from statistics import stdev from statistics import mean from faceObject import faceObject from random import randint import cProfile, pstats, io pr = cProfile.P...
health_checker.py
import tkinter as tk import time import threading import psycopg2 import rcs620s import seeed_python_reterminal.core as rt # DB接続情報 DB_HOST = 'IP_address' DB_PORT = 'port' DB_NAME = 'DB_name' DB_USER = 'username' DB_PASS = 'password' # 設定 DISP_WIDTH = 1280 DISP_HEIGHT = 720 FONT1 = 160 # 体温 FONT2 =...
facial_recognition_learning.py
import numpy as np import cv2 import pickle import os import threading import socket import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) # 27 - 40 RED = 40 BLUE = 38 GREEN = 37 BUTTON = 35 # motor is 29 and 31 GPIO.setup(RED, GPIO.OUT) GPIO.setup(BLUE,GPIO.OUT) GPIO.setup(GREEN, GPIO.OUT...
console.py
import serial import time import re import threading import sys class console(): def connect_serial(self,console_num,baud_rate): time.sleep(3) self.thread_exit_tag = 0 self.reference_checksum = "" self.checksum = "" self.result = 0 sel...
mplot_thread.py
""" * This file is part of PYSLAM * * Copyright (C) 2016-present Luigi Freda <luigi dot freda at gmail dot com> * * PYSLAM 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, either version 3 of the License, or ...
thread_example_lock.py
# -*- codiing:utf-8 -*- """ thread example """ __author__="aaron.qiu" import time, threading # 假定这是你的银行存款: balance = 0 lock = threading.Lock() def change_it(n): print("=====change========") # 先存后取,结果应该为0: global balance balance = balance + n balance = balance - n print("=balance %s========" %...
test_gw.py
import logging import warnings import platform import unittest import gc import json import weakref import threading try: from Queue import Queue, Full, Empty except ImportError: from queue import Queue, Full, Empty try: from io import StringIO except ImportError: from cString import StringIO from .u...
app.py
import datetime import json import logging import os import requests import threading import time import timeout_decorator from flask import Flask, jsonify, Response TIMEOUT = 4 class MissingJsonFields(Exception): pass def heartbeat(): return f'Alive @{datetime.datetime.now()}' def heartbeat_task(app): ...
signals.py
# coding=utf-8 from collections import defaultdict import threading __author__ = 'nekmo' class Events(defaultdict): def __init__(self): super(Events, self).__init__(list) def propagate(self, event, *args, **kwargs): if not event in self: return for function in self[event]: ...
L08_S02_01_DefiningThread.py
import threading import time from learning_python.Lesson08_Parallel_Programming.Section02_Thread_Based_Parallism.MyThreadClass import MyThreadClass from random import randint "############################# 2.1 Defining a thread ####################################################" """ The Python threading module prov...
model.py
import json from threading import Thread import time from typing import Any, Dict, List, FrozenSet, Set, Union, Optional from mypy_extensions import TypedDict import urwid from zulipterminal.helper import ( asynch, classify_unread_counts, index_messages, set_count ) from zulipterminal.ui_tools.utils i...
ticp_handler.py
import logging import queue import threading from time import sleep import serial from uart_handler.ticp_common import TICPCommand from uart_handler.ticp_common import TICPMessageTypeFactory, TICPMessageType from uart_handler.ticp_message import TICPMessageAllSensorData, TICPMessageAllCommandData from uart_handler.ti...
manager.py
#!/usr/bin/env python2.7 import os import sys import fcntl import errno import signal import subprocess from common.basedir import BASEDIR sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR def unblock_stdout(): # get a non-blocking stdout child_pid, child_pty = os.forkpty() if ch...
test_utils.py
import pickle import threading import time import pytest import boardgamegeek.utils as bggutil from _common import * from boardgamegeek.objects.things import Thing def test_get_xml_attr(xml): node = bggutil.xml_attr(None, "attr") assert node is None node = bggutil.xml_attr(None, "attr", default='default...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2019 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 bitcoind node can load multiple wallet files """ import os import shut...
concurrent_query.py
import re import numpy as np import pandas as pd import pprint import psycopg2 from threading import Thread from multiprocessing import Process, cpu_count from queue import Queue import time from tqdm import tqdm def _construct_sql(stp:str, etp:str): ''' A private helper function to construct sql que...
execution.py
from typing import Optional, Callable, Dict import ast import contextlib import faulthandler import io import os import multiprocessing import platform import signal import tempfile def check_correctness(problem: Dict, completion: str, timeout: float, completion_id: Optional[int] = None) -> Dict...
client.py
from threading import Thread from SecureSocketService import Socket from socket import error as socket_error class Client(Socket): def __init__(self, host: str, port: int, service_id: int = 2): super().__init__() self.service_id = service_id self.connect_server(host, port) def receive...
test_http.py
from .context import platypush, config_file, TestTimeoutException import json import logging import requests import sys import time import unittest from threading import Thread from platypush import Daemon from platypush.config import Config from platypush.message import Message from platypush.message.response impor...
prerequisites.py
from multiprocessing import Pool import pandas as pd import pickle import threading from Levenshtein import distance as lev import itertools from sklearn.cluster import DBSCAN import sys import dateutil import pkg_resources import numpy as np from dateutil.relativedelta import relativedelta from datetime import datetim...
run.py
#! /usr/bin/python from lab_polly_speech import PollySpeech from lab_baxter_common import traj_playback from lab_baxter_common.general_toolkit import( move_to_posture ) from lab_ros_speech_to_text.msg import( Speech ) import math import baxter_interface import yaml import rospy import os import rospkg from mu...
Ex12_terminate.py
import os import multiprocessing import time def func(tname): print('프로세스 %s : ' % (os.getpid()), tname) def loopy(name): func('반복구문 시작') start = 1 stop = 1000 for num in range(start, stop): print('\t Number %s of %s' % (num, stop)) time.sleep(1) if __name__ == '__main__': fun...
test_index.py
import logging import time import pdb import copy import threading from multiprocessing import Pool, Process import numpy import pytest import sklearn.preprocessing from utils import * from constants import * uid = "test_index" BUILD_TIMEOUT = 300 field_name = default_float_vec_field_name binary_field_name = default_b...
test_error.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
datasets.py
# Dataset utils and dataloaders import glob import logging import math import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool from pathlib import Path from threading import Thread import cv2 import numpy as np import torch import torch.nn.functional ...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2020 The Elixir Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test elixird shutdown.""" from test_framework.test_framework import ElixirTestFramework from test_frame...
test_dataloader.py
import math import sys import errno import multiprocessing import os import ctypes import faulthandler import torch import gc import time import signal import unittest import itertools import warnings import tempfile from torch import multiprocessing as mp from torch.utils.data import ( ChainDataset, ConcatData...
generate_images.py
from PIL import Image import json import time import threading from multiprocessing.pool import ThreadPool as Pool start = time.time() # print("Loading assets: ... ", end='') f = open('output.json') items = json.load(f) f.close() # print("OK") def process_image(pos, data, props): try: res = None ...
trainer.py
# Copyright 2018 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...
spin_mp.py
import sys from multiprocessing import Queue import functools import datetime import serial from tkinter import messagebox from tkinter import filedialog import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import TextBox from matplotlib.widgets import Button from matplotlib.widgets import Slid...
variable_scope_shim_test.py
# Copyright 2015 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...
algo_four.py
from functools import reduce from sys import * import numpy as np import random as r import socket import struct import subprocess as sp import threading from threading import Thread import ast import time import datetime as dt import os import psutil from netifaces import interfaces, ifaddresses, AF_INET import paho.m...
handleData.py
import tarfile from pymooCFD.setupOpt import checkpointFile, dataDir, problem, nCP, archDir import shutil import numpy as np import time import os def archive(dirToComp, archDir=archDir, background=True): try: if len(os.listdir(dirToComp)) == 0: # print('Directory given to archive is empty!!!'...
TESTE____Extração MagMax COVID - v3.py
from opentrons.types import Point import json import os import math import threading from time import sleep metadata = { 'protocolName': 'USO_v6_station_b_M300_Pool_magmax', 'author': 'Nick <ndiehl@opentrons.com', 'apiLevel': '2.3' } NUM_SAMPLES = 24 # start with 8 samples, slowly increase to 48, then 94 ...
threadexample.py
import time from threading import * def doubles(numbers): for n in numbers: time.sleep(1) print('Double values:',2*n) def squares(numbers): for n in numbers: time.sleep(1) print('Square values:',n*n) numbers=[1,2,3,4,5,6] begintime=time.time() t1=Thread(target=doubles,args=(numbers,)) t2=Thread(target=s...
serve.py
# -*- coding: utf-8 -*- from __future__ import print_function import abc import argparse import json import logging import os import platform import socket import sys import threading import time import traceback import urllib2 import uuid from collections import defaultdict, OrderedDict from multiprocessing import P...
event_stream_generator.py
__author__ = 'Bohdan Mushkevych' import datetime import random import time import math from threading import Thread from amqp import AMQPError from db.model.raw_data import RawData from synergy.mq.flopsy import Publisher from synergy.system.performance_tracker import SimpleTracker from synergy.system.synergy_process...
keck_vnc_launcher.py
#! /usr/bin/env python3 ## Import standard modules import os import argparse import atexit from datetime import datetime from getpass import getpass import json import logging import os from pathlib import Path import platform import re import socket import subprocess import sys from telnetlib import Telnet from threa...
gamepad_monitor.py
#!/usr/bin/python3.9 import usb import threading import logging import pyudev import time import subprocess class USBDetector(): ''' Monitor udev for detection of usb ''' def __init__(self): ''' Initiate the object ''' thread = threading.Thread(target=self._work) thread.daemon = Fal...
test_legacy.py
'''cping.layouts.legacy tests''' import contextlib import io import re import threading import unittest import cping.layouts.legacy import cping.protocols class TestLayout(unittest.TestCase): '''cping.layouts.legacy.Layout tests.''' def test___call__(self): '''Ensure calling layout properly enters a...
classes.py
#!/usr/bin/python3 import json,socket,time,threading from qsys.helpers import required_args,lineno,epoch from logg3r import Log import copy init_logger = Log(log_path="./test_logs/",name='init_logger',level=1) ErrorCodes = { -32700:'Parse error. Invalid JSON was received by the server.', -32600:'Invalid reque...
device.py
"""Demonstrate usin zmq.proxy device for message relay""" # This example is places in the Public Domain # It may also be used under the Creative Commons CC-0 License, (C) PyZMQ Developers from __future__ import print_function from threading import Thread import time import zmq MSGS = 10 PRODUCERS = 2 def produce(u...
texify.py
#! /usr/bin/python # -*- coding = uft-8 -*- from urllib import urlopen from bs4 import BeautifulSoup as bs import os import sys import re import robotparser import lxml import shutil import cPickle as pkl import threading def readNode(filename): url2idx = {} for lines in file(filename): line = lines....
log.py
""" Logging module for printing status during an exploit, and internally within ``binjitsu``. Exploit Developers ------------------ By using the standard ``from pwn import *``, an object named ``log`` will be inserted into the global namespace. You can use this to print out status messages during exploitation. For e...
server.py
import time import asyncio from threading import Thread from .map2d import Map2d from .config import FRAME_PER_SECONDS class Server: def __init__(self): self.__map2d: Map2d self.__game_is_running = False self.__thread: Thread = None self.frame_count = 0 self.__delta_time = 1...
helpers.py
"""Supporting functions for polydata and grid objects.""" import collections.abc import enum import logging import signal import sys import warnings from threading import Thread import threading import traceback import numpy as np import scooby import vtk import vtk.util.numpy_support as nps import pyvista from .fil...
test_req_rep.py
import unittest from multiprocessing import Process from nanoservice import Responder from nanoservice import Requester from nanoservice import encoder from nanoservice import Authenticator class BaseTestCase(unittest.TestCase): def setUp(self): self.addr = 'ipc:///tmp/test-reqprep.sock' def tearDo...
mic.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...
cache.py
'''Caching utilities''' import io import os import re import sys import json import time import atexit import inspect import requests import tempfile import mimetypes import subprocess # nosec import pandas as pd import tornado.template from lxml import etree from threading import Thread from queue import Queue f...
compareDQMOutput.py
#!/bin/env python3 import os import sys import glob import argparse import subprocess from threading import Thread COMPARISON_RESULTS = [] def collect_and_compare_files(base_dir, pr_dir, output_dir, num_procs, pr_number, test_number, release_format): files = get_file_pairs(base_dir, pr_dir) threads = [] ...
rotina_pgdas.py
# dale from random import randint from default.sets import InitialSetting from default.webdriver_utilities.wbs import WDShorcuts from default.interact import press_keys_b4, press_key_b4 from selenium.webdriver.support import expected_conditions from selenium.webdriver.common.keys import Keys from selenium.webdriver.co...