source
stringlengths
3
86
python
stringlengths
75
1.04M
test_ssl.py
import pytest import threading import socket as stdlib_socket import ssl as stdlib_ssl from contextlib import contextmanager from functools import partial from OpenSSL import SSL import trustme from async_generator import async_generator, yield_, asynccontextmanager import trio from .. import _core from .._highlevel...
test_runtime_captures_signals.py
import multiprocessing import os import signal import time import pytest from cli.api import gateway, executor_native from jina import Executor, DocumentArray, Document, requests from jina.clients.request import request_generator from jina.parsers import set_gateway_parser, set_pod_parser from jina.serve.networking i...
phonebook_comm.py
from os import error import socket import select import sounddevice as sd import pyaudio import sys from threading import Thread import time from contextlib import closing import platform class Client: def __init__(self): self.tcp_conn_status = False #self.server_udp_port = None self.server...
Tracking.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # "Tracking Bugs" - a chapter of "The Debugging Book" # Web site: https://www.debuggingbook.org/html/Tracking.html # Last change: 2021-12-13 17:33:02+01:00 # # Copyright (c) 2021 CISPA Helmholtz Center for Information Security # Copyright (c) 2018-2020 Saarland University...
test_tuplespace.py
import pytest from threading import Thread from time import time, sleep from pyresp.tuplespace import ( TupleSpaceNaive, TupleSpaceBucket, TupleSpaceConcurrentQuery, TupleSpaceBucketConcurrentQuery, TupleSpaceParallelBuckets ) BLOCK_TEST_TIME = 0.1 TUPLE = ("foo", 1, (0, .5, 1, "baz"), "bar") PATTERN = (s...
test_poll_directory.py
"""retrieval.poll_directory tests for Erawan.""" import multiprocessing import os import shutil import time from erawan.__main__ import main def test_directory_polling(): os.environ['ERAWAN_DECRYPTION_KEY'] = '1234' os.makedirs('/tmp/erawan_backups', exist_ok=True) main_args = ['-q', '-e', '{"plugins": {"...
graphics.py
import subprocess from math import floor from threading import Thread from time import time from typing import Dict, List import musicalbeeps import pygame from mido import second2tick, bpm2tempo from mido.messages.messages import Message from music21.chord import Chord from music21.note import Note from music21.pitch...
main.py
import threading from config.config import work_num from run_monitor import run_mon if __name__ == '__main__': for item in range(work_num): work = threading.Thread(target=run_mon, args=(1,)) work.start() print("第%s个线程启动成功。" % item)
listen.py
from __future__ import absolute_import from __future__ import division import errno import socket from pwnlib.context import context from pwnlib.log import getLogger from pwnlib.timeout import Timeout from pwnlib.tubes.sock import sock log = getLogger(__name__) class listen(sock): r"""Creates an TCP or UDP-sock...
datasets.py
# Dataset utils and dataloaders import glob import hashlib 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...
MotorPanel.py
#!/usr/bin/env python """General motor control panel. Friedrich Schotte, 31 Oct 2013 - 7 Jul 2017""" __version__ = "1.3" # multiple rows import wx from EditableControls import TextCtrl,ComboBox from logging import debug,info,warn,error class MotorWindow(wx.Frame): """Motors""" def __init__(self,motors,title="...
th2.py
#-*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia, goslate import timeit from bs4 import BeautifulSoup from urllib import...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
gcs.py
from datetime import datetime import time, json, sys from timeit import default_timer as timer import socket, logging import threading from dronekit import connect, VehicleMode, LocationGlobal, LocationGlobalRelative, Command from pymavlink import mavutil # Needed for command message definitions import numpy as np from...
GUI-Chat.py
# GUI-Chat.py from tkinter import * from tkinter import ttk, messagebox import tkinter.scrolledtext as st from tkinter import simpledialog ####################NETWORK########################## import socket import threading import sys PORT = 7500 BUFSIZE = 4096 SERVERIP = '159.65.135.242' # SERVER IP ...
test_flush.py
import pytest from utils.utils import * from common.constants import default_entities from common.common_type import CaseLabel DELETE_TIMEOUT = 60 default_single_query = { "data": gen_vectors(1, default_dim), "anns_field": default_float_vec_field_name, "param": {"metric_type": "L2",...
multithread_dataiter_for_cross_entropy_v1.py
# -*- coding: utf-8 -*- import random import math import threading import time import logging import queue import cv2 import numpy from ChasingTrainFramework_GeneralOneClassDetection.image_augmentation.augmentor import Augmentor from ChasingTrainFramework_GeneralOneClassDetection.data_iterator_base.data_batch import D...
Plugin.py
# API for accessing the core plugin of SublimePapyrus import sublime, sublime_plugin, sys, os, json, threading, time PYTHON_VERSION = sys.version_info SUBLIME_VERSION = None if PYTHON_VERSION[0] == 2: SUBLIME_VERSION = int(sublime.version()) import imp root, module = os.path.split(os.getcwd()) coreModule = "Sublime...
ch03_listing_source.py
import threading import time import unittest import redis ONE_WEEK_IN_SECONDS = 7 * 86400 VOTE_SCORE = 432 ARTICLES_PER_PAGE = 25 ''' # <start id="string-calls-1"/> >>> conn = redis.Redis() >>> conn.get('key') #A >>> conn.incr('key') #B 1 #B >>> conn.incr('key', ...
61952507125b80010f5d6aa8480856beed75d264test_broker.py
import unittest from multiprocessing import Queue, Process from imp import load_source from os import path import events from uuid import uuid4 as uuid class TestBroker(unittest.TestCase): broker_module_path = path.join('..', 'broker.py') broker_test_caching_plugin = 'test_broker_plugin.py' broker_test_cac...
PC_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Python PC Miner (v2.4) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## # Import libraries import socket import threading import...
moto.py
import asyncio import aiohttp import functools import logging import flask import os import threading import moto.server import socket import netifaces import wrapt import http.server from typing import Dict, Any def get_free_tcp_port(release_socket=False): sckt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)...
_runner.py
# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
test_s3.py
import boto3 import botocore.session from botocore.exceptions import ClientError from botocore.exceptions import ParamValidationError from nose.tools import eq_ as eq from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest import isodate import email.utils import datetime import threading import re ...
server.py
import zmq import threading context = zmq.Context() class ThreadedServer(object): def __init__(self, host, port): self.host = host self.port = port self.sock = context.socket(zmq.REP) self.sock.bind("tcp://" + self.host + ":" + self.port) def listen(self): self.sock.l...
ChatRoom3.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 import Queue import AESCipher #Created by ...
proxier.py
import atexit from concurrent import futures from dataclasses import dataclass import grpc import logging from itertools import chain import json import socket import sys from threading import Event, Lock, Thread, RLock import time import traceback from typing import Callable, Dict, List, Optional, Tuple import ray fr...
blockchain_processor.py
#!/usr/bin/env python # Copyright(C) 2011-2016 Thomas Voegtlin # # 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, ...
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...
main.py
from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread import math import cv2 import time import imutils import serial ARDUINO_CONNECTED = False class PiVideoStream: # Orange ball HSV values LOWER = (60, 50, 150) UPPER = (110, 110, 210) SENSOR_MODE = 4 RE...
__init__.py
from cutil.database import Database # noqa: F401 from cutil.config import Config # noqa: F401 from cutil.custom_terminal import CustomTerminal # noqa: F401 from cutil.repeating_timer import RepeatingTimer # noqa: F401 import os import re import sys import uuid import math import time import pytz import json import...
PC_Miner.py
#!/usr/bin/env python3 """ Duino-Coin Official PC Miner v2.7.2 © MIT licensed https://duinocoin.com https://github.com/revoxhere/duino-coin Duino-Coin Team & Community 2019-2021 """ from time import time, sleep, strptime, ctime from hashlib import sha1 from socket import socket from multiprocessing import...
pytest.py
import csv import sys import time import mysql.connector from io import StringIO from multiprocessing import Process def _connect(user, host, port, database): return mysql.connector.connect(user=user, host=host, port=port, database=database) def _print_err_and_exit(e): print(e, file=sys.stderr) sys.exi...
dishes_process.py
import multiprocessing as mp import os import time from datetime import datetime def washer(dishes, output, now_): for dish in dishes: now = datetime.now() print('Washing', dish, ', time:', now - now_, ', pid', os.getpid()) time.sleep(1) #把東西丟給行程(處理程序)後繼續執行下一個 output.put(dis...
finetune.py
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
poodle-exploit.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Poodle attack implementation Author: mpgn <martial.puygrenier@gmail.com> Created: 03/2018 - Python3 License: MIT ''' import argparse import binascii import os import re import select import socket import socketserver import struct import sys import th...
robot_logger.py
import mysql.connector from mysql.connector import pooling from mysql.connector import errors import time import threading import yaml class RobotLogger: def __init__(self, filename=None): self.logging_information = self._read_config_file(filename) self.database_name = self.logging_information["...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
arhuaco_response.py
# Copyright (c) 2019 Andres Gomez Ramirez. # All Rights Reserved. import sys import time import threading import logging from threading import Thread, Event from arhuaco.response.action import Action from arhuaco.response.message import Message from arhuaco.response.process import Process # Main class for executing ...
test_exec_timeout.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 ...
test_nanny.py
import asyncio import gc import logging import multiprocessing as mp import os import random from contextlib import suppress from time import sleep import psutil import pytest pytestmark = pytest.mark.gpu from tlz import first, valmap from tornado.ioloop import IOLoop import dask from distributed import Client, Na...
browserstack.py
from threading import Thread from time import sleep from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWai...
telegram_IO.py
import time from telegram import Update from telegram.ext import Updater, CommandHandler, CallbackContext, MessageHandler, Filters import threading class TelegramIO: def __init__(self, *args, **kwargs): self._output, self._input = None, None updater = Updater(kwargs['telegram']['token']) ...
client.py
#!/usr/bin/env python from server import CHAT_SERVER_NAME from threading import Thread import Pyro.core from Pyro.errors import NamingError, ConnectionClosedError # Chat client. # Uses main thread for printing incoming event server messages (the chat messages!) # and another to read user input and publish this on the...
torcsGuiClient1.py
#!/usr/bin/env python ''' Created on Apr 4, 2012 @author: lanquarden ''' # @author: Ahmed Nassar # This code builds on "lanquarden" code from: # https://github.com/lanquarden/pyScrcClient # by adding mapping capabilities based on # guidelines and code snippets from this presentation: # "Virtual robotic car racing wit...
compute_contacts.py
############################################################################ # Copyright 2018 Anthony Ma & Stanford University # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may no...
signal.py
""" Module to define ophyd Signal subclass utilities. """ # Catch semi-frequent issue with scripts accidentally run from inside module if __name__ != 'pcdsdevices.signal': raise RuntimeError('A script tried to import pcdsdevices.signal ' 'instead of the signal built-in module. This ' ...
multiprocessor.py
import multiprocessing import LoadBar from HashPasswords import pass_compare_with_pickle def authenticate_login(pswd, sal, pep, file, email): print('Creating login token...') __name__ = "__main__" if __name__ == "__main__": manager = multiprocessing.Manager() return_dict = manager.dict() p1 = multip...
ftpclient.py
#!/usr/bin/env python from __future__ import print_function import StringIO import multiprocessing import os import pickle import socket import struct import sys TCP_PROTOCOL = 6 # Based on HTTP status codes. class Status(object): ok = 200 bad_request = 400 forbidden = 403 not_found = 404 inter...
housekeeper.py
#SPDX-License-Identifier: MIT """ Keeps data up to date """ import coloredlogs from copy import deepcopy import logging, os, time, requests import logging.config from multiprocessing import Process, get_start_method from sqlalchemy.ext.automap import automap_base import sqlalchemy as s import pandas as pd from sqlalche...
recipe-442513.py
import time import threading class Cache: "A cached function" # a dict of sets, one for each instance of this class __allInstances = set() # where the cached values are actually kept maxAge = 3600 # the default max allowed age of a cache entry (in seconds) collectionInterval = 2 # how long to wait ...
test_sslsocket.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import ssl import threading import pytest from thriftpy2._compat import MODERN_SSL from thriftpy2.transport import TTransportException, create_thriftpy_context from thriftpy2.transport.sslsocket import TSSLSocket, TSSLServerSocket def _echo_server(soc...
vcp_terminal.py
#!/usr/bin/env python """ VIRTUAL COM PORT TERMINAL - implements a read/write terminal for communicating with pyusb devices SERIAL STATE notifications (2 bytes, interrupt endpoint) 15..7 - reserved 6 bOverRun Received data has been discarded due to a device overrun 5 bParity A parity error has o...
test_util.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...
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # import pprint import logging import queue import re import subprocess import sys import threading from PyQt5.QtCore import QCoreApplication, QBasicTimer, Qt from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QAction, QSplitter, QComboBox, QLabel from PyQt5.QtWid...
test_futures.py
import os import subprocess import sys import threading import functools import contextlib import logging import re import time import gc import traceback from StringIO import StringIO from test import test_support from concurrent import futures from concurrent.futures._base import ( PENDING, RUNNING, CANCELLED, C...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import absolute_import, print_function import os import re import sys import copy import time import types import signal import fnmatch import logging import threading import traceback import multiprocessing from random imp...
etools.py
''' Date: 2021.06.25 8:54 Description : Additional, experimental, non-essential features LastEditors: Rustle Karl LastEditTime: 2021.06.25 09:24:48 ''' import contextlib import os import shutil import signal import socket import tempfile from pathlib import Path from threading import Thread from typing im...
http.py
import logging import base64 import sys import random import os import ssl import time import copy import json import sys from pydispatch import dispatcher from flask import Flask, request, make_response, send_from_directory # Empire imports from lib.common import helpers from lib.common import agents from lib.common i...
test_logging.py
#!/usr/bin/env python # # Copyright 2001-2013 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 n...
ui.py
#!/usr/bin/env python3 # iu.py # Created by: PyQt5 UI code generator 5.5.1 # This script consists of ui script of PixPack # Author: Orhan Odabasi (0rh.odabasi[at]gmail.com) from PyQt5 import QtCore, QtGui, QtWidgets from pixpack import utils from pixpack import process from pixpack import grouping import json import t...
ipython.py
""" Start an IPython Qt console connected to the python session running in Excel. This doesn't work with an IPython notebook as it's not possible to connect a notebook to an existing kernel, the notebook app always creates its own. This version is intended to work with IPython versions 7.x only. To add this to your ...
connect.py
#!/usr/bin/env python import rospy, subprocess, threading, time from subprocess import Popen, PIPE from geometry_msgs.msg import Twist, Vector3 from collections import deque class ConnectNode(object): ''' Creating node to run on neato that will attempt to connect to another free neato to begin with Launc...
index.py
from flask import Flask, render_template, url_for, send_file, Response, jsonify, send_file, request import json import socket, threading import sys import os, string import cv2 import pickle import numpy as np import struct from time import sleep import firebase_admin from firebase_admin import credentials ...
tr_ara_simple.py
from flask import Flask, request, url_for, jsonify, abort import requests, sys, threading, time ARS_API = 'http://localhost:8000/ars/api' def setup_app(): DEFAULT_ACTOR = { 'channel': 'general', 'agent': { 'name': 'ara-simple-agent', 'uri': 'http://localhost:5000' }...
command_stubber.py
# Copyright 2017 The WPT Dashboard Project. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import subprocess import sys import threading import urllib2 import http_stubber def decode_cli_arguments(arguments_string): ...
jobshandler.py
from queue import Queue from threading import Thread from ydl_server.logdb import JobsDB, Job, Actions queue = Queue() thread = None done = False def start(dl_queue): thread = Thread(target=worker, args=(dl_queue,)) thread.start() def put(obj): queue.put(obj) def finish(): done = True def worker(dl...
test_simple.py
import os import time import shutil import logging import unittest import multiprocessing import tempfile import urllib3 import etcd from . import helpers from nose.tools import nottest log = logging.getLogger() class EtcdIntegrationTest(unittest.TestCase): @classmethod def setUpClass(cls): prog...
test_run.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import subprocess import tempfile import threading from unittest import mock from antlir.artifacts_dir impor...
test_cam_get_cam_image_v2.py
# time.sleep введены в попытке улучшить стабильность тестов, периодически тесты то проходили, то нет. Возникала 412 ошибка. Особенно GetV2CamImageCode200 и GetV2CamLiveScaleImageCode200 import requests from model.json_check import * from model.input_data import * import shutil import time import datetime as dt # Запро...
AplayPlayer.py
from __future__ import absolute_import, division, print_function, unicode_literals # Obsolete, given we're playing in C++. import threading from echomesh.base import Config from echomesh.base import Platform from echomesh.sound import Util from echomesh.util import Log from echomesh.util import Subprocess LOGGER = ...
autoTrade.py
from observer import * from execute_orders import * class tradingStrategy(realTimeShow): def __init__(self, symbol, refreshingRate = 5, period_sma1 = 0.1, period_sma2 = 0.2, period_sma3 = 0.5,showPlot=False): realTimeShow.__init__(self, symbol, refreshingRate, period_sma1, period_sma2, period_sma3, showPlot) prin...
Weatherapp.py
from tkinter import * from tkinter import ttk from tkinter import font import threading import time as time import datetime import calendar import requests from PIL import Image, ImageTk def timer(): tmp = time.thread_time() currentTime = time.localtime() print(time.asctime(currentTime)) print(type(c...
OSA_Jupyter-checkpoint_DiskStation_Apr-09-0958-2021_Conflict.py
import numpy as np from ipywidgets import widgets as wdg import matplotlib.pyplot as plt import threading from ipyfilechooser import FileChooser from matplotlib.animation import FuncAnimation import os import plotly.graph_objects as go import pandas as pd import sys import re from IPython.display import display, HTML i...
local_job_service.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...
game.py
import math import os import re import threading from datetime import datetime from typing import Dict, List, Optional, Union from kivy.clock import Clock from katrain.core.constants import ( HOMEPAGE, OUTPUT_DEBUG, OUTPUT_INFO, PLAYER_AI, STATUS_ANALYSIS, STATUS_INFO, STATUS_TEACHING, ) f...
client_server_test.py
from contextlib import contextmanager import gc from multiprocessing import Process import subprocess import unittest from py4j.java_gateway import GatewayConnectionGuard, is_instance_of from py4j.clientserver import ( ClientServer, JavaParameters, PythonParameters) from py4j.protocol import Py4JJavaError, smart_d...
chrome_test_server_spawner.py
# Copyright 2017 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. """A "Test Server Spawner" that handles killing/stopping per-test test servers. It's used to accept requests from the device to spawn and kill instances of ...
compareDQMOutput.py
#!/bin/env python 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 = [] ...
nn_test.py
# Copyright 2020 The Flax 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 wri...
application.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
branchandbound4.py
import time import pandas as pd import os from hungarian import * from collections import deque import multiprocessing as mp import numpy as np import sys sys.setrecursionlimit(1000000) sys.getrecursionlimit() class TreeNode: # This is the node for tree serch def __init__(self, builidng_id, location_id, tree_...
tracker.py
""" Tracker script for DMLC Implements the tracker control protocol - start dmlc jobs - start ps scheduler and rabit tracker - help nodes to establish links with each other Tianqi Chen """ import sys import os import socket import struct import subprocess import time import logging import random from threading imp...
client.py
import socket import threading import tkinter import tkinter.scrolledtext from tkinter import simpledialog HOST = "127.0.0.1" PORT = 9090 class Client: def __init__(self, host, port): self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((host, port)) msg = tki...
webrepl_connection.py
import sys import threading from logging import DEBUG, getLogger from queue import Queue from .connection import MicroPythonConnection logger = getLogger(__name__) class WebReplConnection(MicroPythonConnection): """ Problem with block size: https://github.com/micropython/micropython/issues/2497 Star...
server.py
"""Server module to handle requests independently of the computing algorithm(s).""" import time import threading import warnings import logging from pathlib import Path from functools import cached_property from datetime import datetime from concurrent.futures.thread import ThreadPoolExecutor import numpy as np impor...
test_pdb.py
# A test suite for pdb; not very comprehensive at the moment. import doctest import os import pdb import sys import types import codecs import unittest import subprocess import textwrap from contextlib import ExitStack from io import StringIO from test import support # This little helper class is essential for testin...
OLED.py
import board import digitalio from PIL import Image, ImageDraw, ImageFont import adafruit_ssd1306 import threading import config class OLED: def __init__(self): OLED_RESET = digitalio.DigitalInOut(board.D4) self.WIDTH = 128 self.HEIGHT = 32 self.i2c = board.I2C() self.ol...
videostreamer.py
import ffmpeg import streamlink import numpy from threading import Thread import subprocess as sp from queue import Queue # mostly taken from https://github.com/DanielTea/rage-analytics/blob/master/engine/realtime_VideoStreamer.py class VideoStreamer: def __init__(self, url: object, is_stream: object, queue_size...
tool_broadcaster.py
"""Broadcast the tool frame to TF.""" # Copyright (c) 2022, ABB # All rights reserved. # # Redistribution and use in source and binary forms, with # or without modification, are permitted provided that # the following conditions are met: # # * Redistributions of source code must retain the # above copyright noti...
_asyncio.py
import asyncio import concurrent.futures import math import socket import sys from collections import OrderedDict, deque from concurrent.futures import Future from dataclasses import dataclass from functools import wraps from inspect import isgenerator from socket import AddressFamily, SocketKind, SocketType from threa...
contextBrokerHandler.py
import requests import json import httplib import time import threading from SAN.Serialization.entity import Entity from Utilities.jsonConvert import JsonConvert HEADERS = {"Content-Type" : "application/json"} def isResponseOk(statusCode): if(statusCode >= httplib.OK and statusCode <= httplib.IM_U...
test_explorer.py
import os import threading from OpenDrive import net_interface from OpenDrive.client_side import file_changes from OpenDrive.client_side import file_changes_json from OpenDrive.client_side import gui from OpenDrive.client_side import main from OpenDrive.client_side import paths as client_paths from tests.client_side.h...
controller.py
#!/usr/bin/env impala-python # Copyright (c) 2015 Cloudera, 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...
watchdog.py
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import time import logging from stackprinter import format_thread from threading import main_thread, Thread from pympler import muppy, summary logger = logging.getLogger("halfpipe...
run_hearing_snake.py
# Copyright 2019 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
runfuzzer.py
import subprocess import shlex import time import threading from threading import Timer import config import pickle import os import operators import random from operator import itemgetter import time import shutil import inspect import glob import sys from collections import Counter from datetime import datetime impor...
combat.py
import math import string 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): """Initializes the Combat module. Args: config (Config): ALAuto Config in...
exe_test.py
# Copyright 2015 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...
network_feeder.py
import time import threading import socket import logging _l = logging.getLogger('network_feeder') class NetworkFeeder: """ A class that feeds data to a socket port """ def __init__(self, proto, host, port, data, is_client=True, delay=5, timeout=2): if not is_client: raise Not...