source
stringlengths
3
86
python
stringlengths
75
1.04M
Pubnub.py
## www.pubnub.com - PubNub Real-time push service in the cloud. # coding=utf8 ## PubNub Real-time Push APIs and Notifications Framework ## Copyright (c) 2014-15 Stephen Blum ## http://www.pubnub.com/ ## ----------------------------------- ## PubNub 3.5.2 Real-time Push Cloud API ## ----------------------------------...
handler.py
import abc import csv import datetime import logging import os import threading from queue import Queue, Empty from flask import json from core.httpclient import RequestsBasedHttpClient from core.interface import DATETIME_FORMAT, API_PREFIX class DataHandler: """ A simple interface to define the expected be...
test_auto_scheduler_search_policy.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...
wxRaven_NewInstance.py
''' Created on 3 janv. 2022 @author: slinux ''' # # # # wxRaven for building .exe # # # import json import wx import wx.xrc import wx.dataview import wx.dataview import wx.aui import wx.richtext import wx.lib import wx.lib.scrolledpanel import wx.lib.buttons import wx.adv import wx.grid import wx.html2 import wx...
windows.py
import collections import collections.abc import contextlib import ctypes import ctypes.wintypes import io import json import os import re import socket import socketserver import threading import time from collections.abc import Callable from typing import Any, ClassVar, Optional import pydivert import pydivert.const...
data_reader.py
import os import random import threading import codecs import queue import librosa import numpy as np from params import hparams def read_binary_lc(file_path, dimension): f = open(file_path, 'rb') features = np.fromfile(f, dtype=np.float32) f.close() assert features.size % float(dimension) == 0.0,\ ...
synchronized_lights.py
#!/usr/bin/env python # # Licensed under the BSD license. See full license in LICENSE file. # http://www.lightshowpi.org/ # # Author: Todd Giles (todd@lightshowpi.org) # Author: Chris Usey (chris.usey@gmail.com) # Author: Ryan Jennings # Author: Paul Dunn (dunnsept@gmail.com) # Author: Tom Enos (tomslick.ca@gmail.com)...
log.py
""" Logging module for printing status during an exploit, and internally within ``pwntools``. Exploit Developers ------------------ By using the standard ``from pwn import *``, an object named ``log`` will be inserted into the global namespace. You can use this to print out status messages during exploitation. For e...
tracker.py
import os import numpy as np import math import cv2 import onnxruntime import time import queue import threading import copy from similaritytransform import SimilarityTransform from retinaface import RetinaFaceDetector from remedian import remedian def resolve(name): f = os.path.join(os.path.dirname(__file__), nam...
test__ssl.py
from __future__ import print_function, division, absolute_import from gevent import monkey monkey.patch_all() import os import socket import gevent.testing as greentest # Be careful not to have TestTCP as a bare attribute in this module, # even aliased, to avoid running duplicate tests from gevent.tests import test__s...
mcurl.py
#!/usr/bin/env python3 import http.client import sys import time from multiprocessing import Process def curl(nr, d, url): ers = {} oks = 0 minlat = 100.0 maxlat = 0.0 gist = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] for i in range(0, nr): conn = http.client.HTTPConnection(url[2]) s = ti...
TripAdvisorScrapper.py
#Eric Park #Python 2.7 #TripAdvisor Scrapper import urllib from bs4 import BeautifulSoup from multiprocessing.pool import ThreadPool import csv #Potential Imports import re from threading import Thread from Queue import Queue import time #List of TripAdvisor urls to scrape #This is Scrapping Select Oyster Bar Pages u...
test_netbeans.py
#!/usr/bin/python # # Server that will communicate with Vim through the netbeans interface. # Used by test_netbeans.vim. # # This requires Python 2.6 or later. from __future__ import print_function import socket import sys import time import threading import re try: # Python 3 import socketserver except Impor...
PC_Miner.py
#!/usr/bin/env python3 """ Duino-Coin Official PC Miner 3.1 © MIT licensed https://duinocoin.com https://github.com/revoxhere/duino-coin Duino-Coin Team & Community 2019-2022 """ from threading import Semaphore from time import time, sleep, strptime, ctime from hashlib import sha1 from socket import socket ...
test_util.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
event_writer.py
import Queue import multiprocessing import threading import sys import json import traceback import time import splunktalib.common.util as scutil from splunktalib.common import log import splunktalib.rest as sr logger = log.Logs().get_logger("util") scutil.disable_stdout_buffer() class ModinputEvent(object): ...
test_flight_rotate.py
import socket import threading import time import pickle import cv2 from Detection.MtcnnDetector import MtcnnDetector from Detection.detector import Detector from Detection.fcn_detector import FcnDetector from train_models.mtcnn_model import P_Net, R_Net, O_Net import visualization_utils from instruction import * thre...
receiver.py
"""Module for receiving data and hosting receiving servers.""" from aiohttp import web import asyncio import humanize from multiprocessing import Process import os import pkgutil import platform import requests import socket import sys from time import sleep, strftime from tqdm import tqdm from zipfile import is_zipf...
bruteforce.py
# see https://blog.alexandruioan.me/2017/01/31/the-2017-university-of-bristol-arm-hackathon for more details import math from http.server import BaseHTTPRequestHandler, HTTPServer, urllib from sys import argv # import matplotlib.pyplot as plt import serial import threading import queue import numpy as np import time q...
bot.py
import logging import threading import asyncio import unicodedata from decouple import config import discord from . import xkcd from discord.utils import get from django.core.validators import validate_email from django.core.exceptions import ValidationError from .utils import send_verify_mail intents = discord.Intent...
tkinter DESIGNER.py
from tkinter import * from tkinter.filedialog import askopenfilename from tkinter import colorchooser from pathlib import Path from tkfontchooser import askfont from os import system import sys from threading import Thread this = sys.modules[__name__] #for getattr() global class app(): def atta...
Misc.py
## @file # Common routines used by all tools # # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## # Import Modules # from __future__ import absolute_import import sys import string import threading import time import re import pickle import arr...
__main__.py
# -*- coding: utf8 -*- """ Receive messages from broker, write to a file, and deliver to server. Required: * AVOBROKER_EXCHANGE=<exchange> * AVOBROKER_USER=<user> * AVOBROKER_PASS=<pass> * AVOBROKER_HOST=<host> * WEB_HOST=<host> * PRIVATE_KEY=<key in single line> * REMOTE_USER=<remote user>...
tello_manager_daedalus.py
import threading from threading import Thread import socket import time import netifaces import netaddr from netaddr import IPNetwork from collections import defaultdict from stats import Stats import binascii import io class Tello: """ A wrapper class to interact with Tello Communication with Tello is hand...
Video.py
import os, re, math, time import numpy as np import cv2 import Op, Timecode from IO import MovieReader, OptitrackReader from GCore import Calibrate from threading import Thread import PIL from IO import Reframe class Sequence(Op.Op): def __init__(self, name='/Video Sequence', locations='/root/cameras', directory='...
main.py
import shutil import sys import zipfile from collections import defaultdict from pathlib import Path from typing import Tuple, List, Dict, Optional import os import re from urllib.request import urlretrieve, urlopen from urllib.error import HTTPError from tqdm import tqdm from multiprocessing import Queue, Process fro...
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...
backend.py
# # Copyright (c) 2021, NVIDIA 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 applicable law or agreed ...
WorkerProcess.py
# Copyright © 2017 Valentin Rosca <rosca.valentin2012@gmail.com> import datetime import threading import time from concurrent.futures import ThreadPoolExecutor import psycopg2 import psycopg2.extensions import tornado.ioloop from sqlalchemy import or_ from tornado import concurrent from DB import session_factory fro...
tests.py
# -*- coding: utf-8 -*- # Unit and doctests for specific database backends. from __future__ import unicode_literals import datetime import re import threading import unittest import warnings from decimal import Decimal, Rounded from django.core.exceptions import ImproperlyConfigured from django.core.management.color ...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def main(): return "this is working hmm" def run(): app.run(host="0.0.0.0", port=8080) def keep_alive(): server = Thread(target=run) server.start()
object_detection_multithreading.py
# Based on code by Dat Tran on towardsdatascience.com # Blog post: https://towardsdatascience.com/building-a-real-time-object-recognition-app-with-tensorflow-and-opencv-b7a2b4ebdc32 # github repository: https://github.com/datitran/object_detector_app import os import cv2 import time import argparse import numpy as np...
fs.py
import threading import sublime import codecs import threading import os from PyV8 import JSObject, JSArray, JSFunction from caniuse.v8 import getContext, convert class FileSystem: def __args(self, path, options, callback=None): if(type(options) == JSFunction or options == None): callback = options options =...
listen.py
from logging import getLogger, basicConfig, DEBUG,INFO from dbcookie import DbClient from cookiepool.settings import TEST_URL import time from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as E...
parse-iostat-output.py
import csv import numpy as np import sys from operator import attrgetter import os from pathlib import Path import socket import pandas as pd import re import socket import selectors import types import threading import struct import logging from argparse import ArgumentParser parser = ArgumentParser() parser.add_ar...
message_example.py
__author__ = 'Bojan Delic <bojan@delic.in.rs>' __date__ = 'Aug 30, 2013' __copyright__ = 'Copyright (c) 2013 Bojan Delic' import os import wpf import time from threading import Thread from mvvm import ViewModel, Notifiable, command, notifiable, List from System.Windows import Application, Window class MyView...
planar_hand_worker.py
import multiprocessing import time from qsim.simulator import QuasistaticSimParameters from qsim.system import cpp_params_from_py_params try: from irs_lqr.quasistatic_dynamics import * from zmq_parallel_cmp.array_io import * except ImportError: from irs_lqr.irs_lqr.quasistatic_dynamics import * from i...
task.py
import datetime import threading import logging import time from . import exceptions ONE_MINUTE = datetime.timedelta(minutes=1) def time_match(d, datespec): for spec in ["year", "month", "day", "weekday", "hour", "minute"]: if spec in datespec: val = datespec[spec] if type(val) is...
youtube.py
import os import socket import tempfile import time import youtube_dl import Queue import shmooze.lib.packet as packet import musicazoo.lib.vlc as vlc from shmooze.modules import JSONParentPoller from musicazoo.lib.watch_dl import WatchCartoonOnlineIE from youtube_dl.compat import compat_cookiejar, compat_urllib_re...
hackandtell-pygame.py
#!/usr/bin/env python3 from datetime import datetime import fcntl import time import os import pygame from pygame.locals import * import requests import socket from stopwatch import Stopwatch import struct import threading # from https://stackoverflow.com/a/24196955/388127 def get_ip_address(ifname): s = socket.s...
test_pooling.py
# Copyright 2009-present MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
app.py
from threading import Thread from flask import Flask, request from flask_restful import Api from app.modules.OilTank.OilTank import OilTank app = Flask(__name__) api = Api(app) api.add_resource(OilTank, '/oleo') def create_app(): global app threads_classses = [OilTank] threads = [Thread(target=thr...
streams.py
# -*- coding: utf-8 -*- # # Copyright(2021) Cobalt Speech and Language 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...
strava.py
#!/usr/bin/env python3 # Based https://raw.githubusercontent.com/honzajavorek/honzajavorek.cz/b91bcadf4dba7e83a37d431b5d78103c4b7a267c/strava.py # based on https://medium.com/swlh/using-python-to-connect-to-stravas-api-and-analyse-your-activities-dummies-guide-5f49727aac86 from datetime import timedelta, datetime from...
firmware_update.py
# -*- coding: utf-8 -*- # # Copyright 2017-2021 AVSystem <avsystem@avsystem.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 ...
email.py
from mailer import Message, Mailer from libs.ddbb import email from jinja2 import Template import queue import threading import base64 q = queue.Queue() def sender(): sender = Mailer(email.host, port=email.port, usr=email.user, pwd=email.pw, use_tls=True) while True: d = q.get() ...
SharedMemoryRunner.py
# Copyright 2017 Battelle Energy Alliance, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
test_search_vectors.py
import pdb import struct from random import sample import pytest import threading import datetime import logging from time import sleep from multiprocessing import Process import numpy import sklearn.preprocessing from milvus import IndexType, MetricType from utils import * dim = 128 collection_id = "test_search" add...
util.py
""" syslog2irc.util ~~~~~~~~~~~~~~~ Various utilities :Copyright: 2007-2021 Jochen Kupperschmidt :License: MIT, see LICENSE for details. """ import logging from logging import Formatter, StreamHandler from threading import Thread from typing import Callable def configure_logging(level: str) -> None: """Configu...
__init__.py
# -*- coding: utf-8 -*- ''' napalm-logs utilities ''' from __future__ import absolute_import from __future__ import unicode_literals # Import pythond stdlib import re import ssl import copy import time import socket import logging import threading import collections from pydoc import locate from datetime import dateti...
dumping_callback_test.py
# Copyright 2019 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...
splunk.py
import time, os, sys import logging import json import subprocess import threading import csv import requests import pprint from configparser import ConfigParser from subprocess import Popen from threading import Lock, Thread from lib.constants import FA_HOME from lib.modules import base_module from lib.splunklib imp...
test_request_safety.py
# flake8: noqa 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 ddtr...
code-server.py
import os import time import subprocess import platform import shutil import secrets from threading import Thread def main(): home = os.path.expanduser('~') if not os.path.exists(f"{home}/.ssh/id_rsa"): os.system('ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N ""') port = 8080 cs_instance ...
memcached_udp.py
# Copyright 2015 Idan Moyal. 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 agr...
irc.py
# coding=utf8 """ irc.py - An Utility IRC Bot Copyright 2008, Sean B. Palmer, inamidst.com Copyright 2012, Edward Powell, http://embolalia.net Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> Licensed under the Eiffel Forum License 2. Willie: http://willie.dftba.net/ When working on core IRC protocol related ...
main.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # mian.py # @Author : (Zack Huang) # @Link : # @Date : 12/15/2021, 11:43:57 AM import serial from time import sleep, perf_counter import logging from datetime import datetime import requests import os from enum import Enum import threading from os import listdir f...
interface_rpc.py
#!/usr/bin/env python3 # Copyright (c) 2020-2021 The Eleccoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Tests some generic aspects of the RPC interface.""" import os from test_framework.authproxy import JS...
downloader.py
# -*- coding: utf-8 -*- # # Copyright 2020 AVSystem <avsystem@avsystem.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 requi...
no_notebook.py
from .vpython import GlowWidget, baseObj, vector, canvas, _browsertype from ._notebook_helpers import _in_spyder, _undo_vpython_import_in_spyder from http.server import BaseHTTPRequestHandler, HTTPServer import os import platform import sys import threading import json import webbrowser as _webbrowser import asyncio f...
NephelaeDataServer.py
import threading import time import pickle import os from nephelae.types import NavigationRef from nephelae.types import Position from nephelae.types import SensorSample from nephelae.types import MultiObserverSubject from .SpatializedDatabase import SpatializedDatabase from .SpatializedDatabase import SpbEntry cla...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
WebSocketServer.py
""" WebSocketServer.py Author: Toki Migimatsu Created: April 2017 """ from __future__ import print_function import threading import socket import json import struct from base64 import b64encode from hashlib import sha1 class WebSocketServer: """ Basic implementation for web sockets. Usage: ws_...
data_utils.py
# Lint as python3 # 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 r...
start.py
import multiprocessing from time import sleep from datetime import datetime, time from logging import INFO from vnpy.event import EventEngine from vnpy.trader.setting import SETTINGS from vnpy.trader.engine import MainEngine from vnpy.gateway.ctp import CtpGateway from vnpy.gateway.xtp import XtpGateway from vnpy.app...
hetero_worker.py
import time import os import argparse from multiprocessing import Process import sys from ray.rllib.env.policy_client import PolicyClient SERVER_ADDRESS = os.environ.get('VC_LEARNER_HOSTS', "127.0.0.1") # "127.0.0.1" SERVER_PORT = 9999 parser = argparse.ArgumentParser() parser.add_argument("--inference-...
playerctl.py
#!/usr/bin/env python3 import sys import time from threading import Thread, Lock import tensorflow as tf from gi.repository import Playerctl, GLib import numpy as np import cv2 from ml import encoder, decoder, detect_face, model_fn, get_parser_fn class WebcamVideoStream: def __init__(self, src=0): self.s...
ShellSubprocess.py
from __future__ import print_function import pickle import base64 import subprocess import os import sys import traceback import logging import signal import threading from contextlib import contextmanager __copyright__ = 'Copyright (C) 2019, Nokia' LOGGER = logging.getLogger(__name__) PY3 = (sys.version_info.major...
test_multithreads.py
import traceback import threading import multiprocessing import numpy as np from numba import cuda from numba.cuda.testing import (skip_on_cudasim, skip_under_cuda_memcheck, CUDATestCase) import unittest try: from concurrent.futures import ThreadPoolExecutor except ImportError: ...
sender.py
import time from multiprocessing import Process from .can import Frame from .constants import DELAY from .utils import * def parse_line(line): """ line format: (timestamp) canX arb_id#data e.g. (1638179661.354936) can0 0CF00400#F07D86401FFFFFFF """ part1, part2, part3 = line.split(" ") return...
test_spark.py
import os import sys import time from typing import Iterator import threading from unittest import mock import numpy as np import pandas as pd import pytest import pyspark from pyspark.sql.types import ArrayType, DoubleType, LongType, StringType, FloatType, IntegerType from pyspark.sql.utils import AnalysisException ...
test.py
import multiprocessing import os import re import shutil import socket import subprocess import sys import time import traceback import psutil CURL = 'curl.exe -s -L -k -A "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36" -H "Accept-Language: en-US"' CURL...
FRemover.py
from google.cloud import speech_v1 as speech from pygame import mixer import time import threading import winsound import json class FRemover: def __init__(self, audiogcspath, audiopcpath): mixer.init() self.lowerwal = False self.sound = 0 self.start = time.time() ...
test_advanced.py
# coding: utf-8 from concurrent.futures import ThreadPoolExecutor import json import logging import random import sys import threading import time import numpy as np import pytest import ray import ray.cluster_utils import ray.test_utils from ray.test_utils import RayTestTimeoutException logger = logging.getLogger(...
lib.py
""" Test library. """ import difflib import inspect import json import subprocess import os import posixpath import shlex import shutil import string import threading import urllib #import time import SocketServer import SimpleHTTPServer class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): ...
test_serialization.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
workflow_event_manager.py
# Copyright 2022 The AI Flow Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
test_sys.py
import unittest, test.support from test.support.script_helper import assert_python_ok, assert_python_failure import sys, io, os import struct import subprocess import textwrap import warnings import operator import codecs import gc import sysconfig import locale import threading # count the number of tes...
bwt.py
import subprocess import threading import platform import socket import os import re from electrum import constants from electrum.bip32 import BIP32Node from electrum.plugin import BasePlugin, hook from electrum.i18n import _ from electrum.util import UserFacingException from electrum.logging import get_logger from el...
TestManager.py
#!/usr/bin/env python from __future__ import print_function # -*- coding: utf-8 -*- __author__ = "Rastislav Szabo <raszabo@cisco.com>, Lukas Macko <lmacko@cisco.com>" __copyright__ = "Copyright 2016, Cisco Systems, Inc." __license__ = "Apache 2.0" # Licensed under the Apache License, Version 2.0 (the "License"); # yo...
modsupportbot.py
import os import re import threading import simpleaudio from twitchio.ext import commands DEBUG = False bot = commands.Bot( irc_token = os.environ['TMI_TOKEN'], client_id = os.environ['CLIENT_ID'], nick = os.environ['BOT_NICK'], prefix = os.environ['BOT_PREFIX'], initial_channels = [os.envir...
variable_scope_test.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...
manager.py
#!/usr/bin/env python3.7 import os import time import sys import fcntl import errno import signal import shutil import subprocess import datetime from common.basedir import BASEDIR, PARAMS from common.android import ANDROID sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR TOTAL_SCONS_...
_channel.py
# Copyright 2016 gRPC 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 writing...
Executor.py
from threading import Event, Thread from abc import ABC, abstractmethod class Executor(ABC): @property def subproc(self): return self._subproc @subproc.setter def subproc(self, value): self._subproc = value @property def output(self): return self._output.decode().stri...
initial_inbound_sync.py
#! /usr/bin/env python3 # Copyright 2019 Contributors to Hyperledger Sawtooth # # 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 re...
dl_instagram.py
#!/usr/bin/python #enconding: utf-8 # /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ # _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ # /_/_/_/_/ _/_/_/_/_/ # _/_/_/_/ _____ ____ _ ___ ___ _ __ _/_/_/_/_/ # /_/_/_/ / __ \/ __ \/ |/ / __ |/ \ ...
multithread_context_test.py
# -*- encoding = utf-8 -*- """ 测试原理 定义2个进程、2个Queue p1 p2初始化token p1 通过Queue1传递 token 到 p2 p2 通过Queue2传递 token 到 p1 """ import queue import threading def test_thread_context_switch(): """多线程上下文切换成本 """ def pass_token1(queue1, queue2): for i in range(100000): queue2.put(0) ...
spider.py
import requests from urllib.parse import urlparse import threading import time from webpt.response_analysis import find from webpt.any import isalive requests.packages.urllib3.disable_warnings() # noqa class Dict(dict): def __getattr__(self, item): pass class Spider: def __init__(self, url=None, hea...
worker_base.py
""" Helper methods constant across all workers """ import requests, datetime, time, traceback, json, os, sys, math, logging from logging import FileHandler, Formatter, StreamHandler from multiprocessing import Process, Queue import sqlalchemy as s import pandas as pd from pathlib import Path from urllib.parse import ur...
views.py
import datetime from mcipc.rcon.je import Client from mcipc.query import Client as Client_q from mcipc.rcon.errors import * from .models import * from django.shortcuts import render, redirect from django.http import HttpResponse from django.template import loader from django.contrib.auth.decorators import login_requ...
saltmod.py
""" Control the Salt command interface ================================== This state is intended for use from the Salt Master. It provides access to sending commands down to minions as well as access to executing master-side modules. These state functions wrap Salt's :ref:`Python API <python-api>`. .. versionadde...
decorators.py
from flask import redirect, url_for, flash, session from functools import wraps from threading import Thread def login_required(f): @wraps(f) def wrap(*args, **kwargs): if 'logged_in' in session: return f(*args, **kwargs) else: flash('You need to login first') ...
client2.py
import asyncio import curses import threading from curses import wrapper from queue import Queue import discord import discord.ext.commands from discord.channel import TextChannel from discord.ext import tasks from discord.ext.commands import Bot # TODO: # - curses func for recording keyboard input # - curses func ...
pyrgos_main_window.py
import tkinter from tkinter import ttk, messagebox from tkinter.scrolledtext import ScrolledText import os import sys import subprocess import threading root = tkinter.Tk() root.wm_title("Pyrgos") root.resizable(width='TRUE', height='TRUE') root.wm_geometry("%dx%d%+d%+d" % (720, 480, 0, 0)) tree = ttk.Treeview(root)...
SentenceTransformer.py
import json import logging import os import shutil from collections import OrderedDict from typing import List, Dict, Tuple, Iterable, Type, Union, Callable from zipfile import ZipFile import requests import numpy as np from numpy import ndarray import transformers import torch from torch import nn, Tensor, device from...
cp_f.py
import scapy_http.http import scapy.all as scapy import scapy import string as string import socketserver import time import threading from collections import defaultdict threaten=False ip_th="" dic = defaultdict(list) dic_believing=defaultdict(list) def cp(): print("抓包线程启动") while 1: dpkt = scapy.al...
Client.py
from socket import * import threading import struct def recvmsg(client): while True: try: recvheader = client.recv(4) size = struct.unpack('i', recvheader)[0] recv_size = 0 recvdata = b'' while recv_size < size: data ...
debug_ext.py
import json import os import sys import subprocess import shlex import time import re from threading import Thread import threading from idf_py_actions.errors import FatalError from idf_py_actions.tools import ensure_build_directory PYTHON = sys.executable def action_extensions(base_actions, project_path): OPEN...
state_connection.py
# Copyright 2020 Norwegian University of Science and Technology. # # 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 appl...