source
stringlengths
3
86
python
stringlengths
75
1.04M
web.py
from flask import Flask from threading import Thread app = Flask('WEB') @app.route('/') def home(): return "I am Discord Bot and I'm vibing to Inception" def run(): app.run(host='0.0.0.0', port=8080) def keep_alive(): t = Thread(target=run) t.start()
cloner.py
import os import sys import time import signal import multiprocessing PROJECT_PATH = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(PROJECT_PATH, '..', '..')) from pygithub3 import Github import src.todoMelvin from src.todoMelvin import settings, createGithubObject from src.todoLogging impor...
pa_lianjia_new.py
import json import threading from selenium import webdriver def task(url): driver = webdriver.PhantomJS(executable_path=r'D:\phantomjs-2.1.1-windows\bin\phantomjs.exe') driver.get(url) loupan_list = driver.find_elements_by_xpath('//ul[@class="resblock-list-wrapper"]/li') for loupan in loupan_list: ...
main.py
import re import shlex import threading import time from typing import get_type_hints, Dict, List, Optional import urllib3 from docopt import docopt from prompt_toolkit import PromptSession, HTML from prompt_toolkit.completion import Completer from prompt_toolkit.history import InMemoryHistory from prompt_toolkit.patc...
http_server.py
import os import socketserver import time import traceback from http.server import BaseHTTPRequestHandler from pathlib import Path from socket import socket, AF_INET, SOCK_DGRAM from threading import Thread, Timer def serve_file(filename, content_type=None): """ Create an http server on a random port to s...
detector.py
from threading import Thread import collections import tensorflow as tf import numpy as np import cv2 class Detector: def __init__(self, model_path, label_path): self.running = True self.camera = cv2.VideoCapture(0) self.results = collections.deque(maxlen=10) self.interpr...
arbusto.py
''' Created on 28 de abr de 2020 @author: leonardo Content: Classe Arbusto ''' from componentes.jogo.objetos_estaticos import ObjetosEstaticos import random from componentes.jogo.distancia_bomba import DistanciaBomba from componentes.jogo.multi_bomba import MultiBomba from componentes.jogo.raio_bomba import RaioBomb...
test_basic.py
# -*- coding: utf-8 -*- """ tests.basic ~~~~~~~~~~~~~~~~~~~~~ The basic functionality. :copyright: © 2010 by the Pallets team. :license: BSD, see LICENSE for more details. """ import re import sys import time import uuid from datetime import datetime from threading import Thread import pytest im...
mumbleBot.py
#!/usr/bin/env python3 import threading import time import sys import signal import configparser import audioop import subprocess as sp import argparse import os.path import pymumble.pymumble_py3 as pymumble import interface import variables as var import hashlib import youtube_dl import logging import util import bas...
test_failure.py
import json import logging import os import signal import sys import tempfile import threading import time import numpy as np import pytest import redis import ray from ray.experimental.internal_kv import _internal_kv_get from ray.autoscaler._private.util import DEBUG_AUTOSCALING_ERROR import ray.utils import ray.ray...
revocation_notifier.py
#!/usr/bin/env python ''' DISTRIBUTION STATEMENT A. Approved for public release: distribution unlimited. This material is based upon work supported by the Assistant Secretary of Defense for Research and Engineering under Air Force Contract No. FA8721-05-C-0002 and/or FA8702-15-D-0001. Any opinions, findings, conclu...
captive_portal.py
"""Detect captive portals Regularly monitor the connection. Ignore captive portals if the connection is behind a proxy.""" import requests import tempfile import threading import time import logging from enum import Enum, auto check_connection_url = 'http://captive.dividat.com/' """ Connection Status The connectio...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import support import socket import select import time import datetime import gc import os import errno import pprint import urllib.request import threading import traceback import asyncore import weakref import platform import functools impor...
main.py
from kivymd.app import MDApp from kivymd.uix.label import MDLabel from kivy.lang.builder import Builder from kivy.properties import StringProperty, BooleanProperty, NumericProperty, ObjectProperty import threading import time import datetime from kivy.core.window import Window from playsound import playsound Window.siz...
threaded-button-demo.py
#!/usr/bin/env python3 """UrsaLeo LEDdebug threaded button demo Toggle LED6 while capturing button presses on SW1 & SW2 Press CTR+C to exit""" import time import threading try: from LEDdebug import LEDdebug except ImportError: try: import sys import os sys.path.append("..") ...
threads.py
import os import datetime import subprocess import zipfile from analyze.models import Project, Manifest, Avscan from threading import Thread import tools.axmlparserpy.apk as ApkParser from apksa import settings def get_file_path(path): directory = os.path.join(settings.MEDIA_ROOT, path) return directory d...
logger.py
#!/usr/bin/env python # Copyright 2013, Institute for Bioninformatics and Evolutionary Studies # # 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...
snippet.py
from multiprocessing import Process from django.core import serializers from django.core.management import call_command from StringIO import StringIO def dump_database(): sio = StringIO() call_command('dumpdata', stdout=sio, natural=True) return sio.getvalue() def call_command_with_db(dbdump, *args, **kwa...
base_controller.py
#!/usr/bin/env python # coding: utf-8 import time import atexit import weakref import pybullet import threading from qibullet.tools import * class BaseController(object): """ Class describing a robot base controller """ _instances = set() FRAME_WORLD = 1 FRAME_ROBOT = 2 def __init__(sel...
test_transaction.py
#!/usr/bin/env python # test_transaction - unit test on transaction behaviour # # Copyright (C) 2007-2011 Federico Di Gregorio <fog@debian.org> # # psycopg2 is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published # by the Free Software Foundat...
test_request_safety.py
import threading import asyncio import aiohttp_jinja2 from urllib import request from nose.tools import eq_ from aiohttp.test_utils import unittest_run_loop from ddtrace.pin import Pin from ddtrace.provider import DefaultContextProvider from ddtrace.contrib.aiohttp.patch import patch, unpatch from ddtrace.contrib.aio...
test_collection.py
import pdb import pytest import logging import itertools from time import sleep from multiprocessing import Process from milvus import IndexType, MetricType from utils import * dim = 128 drop_collection_interval_time = 3 index_file_size = 10 vectors = gen_vectors(100, dim) class TestCollection: """ ********...
client.py
import sys from socket import AF_INET, socket, SOCK_STREAM from threading import Thread from PySide2.QtCore import * from PySide2.QtGui import * from PySide2.QtWidgets import * from frontend.tela_login import * from frontend.tela_chat import * class TelaXat(QMainWindow): def __init__(self, cs, username): ...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
test_general.py
""" Collection of tests for unified general functions """ # global import os import math import time import einops import pytest import threading import numpy as np from numbers import Number from collections.abc import Sequence import torch.multiprocessing as multiprocessing # local import ivy import ivy.functional....
pocketsphinxtrigger.py
import os import threading import logging import alsaaudio from pocketsphinx import get_model_path from pocketsphinx.pocketsphinx import Decoder import alexapi.triggers as triggers from .basetrigger import BaseTrigger logger = logging.getLogger(__name__) class PocketsphinxTrigger(BaseTrigger): type = triggers.T...
agent_test.py
""" This file contains test cases to verify the correct implementation of the functions required for this project including minimax, alphabeta, and iterative deepening. The heuristic function is tested for conformance to the expected interface, but cannot be automatically assessed for correctness. STUDENTS SHOULD NOT...
invokers.py
# # (C) Copyright IBM Corp. 2020 # (C) Copyright Cloudlab URV 2020 # # 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 ap...
login.py
from kivy.metrics import dp from kivy.lang import Builder from kivy.properties import ObjectProperty from kivy.uix.screenmanager import Screen from kivy.clock import Clock import socket from threading import Thread Builder.load_string(""" #:import IconInput uix.inputs.IconInput #:import ButtonEffect ui...
sql_isolation_testcase.py
""" Copyright (c) 2004-Present Pivotal Software, Inc. 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://www.apache....
utils.py
#!/usr/bin/env python # Copyright (c) 2022 SMHI, Swedish Meteorological and Hydrological Institute. # License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit). """ Created on 2022-02-02 18:00 @author: johannes """ import numpy as np from pathlib import Path from collections import Mapping from thre...
ex_3_biped_balance_with_gui.py
# -*- coding: utf-8 -*- """ Created on Wed Apr 17 22:31:22 2019 @author: student """ import numpy as np import pinocchio as pin import tkinter as tk from tkinter import Scale, Button, Frame, Entry, Label, Tk, mainloop, HORIZONTAL import threading class Scale3d: def __init__(self, master, name, from_, to, tickint...
curl_grading.py
"""curl_grading.py: tools for analyzing and checking C++ and Py programs""" import subprocess as sub import difflib import unittest import re import tokenize import dis import io import cpplint import sys import pycodestyle import logging import os import random import importlib import multiprocessing from io import St...
athenad.py
#!/usr/bin/env python3 import base64 import hashlib import io import json import os import sys import queue import random import select import socket import threading import time from collections import namedtuple from functools import partial from typing import Any import requests from jsonrpc import JSONRPCResponseM...
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...
dask.py
# pylint: disable=too-many-arguments, too-many-locals # pylint: disable=missing-class-docstring, invalid-name # pylint: disable=too-many-lines """Dask extensions for distributed training. See https://xgboost.readthedocs.io/en/latest/tutorials/dask.html for simple tutorial. Also xgboost/demo/dask for some examples. Th...
led.py
import pingo import time import threading class Led(object): """A single LED""" def __init__(self, pin, lit_state=pingo.HIGH): """Set lit_state to pingo.LOW to turn on led by bringing cathode to low state. :param lit_state: use pingo.HI for anode control, pingo.LOW ...
test_utils.py
# coding=utf-8 # Copyright 2018 The TF-Agents 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...
server.py
import json import os import subprocess import sys from http.server import HTTPServer, SimpleHTTPRequestHandler from multiprocessing import Process from urllib.parse import unquote, urlparse import fire import torch from transformers import RobertaForSequenceClassification, RobertaTokenizer model: RobertaForSequenceC...
drEngine.py
# encoding: UTF-8 ''' 本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。 使用DR_setting.json来配置需要收集的合约,以及主力合约代码。 ''' import json import os import copy from collections import OrderedDict from datetime import datetime, timedelta from Queue import Queue from threading import Thread from eventEngine import * from vtGateway import V...
WeaveDeviceMgr.py
# # Copyright (c) 2013-2017 Nest Labs, 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 # # ...
drivers.py
#!/usr/bin/env python #Ros utilites import threading import rospy from geometry_msgs.msg import Point, Pose, Quaternion, Twist from sensor_msgs.msg import Image, CompressedImage, Imu from std_msgs.msg import Empty from tello_msgs.msg import FlightData from cv_bridge import CvBridge, CvBridgeError from nav_msgs.msg imp...
service.py
import os import traceback import urllib2 from threading import Thread, Event from time import sleep, time from jnius import autoclass import subprocess from kivy.lib import osc from pyupdater import SERVICE_PORT, CLIENT_PORT, SERVICE_PATH, MESSAGE_UPDATE_AVAILABLE, MESSAGE_DO_UPDATE, \ MESSAGE_CHECK_FOR_UPDATE from p...
__init__.py
import logging import os import signal import sys import time logger = logging.getLogger(__name__) class Patroni(object): def __init__(self): from patroni.api import RestApiServer from patroni.config import Config from patroni.dcs import get_dcs from patroni.ha import Ha ...
process_worker.py
# coding=utf-8 import multiprocessing import serial import socket import os import fuckargs # 串口通讯 # 频率的决定者以硬件的串口通讯频率决定 def get_serial_info( input_str ): os.system( "echo %d >>pid_repo" % os.getpid() ) # store the pid while True: if input_str.value.find("$_$") > -1: print len( input_str.va...
iTrader.py
from tkinter import * from tkinter import Menu from tkinter import ttk from tkinter.ttk import Combobox from tkinter import messagebox import tkinter.font as font from binance_api import Binance import threading import time import datetime import os import os.path #__Main global variables ep = Fals...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
server.py
# -*- coding:utf-8 -*- from socket import socket import threading import json # id : [사용자 이름] # action : [create | join | send_msg | broadcast | out ] # action_value : [action에 따른 수행 값] class Server : def __init__(self): self.server_sock = socket() self.clients = [] self.rooms = {} ...
UComp_multiprocess_NO-INTODB.py
# # Copyright 2005-2018 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # # In applying this licence, ECMWF does not waive the privileges and immunities granted to it by # virtue of its status as an intergovern...
_testing.py
import bz2 from collections import Counter from contextlib import contextmanager from datetime import datetime from functools import wraps import gzip import operator import os import re from shutil import rmtree import string import tempfile from typing import Any, Callable, ContextManager, List, Optional, Type, Union...
http.py
from __future__ import print_function import base64 import copy import json import logging import os import random import ssl import string import sys import time from builtins import object from builtins import str from typing import List from flask import Flask, request, make_response, send_from_directory from pydi...
__init__.py
#!/usr/bin/env python3 """Library for performing speech recognition, with support for several engines and APIs, online and offline.""" import io import os import subprocess import wave import aifc import math import audioop import collections import json import base64 import threading import platform import stat impo...
v2.2.py
#!/usr/bin/env python #version: beta-2.2 import threading import argparse import logging import random import atexit import socket import socks import time import ssl import sys import os parser = argparse.ArgumentParser() parser.add_argument("url", nargs="?", type=str, help="Target URL. Format: \"http(s)://example.co...
controllerTelaSistema.py
from PyQt5.QtWidgets import QMainWindow from view.telaSistema import Ui_MainWindow from PyQt5.QtWidgets import QTableWidget,QTableWidgetItem from model.entrada import Entrada from model.saida import Saida import threading, time from datetime import datetime class ControllerTelaSistema(QMainWindow): def __init__(se...
rc_ipc_shim.py
import socket import time import struct from threading import Thread from sololink import rc_pkt rc_sock = None rc_attached = False rc_actual = [1500, 1500, 900, 1500, 0, 0, 0, 0] rc_override = [1500, 1500, 900, 1500, 0, 0, 0, 0] def attach(): global rc_attached rc_attached = True def detach(): global r...
multiProcessTest.py
import multiprocessing import time import os def work(): for _ in range(10): print("work..") print(multiprocessing.current_process()) print(f"subprocess pid: {multiprocessing.current_process().pid}") print(f"parent process pid: {os.getppid()}") time.sleep(0.2) if __name__...
runner.py
#!/usr/bin/env python2 # This Python file uses the following encoding: utf-8 ''' Simple test runner These tests can be run in parallel using nose, for example nosetests --processes=4 -v -s tests/runner.py will use 4 processes. To install nose do something like |pip install nose| or |sudo apt-get install python-no...
main.py
# Importing the modules from tkinter import * from tkinter.font import BOLD import socket import threading import random import csv import pygame r = lambda: random.randint(0, 255) color = '#%02X%02X%02X' % (r(), r(), r()) # client connections PORT = 5000 SERVER = "192.168.56.1" ADDRESS = (SERVER, PORT) FORMAT = "ut...
qtgui.py
import threading import queue from ._common import * from . import _core from .excelgui import CustomTaskPane import importlib import sys import concurrent.futures as futures import concurrent.futures.thread def _qt_import(sub, what): """ Helper function to import Q objects from PyQt or PySide depending ...
bridge.py
#!/usr/bin/env python3 import os import time import math import atexit import numpy as np import threading import random import cereal.messaging as messaging import argparse from common.params import Params from common.realtime import Ratekeeper from lib.can import can_function, sendcan_function import queue parser = ...
base.py
""" Base functions for tests. """ import os import socketserver import threading import unittest from contextlib import contextmanager from functools import wraps from http.server import SimpleHTTPRequestHandler from time import sleep from selenium import webdriver from aloe.testing import in_directory def feature...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import threading_helper from test.support import verbose, import_module, cpython_only from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys import _thread import threading import time import...
mac_prefs.py
# -*- coding: utf-8 -*- ''' Support for reading and writing of preference key/values with ObjectiveC's CFPreferences Modules. Documentation on the Modules can be found here. https://developer.apple.com/documentation/corefoundation/preferences_utilities?language=objc This appears to be significantly faster than shellin...
OSC.py
#!/usr/bin/python """ This module contains an OpenSoundControl implementation (in Pure Python), based (somewhat) on the good old 'SimpleOSC' implementation by Daniel Holth & Clinton McChesney. This implementation is intended to still be 'simple' to the user, but much more complete (with OSCServer & OSCClient classes) ...
TrapFeedback.py
from simple_pid import PID import time import threading import urllib import json import ast import math class TrapFeedback(object): def __init__(self, waveManager): self.waveManager = waveManager self.PIDs = [] self.P = .0005 self.I = .000002 self....
ort_eps_test.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import unittest import torch import onnxruntime_pybind11_state as torch_ort import os import sys def is_windows(): return sys.platform.startswith("win") from io import StringIO import sys import threading import time ...
udp_echo_client.py
""" mbed SDK Copyright (c) 2011-2013 ARM 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 License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
manipulate2.py
# TODO: # * modify exports using lief # * zero out rich header (if it exists) --> requires updating OptionalHeader's checksum ("Rich Header" only in Microsoft-produced executables) # * tinker with resources: https://lief.quarkslab.com/doc/tutorials/07_pe_resource.html import lief # pip install https://github.com/lief...
aps_video.py
# aps_video.py # # Copyright (c) 2022 John Fritz # MIT License, see license.md for full license text from imutils.video import VideoStream import threading import time import datetime import os os.environ["OPENCV_IO_MAX_IMAGE_PIXELS"] = str(2 ** 64) import cv2 import collections import numpy as np fr...
named_pipes.py
#!/usr/bin/env python3 import configparser import multiprocessing import os from jackal import HostSearch, RangeSearch, ServiceSearch, UserSearch from jackal.config import Config from jackal.utils import print_error, print_notification, print_success from jackal.utils import PartialFormatter fmt = PartialFormatter(mi...
Hiwin_RT605_ArmCommand_Socket_20190627170600.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * from std_msgs.msg import Int32MultiArray import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端...
backup.py
import os from shlex import quote from colorama import Fore import multiprocessing as mp from shutil import copytree, copyfile from .utils import * from .printing import * from .compatibility import * from .config import get_config def backup_dotfiles(backup_dest_path, home_path=os.path.expanduser("~"), skip=False): ...
mysawyer.py
# # Copyright (C) 2018 Isao Hara,AIST,JP # All rights reserved # # from __future__ import print_function import os import sys import traceback import rospy import intera_interface import numpy as np import threading import cv2 import cv_bridge import tf import JARA_ARM # # from intera_core_msgs.msg import Interact...
model.py
#! /usr/bin/env python import os import threading from abc import abstractmethod import calendar import datetime import inspect import copy import sys script_dir = os.path.dirname(os.path.realpath(__file__)) data_dir = os.path.join(script_dir, 'data') class Serializable(object): ''' Helper class for seriali...
core.py
# -*- coding: utf-8 -*- # # 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 #...
sniffer.py
import threading import os import layers.packet from scapy.all import sniff from scapy.utils import PcapWriter class Sniffer(): """ The sniffer class lets the user begin and end sniffing whenever in a given location with a port to filter on. Call start_sniffing to begin sniffing and stop_sniffing to stop...
trainer.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
env_utils.py
import gym import numpy as np from gym.spaces import Discrete, Box from gym.core import Env from multiprocessing import Process, Pipe from yarlp.utils.atari_wrappers import wrap_deepmind from yarlp.utils.atari_wrappers import NoopResetEnv, MaxAndSkipEnv def wrap_atari(env): assert 'NoFrameskip' in env.spec.id,\ ...
test_rpc.py
import os import time import socket import dgl import backend as F import unittest, pytest import multiprocessing as mp from numpy.testing import assert_array_equal if os.name != 'nt': import fcntl import struct INTEGER = 2 STR = 'hello world!' HELLO_SERVICE_ID = 901231 TENSOR = F.zeros((10, 10), F.int64, F....
java_gateway.py
# -*- coding: UTF-8 -*- """Module to interact with objects in a Java Virtual Machine from a Python Virtual Machine. Variables that might clash with the JVM start with an underscore (Java Naming Convention do not recommend to start with an underscore so clashes become unlikely). Created on Dec 3, 2009 :author: Barthe...
test_convenience_methods.py
"""Test convenience methods that save the need for stuff such as instantiating factories""" from threading import Thread from typing import * from rdisq.request.receiver import RegisterMessage from tests._messages import AddMessage if TYPE_CHECKING: from tests.conftest import _RdisqMessageFixture def test_send_...
tube.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import re import string import subprocess import sys import threading import time from pwnlib import atexit from pwnlib import term from pwnlib.context import context from pwnlib.log import Logger from pwnlib.timeout import Timeout from pwn...
asyncorereactor.py
# Copyright 2013-2015 DataStax, 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 writi...
1.py
#!/usr/bin/env python3 import intcode import queue import threading import itertools excluded_items = { "giant electromagnet", "molten lava", "infinite loop", "escape pod", "photons" } directions = { "east": "west", "west": "east", "south": "north", "north": "south" } security_...
web.py
import os from http.server import BaseHTTPRequestHandler, HTTPServer from socket import AF_INET, SOCK_STREAM, gethostbyname, socket from threading import Thread from urllib.parse import parse_qs from oic.oic import AccessTokenResponse, AuthorizationResponse, Client from src.authentication.types import AuthenticationD...
connection.py
""" Connection module for exchanging data with the Raspberry Pi. """ from socket import socket, SHUT_RDWR from multiprocessing import Process from threading import Thread import msgpack from msgpack import UnpackException from ..constants.networking import CONNECTION_IP, CONNECTION_PORT, CONNECTION_DATA_SIZE from ..con...
Lesson15.py
#Python的多线程: import threading ,time ,random #在子线程中进行轮询操作 def loop(): #显示当前线程的名字 print("current thread name: %s"%threading.current_thread().name) n = 0 while n<5: print("thread %s ==> %s"%(threading.current_thread().name,n)) n+=1 time.sleep(1) print("child thread ...
joomla_killer.py
import http.cookiejar import queue import threading import urllib.error import urllib.parse import urllib.request from abc import ABC #Abstract Base Classes from html.parser import HTMLParser # global settings user_thread = 10 username = "admin" wordlist_file = "cain.txt" resume = None # target settin...
fn_api_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...
middleman.py
#!/usr/bin/env python """ Middleman Middleman is responsible for monitoring for incoming submission requests, sending submissions, waiting for submissions to complete, sending a message to a notification queue as specified by the submission and, based on the score received, possibly sending a message to indicate that ...
mediaplayer.py
import time import json import threading import socket from twisted.internet import reactor class MediaPlayerProperty(): def __init__(self, property_, request_id): self.property = property_ self.request_id = request_id @property def command(self): return {'command': ['get_property...
address_publisher.py
"address_publisher.py - Takes addresses from Kafka and submit them to node" from app import settings from app.request_wrapper import RequestWrapper from app.kafka_wrapper import Consumer from prometheus_client import Gauge, Histogram, start_http_server from queue import Queue import logging import threading import ti...
testio.py
import json import sys import subprocess import multiprocessing import re import os import errno import fpdf PROGRAM_PATH_JSON = "ProgramPath" TIMEOUT_JSON = "Timeout" TEST_JSON = "Test\s?\d*" TEST_INPUT_JSON = "input" TEST_OUTPUT_JSON = "output" TEST_PASSED_MSG = "Test passed successfully!" TEST_FAILED_MSG = "Test fa...
mjpeg_server.py
# Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # This source code is subject to the terms found in the AWS Enterprise Customer Agreement. """ MJPEG server for Panorama inference output """ import logging from http.server import BaseHTTPRequestHandler, HTTPServer from io import StringIO im...
util.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2011 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 t...
scheduler.py
import Queue import math import traceback from threading import Thread import monotonic from distributed import as_completed from .util import TimeoutManager, haydi_logger class Job(object): def __init__(self, worker_id, start_index, size): """ :type worker_id: str :type start_index: int...
my_prefetchingIter.py
# -*- coding: utf-8 -*- # 该版本的输入尺寸为50x50 mxnet_095 = '/home/forrest/MXNet/mxnet-0.9.5/python' import sys sys.path.append(mxnet_095) import mxnet import cPickle import numpy import random import threading import cv2 import time import logging import data_augmentation_util class MyDataBatch(): def __init__(self): ...
console.py
#!/usr/bin/env python3 import cmd import configparser import sys import threading try: import colorama except ImportError: exit('Please install colorama for colorful console output: pip install colorama') try: import tabulate except ImportError: exit('Tabulate module is needed for interactive console...
data_processing.py
# -*- coding: utf-8 -*- import numpy as np import re import random import json import collections from tqdm import tqdm import nltk from nltk.corpus import wordnet as wn import os import pickle from nltk.tag import StanfordNERTagger from nltk.tag import StanfordPOSTagger from chainer import cuda LABEL_MAP = { "e...
route_server.py
#!/usr/bin/env python # Author: # Muhammad Shahbaz (muhammad.shahbaz@gatech.edu) # Rudiger Birkner (Networked Systems Group ETH Zurich) # Arpit Gupta (Princeton) import argparse from collections import namedtuple import json from multiprocessing.connection import Listener, Client import os import Queue import sys...