source
stringlengths
3
86
python
stringlengths
75
1.04M
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Fujicoin 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 with...
updated_Display_Run.py
import cv2 import _thread import time import socket import base64 import numpy import multiprocessing as mp from luma.core.interface.serial import i2c from luma.core.render import canvas from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106 from time import sleep from PIL import Image full_Data = b'' TCP_IP =...
perf.py
#!/usr/bin/python3 import argparse import clickhouse_driver import itertools import functools import math import os import pprint import random import re import statistics import string import sys import time import traceback import logging import xml.etree.ElementTree as et from threading import Thread from scipy imp...
supervisor.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...
_algorithm.py
''' Copyright (c) 2018 by Tobias Houska This file is part of Statistical Parameter Optimization Tool for Python(SPOTPY). :author: Tobias Houska This file holds the standards for every algorithm. ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function from __futu...
test_communicator.py
import unittest import torch import os from bagua.torch_api.communication import ( init_bagua_communicator, allreduce, send, recv, allgather, ) from tests.internal.common_utils import find_free_port import multiprocessing import bagua.torch_api as bagua import threading import time from tests import...
front.py
# coding=utf-8 """ 这是对微信的接口 运行的应该是此脚本! 关于itchat的资料:http://www.tuicool.com/articles/VJZRRfn ;GitHub:https://github.com/littlecodersh/ItChat """ import os import random import threading import time import itchat from itchat.content import * from code import main from code.modules.voice import * ROBOT_NAME = 'Cherry' ...
RNodeInterface.py
from .Interface import Interface from time import sleep import sys import serial import threading import time import math import RNS class KISS(): FEND = 0xC0 FESC = 0xDB TFEND = 0xDC TFESC = 0xDD CMD_UNKNOWN = 0xFE CMD_DATA = 0x00 ...
app.py
#!/usr/bin/env python #Pyjsdl - Copyright (C) 2021 #Released under the MIT License """ Pyjsdl App Script launches HTML app on desktop using Gtk/Webkit. Copy app script to the application root and optionally rename. Run the script once to create an ini file and edit to configure. Tested under Linux Gnome desktop wit...
server.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...
bm_float.py
""" Artificial, floating point-heavy benchmark originally used by Factor. """ from six.moves import xrange import multiprocessing as mp from mpkmemalloc import * import os import gc import threading import psutil import pyperf from math import sin, cos, sqrt POINTS = 100000 class Point(object): __slots__ = ('x...
ContextTest.py
########################################################################## # # Copyright (c) 2012, John Haddon. 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 so...
val.py
"""Validate a trained YOLOv5 model accuracy on a custom dataset Usage: $ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640 """ import argparse import json import os import sys from pathlib import Path from threading import Thread import numpy as np import torch import yaml from tqdm import...
sltrx.py
import os import math import sys import telegram_send import threading import importlib import glob from colorama import init init() from binance.client import Client from binance.exceptions import BinanceAPIException from requests.exceptions import ReadTimeout, ConnectionError from datetime import date, datetime, tim...
processing.py
# Examples: # python processing.py -i 192.168.0.12 -o 8002 -s http://192.82.150.11:8083/mjpg/video.mjpg -c a -m ipcam # python processing.py -i 192.168.0.12 -o 8002 -s https://youtu.be/5JJu-CTDLoc -c a -m video # python processing.py -i 192.168.0.12 -o 8002 -s my_video.avi -c a -m video # python processing.py -i 192.16...
StreamDeck.py
# Python Stream Deck Library # Released under the MIT license # # dean [at] fourwalledcubicle [dot] com # www.fourwalledcubicle.com # import threading class DeviceManager(object): """ Central device manager, to enumerate any attached StreamDeck devices. An instance of this class mu...
basestrat.py
import multiprocessing as mp import time import threading import datetime ''' How to use: use the longshort class as an example. In the __init__ funciton, include a call to super().__init__(pipe,logger,alpaca) this will take care of the pipeline creation To send a message to the user directly, use self.talk() To sto...
gatewayTogglerClient1.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'gatewayToggler.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! import socket import sys import threading from PyQt5 import QtCore, QtGui, QtWidgets from config import DeviceConf...
elm_car_simulator.py
#!/usr/bin/env python3 """Used to Reverse/Test ELM protocol auto detect and OBD message response without a car.""" import sys import os import struct import binascii import time import threading from collections import deque sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")) from panda i...
doctor.py
import socket import threading import pyaudio import sys class Client: def __init__(self): self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) while 1: try: self.target_ip = input('Enter IP address of server --> ') self.target_port = int(i...
multiprocess.py
import time from multiprocessing import Process,Manager,Value class test: def __init__(self): self.manager = Manager() # self.cache = self.manager.list() self.token = self.manager.Value('i',0) self.s_time = time.time() def func1(self): while True: self.token...
mestre.py
#!/usr/bin/python import subprocess import shlex import string import time import itertools import os import urllib import json import urllib2 import types from pprint import pprint from threading import Thread from escravo import GerenciadorEscravo # pertence ao no Mestre class ProcessoDesc: id = 0 init_time...
datastore.py
#============================================================================== # datastore.py # Buffering, caching and batch functions for access to the Exosite Data # Platform using the JSON RPC API over HTTP. # This layer was written so that a system with many subcriber/provider tasks # could simulataneously access ...
main.py
############################################## # sudo apt-get install -y python3-picamera # sudo -H pip3 install imutils --upgrade ############################################## import sys import numpy as np import cv2, io, time, argparse, re from os import system from os.path import isfile, join from time import slee...
A3C_discrete_action.py
""" Asynchronous Advantage Actor Critic (A3C) with discrete action space, Reinforcement Learning. The Cartpole example. View more on my tutorial page: https://morvanzhou.github.io/tutorials/ Using: tensorflow 1.8.0 gym 0.10.5 """ import multiprocessing import threading import tensorflow as tf import numpy as np imp...
liqui.py
from befh.restful_api_socket import RESTfulApiSocket from befh.exchanges.gateway import ExchangeGateway from befh.market_data import L2Depth, Trade from befh.util import Logger from befh.instrument import Instrument from befh.clients.sql_template import SqlClientTemplate from functools import partial from datetime impo...
functionprofiler.py
#!/usr/bin/env python # # # TODO: # - implement cProfile or yappi, or use threading.setProfile and sys.setProfile, or implement one's own multi-threaded profiler: # http://code.google.com/p/yappi/ # http://code.activestate.com/recipes/465831-profiling-threads/ # http://effbot.org/librarybook/sys.htm # # # CHANGELOG: #...
test_randomstate.py
import hashlib import pickle import sys import warnings import numpy as np import pytest from numpy.testing import ( assert_, assert_raises, assert_equal, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings ) from numpy.random import MT199...
test_core.py
""" tests.test_core ~~~~~~~~~~~~~~~ Provides tests to verify that Home Assistant core works. """ # pylint: disable=protected-access,too-many-public-methods # pylint: disable=too-few-public-methods import os import signal import unittest from unittest.mock import patch import time import threading from datetime import ...
Thread.py
import threading import time def saygi(num): print("running on number:%s" %num) time.sleep(3) if __name__ == '__main__': t1 = threading.Thread(target=saygi, args=(1,)) t2 = threading.Thread(target=saygi, args=(2,)) t1.start() t2.start() print(t1.getName()) print(t2.getName()) class M...
Hover.py
#!/usr/bin/env python ​ import rospy import numpy as np import tf from crazyflie_driver.msg import Hover from std_msgs.msg import Empty from crazyflie_driver.srv import UpdateParams from threading import Thread from geometry_msgs.msg import PoseStamped class Crazyflie: def __init__(self, prefix): self.prefi...
radiomanager.py
# -*- coding: utf-8 -*- import pyric import pyric.pyw as pyw import yaml import pprint import argparse import gfiwscan from time import sleep from multiprocessing import Process cardprocesslist=[] def interface_handler(interface_name): newhandler = gfiwscan.IWScanner(iface_name=interface_name) while True: ...
obfuscation.py
import helpers.common as common from multiprocessing import Process import helpers.io as io import math statTypes = ["numLines", "numWhitespace", "numComments", "avgIdentLength", "numFunctions", "numDefines", "numMathOps", "lenLongestLine", "numReturns"] # finds the mean of the data def getMean(data, key): total = 0...
ubxstreamer.py
""" Example implementation of a threaded UBXMessage streamer Connects to the receiver's serial port and sets up a threaded UBXReader process. With the reader process running in the background, it polls the current PRT, USB, NMEA and MSG configuration. You should see the poll responses in the input stream, or...
labutils.py
''' This software was created by United States Government employees at The Center for Cybersecurity and Cyber Operations (C3O) at the Naval Postgraduate School NPS. Please note that within the United States, copyright protection is not available for any works created by United States Government employees, pursuan...
app.py
import os import sys import logging import pika import threading import schedule import time from flask import Flask, make_response, request, jsonify, g from src.database.pg import connect_to_db as connect_to_db from src.credit_card.controllers import credit_card as cc_controllers from src.payment.controllers import ...
test_integration.py
import os import signal import threading from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from subprocess import Popen from subprocess import check_output from unittest import TestCase from urllib.parse import parse_qs from urllib.parse import urlparse import pytest from brotab.api im...
rtcmserial.py
""" rtcmpoller.py This example illustrates a simple implementation of a 'pseudo-concurrent' threaded RTCMMessage streaming utility. (NB: Since Python implements a Global Interpreter Lock (GIL), threads are not truly concurrent.) It connects to the receiver's serial port and sets up a RTCMReader read thread...
1.py
from multiprocessing import Process, freeze_support def f(): print('hello world!') if __name__ == '__main__': freeze_support() Process(target=f).start()
demo2.py
# -*- coding: utf-8 -*- """ 多线程 threading Thread类创建线程 """ from random import randint from threading import Thread from time import time, sleep def download(filename): print('开始下载%s...' % filename) time_to_download = randint(5, 10) sleep(time_to_download) print('%s下载完成!耗费了%d秒' % (filena...
alicescan_hnoob.py
from scapy.all import * import socket import sys import time import os import random import argparse from threading import Thread import binascii from multiprocessing.dummy import Pool as ThreadPool # Project Alice #1 Port Scan def check(dest, port, services): def umast(): scanned = [] _port_checke...
devserver.py
import os import time import traceback import threading from werkzeug.serving import run_simple, WSGIRequestHandler from lektor.db import Database, DatabaseCache from lektor.builder import Builder, process_extra_flags from lektor.watcher import Watcher from lektor.reporter import CliReporter from lektor.admin import ...
command.py
# Copyright 1996-2019 Cyberbotics 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 in...
common_video.py
# coding=utf-8 # Copyright 2019 The Tensor2Tensor 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...
app_mt.py
''' Copyright 2020 Xilinx 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 writing, software distr...
SpliceHetero.py
import os import sys import commands import numpy as np import time import math import multiprocessing as mp import itertools import argparse import random from scipy.stats import entropy import datetime nn = "\n" tt = "\t" ss = "/" cc = "," def GET_TIME(): return str(datetime.datetime.now()).split(".")[0] ##End GE...
platform_utils.py
# -*- coding:utf-8 -*- # # Copyright (C) 2016 The Android Open Source Project # # 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...
client_code.py
import socket import random from threading import Thread from datetime import datetime from colorama import Fore, init, Back init() colors = [Fore.BLUE, Fore.CYAN, Fore.GREEN, Fore.LIGHTBLACK_EX, Fore.LIGHTBLUE_EX] client_color = random.choice(colors) SERVER_HOST = "127.0.0.1" SERVER_PORT = 50...
piksi_multi.py
#!/usr/bin/env python # # Title: piksi_multi.py # Description: ROS Driver for Piksi Multi RTK GPS module # Dependencies: libsbp (https://github.com/swift-nav/libsbp), tested with version = see LIB_SBP_VERSION_MULTI # Based on original work of https://bitbucket.org/Daniel-Eckert/piksi_node # import rospy i...
main.py
import threading import ctypes import subprocess import os import sys import platform from PySide6.QtWidgets import (QMainWindow, QApplication, QLabel, QPushButton, QComboBox, QVBoxLayout, QHBoxLayout, QWidget) from PySide6.QtCore import Slot, Qt, QFile, QTextStream from PySide6.QtGui import QPixmap, QIcon, QAction fro...
test_wrapper.py
# Copyright 2017 The Nuclio 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...
optimization_checks.py
# Copyright 2019 WebPageTest LLC. # Copyright 2017 Google Inc. # Use of this source code is governed by the Apache 2.0 license that can be # found in the LICENSE file. """Run the various optimization checks""" import binascii import gzip import logging import multiprocessing import os import re import shutil import str...
configure.pyw
#! /usr/bin/env python """Post-install / configuration script for Iromlab""" import os import sys import imp import site import sysconfig from shutil import copyfile import threading import logging import pythoncom from win32com.client import Dispatch try: import tkinter as tk # Python 3.x import tkinter.scro...
server.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...
commoncrawl.py
# coding: utf-8 import getopt, sys, os, stat, subprocess from multiprocessing import Process import warc cmd_wget = ["wget", "-q"] cmp_unzip = ["gzip", "-qq", "-d"] commoncrawl_url = "https://commoncrawl.s3.amazonaws.com" def run_test(file_list, bin_parser, save_to = ".", threads_count = 10): f = open(file_lis...
dag_processing.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 #...
piDSKY2.py
#!/usr/bin/python3 # Copyright 2017 Ronald S. Burkey # # This file is part of yaAGC. # # yaAGC 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 Foundation; either version 2 of the License, or # (at your option) any later...
ContextManagers.py
import builtins import os import platform import signal import sys import tempfile import threading from contextlib import closing, contextmanager from io import StringIO from coala_utils.MutableValue import MutableValue @contextmanager def subprocess_timeout(sub_process, seconds, kill_pg=False): """ Kill su...
parcel_id_extractor.py
# -*- coding: utf-8 -*- import os import threading from queue import Queue from string import ascii_uppercase, digits import requests from bs4 import BeautifulSoup SEARCH_URL = "https://qpublic.schneidercorp.com/Application.aspx?AppID=979&LayerID=19792&PageTypeID=2&PageID=8661" \ "searchType=owner_name&...
ajaxterm.py
#!/usr/bin/env python """ Ajaxterm """ import array,cgi,fcntl,glob,mimetypes,optparse,os,pty,random,re,signal,select,sys,threading,time,termios,struct,pwd os.chdir(os.path.normpath(os.path.dirname(__file__))) # Optional: Add QWeb in sys path sys.path[0:0]=glob.glob('../../python') import qweb class Terminal: def ...
executor.py
# Copyright (C) The Arvados Authors. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 from __future__ import division from builtins import next from builtins import object from builtins import str from future.utils import viewvalues, viewitems import argparse import logging import os import sys import thr...
conftest.py
# Copyright The PyTorch Lightning team. # # 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 i...
portfucker.py
import threading from queue import Queue import time import socket import sys import signal import os import argparse from termcolor import colored parser = argparse.ArgumentParser(description="Port Fucker | Coded By https://github.com/rootkral4") parser.add_argument("-i", "--ip", required=True, help="Ip address of ho...
main.py
# 2020 # The Raven-Storm Toolkit was programmed and developed by Taguar258. # The Raven-Storm Toolkit is published under the MIT Licence. # The Raven-Storm Toolkit is based on the CLIF-Framework. # The CLIF-Framework is programmed and developed by Taguar258. # The CLIF-Framework is published under the MIT Licence. imp...
worker.py
from contextlib import contextmanager import atexit import faulthandler import hashlib import inspect import io import json import logging import os import redis import sys import threading import time import traceback from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union # Ray modules from ra...
MultiProcessing.py
# Project: hardInfo # Author: George Keith Watson # Date Started: March 18, 2022 # Copyright: (c) Copyright 2022 George Keith Watson # Module: service/MultiProcessing.py # Date Started: March 22, 2022 # Purpose: Manage initiation and communication between any number ...
scheduler.py
#!/usr/bin/env python3 from utility import get_time import threading from time import sleep import sys def run(work_items, slots): retries = 0 max_retries = 5000 free_slots = slots taken_slots = [] work_done = [] total_num_of_jobs = len(work_items) while(1): for slot in taken_slots...
test_start_vrs_simultaneously.py
''' Test stop all vrs, then start them simultaneously @author: Youyk ''' import os import sys import threading import time import zstacklib.utils.linux as linux import apibinding.inventory as inventory import zstackwoodpecker.operations.resource_operations as res_ops import zstackwoodpecker.operations.config_operation...
MudaeAutoBot.py
import discum import re import asyncio import json import time import logging import threading from collections import OrderedDict class CacheDict(OrderedDict): def __init__(self, *args, **kwds): self.max = kwds.pop("max", None) OrderedDict.__init__(self, *args, **kwds) self._check_size_li...
dataplotter.py
"""Run this script to display the data output during a run.""" import pickle import threading import matplotlib.pyplot as plt import numpy as np def run(filename): with open(filename, "rb") as f: plots = pickle.load(f) axes = [] lines = [] for p in plots: plt.figure() plt.ti...
lisp-rtr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <[email protected]> # # 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...
test_precharge_interface.py
import tkinter as tk import can import time import threading # https://realpython.com/python-gui-tkinter/ # CANBUS SPEED CANBUS_SPEED = 500000 # CANBUS ADDRESSES THROTTLE_CONTROLLER_PERIPERAL_ID = 0x343 ORION_BMS_STATUS_ID = 0x180 # INERFACE OBJECTS window = tk.Tk() greeting = tk.Label(text="TS_21 ELECTRICAL T...
webpagetest.py
# Copyright 2017 Google Inc. All rights reserved. # Use of this source code is governed by the Apache 2.0 license that can be # found in the LICENSE file. """Main entry point for interfacing with WebPageTest server""" from datetime import datetime import gzip import logging import multiprocessing import os import platf...
flasher.py
#!/usr/bin/env python # # Copyright (c) 2018, Pycom Limited. # # This software is licensed under the GNU GPL version 3 or any # later version, with permitted additional terms. For more information # see the Pycom Licence v1.0 document supplied with this file, or # available at https://www.pycom.io/opensource/licensing ...
pvhttpsrv.py
#!/usr/bin/env python3 # Infos: https://medium.com/@andrewklatzke/creating-a-python3-webserver-from-the-ground-up-4ff8933ecb96 # # Aditional Infos: # https://www.afternerd.com/blog/python-http-server/ # https://daanlenaerts.com/blog/2015/06/03/create-a-simple-http-server-with-python-3/ # ht...
test_seed_cachelock.py
# This file is part of the MapProxy project. # Copyright (C) 2012 Omniscale <http://omniscale.de> # # 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...
control.py
# -*- coding: utf-8 -*- # !/usr/bin/python import sqlite3 import time import serial import binascii import RPi.GPIO as GPIO from sakshat import SAKSHAT import threading import os GPIO.setmode(GPIO.BCM) DS = 6 SHCP = 19 STCP = 13 PIN_NO_BEEP = 12 # 开机 ac_open = ['FD','FD','30','03','40','17','00','34',...
event.py
# -*- coding: utf-8 -*- # MIT License # # Copyright 2020 Kevin G. Schlosser # # 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 ...
swapi.py
import requests import requests_cache import threading from api import Api class Swapi(Api): _page_size=10 _base_url = 'https://swapi.dev/api/' def __init__(self, cache=True): if cache: requests_cache.install_cache('.swapi_cache', backend='sqlite', expire_after=3600) def do_reque...
start_to_end.py
import threading import os import time import random import requests import json from bit import Key from bit.format import bytes_to_wif import traceback # maxPage = int(pow(2, 256) / 128) maxPage = 904625697166532776746648320380374280100293470930272690489102837043110636675 def getRandPage(): return random.rand...
__init__.py
from threading import Thread from typing import List, Tuple import tensorflow as tf from queue import Queue import numpy as np from nboost.plugins.models.rerank.tf.bert import modeling, tokenization from nboost.plugins.models.rerank.base import RerankModelPlugin from nboost import defaults import pathlib class TfBert...
trainAI.py
from board import * import tttAI as ai import neuralnet as nn import numpy as np import time import threading emptyBoard = "0 0 0 0 0 0 0 0 0 " nGames = None f = [1, 1, 1, 3, 3, 1] def takeTurn( mrk, brd, ai ): """Ask player mrk for square to place their marker.""" done = False boardStr = brd.convertBoard...
main.py
from multiprocessing import Process, Queue, Manager import scrapy.spiders from scrapy.crawler import CrawlerProcess from urllib.parse import urlencode import re import json def GoogleScholar(request): def SearchResultsScraper(request): def script(queue, output): try: ...
layer7proxy.py
import urllib.request import re import random from bs4 import BeautifulSoup import threading useragents=["AdsBot-Google ( http://www.google.com/adsbot.html)", "Avant Browser/1.2.789rel1 (http://www.avantbrowser.com)", "Baiduspider ( http://www.baidu.com/search/spider.htm)", "BlackBerry7100i/4.1.0 Profile/MID...
trail.py
"""Copyright 2017-2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at http://aws.amazon.com/apache2.0/ or in the "license" file accompanyi...
k8scrhandler.py
#!/usr/bin/env python3 # encoding: utf-8 # # Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. # # This file is part of ewm-cloud-robotics # (see https://github.com/SAP/ewm-cloud-robotics). # # This file is licensed under the Apache Software License, v. 2 except as noted # otherwise in the LIC...
spaceinvaders.py
#!/usr/bin/env python # Space Invaders # Created by Lee Robinson if __name__ == '__main__': import sys from os.path import abspath, dirname from random import choice import multiprocessing from multiprocessing import shared_memory import torch import math as m import time as t from...
__main__.py
import os import ssl from multiprocessing import Process from flask import Flask from openmfd.server import create_app, socketio from openmfd.ssl.generate import generate_instance_ssl app = create_app() def main(): has_certificate = os.path.isfile(app.instance_path + "/cert.pem") if not has_certificate: ...
guiCrawling.py
import Tkinter as tk from versionControl import greeting import AppKit import subprocess import threading import time import twitter_stream_download import readJson import os start_bt_ms = "Welcome! Think about the keyword you want to know." class App(tk.Frame): def __init__(self, master): tk.Frame.__init...
7_event.py
# Copyright 2020 IOTA Stiftung # SPDX-License-Identifier: Apache-2.0 import iota_wallet import threading import queue import time # This example shows how to listen to on_balance_change event. # The queue to store received events q = queue.Queue() def worker(): """The worker to process the queued events. ...
demo_parallel.py
from __future__ import division from __future__ import print_function import sys import os sys.path.append( '%s/gcn' % os.path.dirname(os.path.realpath(__file__)) ) # add the libary path for graph reduction and local search sys.path.append( '%s/kernel' % os.path.dirname(os.path.realpath(__file__)) ) import s...
step_prepare.py
"""Batching file prepare requests to our API.""" import queue import threading import time from typing import Any, Callable, NamedTuple, Sequence, Union # Request for a file to be prepared. class RequestPrepare(NamedTuple): prepare_fn: Callable[..., Any] on_prepare: Callable[..., Any] response_queue: "qu...
pokeslack.py
#!/usr/bin/python # -*- coding: utf-8 -*- import flask from flask import Flask, render_template from flask_googlemaps import GoogleMaps from flask_googlemaps import Map from flask_googlemaps import icons import os import codecs import re import sys import struct import json import requests import argparse import getpa...
test_crt_basic_l3_vm_with_given_num.py
''' New Perf Test for creating KVM VM with basic L3 network. The created number will depend on the environment variable: ZSTACK_VM_NUM @author: Youyk ''' import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_state as test_state import zstackwoodpecker.test_lib as test_lib import zsta...
scheduler_command.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...
pySmartListener.py
import socket import sys import select import threading import data_file import time from utils import current_milli_time buffer_size = 1 * 1024 * 1024 def socket_to_file(port, filename): host = "0.0.0.0" s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSE...
utils.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 to in ...
SocialFish.py
#-*- coding: utf-8 -*- # SOCIALFISH # by: UNDEADSEC # ########################### from time import sleep from sys import stdout, exit from os import system, path import multiprocessing from urllib import urlopen from platform import architecture from wget import download RED, WHITE, CYAN, GREEN, END = '\033[...
simple_http_server.py
from http.server import BaseHTTPRequestHandler, HTTPServer from socketserver import ThreadingMixIn from urllib.parse import urlparse import json import sys import datetime import plyvel import requests import threading rec = False class RequestHandler(BaseHTTPRequestHandler): protocol_version = "HTTP/1.1" d...