source
stringlengths
3
86
python
stringlengths
75
1.04M
Ghost.py
#!/usr/bin/python # -*- coding: UTF-8 -*- # Copyright (C) 2021 Ben Tettmar # 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 right...
njrat.py
#!/usr/bin/env python3 # MIT License # # Copyright (C) 2020, Entynetproject. All Rights Reserved. # # 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 lim...
job_monitor.py
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2017, 2018, 2019 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Job monitoring wrapper.""" import logging import threading import time import ...
websocket_client.py
# encoding: UTF-8 import json import ssl import sys import traceback from datetime import datetime from threading import Lock, Thread from time import sleep import websocket class WebsocketClient(object): """ Websocket API After creating the client object, use start() to run worker and ping threads. ...
ThreadedInstaller.py
###################################################################### # PACKAGE MANAGER # ###################################################################### from logger import log_info, close_log from Classes.Download import Download from Classes.Install import ...
portscan.py
#!/usr/bin/env python3 import socket import threading from rich.progress import track import sys import os import time R = '\033[31m' # red G = '\033[32m' # green C = '\033[36m' # cyan W = '\033[0m' # white Y = '\033[33m' # yellow def ps(ip, output, data, ps_mode): threads = [] result = {} try: print('\n\n'...
utility.py
import os import math import time import datetime from multiprocessing import Process from multiprocessing import Queue import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import imageio import torch import torch.optim as optim import torch.optim.lr_scheduler as lrs class time...
mysql_test.py
#!/usr/bin/env python # Lint as: python3 from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import contextlib import logging import os import threading import unittest from unittest import mock import uuid import warnings...
stm32_updater.py
import json import sys import threading as th import time from base64 import b64decode, b64encode from io import open from os import path import serial import serial.tools.list_ports as stl from modi_firmware_updater.util.connection_util import SerTask from modi_firmware_updater.util.message_util import (decode_messa...
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 platform import contextlib from weakref import proxy import signal import math import pickle import struct impo...
variable_scope.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
control.py
import multiprocessing import os import signal import sys import threading from Queue import Empty from importlib import import_module from util import logs, files class TaskController(multiprocessing.Process): def __init__(self, cfg, vm, work_queue): """ :type cfg: conf.vcfg.Config :typ...
do-partition.py
#! /usr/bin/env python # # This file is part of khmer, http://github.com/ged-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2013. It is licensed under # the three-clause BSD license; see doc/LICENSE.txt. Contact: ctb@msu.edu # import khmer, sys import threading import Queue import gc import os.path ...
local_backend.py
import sys import os import json import socket import socketserver from threading import Thread import py4j from py4j.java_gateway import JavaGateway, GatewayParameters, launch_gateway import hail from hail.utils.java import FatalError, Env, scala_package_object, scala_object from hail.expr.types import dtype from hai...
5_multithreaded.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. import time import threading import torch from polymetis import RobotInterface from utils import check_episode_log success = [] exceptions ...
bmv2stf.py
#!/usr/bin/env python2 # Copyright 2013-present Barefoot Networks, 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 b...
bthread.py
import threading import time import logging def thread_one(name): logging.info('starting thread. {}'.format(name)) time.sleep(5) logging.info('finishing thread. {}'.format(name)) def thread_two(name): logging.info('starting thread. {}'.format(name)) time.sleep(10) logging.info('finishing threa...
example_reqmod_request_change.py
# -*- coding: utf8 -*- import time import threading from icapserver import * set_logger('debug') class ExampleICAPHandler(BaseICAPRequestHandler): def example_OPTIONS(self): self.set_icap_response(200) self.set_icap_header('Methods', 'RESPMOD, REQMOD') self.set_icap_header('Service', 'ICAP Server' + ' ' + s...
test_c10d_nccl.py
import copy import math import os import random import signal import sys import tempfile import threading import time import unittest from contextlib import contextmanager from datetime import timedelta from itertools import product from unittest import mock import torch import torch.distributed as c10d if not c10d.i...
test_decorator.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import subprocess import sys import threading import unittest from concurrent.futures import ThreadPoolExecutor, as_completed from maro.communication import Proxy, SessionMessage, dist from tests.communication.utils import get_random_p...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading from electrum_dongri.bitcoin import TYPE_ADDRESS from electrum_dongri import WalletStorage, Wallet from electrum_dongri_gui.kivy.i18n import _ from electrum_dongri.paymentrequest import InvoiceStore...
httpserver.py
### # Copyright (c) 2011, Valentin Lorentz # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditi...
gallery.py
def gallery(*args, **kwargs): """Create a web-browsable gallery of plots (aka "PNG Walk"). For additional documentation and demonstration, see hapi_demo.ipynb at <https://github.com/hapi-server/client-python-notebooks/> Usage ---------- gallery(server, dataset) gallery(server, dataset, par...
download.py
# Copyright (c) Microsoft Corporation # # All rights reserved. # # MIT License # # 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...
executor.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #################################################################### # Cyclic grid strategy based on martingale ################################################################## __author__ = "Jerry Fedorenko" __copyright__ = "Copyright © 2021 Jerry Fedorenko aka VM" __lic...
Time_Network.py
import argparse import numpy as np import tensorflow as tf #from reader_frozen import plot_prediction, convert_time, read_data, read_mesh, read_soln import os import sys import time import multiprocessing import threading import csv # Import flags specifying dataset parameters from timer_flags import getFlags DATA_...
builddb.py
# Copyright 2010-2012 Opera Software ASA # # 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 ...
dynamic_data.py
#!/usr/bin/python3 #Author: Rahil Gandotra #Python script to dynamically modify power/network performance parameters in the simulated SNMP agents. import random import threading import time pwr_cons1 = ['102.85','103.02','103.19','102.90','103.03','103.21','102.91','103.03','103.09','102.95','103.08','103.14'] pwr_co...
setup.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. import asyncio import contextlib import functools import json import os import socketserver import tempfile import threading from pathlib impo...
callback.py
from utlis.rank import setrank,isrank,remrank,remsudos,setsudo,GPranks,IDrank from utlis.send import send_msg, BYusers, Sendto, fwdto,Name,Glang,getAge from utlis.locks import st,getOR,Clang,st_res from utlis.tg import Bot from config import * from pyrogram import ReplyKeyboardMarkup, InlineKeyboardMarkup, Inlin...
liverecording.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, unicode_literals from future.builtins import bytes, chr, dict, int, range, str from future.utils import iteritems from future.standard_library import hooks import sys try: reload # Python 2 reload(sys) sys.setdefaultencoding...
hue.py
import time from threading import Thread from platypush.backend import Backend from platypush.context import get_plugin from platypush.message.event.light import LightStatusChangeEvent class LightHueBackend(Backend): """ This backend will periodically check for the status of your configured Philips Hue ...
serialization.py
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
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...
post_to_slack.py
#!/usr/bin/env python3 """ Posts the status of a test run to a slack channel designated by SLACK_WEBHOOK. Each gitlab repo seems to only be allowed one slack integration (although you can use a comma-separated list to designate multiple channels in one slack account so long as the hook has permissions for each). TODO...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 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 bitcoinpaythroughd shutdown.""" from test_framework.test_framework import BitcoinpaythroughTestFramewo...
utils.py
import shutil import traceback import os import os.path from pathlib import Path from dataclasses import dataclass from typing import Optional, Iterable import time import unittest import urllib.request from click.testing import CliRunner from unfurl.__main__ import cli, _latestJobs from unfurl.job import Runner, JobO...
server.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
cluster_health_check.py
# Copyright 2018 The OpenEBS Authors # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writ...
xo.py
####ok.py #### from new import * import time import dill as pk # import pickle as pk import glob import traceback from threading import Thread import os.path as PATH import os import re import json from .fileWatch import * # print(" ::: imported xo successfully ") class SelfNamed(object): """docstring for SelfNam...
__init__.py
import os, sys, time os.environ["QT_MAC_WANTS_LAYER"] = "1" if hasattr(sys, 'frozen'): print(os.path.dirname(sys.executable)) sys.path.append(os.path.dirname(sys.executable)) sys.argv.append("--enable-smooth-scrolling") from sys import platform as _platform import MainWindow, platform, traceback, webbrowser fr...
metadata.py
import logging import os import time import tkinter.scrolledtext as ScrolledText from concurrent.futures import ProcessPoolExecutor from tkinter import ( END, Button, Label, StringVar, Tk, filedialog ) from ShazamAPI import Shazam from mutagen.id3 import APIC, ID3, USLT from mutagen.mp3 import ...
wiki.py
import os import time import re import logging import uuid import pypandoc import knowledge_graph from flask import Flask, render_template, request, redirect, url_for, send_from_directory from werkzeug.utils import secure_filename from random import randint from threading import Thread from config import WikmdConfig ...
runner.py
import os import threading import subprocess from pathlib import Path from colored import fg, attr threads = [] def run_cmd(echo, cmd): t = threading.Thread(target=_run_cmd0, args=[echo, cmd]) t.start() threads.append(t) def _run_cmd0(echo, cmd): if echo: print(f"{fg(240)}{cmd}{attr('reset')...
process.py
import mpi4py mpi4py.rc.threaded = True mpi4py.rc.thread_level = "funneled" # mpi4py.rc.profile('vt-hyb', logfile='threads') from mpi4py import MPI from threading import Thread MPI.COMM_WORLD.Barrier() # Understanding the Python GIL # David Beazley, http://www.dabeaz.com # PyCon 2010, Atlanta, Georgia # http://www.d...
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...
azure_blob.py
""" Object Store plugin for the Microsoft Azure Block Blob Storage system """ import logging import os import shutil import threading import time from datetime import datetime try: from azure.common import AzureHttpError from azure.storage import CloudStorageAccount from azure.storage.blob import BlockBlo...
convert_calib_to_trace_npy.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Jan 17 14:01:29 2018 @author: chrelli CONVERT THE CALIBRATION into a 3d shape! """ #%% Import the nescessary stuff # basic OS stuff import time, os, sys, shutil # for math and plotting import pandas as pd import numpy as np import scipy as sp import...
test_system.py
# Copyright 2016 Google LLC All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
mqtt_tcp_example_test.py
import re import os import sys import socket from threading import Thread import struct import time try: import IDF except ImportError: # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, # we need to set environment variable `TEST_FW_PATH`, # th...
tms.py
import socket from multiprocessing import Process, Value import TrboDataSvc.util as util import logging class TMS(): def __init__(self, port=4007): self._ip = "0.0.0.0" self._cai = 12 self._gcai = 225 self._port = port self._sock = socket.socket(socket.AF_INET, socket.SOCK_D...
Core.py
import time from BigLearnAPI import big_learn_api from Log import log from QQBotMessage import send_group_message, send_user_message from Scheduler import time_in_work, min_sleep from Settings import WorkTimeStart, ServerName, HOST, PORT from Server import server from threading import Thread def cruise(): now = ...
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...
readInputRegisterException.py
import os import threading from System.Core.Global import * from System.Core.Colors import * from System.Core.Modbus import * from System.Lib import ipcalc class Module: info = { 'Name': 'Read Input Registers Exception', 'Author': ['@enddo'], 'Description': ("Fuzzing Read Input Registers Exception Function")...
datasets.py
import glob import math import os import random import shutil import time from pathlib import Path from threading import Thread import cv2 import numpy as np import torch from PIL import Image, ExifTags from torch.utils.data import Dataset from tqdm import tqdm from .utils import xyxy2xywh, xywh2xyxy help_url = 'htt...
play_audio_dial_out.py
##------------------------------------------ ##--- Author: Pradeep Singh ##--- Blog: https://iotbytes.wordpress.com/play-audio-file-on-phone-line-with-raspberry-pi/ ##--- Date: 24th June 2018 ##--- Version: 1.0 ##--- Python Ver: 2.7 ##--- Description: This python code will pick an incomming call and play an audio msg o...
mellowGUI.py
import sys, pygame import time import random, os import pygame from threading import Thread import threading #from pygame import _view from pygame.locals import * from sys import exit import box import mellowLogic #This is designed to be a singleton object FIRST_ROUND = -999 class MellowGUI: pygame.init() ...
parall_util.py
from typing import List, Tuple, Dict, Callable, Any import multiprocessing import threading from multiprocessing import Queue as MPQueue def get_parall_id() -> Any: return (multiprocessing.current_process().pid, threading.get_ident()) def _run_parall(funcs_kwargs: List[Tuple[Callable, Dict]]) -> None: proce...
driver.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyright (c) 2012 University Of Minho # (c) Copyright 2013 Hewlett-Pa...
futures.py
""" Support for Futures (asynchronously executed callables). If you're using Python 3.2 or newer, also see http://docs.python.org/3/library/concurrent.futures.html#future-objects Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net). """ import sys import functools import logging ...
test_podmodel_installer.py
"""test_podmodel_installer.py - tests the podmodel_installer module Chris R. Coughlin (TRI/Austin, Inc.) """ __author__ = 'Chris R. Coughlin' from controllers import pathfinder from models.tests import test_plugin_installer import models.podmodel_installer as podmodel_installer import models.zipper as zipper import ...
gobgp.py
# Copyright (C) 2015 Nippon Telegraph and Telephone Corporation. # # 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 appli...
applications_test.py
import pytest from multiprocessing import Process, Queue from keras.utils.test_utils import keras_test from keras.utils.test_utils import layer_test from keras.utils.generic_utils import CustomObjectScope from keras.models import Sequential from keras import applications from keras import backend as K @keras_test def...
utils.py
import asyncore import base64 import cherrypy import contextlib import email import errno import json import os import six import smtpd import socket import threading import time from six import BytesIO from six.moves import queue, range, urllib _startPort = 31000 _maxTries = 100 class MockSmtpServer(smtpd.SMTPServ...
panorama.py
import logging try: from Queue import Empty except: from queue import Empty from time import time, sleep from threading import Thread # @modified 20190522 - Task #3034: Reduce multiprocessing Manager list usage # Use Redis sets in place of Manager().list() to reduce memory and number of # processes # from multi...
test_jobs.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 #...
load_analyze_simultaneously.py
from multiprocessing import Process rocket = 0 def func1(): global rocket print('start func1') while rocket < 10: rocket += 1 print('end func1') def func2(): global rocket print('start func2') while rocket < 10: rocket += 1 print('end func2') def load_analyze_simultan...
__init__.py
''' module beeline ''' import functools import logging import os import socket from contextlib import contextmanager from libhoney import Client from beeline.trace import SynchronousTracer from beeline.version import VERSION from beeline import internal import beeline.propagation.honeycomb import sys # pyflakes assert...
dispatcher.py
""" This is the test dispatcher. It will dispatch tests against any registered test runners when the repo observer sends it a 'dispatch' message with the commit ID to be used. It will store results when the test runners have completed running the tests and send back the results in a 'results' messagee It can register...
api_views.py
from rest_framework import viewsets, views, permissions from rest_framework.pagination import PageNumberPagination from .serializers import * from django.http import JsonResponse, HttpResponse from django.utils.timezone import localtime from .models import ServerControlModel import paramiko from .forms import ServerCo...
alis2t_api.py
# -*- coding: utf-8 -*- import os import sys import time import threading import ali_speech from ali_speech.callbacks import SpeechRecognizerCallback from ali_speech.constant import ASRFormat from ali_speech.constant import ASRSampleRate # local dep sys.path.append("./utils") import audio # macro APPKEY = 'iVo54C7qeKy...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from el...
toggle_example.py
#Copyright (c) 2017 Joseph D. Steinmeyer (jodalyst) #Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights to use, # copy, modify, m...
ServerLogic.py
import os from twilio.rest import Client from flask import Flask, request from twilio import twiml twillio_phone_number = "[Number]" account_sid = "[SID]" auth_token = "[TOKEN]" HOST = '172.31.39.142' PORT = 6666 BUFFER_SIZE = 4096 threads = [] users = {} app = Flask(__name__) @app.route('/sms', methods=['POST']) def...
client.py
# Copyright 2020 Tabacaru Eric # # 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 writ...
distributed.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import time import torch import signal import pickle import threading import functools import traceback imp...
order_handler.py
from cbpro.order_book import OrderBook from decimal import Decimal import time from itertools import islice from threading import Thread import json, os import multiprocessing def debug_write(text, debug_file='debug.txt'): """Helper function to keep code clean""" with open(debug_file,'a+') as f: f.writ...
qtum_transaction_receipt_origin_contract_address.py
#!/usr/bin/env python3 from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from test_framework.script import * from test_framework.mininode import * from test_framework.address import * import threading def waitforlogs(node, contract_address): logs = node.cli.waitforlo...
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 functools import partial from typing import Any import requests from jsonrpc import JSONRPCResponseManager, dispatcher from websocket i...
checkpoint.py
import re import time import uuid import logger from threading import Thread from tasks.future import TimeoutError from couchbase_helper.cluster import Cluster from couchbase_helper.stats_tools import StatsCommon from membase.api.rest_client import RestConnection from membase.helper.cluster_helper import ClusterOperat...
compareDQMOutput.py
#!/bin/env python import os import sys import glob import argparse import subprocess from threading import Thread COMPARISON_RESULTS = [] def collect_and_compare_files(base_dir, pr_dir, output_dir, num_procs, pr_number, test_number, release_format): files = get_file_pairs(base_dir, pr_dir) threads = [] ...
test_authorization_code.py
from __future__ import absolute_import import sys from multiprocessing import Queue from wsgiref.simple_server import make_server from flask import Flask from oauth2 import Provider from oauth2.compatibility import json, parse_qs, urlencode from oauth2.grant import AuthorizationCodeGrant, RefreshToken from oauth2.tes...
env_stock_papertrading.py
import datetime import threading from finrl.neo_finrl.data_processors.processor_alpaca import AlpacaProcessor import alpaca_trade_api as tradeapi import time import pandas as pd import numpy as np import torch import sys import os class AlpacaPaperTrading(): def __init__(self,ticker_list, time_interv...
testsend.py
#!/usr/bin/env python import socket # import time import threading sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(("127.0.0.1", 5555)) sock.connect(("127.0.0.1", 6666)) def print_incoming(sock): print("Starting threaded read.") while True: data, ancdata, msg_flags, addr = sock.rec...
resquiggle.py
import os, sys import re import h5py import queue import numpy as np np.seterr(all='raise') import multiprocessing as mp from glob import glob from time import sleep, time from subprocess import call, STDOUT from tempfile import NamedTemporaryFile from distutils.version import LooseVersion from itertools import grou...
test_csv.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...
test_http.py
#!/usr/bin/env python3 # Allow direct execution import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import ssl import threading from test.helper import http_server_port from yt_dlp import YoutubeDL from yt_dlp.compat import compat_http_server, compat_u...
app.py
############################################################################# # Copyright (c) 2018, Voila Contributors # # # # Distributed under the terms of the BSD 3-Clause License. # # ...
wsserver.py
from websocketserver import WebsocketServer from threading import Thread # Called for every client connecting (after handshake) # def new_client(client, server): # print("New client connected and was given id %d" % client['id']) # server.send_message_to_all("Hey all, a new client has joined us") # Called for every...
tello.py
import socket import threading import time import cv2 from datetime import datetime class Stats: def __init__(self, command: str, id: int): self.command = command self.response = None self.id = id self.start_time = datetime.now() self.end_time = None self.duration = None def add_response(self, respons...
test_multiprocessing.py
# Tai Sakuma <tai.sakuma@gmail.com> import time, random import itertools import multiprocessing import pytest from atpbar import atpbar from atpbar import register_reporter, find_reporter, flush ##__________________________________________________________________|| def run_with_multiprocessing(nprocesses, ntasks, ni...
udp_scan.py
import socket import sys import threading def getServiceName(port, proto): try: name = socket.getservbyport(int(port), proto) except: return None return name def scan(RPORT): MESSAGE = "ping" client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) if clien...
agent.py
#!/usr/bin/env python from flask import Flask, jsonify, request from flask_socketio import SocketIO, join_room, leave_room from redis import Redis from redis_semaphore import Semaphore from threading import Thread import argparse import eventlet import pika import sys import json import redis import random import s...
run_webserver.py
import jetson.inference import jetson.utils from jetbot import Robot from flask import Response from flask import Flask from flask import render_template from flask import request from flask import make_response from flask import jsonify import threading import time import cv2 import ctypes import argparse import numpy...
tcpServer.py
#!/ usr/bin/python import socket, threading, sys def banner(): #TODO: Add functions. print "[***] TCP Server p12 [***]" bind_ip = sys.argv[1] bind_port = sys.argv[2] server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((bind_ip, bind_port)) server.listen(5) print "[*] Listening on %s:%d" %...
mailer.py
from tkinter import * import tkinter.filedialog, tkinter.messagebox from threading import Thread from _sender import Sender import numpy as np class GUI(): def __init__(self): """ We are going to show GUI """ self.root = Tk() self.root.geometry("700x400") self.root.wm_title("MM toolkit v1.0"...
router.py
"""Event router module. Handles main program event loop. Exports: :class EventRouter -- Static router class for handling events. """ from core.decorators import classproperty from core.exceptions import InitError import threading import time class EventRouter(object): """EventRouter for handling SocketEve...
util.py
from os.path import abspath, join, dirname, basename, split from datetime import datetime from threading import Thread import json import sys # Import correct Queue if (sys.version_info[0] == 3): from queue import Queue else: # Python 2 from multiprocessing import Queue # Debugging this adapter debug = Tru...
main.py
#!/usr/bin/python3 import sys; import logging; import threading; import time; import re; import requests; import signal; import argparse; from threading import Lock; ThreadLock = Lock(); # Initial URL to mine from Start = {}; # Result will be stored here Urls = {}; ExitApp = False; StopWriting = False; NoMeta = T...
event_mgr.py
from queue import Queue, Empty from threading import Thread from time import sleep from typing import Any, Callable, defaultdict from ..extention import Extention from ..applog import AppLog log = AppLog.get('event') EVENT_TIMER = "timer" class Event: def __init__(self, type: str, data: Any = None): se...