source
stringlengths
3
86
python
stringlengths
75
1.04M
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...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
post_processing.py
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import json import multiprocessing as mp from utils import iou_with_anchors def load_json(file): with open(file) as json_file: data = json.load(json_file) return data def getDatasetDict(opt): # df = pd.read_csv(opt["video_info"]...
socket.py
import time import json import websocket import threading import contextlib from sys import _getframe as getframe from .lib.util import objects class SocketHandler: def __init__(self, client, socket_trace = False, debug = False): # websocket.enableTrace(True) self.socket_url = "wss://ws1.narvii.c...
bridge.py
#!/usr/bin/env python # # Copyright (c) 2018-2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # """ Rosbridge class: Class that handle communication between CARLA and ROS """ import os import pkg_resources try: import que...
jobscheduler.py
import logging import threading import time from astroplan import Observer from astropy.time import TimeDelta import astropy.units as u from pyobs.comm import Comm from pyobs.comm.proxy import Proxy from pyobs.modules import Module from pyobs.utils.threads import Future from pyobs.utils.time import Time log = loggi...
exercise.py
#!/usr/bin/env python from __future__ import print_function from websocket_server import WebsocketServer import socket import json import time import threading import sys from datetime import datetime import re import importlib import cv2 from gui import GUI, ThreadGUI from hal import HAL from console import start_co...
WebcamVideoStream.py
# import the necessary packages from threading import Thread import cv2 class WebcamVideoStream: def __init__(self, src=0): # initialize the video camera stream and read the first frame # from the stream self.stream = cv2.VideoCapture(src) (self.grabbed, self.frame) = self.stream.read() # initialize the vari...
test_serve.py
import unittest import asyncio import io import multiprocessing import urllib.request import time import grole def simple_server(): app = grole.Grole() @app.route('/') def hello(env, req): return 'Hello, World!' app.run(host='127.0.0.1') class TestServe(unittest.TestCase): def test_sim...
crawler.py
#!/usr/bin/env python3 import os import re import bs4 import lxml import asyncio import requests import threading import tldextract requests.packages.urllib3.disable_warnings() R = '\033[31m' # red G = '\033[32m' # green C = '\033[36m' # cyan W = '\033[0m' # white Y = '\033[33m' # yellow user_agent = { 'User-Agent...
deadlock.py
import threading import socket import select import sys l = threading.Lock() listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM) listener.bind(("localhost", 0)) listener.listen(1) s2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s2.connect(listener.getsockname()) s3 = listener.accept()[0] def server(...
shutdown.py
import os from flask import Flask, request, jsonify import threading import logging from time import sleep import pyautogui from gtts import gTTS import tempfile #logging.getLogger("Flask").setLevel(logging.WARNING) from playsound import playsound import socket import numpy as np import cv2 pyautogui.FAI...
tree-orders.py
# python3 import sys, threading sys.setrecursionlimit(10**6) # max depth of recursion threading.stack_size(2**27) # new thread will get stack of such size class TreeOrders: def read(self): self.n = int(sys.stdin.readline()) self.key = [0 for i in range(self.n)] self.left = [0 for i in range(self.n)] ...
test_zip_container.py
import io import multiprocessing import os import pickle import random import shutil import string import subprocess import sys import tempfile import unittest from datetime import datetime from zipfile import ZipFile import pytest from parameterized import parameterized import pfio def make_zip(zipfilename, root_d...
generator_utils.py
# Copyright (c) 2020 mingruimingrui # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the MIT-style license found in the # LICENSE file in the root directory of this source tree. """Helper functions to work with generators""" import time import queue impo...
async_tasks.py
import functools import json import logging import os import os.path import platform import subprocess import uuid from collections import deque from datetime import datetime from threading import Thread from typing import Dict import psutil from monailabel.config import settings logger = logging.getLogger(__name__)...
base_trajectory_controller.py
from brett2.PR2 import PR2 #roslib.load_manifest("nav_msgs"); import nav_msgs.msg as nm import trajectory_msgs.msg as tm import numpy as np from numpy import sin, cos import rospy import scipy.interpolate as si from Queue import Queue, Empty from threading import Thread import jds_utils.conversions as conv import kinem...
server.py
#!/usr/bin/env python ''' Machine tracker server. Waits for connections. Once connected it will save the updates to locations. ''' import networking as nt import socket import threading def discovery_thread(client_list_lock, client_list,end_event): ''' This thread runs forever. It waits for a client di...
ARclient.py
#!/bin/python3.6 # -*- coding: utf-8 -*- # # MIT License # # Copyright (c) 2018 Robert Gustafsson # Copyright (c) 2018 Andreas Lindhé # # 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...
kinect2grasp.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author : Hongzhuo Liang # E-mail : liang@informatik.uni-hamburg.de # Description: # Date : 05/08/2018 6:04 PM # File Name : kinect2grasp.py import torch import rospy from sensor_msgs.msg import PointCloud2 from visualization_msgs.msg import MarkerArray fro...
oes_td.py
import time from copy import copy from dataclasses import dataclass from datetime import datetime, timedelta, timezone from gettext import gettext as _ from threading import Lock, Thread # noinspection PyUnresolvedReferences from typing import Any, Callable, Dict from vnpy.api.oes.vnoes import OesApiClientEnvT, OesApi...
emails.py
# -*- coding:utf-8 -*- """ :author: Albert Li :copyright: © 2020 Albert Li :time: 2020/1/14 11:33 """ from threading import Thread from flask import current_app from flask_mail import Message from app.extensions import mail def _send_async_mail(app, message: Message): """异步发送邮件""" # 异步发送将开启一个新的...
downloader.py
from ftpclient import FTPClient import ftplib import threading, os, time from queue import Queue from PyQt5.QtGui import QIcon, QPixmap configFile = 'ftp-client.conf' class Node: def __init__(self, hostname='locahost', port=2121, filesize=0, filename=None, destpath='', pathname=None, guiwidget=None): if (not file...
tasks.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python from collections import OrderedDict, namedtuple import errno import functools import importlib import json import logging import os import shutil import stat import tempfile import time import traceback from distutils.dir_util ...
env_wrappers.py
""" Modified from OpenAI Baselines code to work with multi-agent envs """ import numpy as np from multiprocessing import Process, Pipe from baselines.common.vec_env import VecEnv, CloudpickleWrapper from baselines.common.tile_images import tile_images def worker(remote, parent_remote, env_fn_wrapper): parent_remo...
tello.py
import socket import threading import cv2 import logging import time class Tello: #logger setup handler = logging.StreamHandler() formatter = logging.Formatter('%(message)s') handler.setFormatter(formatter) logger = logging.getLogger('tello') logger.addHandler(handler) ...
memory.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # By Allex Lima <allexlima@unn.edu.br> | www.allexlima.com import support from threading import Thread class Block(object): def __init__(self, size=None): self.address = None self.size = { 'total': size, 'available': size ...
test_socket_manager.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 unittest import time import uuid from unittest import mock from parlai.mturk.core.dev.socket_manager import Packe...
test_application.py
import os import shutil import sys import threading import time import unittest import web try: from urllib.parse import urlencode except ImportError: from urllib import urlencode data = """ import web urls = ("/", "%(classname)s") app = web.application(urls, globals(), autoreload=True) class %(classname)s...
dataengine-service_configure.py
#!/usr/bin/python # ***************************************************************************** # # 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 A...
test_datapipe.py
# Owner(s): ["module: dataloader"] import copy import http.server import itertools import os import os.path import pickle import random import socketserver import sys import tarfile import tempfile import threading import time import unittest import warnings import zipfile from functools import partial from typing imp...
multiprocessing_logging.py
# vim : fileencoding=UTF-8 : from __future__ import absolute_import, division, unicode_literals import logging import multiprocessing import sys import threading import traceback __version__ = '0.2.4' def install_mp_handler(logger=None): """Wraps the handlers in the given Logger with an MultiProcessingHandler...
threadScheduler.py
import threading import os.path import time import config from LED_Sequences import * # Import all sequences from LED_Controller import RenderLoop import json def PollLEDSequence(path): """ function to repeatedly read the LED_Sequence file to see which mode is selected and start the particular thread """ ...
receiver.py
import pickle import socket import random import threading from Utils import Config, RecvLogConfig, CRC recv_config = Config() #读取配置文件 recv_log_config = RecvLogConfig() #读取日志配置 recv_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #服务端socket recv_socket.bind(recv_config.recv_addr) recv_file = open(recv_con...
send_tensor.py
# stdlib import multiprocessing as mp from multiprocessing import Process import time # third party import torch as th # syft absolute import syft as sy mp.set_start_method("spawn", force=True) # Make sure to run the local network.py server first: # # $ syft-network # def do() -> None: # stdlib import asy...
test.py
#!/usr/bin/python2 import sys import json import urllib2 import threading import Queue import glob import os import jsonschema hdr = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11', 'Accept': 'application/json,text/javascript,applicati...
confirm-rate.py
from pyblt import * import random import gc import math import csv from multiprocessing import Process, Lock import os PROCESSES = 4 def trial(hedge,k,entries): trials=0 successes=0 while (True): p=PYBLT(entries=entries,value_size=9,hedge=hedge,num_hashes=k) for _ in range(entries): p.insert(ran...
heartbeat.py
# -*- coding: utf-8 -*- # ========================================== # Discord # ========================================== import time from datetime import datetime, timedelta, timezone # thred操作 import threading # from puppeteer import Puppeteer # ============================================================== # H...
main.py
# Setup logs import django import logging import os import threading from django.utils import timezone import time logging.basicConfig(level=os.environ['LOG_LEVEL']) logger = logging.getLogger(__name__) parallelism = int(os.environ['DUEL_PARALLELISM']) do_tag = os.environ.get('DO_TAG') # Start Django in stand-alone mo...
greenonbrown.py
#!/home/pi/.virtualenvs/owl/bin/python3 from algorithms import exg, exg_standardised, exg_standardised_hue, hsv, exgr, gndvi from button_inputs import Selector, Recorder from image_sampler import image_sample from imutils.video import VideoStream, FileVideoStream, FPS from relay_control import Controller from queue imp...
test_bulk.py
#! /usr/bin/env python3 import argparse def parse_args(): parser = argparse.ArgumentParser(description='Talk to a ODrive board over USB bulk channel.') return parser.parse_args() if __name__ == '__main__': # parse args before other imports args = parse_args() import sys import time import threading from odr...
tests.py
import collections as co import datetime as dt import itertools import random import time import pytest from django.contrib.auth.models import User from django.test import Client import modelqueue as mq from .models import Task def nop(obj): min_working = mq.Status.minimum(mq.State.working) max_working = m...
gameMapClient.py
import socket, threading from pygame import * from math import* #TCP_IP = '10.88.214.97' TCP_IP = '192.227.178.111' TCP_PORT = 5005 BUFFER_SIZE = 200 running = True screen = display.set_mode((800,600)) otherPlayers = {} background = image.load('OutcastMap.png') person = image.load("Default Person.png") deg = 90 playerL...
tornado-localserver.py
import re import threading import tornado.httpserver import tornado.ioloop import tornado.web import time from authhandler import BasicAuthHandler from authhandler import DigestAuthHandler RELOAD_TEST_HTML = """\ <html> <head><title>Title</title></head> <body> <a href="/mechanize">near the start</a> <p>Now some data...
monitors.py
""" Common threading utils for anchore engine services. """ import time import threading from anchore_engine.subsys import logger # generic monitor_func implementation click = 0 running = False last_run = 0 monitor_thread = None def default_monitor_func(**kwargs): """ Generic monitor thread function for in...
test_socket_transceiver.py
from collections import deque from typing import Deque, Optional, Tuple, Union from enum import Enum import random from threading import Thread from time import sleep from pisat.comm.transceiver import TransceiverBase from pisat.comm.transceiver import SocketTransceiver from pisat.comm.transceiver import CommSocket ...
ShifterRunner.py
import os from threading import Thread from subprocess import Popen, PIPE from select import select class ShifterRunner: """ This class provides the container interface for Docker. """ def __init__(self, logger=None): """ Inputs: config dictionary, Job ID, and optional logger ...
main.py
from cv2 import cv2 import os from time import time, sleep import pydirectinput, pyautogui, threading from ekranyakala import ekranYakala from vision import Vision # from detection import Detection os.chdir(os.path.dirname(os.path.abspath(__file__))) # Pencere başlığı sürekli değiştiği için tüm başlıkları tek tek yaz...
remote_execution.py
import os import sys import stat import tempfile import traceback import subprocess import dace.dtypes from string import Template from dace.codegen.compiler import generate_program_folder from dace.config import Config from dace.codegen.instrumentation.papi import PAPISettings, PAPIUtils class Executor: """ Remo...
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 errno import types import signal import fnmatch import hashlib import logging import threading import traceback import mul...
wsdump.py
#!/usr/bin/env python import argparse import code import sys import threading import time import ssl import gzip import zlib import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding = getattr(sys.stdin, "encoding...
portable_runner.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...
multiproc.py
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) """ This implements a parallel map operation but it can accept more values than multiprocessing.Pool.apply() can. For exa...
archiver.py
import argparse import dateutil.tz import errno import io import json import logging import os import pstats import random import re import shutil import socket import stat import subprocess import sys import tempfile import time import unittest from binascii import unhexlify, b2a_base64 from configparser import Config...
entities.py
import game import settings import pygame import threading import pypboy.data class Map(game.Entity): _mapper = None _transposed = None _size = 0 _fetching = None _map_surface = None _loading_size = 0 _render_rect = None def __init__(self, width, render_rect=None, loading_type="Loadin...
collect_data.py
import os import re import urllib from multiprocessing import Process SUPPORTED_FORMATS = ['jpg', 'png', 'jpeg'] URL_TEMPLATE = r'http://image.b***u.com/search/flip?tn=b***uimage&ie=utf-8&word={keyword}&pn={index}' def download_images_from_b***u(dir_name, keyword, start_index, end_index): index = start_index ...
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 platform import array import contextlib from weakref import proxy import signal import math import pickle import struct impo...
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...
websocket_client.py
import asyncio import json import threading import websockets import uuid from utils.log import get_logger logger = get_logger("pxls_websocket") class WebsocketClient: """A threaded websocket client to update the canvas board and online count in real-time.""" def __init__(self, uri: str, stats_manager):...
locationsDatabase.py
import time import numpy as np from threading import Thread import utils import dbscan import placesDatabase as placesDB import userDatabase as userDB #Distance in meters minDist = 20 minPoints = 10 #public in database: 0=hidden 1=public for friends, 2=everybody def storePlacesIdArroundUser(conn, latitude, longitude)...
rl.py
<<<<<<< HEAD if __name__ == "__main__": import sys sys.path.append("../") ======= >>>>>>> 25ad69f87fc0158bde48b4eddcbe599de49c5edb import rospy import time import math import copy import threading import random import numpy as np from abc import abstractmethod, ABC from gym import Env, spaces <<<<<<< HEAD fr...
multi_processing.py
import multiprocessing def square_mp(in_queue, out_queue): while(True): n = in_queue.get() n_squared = n**2 out_queue.put(n_squared) if __name__ == '__main__': in_queue = multiprocessing.Queue() out_queue = multiprocessing.Queue() process = multiprocessing.Process(target=square...
youtubequeue.py
import os import settings settings.generateConfigFile() import soundfile as sf from pydub import AudioSegment import generatorclient from time import sleep from subprocess import * import videouploader from threading import Thread import pickle import datetime from datetime import timedelta import subproce...
base_test_rqg.py
import paramiko from basetestcase import BaseTestCase import os import zipfile import Queue import json import threading from memcached.helper.data_helper import VBucketAwareMemcached from rqg_mysql_client import RQGMySQLClient from membase.api.rest_client import RestConnection, Bucket from couchbase_helper.tuq_helper ...
thumbnail_maker.py
# thumbnail_maker.py import time import os import logging from urllib.parse import urlparse from urllib.request import urlretrieve from queue import Queue from threading import Thread import PIL from PIL import Image FORMAT = "[%(threadName)s, %(asctime)s, %(levelname)s] %(message)s" logging.basicConfig(filename='log...
climon.py
from multiprocessing import Process, Queue import mon import web def main(conf_fname, debug=False): sensor_queue = Queue() monp = Process(target=mon.run, args=(conf_fname, sensor_queue, debug)) monp.start() web.run(conf_fname, sensor_queue, debug) monp.join() if __name__ == '__main__': main...
parallel_processing.py
# -*- coding: utf-8 -*- """ concurrent - A module for handing concurrency with PyQt Adapted from Orange3: https://github.com/biolab/orange3/blob/master/Orange/widgets/utils/concurrent.py """ # define authorship information __authors__ = ['Lars Fasel'] __author__ = ','.join(__authors__) __credits__ = [] __copyright_...
thumbnail_service.py
import asyncio import errno import json import logging import os import threading import uuid from .redis_factory import RedisFactory from .thumbnail_processor import ThumbnailProcessor class ThumbnailException(Exception): def __init__(self, reason): self.reason = reason class FileValidationException(Th...
commentary_backend.py
import _thread from datetime import datetime from enum import Enum import json import logging import logging.handlers import os import re import sys import tkinter from tkinter import StringVar, filedialog, messagebox, ttk from tkinter.scrolledtext import ScrolledText import urllib.parse import urllib.request import ps...
watchdog_plugin.py
# Copyright 2017 Cedraro Andrea <a.cedraro@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 a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
test_worker.py
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import json import os import shutil import signal import subprocess import sys import time import zlib from datetime import datetime, timedelta from multiprocessing import Process from ...
spa.py
""" Calculate the solar position using the NREL SPA algorithm either using numpy arrays or compiling the code to machine language with numba. """ # Contributors: # Created by Tony Lorenzo (@alorenzo175), Univ. of Arizona, 2015 import os import threading import warnings import numpy as np # this block is a way to u...
controller.py
# LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1.2.0 python3 controls.py import RPi.GPIO as GPIO import time import prefs import os import errno import shutil import threading import sys #import cv2 #import numpy as np def log(*a): #print("[CONT]", a) pass #import sys #sys.path.append("../self_driv...
cats_and_mice.py
# from time import sleep from threading import Thread, Semaphore from random import randint, choice number_of_cats = 2 number_of_mice = 200 number_of_bowls = 15 mice_in_eating_zone = [] cats_in_eating_zone = [] mice_in_eating_zone_access = Semaphore(1) cats_in_eating_zone_access = Semaphore(1) permission_to_bowls =...
process_monitor_unix.py
import os import sys import getopt import signal import time import threading import subprocess from boofuzz import pedrpc ''' By nnp http://www.unprotectedhex.com This intended as a basic replacement for Sulley's process_monitor.py on *nix. The below options are accepted. Crash details are limited to the signal tha...
main.py
# Dindo Bot # Copyright (c) 2018 - 2019 AXeL import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, GdkPixbuf, GObject from lib import tools, logger, data, parser, settings, accounts, maps from threads.bot import BotThread from lib.shared import LogType, DebugLevel, __program_name__ from .dev i...
serverhandler.py
import logging, socket, sys from threading import Thread from messageparser import * from playingfield import Orientation reportCodes = { 11: "Begin_Turn", 13: "Update_Own_Field", 14: "Update_Enemy_Field", 15: "Chat_Broadcast", 16: "Update_Lobby", 17: "Game_Ended", 18: "Begin_Ship_Placing", 19: "Game_Aborted"...
timed_subprocess.py
# -*- coding: utf-8 -*- ''' For running command line executables with a timeout ''' from __future__ import absolute_import, print_function, unicode_literals import shlex import subprocess import threading import salt.exceptions import salt.utils.data from salt.ext import six class TimedProc(object): ''' Crea...
test_program_for_Dynamixel_Protocol2_Xseries_ReubenPython2and3Class.py
# -*- coding: utf-8 -*- ''' Reuben Brewer, reuben.brewer@gmail.com, www.reubotics.com Apache 2 License Software Revision C, 05/28/2021 Verified working on: Python 2.7 and 3.7 for Windows 8.1 64-bit and Raspberry Pi Buster (no Mac testing yet). ''' __author__ = 'reuben.brewer' from Dynamixel_Protocol2_Xs...
generate_tiles.py
#!/usr/bin/env python #Source: https://trac.openstreetmap.org/browser/subversion/applications/rendering/mapnik/generate_tiles.py from math import pi,cos,sin,log,exp,atan from subprocess import call import sys, os from Queue import Queue import threading try: import mapnik2 as mapnik except: import mapnik D...
datasets.py
# YOLOv5 dataset utils and dataloaders import glob import hashlib import json import logging import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool, Pool from pathlib import Path from threading import Thread import cv2 import numpy as np import torch...
WebServer.py
import re import socket import threading from time import sleep from PyQt5.QtCore import pyqtSignal from typing import Tuple from Network import StopThreading class WebLogic: signal_write_msg = pyqtSignal(str) def __init__(self): self.tcp_socket = None self.sever_th = None self.dir ...
master.py
#!/usr/bin/env python """Data master specific classes.""" import socket import threading import urlparse import urllib3 from urllib3 import connectionpool import logging from grr.lib import config_lib from grr.lib import rdfvalue from grr.lib import utils from grr.server.data_server import constants from grr.ser...
pycat.py
#!/usr/bin/env python3 from proxy import proxy from select import select import importlib import json import os import pprint import re import sys import telnetlib import threading import traceback telnetlib.GMCP = b'\xc9' class Session(object): def __init__(self, world_module, port, arg): self.mud_encod...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS # environment import ftplib import asyncore import asynchat import socket import io import errno import os import time try: import ssl except ImportError: ssl = None from unittest import TestCase, skipUnless ...
autodetect.py
# Copyright (c) 2017-2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from datetime import datetime from functools import partial from threading import Event, RLock, Thread from typing import TYPE_CHECKING, Dict, Iterable, Optional, Union from .. ...
test_core.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...
sublist3r.py
#!/usr/bin/env python # coding: utf-8 # Sublist3r v1.0 # By Ahmed Aboul-Ela - twitter.com/aboul3la # modules in standard library import re import sys import os import argparse import time import hashlib import random import multiprocessing import threading import socket import json from collections import Counter # e...
essdp.py
#!/usr/bin/env python3 import sys if sys.version_info < (3, 0): print("\nSorry mate, you'll need to use Python 3+ on this one...\n") sys.exit(1) from multiprocessing import Process from string import Template from http.server import BaseHTTPRequestHandler from socketserver import ThreadingMixIn from http.serv...
dlnap.py
#!/usr/bin/python # @file dlnap.py # @author cherezov.pavel@gmail.com # @brief Python over the network media player to playback on DLNA UPnP devices. # Change log: # 0.1 initial version. # 0.2 device renamed to DlnapDevice; DLNAPlayer is disappeared. # 0.3 debug output is added. Extract location url fixed. #...
keyboard_controller_test.py
#!/usr/bin/env python3 import threading import queue class NonBlockingInput: def __init__(self, exit_condition): self.exit_condition = exit_condition self.input_queue = queue.Queue() self.input_thread = threading.Thread(target=self.read_kbd_input, args=(), daemon=True) self.input...
ws.py
"""WebSocket IO definition.""" import json import asyncio import websockets import numpy as np from threading import Thread, Event from base64 import b64decode from io import BytesIO from PIL import Image from .io import IO class WsIO(IO): """WebSocket IO implementation.""" ws = None def __init__(sel...
invoker.py
import os import sys import grpc import json import time import argparse from threading import * from timeit import default_timer as now from multiprocessing import Process, Manager from trace_manager import TraceQuery, TraceManager from kubernetes import config, client from kubernetes.client import Configuration from...
distributedGetTitle.py
import time import re import requests from lxml import etree from multiprocessing import Process from dbmongo import DBMongo from dbredis import RedisDB def get_response(url): ret = requests.get(url, timeout=10) site_encode = pick_charset(ret.text) ret = ret.content.decode(site_encode) html = etree.HT...
pressure.py
''' 'Windows' pressure sensor --------------------- A dummy pressure sensor for phone emulation ''' from plyer.facades import Pressure from sensor_simulate import SemiRandomData # from multiprocessing import Process, Manager from threading import Thread import time import sys class PressureSensorListener(object): ...
client.py
import socket import threading import random def send_message(): try: while True: msg = input() sock.send(bytes(name + ": " + msg, 'utf-8')) if msg == '\leave chat': sock.close() break except Exception: pass finally: ...
printreveal_v2.py
#!/usr/bin/env python # NOTE: This script requires a copy of decktape.js properly set up in the decktape-2.9.3 folder, along with ghostscript AND node.js WITH chalk installed # It uses puppet, based on chrome, to print. It prints at a higher resolution than printreveal.py. import sys #if sys.version_info[0] < 3: # ...
train.py
import argparse import logging import math import os import random import time from pathlib import Path from threading import Thread from warnings import warn import numpy as np import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_sche...
_kit2fiff_gui.py
"""Mayavi/traits GUI for converting data from KIT systems""" # Authors: Christian Brodbeck <christianbrodbeck@nyu.edu> # # License: BSD (3-clause) import os import numpy as np from scipy.linalg import inv from threading import Thread from ..externals.six.moves import queue from ..io.meas_info import _read_dig_points...
FSMActionInterface.py
#!/usr/bin/env python import rospy, copy import actionlib from BaseActionInterface import BaseActionInterface from ActionlibActionInterface import ActionlibActionInterface from ServiceActionInterface import ServiceActionInterface import threading from rosplan_dispatch_msgs.msg import ActionFeedback # ToDo: Implement ...