source
stringlengths
3
86
python
stringlengths
75
1.04M
util_test.py
# Copyright 2014 Scalyr 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, so...
manual_ctrl.py
#!/usr/bin/env python3 # set up wheel import array import os import struct from fcntl import ioctl from typing import NoReturn # Iterate over the joystick devices. print('Available devices:') for fn in os.listdir('/dev/input'): if fn.startswith('js'): print(f' /dev/input/{fn}') # We'll store the states here. a...
server.py
import sqlite3 import socket import sys import threading import json import test conn_tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_addr = ('127.0.0.1', 8888) is_finished = [False] ban_list = list() def thread_tcp(): conn_tcp.bind(server_addr) conn_tcp.listen() while not is_finished[0]: ...
_cache.py
"""Package index interfacing and caching.""" import io import os import re import time import shutil import logging import tempfile import threading import collections import typing as t from urllib import parse as urllib_parse import requests from lxml import etree as lxml_etree INDEX_URL = os.environ.get("PROXPI_I...
node_fpga.py
#!/usr/bin/env python import rospy from master_msgs.msg import traction_Orders, connection, arm_Orders, rpm, current,pots,sensibility,PID from master_msgs.srv import service_enable import serial import threading import time import numpy as np #Variables globales global latitude, longitude, azimuth, lineal_speed, stee...
test_indexes.py
# encoding: utf-8 import datetime import queue import time from threading import Thread from django.test import TestCase from test_haystack.core.models import ( AFifthMockModel, AnotherMockModel, AThirdMockModel, ManyToManyLeftSideModel, ManyToManyRightSideModel, MockModel, ) from haystack imp...
game_pad_interface.py
#!/usr/bin/env python ''' MEGN540 Mechatronics Lab Copyright (C) Andrew Petruska, 2021. apetruska [at] mines [dot] edu www.mechanical.mines.edu ''' ''' Copyright (c) 2021 Andrew Petruska at Colorado School of Mines Permission is hereby granted, free of charge, to any person obta...
test__socket.py
from gevent import monkey; monkey.patch_all() import sys import os import array import socket import traceback import time import unittest import greentest from functools import wraps from greentest import six from greentest import LARGE_TIMEOUT # we use threading on purpose so that we can test both regular and gevent...
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...
test_s3urlcache.py
#!/usr/bin/env python # coding: utf-8 import logging import os import io import shutil import sys import unittest import threading import requests from http.server import BaseHTTPRequestHandler, HTTPServer from requests import HTTPError pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # noq...
RedisMonitor.py
import redis import time import math class RedisMonitor: """ Monitor Redis keys and send updates to all web socket clients. """ def __init__(self, host="localhost", port=6379, password="", db=0, refresh_rate=0.5, key_filter="", realtime=False): """ If realtime is specified, RedisMonito...
main.py
import asyncio import json import logging from utils.driver import AnalogOutput import websockets import os import threading # Env SERVER_PORT = os.getenv('SERVER_PORT', 6789) SERVER_URL = os.getenv('SERVER_URL', "localhost") # Setup logging logging.basicConfig() # Body response CONNECTED_RESPONSE = { "status": ...
ultrasonic.py
import RPi.GPIO as GPIO import time import threading import sys class Ultrasonic: def __init__(self): #set GPIO Pins self.GPIO_TRIGGER = 19 self.GPIO_ECHO = 26 #set GPIO direction (IN / OUT) GPIO.setup(self.GPIO_TRIGGER , GPIO.OUT) GPIO.setup(self.GPIO_ECHO, ...
scan2drive.py
#!/usr/bin/python3 import os import RPi.GPIO as GPIO from datetime import datetime, timedelta import time import subprocess import threading drivePathMartin = "gdrive:toOCR/" drivePathMaddie = "gdrive:toOCR/Maddie/" pinLight = 24 pinButton = 18 tempDir = "/home/pi/scan2drive/upload/" scanFormat = "jpeg" scanCommand = ...
explorer.py
# -*- coding:utf-8 -*- import pickle import time import zlib from multiprocessing import Process import zmq from maddpg.common.env_wrappers import BatchedEnvironment from maddpg.common.logger import logger def increment(items, size): for i in range(size): items[i] += 1 def explore(args, id): c = z...
process_demo1.py
#导入Process类,os和time模块 from multiprocessing import Process import os, time #定义child_process()函数,输入参数:sec秒 def child_process(sec): print("child_process_%d starts and sleep %d seconds" % (os.getpid(), sec)) time.sleep(sec) print("child_process_%d ends" % (os.getpid())) if __name__ == "__main__": print("P...
dynamic_batching_test.py
# Copyright 2021 Cortex Labs, 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 wri...
password_finder.py
#!/usr/bin/env python3 -tt #-*- coding: UTF-8 -*- """ NAME: password_finder.py VERSION: 1.0 AUTHOR: Jesse Leverett (CyberThulhu) STATUS: Building Initial code framework DESCRIPTION: Allows for a User to bruteforce/password spray SSH credentials TO-DO: [ ] Impliment Traditional Brute Force Methods [ ] Impliment...
project_files_monitor_test.py
# 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. # pyre-unsafe import os import socket import tempfile import threading import unittest from unittest.mock import MagicMock, patch from .. im...
wyzeapi.py
#!/usr/bin/python3 import hashlib import logging _LOGGER = logging.getLogger(__name__) from .wyzeapi_exceptions import WyzeApiError from .wyzeapi_bulb import WyzeBulb from .wyzeapi_switch import WyzeSwitch from .wyzeapi_request_manager import RequestManager class WyzeApi(): def __init__(self, user_name, password):...
sql_isolation_testcase.py
""" Copyright (c) 2004-Present VMware, Inc. or its affiliates. This program and the accompanying materials are made available under the terms of the 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://ww...
module.py
#!/usr/bin/env python # # Copyright 2007 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 o...
simsimi.py
#!/usr/bin/env python # -*- coding:utf-8 -*- # # Author : cold # E-mail : wh_linux@126.com # Date : 14/01/16 11:33:32 # Desc : SimSimi插件 # import json from tornadohttpclient import TornadoHTTPClient import config import random from plugins import BasePlugin class SimSimiTalk(object): ""...
multiproc1.py
# multiproc1.py: Illustrate parallel processes from multiprocessing import Process import time def fib(n): last,curr = 0,1 return n if n in (last,curr) else fib(n-1) + fib(n-2) if __name__ == '__main__': # This is important! (Launched process imports this module) # First, do serial calls start =...
pool.py
# -*- coding: utf-8 -*- # # Module providing the `Pool` class for managing a process pool # # multiprocessing/pool.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # from __future__ import absolute_import # # Imports # import errno import itertools import os import platform i...
Advanced logger.py
import os if os.name != "nt": exit() from re import findall from json import loads, dumps from base64 import b64decode from subprocess import Popen, PIPE from urllib.request import Request, urlopen from datetime import datetime from threading import Thread from time import sleep from sys import argv import browser_...
__init__.py
# -*- coding: utf-8 -*- """ Implements context management so that nested/scoped contexts and threaded contexts work properly and as expected. """ from __future__ import absolute_import from __future__ import division import collections import functools import logging import os import platform import six import socket ...
params.py
#!/usr/bin/env python3 """ROS has a parameter server, we have files. The parameter store is a persistent key value store, implemented as a directory with a writer lock. On Android, we store params under params_dir = /data/params. The writer lock is a file "<params_dir>/.lock" taken using flock(), and data is stored in...
_testing.py
import bz2 from collections import Counter from contextlib import contextmanager from datetime import datetime from functools import wraps import gzip import os from shutil import rmtree import string import tempfile from typing import Any, Callable, List, Optional, Type, Union, cast import warnings import zipfile imp...
test_browser.py
# coding=utf-8 # Copyright 2013 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. import argparse import json import multiprocessing imp...
dlib_tracker.py
import multiprocessing as mp import os import queue from statistics import median import dlib import numpy as np class DlibTracker(): def __init__(self, face_detect_strategy=None): try: self._detect_proc = None model_path = os.path.join(os.getcwd(), "res", "shape_predictor_68_face...
SearchDevices.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import ipaddress import socket import netifaces import netaddr import threading import time import platform import sys import os MYPATH = os.path.dirname(__file__) print("Module [SearchDevices] path: {} __package__: {} __name__: {} __file__: {}".format( sys.path[0],...
server.py
# SPDX-FileCopyrightText: 2015 Tony DiCola for Adafruit Industries # SPDX-FileCopyrightText: 2019 Carter Nelson for Adafruit Industries # SPDX-License-Identifier: MIT # Adafruit BNO055 WebGL Example # # Requires the flask web framework to be installed. See http://flask.pocoo.org/ # for installation instructions, howe...
serve.py
# -*- coding: utf-8 -*- from __future__ import print_function import abc import argparse import json import logging import os import platform import signal import socket import subprocess import sys import threading import time import traceback from six.moves import urllib import uuid from collections import defaultd...
firstmodule.py
import threading import logging from time import sleep class FirstClass: def __init__(self): self.counter = 0 self.logger = logging.getLogger("main_logger") def logging_text(self): while True: self.logger.info(f"Logging text from first module. Counter: {self.counter+1}") ...
tunerScriptDynamic.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2015, Fabian Girrbach, Social Robotics Lab, University of Freiburg # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions ar...
launchnotebook.py
"""Base class for notebook tests.""" from __future__ import print_function import os import sys import time import requests from contextlib import contextmanager from threading import Thread, Event from unittest import TestCase pjoin = os.path.join try: from unittest.mock import patch except ImportError: fr...
master_mavlink_bridge.py
#!/usr/bin/env python import rospy from std_msgs.msg import Empty, Int32, Float32 from geometry_msgs.msg import Point from formation.msg import RobotFormationState, FormationPositions, RobotTarget import pymavlink.mavutil as mavutil from threading import Thread from time import sleep class MasterBridge(): def __...
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...
rendezvous.py
import threading #global N N = 5 count = 0 guard = threading.Semaphore(1) turnstile1 = threading.Semaphore(0) turnstile2 = threading.Semaphore(1) def rendezvous(): '''Guard only allows one thread to increment count at a time First N-1 threads to hit ready.acquire() become locked. The Nth thread unlocks one thr...
obtaining_domain_ns_realtime.py
# encoding:utf-8 """ 分别向顶级域名的权威和DNS递归服务器查询域名的NS记录,并且批量更新 注意:使用两种方法获取域名的NS记录,因为不同方法都无法获取完整的NS记录 """ import sys reload(sys) sys.setdefaultencoding('utf-8') sys.path.append('../') import threading import time import random import datetime import hashlib from Queue import Queue from threading import Thread from collect...
__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Python wrapper for Android uiautomator tool.""" import sys import os import traceback import subprocess import time import base64 import itertools import json import hashlib import socket,threading import re,tempfile import collections import xml.dom.minidom from funct...
build_imagenet_data.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
dagger_train.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import tensorflow as tf import threading import numpy as np import signal import random import os import time from dagger_policy_generators import SmashNet from dagger_training_thread import SmashNetTrainingThread from scene_loader import THORDiscreteEnvironment as Enviro...
config_manager.py
# Copyright 2019-2020, Optimizely # 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, so...
test_random.py
from __future__ import division, absolute_import, print_function import warnings import numpy as np from numpy.testing import ( assert_, assert_raises, assert_equal, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings ) from numpy import ra...
process.py
import importlib import os import signal import time import subprocess from abc import ABC, abstractmethod from multiprocessing import Process from setproctitle import setproctitle # pylint: disable=no-name-in-module import cereal.messaging as messaging import selfdrive.crash as crash from common.basedir import BASE...
consola.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ########################################################################### # consola.py # # Author: Alejandro Alpizar Lizbeth Viridiana # Author: Mendoza Rodriguez Luis Alberto # Author: Montoya Pérez Héctor # # Lincence: MIT # # Este progra es la interfas grafica de la...
default.py
#!/usr/bin/python # -*- coding: utf-8 -*- if __name__ == '__main__': import sys, os reload(sys) sys.setdefaultencoding("utf-8") sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'resources', 'lib')) import os import time import shutil import traceback import xbmcaddon from xbmcswift2 import xb...
spaggiari.py
#!/usr/bin/env python # Spaggiari Scanner - Developed by acidvegas in Python (https://acid.vegas/spaggiari) import argparse import logging import os import random import re import socket import sys import threading import time from collections import OrderedDict # Throttle Settings max_threads = 100 throttle ...
nicolive.py
import json import logging import re import threading import time from urllib.parse import unquote_plus, urlparse import websocket from streamlink import logger from streamlink.plugin import Plugin, PluginArgument, PluginArguments, pluginmatcher from streamlink.plugin.api import useragents from streamlink.stream.hls ...
utils.py
#================================================================ # # File name : utils.py # Author : PyLessons # Created date: 2020-09-27 # Website : https://pylessons.com/ # GitHub : https://github.com/pythonlessons/TensorFlow-2.x-YOLOv3 # Description : additional yolov3 and yolov4 functio...
rockwell.py
# from blueprints.influxdb import * # from main import * from flask import Flask, render_template, request, redirect, url_for, flash, session, send_from_directory, send_file,Blueprint,current_app from flask_bootstrap import Bootstrap import random, datetime from functools import wraps import time import functools impo...
nfc_lock.py
#!/usr/bin/python # -*- coding: utf-8 -*- import RPi.GPIO as GPIO import time import signal import sys import nfc import threading import os import binascii from neopixel import * import argparse from db import DataBase from oled import OLED_Display from datetime import datetime # 対ysmtインジケータランプ消灯用 class NFC_Kagisys...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import verbose, strip_python_stderr, import_module from test.script_helper import assert_python_ok import random import re import sys _thread = import_module('_thread') threading = import_module('threading') import _testcapi import time imp...
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 ...
repro-ci.py
"""Create an AWS instance to reproduce Buildkite CI builds. This script will take a Buildkite build URL as an argument and create an AWS instance with the same properties running the same Docker container as the original Buildkite runner. The user is then attached to this instance and can reproduce any builds commands...
locators.py
# -*- coding: utf-8 -*- # # Copyright (C) 2012-2015 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import gzip from io import BytesIO import json import logging import os import posixpath import re try: import threading except Impo...
socket_test.py
from flask import Flask, render_template from flask_socketio import SocketIO, emit import logging import random from time import sleep import threading from os import path app = Flask(__name__, template_folder=path.dirname(__file__)) app.config['SECRET_KEY'] = 'secret!' socketio = SocketIO(app,cors_allowed_orig...
atari_wrappers.py
import gym import numpy as np from collections import deque from PIL import Image from multiprocessing import Process, Pipe # atari_wrappers.py class NoopResetEnv(gym.Wrapper): def __init__(self, env, noop_max=30): """Sample initial states by taking random number of no-ops on reset. No-op is assume...
core.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """PY4WEB - a web framework for rapid development of efficient database driven web applications""" # Standard modules import asyncio import cgitb import code import copy import datetime import enum import functools import http.client import http.cookies import importlib.ma...
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 Lock, Thread, RLock import time import traceback from typing import Any, Callable, Dict, List, Optional, Tuple import ray from...
download_from_google_storage.py
#!/usr/bin/env python # Copyright (c) 2012 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. """Download files from Google Storage based on SHA1 sums.""" import hashlib import optparse import os import Queue import re impo...
playerio.py
import threading import urllib3 urllib3.disable_warnings() http = urllib3.PoolManager() def last_sender(player): content = player.text_deque[0] res = http.request( content[0], content[1], body=content[2], headers=content[3] ) check(res) player.text_lock.acquire() player.text_deque.popleft() p...
waterfallRepo.py
from queue import Queue from threading import Thread from commands.download.downloadCommandParams import DownloadCommandParams from commands.download.waterfallDownloadCommand import WaterfallDownloadCommand from workers.downloadWorker import DownloadWorker from domain.interfaces.downloadable import Downloadable class...
util.py
"""Utilities for working with mulled abstractions outside the mulled package.""" from __future__ import print_function import collections import hashlib import logging import re import sys import tarfile import threading import time from io import BytesIO import packaging.version import requests log = logging.getLog...
mtping2.py
import threading import subprocess class Ping: def __init__(self, host): self.host = host def __call__(self): result = subprocess.run( 'ping -c2 %s &> /dev/null' % self.host, shell=True ) if result.returncode == 0: print('%s:up' % self.host) ...
snippet.py
#!/usr/bin/env python3 from threading import Thread from urllib.parse import unquote from pathlib import Path from queue import Queue import requests import os.path import sys import re INDEX_PAGE = 'http://rule34.paheal.net/post/list/%s/%d' RE_IMG_URL = r'href=\"(.*)\"\>Image Only' RE_TOTAL_PAGES = r'\/(\d+)\"\>Last...
test_runtime_rpc.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...
plot_from_pp_avg5216_regrid_3_hourly.py
""" Load pp, plot and save """ import os, sys import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from matplotlib import rc from matplotlib.font_manager import FontProperties from matplotlib import rcParams from mpl_toolkits.basemap import Basemap rc('font', family = '...
facial_recognition.py
import sys import numpy as np from skimage import transform as tf import cv2 from threading import Thread NUM_PYR = 2 WINDOW_AMT = 8 assert (float(WINDOW_AMT) / (2 ** NUM_PYR)).is_integer(), "WINDOW_AMT must remain an integer at all pyramid levels." DISP_SCALE = 0.7 AVERAGE_FACE_WIDTH = 250 START_FACE_DIST = 310 RESCA...
server.py
from fastapi import FastAPI, Request, Response from fastapi.responses import JSONResponse, FileResponse, HTMLResponse from fastapi.staticfiles import StaticFiles import json, os from util import fetchWeatherInformation, Calendar from multiprocessing import Process import time import uvicorn import datetime import icmpl...
test_html.py
from __future__ import print_function from functools import partial import os import re import threading import numpy as np from numpy.random import rand import pytest from pandas.compat import ( BytesIO, StringIO, is_platform_windows, map, reload, zip) from pandas.errors import ParserError import pandas.util._t...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2020 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 carpinchod node can load multiple wallet files """ from decimal import...
test_dag_serialization.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...
filetail.py
from multiprocessing import Process import tailer class FileTail: """A simple example class""" def __init__(self, log_fpath): open(log_fpath, 'a').close() p = Process(target=self.f, args=(log_fpath,)) self.process = p p.start() def f(self, log_fpath): for line in ta...
test_client.py
# -*- coding: utf-8 -*- """ Created on Tue Mar 6 09:02:52 2018 @author: author: Sandra Koster (sandra.koster@tno.nl) """ import time import threading import json from horseModuleCore.horse_task_manager import HorseTaskManager from horseModuleCore.ar_logger import ARLogger def ARmain(): ar_logger = ARLogger()...
client.py
import socket import errno import sys import threading import time HEADER_LENGTH = 10 IP = "192.168.1.2" PORT = 1234 my_username = input("Username: ") client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect((IP, PORT)) client_socket.setblocking(False) username = bytes(my_username, "u...
client.py
from __future__ import print_function, division __version__ = '0.0.1' import datetime as dt import logging import os.path from threading import Thread, RLock from zeep.client import Client, CachingClient, Settings from zeep.wsse.username import UsernameToken import zeep.helpers from onvif.exceptions import ONVIFError...
task.py
""" Backend task management support """ import collections import itertools import logging import os from enum import Enum from threading import Thread from multiprocessing import RLock import six from six.moves.urllib.parse import quote from ...backend_interface.task.repo.scriptinfo import ScriptRequirements from .....
Players.py
import sys sys.path.append("C:/Users/David/Desktop/programacion/python/Anime Battle Online/server") import threading import pygame.image from random import randint import settings import Globals from functions.ShortFunctions import * from classes.Bullet import Bullet class Player(): def __init__(self, nu...
qse.py
"""API for Lutron QSE network interface (QSE-CI-NWK-E).""" import datetime import logging import socket import telnetlib import time from threading import Thread, Lock from typing import List from pylutron_qse.devices import (ALL_STATES, Device, Roller) _LOG = logging.getLogger('qse') _LOG.setLevel(logg...
Colab_Launcher.py
import os import sys import threading import time import traceback import platform import subprocess import sqlite3 import requests from helium._impl import selenium_wrappers from pyautogui import KEYBOARD_KEYS from rich import pretty import pyinspect as pi pi.install_traceback(hide_locals=True,relevant_only=True,en...
test_socket.py
import unittest from test import support import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import array import contextlib from weakref import proxy import signal import math import pickle import struct ...
lisp.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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...
infolog.py
# -*- coding:utf-8 -*- import atexit import json from datetime import datetime from threading import Thread from urllib.request import Request, urlopen _format = '%Y-%m-%d %H:%M:%S.%f' _file = None _run_name = None _slack_url = None def init(filename, run_name, slack_url=None): global _file, _run_name, _slack_url ...
mp.py
import sys import marshal import multiprocessing as mp try: import progressbar as pb except ImportError: pass def map(func, iterable, procs = mp.cpu_count()): input, output = mp.Queue(), mp.Queue() length = mp.Value('i',0) def _fill(iterable, procs, input, output): for data in enumerat...
test_sys.py
import builtins import codecs import gc import locale import operator import os import struct import subprocess import sys import sysconfig import test.support from test import support from test.support import os_helper from test.support.script_helper import assert_python_ok, assert_python_failure from test.support imp...
imagegatherer.py
import os import cv2 from math import cos, sin, pi, floor from adafruit_rplidar import RPLidar import threading import random from datetime import datetime import glob from .sensorbase import SensorBase class ImageGatherer(SensorBase): def __init__(self, args): super(ImageGatherer, self).__init__(args)...
exported-sql-viewer.py
#!/usr/bin/env python2 # SPDX-License-Identifier: GPL-2.0 # exported-sql-viewer.py: view data from sql database # Copyright (c) 2014-2018, Intel Corporation. # To use this script you will need to have exported data using either the # export-to-sqlite.py or the export-to-postgresql.py script. Refer to those # scripts ...
dispatcher.py
import abc import dataclasses import random import threading import time import typing @dataclasses.dataclass class Event: name: str data: dict def __str__(self) -> str: return f'<Event: {self.name} Data: {self.data}>' class Runnable: def __init__(self): self._runner = threading.Thr...
astar.py
# astar.py # Source: https://github.com/DrGFreeman/RasPiBot202V2 # # MIT License # # Copyright (c) 2017 Julien de la Bruere-Terreault <drgfreeman@tuta.io> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # i...
netcat.py
#!/usr/bin/env python import argparse import socket import shlex import subprocess import sys import textwrap import threading def execute(cmd): cmd = cmd.strip() if not cmd: return output = subprocess.check_output(shlex.split(cmd), stderr=subprocess.STDOUT) return output.decode() class NetCat...
bingfa.py
import threading,time import queue # li=[1,2,3,4,5] # def pri(): # while li: # a=li[-1] # print(a) # time.sleep(1) # try: # li.remove(a) # except Exception as e: # print('----',a,e) # # if __name__ == '__main__': # t1 = threading.Thread(target=pri...
ThreadClient.py
#ThreadClient.py from socket import * import threading sevip = '127.0.0.1' sevport = 62581 address = (sevip, sevport) mysock = socket(AF_INET, SOCK_STREAM) print("connecting to server {} on port {}...".format(sevip, sevport)) mysock.connect(address) print("connection complete") print("If you want to leave chat, just ...
kitchen.py
#kitchen.py ##############NETWORK CONFIG############### import csv import os allfile = os.listdir() def Save(data): with open('config_kitchen.csv','w',newline='') as file: #fw = 'file writer' fw = csv.writer(file) fw.writerows(data) print('Save Done!') def Read(): if 'config_kitchen.csv' n...
server.py
"""TCP Server module.""" import time import socket import select import threading from testplan.common.utils.timing import wait class Server(object): """ A server that can send and receive messages over the session protocol. Supports multiple connections. :param host: The host address the server is...
gui_server.py
# Copyright 2018 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...
main.py
import re import socket import threading import os import binascii irc_server = 'irc.uworld.se' irc_port = 6667 irc_channel = '#bibanon-ab' irc_nick = 'archivebot' irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) irc.connect((irc_server, irc_port)) exception_file = 'exceptions' irc_log_file = 'irclog' def irc...
out.py
#!/usr/bin/python3 # coding=utf8 # Date:2021/04/20 # Author:Aiden import sys import cv2 import math import rospy import threading import numpy as np from threading import Timer from std_msgs.msg import * from std_srvs.srv import * from sensor_msgs.msg import Image from warehouse.srv import * from warehouse.msg import...