source
stringlengths
3
86
python
stringlengths
75
1.04M
zmq_server.py
import zmq import struct import ipaddress import binascii import threading def reqrep_server(context): socket = context.socket(zmq.REP) socket.bind("tcp://*:5556") while True: try: message = socket.recv() print("Received request:" + str(message)) if message ==...
engine.py
""" """ import logging from logging import Logger import smtplib import os import sys from abc import ABC from datetime import datetime from email.message import EmailMessage from queue import Empty, Queue from threading import Thread from typing import Any, Sequence, Type, Dict, List, Optional from vnpy.event import...
validate.py
#!/usr/bin/env python3 import argparse import os, atexit import textwrap import time import tempfile import threading, subprocess import barrier, finishedSignal import signal import random import time from enum import Enum from collections import defaultdict, OrderedDict BARRIER_IP = "localhost" BARRIER_PORT = 10...
main.py
import logging from logging.handlers import RotatingFileHandler from multiprocessing import Process import combined_equipment_energy_input_category import combined_equipment_energy_input_item import combined_equipment_energy_output_category import combined_equipment_billing_input_category import combined_equipment_b...
test_admin_integration.py
import pytest from logging import info from test.testutil import env_kafka_version, random_string from threading import Event, Thread from time import time, sleep from kafka.admin import ( ACLFilter, ACLOperation, ACLPermissionType, ResourcePattern, ResourceType, ACL, ConfigResource, ConfigResourceType) from kafk...
test_state.py
""" Tests for the state runner """ import errno import logging import os import queue import shutil import signal import tempfile import textwrap import threading import time import salt.exceptions import salt.utils.event import salt.utils.files import salt.utils.json import salt.utils.platform import salt.utils.stri...
test_worker.py
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import json import os import shutil import signal import subprocess import sys import time import zlib from datetime import datetime, timedelta from multiprocessing import Process from ...
lisp-etr.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...
association_item.py
# -*- coding: future_fstrings -*- """ This module defines a single AssociationItem in the AssociationsPanel. """ from threading import Thread from PySide2.QtWidgets import QComboBox from xdgprefs.gui.mime_item import MimeTypeItem class AssociationItem(MimeTypeItem): def __init__(self, mime_type, apps, main_w...
amazon.py
#!/usr/bin/env python import base64 import os import boto3 from datetime import datetime from threading import Thread from botocore.exceptions import ProfileNotFound from lxml import etree from aws_google_auth.google import ExpectedGoogleException class Amazon: def __init__(self, config, saml_xml): s...
megaphone.py
#!/usr/bin/env python """Megaphone is an alerting consolidation service.""" import json import sys import os import re from bottle import Bottle import time import urllib2 import shutil import bottle from ConfigParser import SafeConfigParser import logging import multiprocessing logging.basicConfig() app = Bottle() ...
util.py
"""Test utilities. .. warning:: This module is not part of the public API. """ import logging import multiprocessing import os import pkg_resources import shutil import stat import tempfile import unittest import sys from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import ...
create_test_data_file_from_bt.py
import serial import time import platform import csv import threading import zephyr.protocol import zephyr.message def callback(x): print x def reading_thread(protocol): start_time = time.time() while time.time() < start_time + 120: protocol.read_and_handle_byte() ...
concurren-futures.py
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor import multiprocessing from multiprocessing.pool import ThreadPool import threading import time def bar(i=0): if i == 0: raise ValueError("bar raise") return i ** 2 def main_Thread(): thread = threading.Thread(target=bar) ...
app.py
import logging import helper import json from datetime import datetime, timedelta import os import sys from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore from telegram import InlineKeyboardButton, InlineKeyboardMarkup from queue import Queue...
exercise8.py
#!/usr/bin/env python ''' Exercise 8 - Class 8 - Thread connection to each device and run the command Gleydson Mazioli <gleydsonmazioli@gmail.com> ''' from net_system.models import NetworkDevice import netmiko import django import time from multiprocessing import Process, Queue def get_cred_type(l_credentials, l_type...
learn.py
# # Unity ML-Agents Toolkit import logging import argparse from multiprocessing import Process, Queue import os import glob import shutil import numpy as np from typing import Any, Callable, Optional, List, NamedTuple from mlagents.trainers.trainer_controller import TrainerController from mlagents.trainers.exceptio...
ED_scan.py
""" Copyright (c) 2017, Arm Limited and affiliates. SPDX-License-Identifier: Apache-2.0 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 requir...
environment.py
# Copyright 2020 Tensorforce Team. 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 la...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2019 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 carpinchod shutdown.""" from test_framework.test_framework import CARPINCHOTestFramework from tes...
util.py
from __future__ import print_function # For * ** import sys import os def runsep(method, args): # Run and retrieve process's stdout def queue_wrapper(q, params): r = method(*params) q.put(r) q = Queue() p = Process(target=queue_wrapper, args=(q, args)) p.start() return_val = q.get() p.join() return return_v...
padding_fifo_queue_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...
server.py
#!/usr/bin/python3 import socket import struct import threading import picamera import camera import time import datetime #TODO : need to redo following code from pwm import Motors from common import * from debug import * from comms_packet_structure import * from external_processes import * BUFFER_SIZE = 20 BUFFER_F...
taricapi.py
from gevent import monkey # noqa: E402 # pylint: disable=C0411, C0412, C0413 monkey.patch_all() # noqa: E402 # pylint: disable=C0411, C0413 import click import datetime import hashlib import io import json from logging.config import dictConfig import re import signal import sys import threading import uuid from...
test_search.py
import time import pdb import copy import logging from multiprocessing import Pool, Process import pytest import numpy as np from pymilvus import DataType from utils import * from constants import * uid = "test_search" nq = 1 epsilon = 0.001 field_name = default_float_vec_field_name binary_field_name = default_binary...
autologin2.py
import time import pythoncom from manuallogin import * from PyQt5 import QtWidgets from PyQt5.QtCore import QTimer from multiprocessing import Process from PyQt5.QAxContainer import QAxWidget sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from utility.setting import openapi_path class Wi...
cleanup.py
""" sentry.runner.commands.cleanup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import os from datetime import timedelta from uuid import uuid4 import click...
filesystemio_test.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...
lims_image_tracing.py
__author__ = 'coriannaj' ### import os import subprocess, threading import pandas as pd import math import re from lims_access import get_mip V3D = "/data/mat/xiaoxiaol/work/bin/bin_vaa3d_for_clusters/start_vaa3d.sh" class Command(object): def __init__(self, cmd): self.cmd = cmd self.process = ...
master_list_model.py
# Software License Agreement (BSD License) # # Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko # 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 mus...
server.py
import socket import asyncio import os import sys import threading import time import nn import ga import pickle from const import * from pygame.locals import * import pygame import subprocess from player import * import game from multiprocessing.pool import ThreadPool import time def listenCommunication(clientSocket)...
engine.py
# encoding: UTF-8 # 通达信指数行情发布器 # 华富资产 import copy import json import traceback from threading import Thread from datetime import datetime, timedelta from time import sleep from logging import ERROR from pytdx.exhq import TdxExHq_API from copy import deepcopy from vnpy.event import EventEngine from vnpy.trader.consta...
test_utils.py
# -*- encoding:utf-8 -*- # Copyright (c) Alibaba, Inc. and its affiliates. """Contains functions which are convenient for unit testing. isort:skip_file """ from future import standard_library standard_library.install_aliases() import yaml import glob import json import logging import os import random import shutil imp...
saltmod.py
# -*- coding: utf-8 -*- ''' 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-ap...
_app.py
""" websocket - WebSocket client library for Python Copyright (C) 2010 Hiroki Ohtani(liris) This library 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 Foundation; either version 2.1 of the License, ...
units.py
#!/usr/bin/env python3 # # units.py - Units test harness for ctags # # Copyright (C) 2019 Ken Takata # (Based on "units" written by Masatake YAMATO.) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Found...
dev_test_full_non_stop.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: dev_test_full_non_stop.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api # Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api # PyPI: https://py...
multiprocessing.py
import sys import multiprocessing.pool from multiprocessing import Manager from threading import Thread from typing import Sequence, Iterable, Any from coba.config import CobaConfig, IndentLogger, CobaFatal from coba.pipes import Filter, Sink, Pipe, StopPipe, QueueSource, QueueSink super_worker = mul...
__init__.py
import sublime import os import sys import imp import re import json from collections import OrderedDict from threading import Thread, Lock from time import time from queue import Queue from ..add_path import add_path from .helpers import is_auxiliary_view from .responses import ResponseThreadPool, prepend_library ...
common.py
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python import json import yaml import logging import os import re import subprocess import stat import urllib.parse import threading import contextlib import tempfile import psutil from functools import reduce, wraps from decimal import Decimal # Django fro...
test_operator_gpu.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_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....
test_gui.py
# This file is part of the Extra-P software (http://www.scalasca.org/software/extra-p) # # Copyright (c) 2020, Technical University of Darmstadt, Germany # # This software may be modified and distributed under the terms of a BSD-style license. # See the LICENSE file in the base directory for details. import sys import...
test_wfp.py
# pylint: disable=protected-access, unused-argument # pylint: disable=no-value-for-parameter import os from unittest import TestCase # from hypothesis import given, settings, strategies as st import threading as mt import time from radical.entk.appman.wfprocessor import WFprocessor from radical.entk ...
test_psp.py
import sys import time import threading import logging import pytest import numpy as np import psp from conftest import test_pvs, pvbase if sys.version_info.major >= 3: long = int logger = logging.getLogger(__name__) def setup_pv(pvname, connect=True): pv = psp.PV(pvname) if connect: pv.connect(...
main_window.py
# -*- coding: utf-8 -*- from PyQt5.QtWidgets import QMainWindow from PyQt5 import QtWidgets, QtCore from qt_figure import QtFigure from http_server import flask import socket import multiprocessing import threading import re class MyPushButton(QtWidgets.QPushButton): is_clicked = False class MyMainWindow(QMainW...
generate.py
"""Collection of functions to generate data""" import multiprocessing import os from glob import glob import numpy as np from torchvision.utils import save_image from tqdm import tqdm from src.data.raw import Raw from src.features import transform from src.utils import path def _triplets(dataset: Raw, n_triplets: ...
main.py
from fastapi import FastAPI, Response from starlette.status import HTTP_204_NO_CONTENT import uuid, random, requests, json, hashlib, os, rsa, sys, datetime, trace, time, logging from threading import Thread from queue import PriorityQueue from Crypto.PublicKey import RSA from pydantic import BaseModel from typing impor...
hserv.py
from http.server import BaseHTTPRequestHandler, HTTPServer from threading import Thread import time import cgi import os import sys import subprocess if len(sys.argv) != 2: print("python3 hserv.py password") sys.exit(0) class WebServer(BaseHTTPRequestHandler): def do_GET(self): if self.path == "/":...
lint_check.py
from __future__ import print_function import subprocess import xml.dom import xml.dom.minidom import re import os import os.path from optparse import OptionParser from collections import namedtuple from . import monitor from . import webserver import json try: import urlparse except ModuleNotFoundError: from ...
armrunner.py
""" Terminal Runner class """ __author__ = "Bruno Chianca Ferreira" __license__ = "MIT" __version__ = "0.5" __maintainer__ = "Bruno Chianca Ferreira" __email__ = "brunobcf@gmail.com" import traceback, os, logging, time, subprocess, threading from classes.runner.runner import Runner from core.nodes.base import Core...
_task.py
"""ESMValtool task definition""" import contextlib import datetime import errno import logging import numbers import os import pprint import subprocess import threading import time from multiprocessing import Pool, cpu_count import psutil import yaml logger = logging.getLogger(__name__) DATASET_KEYS = { 'mip', }...
smartGarden.py
import threading from datetime import datetime from datetime import timedelta import os import zipfile import logging from GardenModules.luxSensor.luxSensor import LuxSensor from GardenModules.pump.pump import WaterPump from GardenModules.soilMoisture.soil import SoilMoisture from GardenModules.gardenServer.gardenServe...
distributors.py
from __future__ import absolute_import from __future__ import unicode_literals import Queue import logging import threading import collections import multiprocessing from buckshot import errors from buckshot import lockutils from buckshot import constants from buckshot.workers import TaskWorker from buckshot.tasks im...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2021 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test multiwallet. Verify that a syscoind node can load multiple wallet files """ from decimal import D...
profile_pictures.py
import logging import os from threading import Thread import requests from kik_unofficial.device_configuration import kik_version_info from kik_unofficial.datatypes.exceptions import KikApiException, KikUploadError from kik_unofficial.utilities.cryptographic_utilities import CryptographicUtils from kik_unofficial.util...
bmkit_load_csv_mp.py
import pandas as pd import csv from progressivis import Scheduler from progressivis.io import CSVLoader from progressivis.table.constant import Constant from progressivis.table.table import Table from progressivis.datasets import get_dataset from benchmarkit import BenchMarkIt import sys import os import os.path import...
tsetmp.py
__about__="Multiprocessing Example" import multiprocessing def calc_squares(n): for x in n: print("Square of:"+str(x)+":is:",x*x) def calc_cube(n): for y in n: print("Cubes of:"+str(y)+":is:",y*y*y) if __name__=='__main__': arr = [1,2,3,4,5,6,7] p1 = multiprocessing.Process(target=ca...
plugin.py
# Domoticz WiZ connected Plugin # # Author: Syds Post sydspost@gmail.com # Color bulbs support & UDP discovery by Faust93 monumentum@gmail.com # """ <plugin key="wiz" name="WiZ connected" author="Syds Post" version="1.0.0" wikilink="" externallink="https://www.wizconnected.com/"> <description> <h2>WiZ conne...
1_disc_golf_range.py
import threading from threading import Thread, Semaphore, Lock import random from time import sleep #configurable variables STASH = 25 BUCKET_SIZE = 5 NUM_FROLFERS = 5 #Locking Structures stashLock = Lock() fieldLock = Lock() stashEmpty = Semaphore(0) stashFull = Semaphore(0) #other global vars discs_on_field = 0 rn...
__init__.py
# Copyright 2017 Mycroft AI Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
timer.py
import threading import time tLock = threading.Lock() def timer(name, delay, repeat): print "Timer" + name + ": Started." tLock.acquire() print "Timer" + name + ": has acquire the lock." while repeat > 0: time.sleep(delay) print "Timer" + name + ": " + str(time.ctime(time.time())) ...
kMedoids_parallel.py
# new code in this file from kMedoidsClustering.py Written by Matteo Bjornsson #################################################################### MODULE COMMENTS ############################################################################ # This file is a mirror of kMedoidsClustering.py but with much of the distorti...
val.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Validate a trained YOLOv5 model accuracy on a custom dataset Usage: $ python path/to/val.py --weights yolov5s.pt --data coco128.yaml --img 640 Usage - formats: $ python path/to/val.py --weights yolov5s.pt # PyTorch ...
utils.py
import os import threading from io import StringIO from kivy.clock import mainthread from kivy.lang import Builder from kivy.metrics import dp from kivy.uix.boxlayout import BoxLayout from kivy.utils import platform from kivymd.dialog import MDDialog from kivymd.label import MDLabel from kivymd.snackbar import Snackba...
test_client.py
import asyncio import contextlib import functools import gc import inspect import logging import os import pickle import random import subprocess import sys import threading import traceback import warnings import weakref import zipfile from collections import deque from contextlib import suppress from functools import...
pixiv.py
#!/usr/bin/env python3 """ pixiv Usage: pixiv.py pixiv.py <id>... pixiv.py -r [-d | --date=<date>] pixiv.py -u Arguments: <id> user_ids Options: -r Download by ranking -d <date> --date <date> ...
word2vec_optimized.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...
__init__.py
from __future__ import annotations import collections from datetime import datetime from functools import wraps import operator import os import re import string from typing import ( TYPE_CHECKING, Callable, ContextManager, Counter, Iterable, List, Type, ) import warnings import numpy as n...
async_.py
# Copyright 2018, OpenCensus 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 w...
engine.py
import copy import json import os import subprocess import threading import time import traceback from typing import Callable, Optional, Dict from katrain.core.constants import OUTPUT_DEBUG, OUTPUT_ERROR, OUTPUT_EXTRA_DEBUG, OUTPUT_KATAGO_STDERR from katrain.core.game_node import GameNode from katrain.core.lang import...
worker.py
"""Embedded workers for integration tests.""" from __future__ import absolute_import, unicode_literals import os import threading from contextlib import contextmanager from celery import worker from celery.result import _set_task_join_will_block, allow_join_result from celery.utils.dispatch import Signal from celery....
test_interface.py
from future.standard_library import install_aliases install_aliases() import tests str(tests) from time import sleep import requests from littleutils import only from selenium.webdriver import ActionChains from selenium.webdriver.chrome.options import Options from birdseye import eye import unittest from threading ...
base_events.py
"""Base implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a c...
compute.py
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import networkx as nx import time import random from tqdm import tqdm import argparse plt.style.use('ggplot') import multiprocessing as mp from sklearn.metrics import roc_curve, roc_auc_score, confusion_matrix parser = argparse.ArgumentParser(...
web.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...
Bitcoin_randomCPU_Divison.py
''' Made by Mizogg Look for Bitcoin Compressed and Uncompressed 3 bc1 Using iceland2k14 secp256k1 https://github.com/iceland2k14/secp256k1 fastest Python Libary Good Luck and Happy Hunting Bitcoin_randomCPU_Divison.py Version 1 scan randomly in Range Divsion with CPU Speed Improvments https://mizogg.co.uk '...
query_optimizer.py
""" This file composes the functions that are needed to perform query optimization. Currently, given a query, it does logical changes to forms that are sufficient conditions. Using statistics from Filters module, it outputs the optimal plan (converted query with models needed to be used). To see the query optimizer pe...
thread_manager.py
from threading import Thread class ThreadsManager: def __init__(self): self.results = [] self.thread_pool = [] def init_thread_pool(self, query, crawlers): """ Method to create threads and assign crawlers to each of the threads. Each thread then will start processing ...
wsdump.py
#!/usr/bin/python import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding = getattr(sys.stdin, "encoding", "") if not encoding: ...
test_transport.py
# # 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, software # distributed under ...
api.py
import core.rest_server import time import sys import os DESCRIPTION = "turn off/on the rest api" def autocomplete(shell, line, text, state): return None def help(shell): pass def execute(shell, cmd): splitted = cmd.split() if len(splitted) > 1: username = "koadic" password = "koad...
train.py
#!/usr/bin/env python import argparse import importlib import json import os import pprint import queue import random import threading import traceback import numpy as np import torch from torch.multiprocessing import Pool, Process, Queue from tqdm import tqdm from config import system_configs from db.datasets import...
Collector.py
import requests import threading from queue import Queue from lxml import html import time class Collector(): itemsToCheck = ['#', 'File:', '_(disambiguation)', 'Template:', 'Category:', 'Wikipedia_talk:'] def __init__(self, url): self.startUrl = url self.seen = [] self.queue = Queue()...
yt.py
import json from apiclient.discovery import build_from_document, build import httplib2 import random import time import os from oauth2client.client import OAuth2WebServerFlow, AccessTokenCredentials from flask import Flask, render_template, session, request, redirect, url_for, abort, jsonify, Response from flask_socke...
hentairoxdl.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # script by HYOUG from argparse import ArgumentParser from os import listdir, makedirs, remove from os.path import basename, exists, join from threading import Lock, Thread from time import sleep, time from zipfile import ZIP_DEFLATED, ZipFile from bs4 import Be...
client.py
import os import subprocess import time from PIL import ImageGrab import tempfile import shutil import socket import threading import pyaudio import wave import cv2 import operator import collections from modules import persistent from modules import serverdiscovery from modules import key...
main.py
# Copyright 2020 Google Research. 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...
Thread.py
import time, threading def loop(): print(" thread %s is begin runging" %(threading.current_thread().name)) print(" thread %s run %d" % (threading.current_thread().name,i)) time.sleep(1) print(" thread %s run %d end" % (threading.current_thread().name,i)) if __name__ =='__main__': print(" thread %s i...
transport.py
import socket import threading from . import api def send_flows(config: api.Config) -> None: src = socket.socket(socket.AF_PACKET, socket.SOCK_RAW) dst = socket.socket( socket.AF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0003) ) f = config.flows[0] src.bind((f.src_port, 0)) dst.bind((...
python_input.py
""" Application for reading Python input. This can be used for creation of Python REPLs. """ import __future__ import threading from asyncio import get_event_loop from functools import partial from typing import TYPE_CHECKING, Any, Callable, Dict, Generic, List, Optional, TypeVar from prompt_toolkit.application impor...
schedule.py
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: leeyoshinari import queue from threading import Thread from testing import Testing class Scheduler(object): def __init__(self): self.testing = Testing() self.test_task = queue.Queue() # 创建队列 t = Thread(target=self.worker...
preview_camerax.py
# An implementation of Android CameraX called from a Kivy Preview widget. # # About CameraX: # https://developer.android.com/training/camerax # Tested devices: # https://developer.android.com/training/camerax/devices # # Source # https://github.com/Android-for-Python/Camera4Kivy/preview_camerax.py # from kivy.cl...
presubmit_support.py
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Enables directory-specific presubmit checks to run at upload and/or commit. """ from __future__ import print_function __versio...
manage.py
import os from multiprocessing import Process from datetime import datetime from time import sleep def run(): file_path = os.getcwd() + "/serve.py" # for sudo user # os.system(f'echo "your password in here" |sudo -S python3.7 {file_path}') # for general user os.system(f'python3.7 {file_path}') ...
emails.py
# -*- coding: utf-8 -*- """ :author: perfectbullet :url: :copyright: © 2018 :license: MIT, see LICENSE for more details. """ from threading import Thread from flask import current_app, render_template from flask_mail import Message from albumy.extensions import mail def _send_async_mail(app, message...
youtube-dl-server.py
from __future__ import unicode_literals import json import os import subprocess from queue import Queue from bottle import route, run, Bottle, request, static_file from threading import Thread import youtube_dl from pathlib import Path from collections import ChainMap app = Bottle() app_defaults = { 'YDL_FORMAT'...
threaded_simulator.py
from multiprocessing import Process, cpu_count, Value from simulator import Simulator import pickle import os import shutil class ThreadedSimulator: def __init__(self, config): self.runs = config["runs"] self.config = config print("You have " + str(cpu_count()) + " cores.") print("...
main.py
import socket import ssl import threading import select import re import os import subprocess import time from binascii import hexlify, unhexlify from base64 import b64encode from seth.args import args from seth.parsing import * import seth.consts as consts class RDPProxy(threading.Thread): """Represents the RDP...
view.py
#!/usr/bin/python3 # -*- coding:utf-8 -*- import math import os import random import string import threading import time from flask import url_for, render_template, request, flash, send_from_directory from flask_login import login_required, current_user from werkzeug.utils import redirect from . import m...