source
stringlengths
3
86
python
stringlengths
75
1.04M
server.py
import socket, threading, os from urlparse import urlparse, parse_qs import handler HOST = '' # Symbolic name meaning all available interfaces PORT = 8080 # Arbitrary non-privileged port STATIC_PATH = "./" urlMapper = dict() def getType(path): if path.endswith('.js'): return 'applicatio...
ARP_Spoof.py
#!/usr/bin/python from scapy.all import * import os import sys import threading import signal interface = "eth1" target = "192.168.108.49" gateway = "192.168.108.1" packets = 1000 conf.iface = interface conf.verb = 0 def restore(gateway, gwmac_addr, target, targetmac_addr): print "\nRestoring normal ARP mappings." ...
test_multiplexer.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the ...
ratings.py
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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 Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
main.py
#!/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 import subprocess from sys import exit from typing import final from src.termcolor import colored import platform from base64 import b64decode from zipfile import ZipFile from os import walk,path,getcwd,mkdir,remove,environ import threading from datetime i...
query.py
import requests as req import bs4 from urllib.parse import quote import time import threading from post import Post from threads_request import threaded_request class Query(object): def __init__(self): pass @staticmethod def query_by_tags(tags: set, pages: int = 1, anti_tags: se...
main.py
import os import os.path as path import requests import youtube_dl import imagehash from PIL import Image import ffmpeg from youtube_dl.utils import DownloadError import responder import json import asyncio import base64 import threading import time dirpath = "/tmp/yfts" if not path.exists(dirpath): os.mkdir(dirp...
threading_local_defaults.py
#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2008 Doug Hellmann All rights reserved. # """Defaults for thread-local values """ #end_pymotw_header import random import threading import logging logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-10s) %(message)s', ...
WtCtaOptimizer.py
from json import encoder import multiprocessing import time import threading import json import os import math import numpy as np import pandas as pd from pandas import DataFrame as df from wtpy import WtBtEngine,EngineType from wtpy.apps import WtBtAnalyst def fmtNAN(val, defVal = 0): if math.is...
collectCode.py
from bs4 import BeautifulSoup as bs from urllib.parse import urljoin import re import time import argparse from collectSources import get_sources import utils import multiprocessing globals_ = utils.load_globals() def get_url_javascript(url, driver, response): """ Get code from a website Args: url ...
cli.py
""" cli.py Sample CLI Clubhouse Client RTC: For voice communication """ import os import sys import threading import configparser import keyboard from rich.table import Table from rich.console import Console from clubhouse.clubhouse import Clubhouse # Set some global variables try: import agorartc RTC = ago...
spark.py
import copy import threading import time import timeit import traceback from hyperopt import base, fmin, Trials from hyperopt.base import validate_timeout, validate_loss_threshold from hyperopt.utils import coarse_utcnow, _get_logger, _get_random_id from py4j.clientserver import ClientServer try: from pyspark.sq...
main.py
import binascii from romTables import ROMWithTables import shlex import randomizer import logic import spoilerLog import re from argparse import ArgumentParser, ArgumentTypeError def goal(goal): if goal == "random": goal = "-1-8" elif goal in ["seashells", "raft", "bingo", "bingo-full"]: retur...
__init__.py
import builtins import contextlib import errno import glob import importlib.util from importlib._bootstrap_external import _get_sourcefile import marshal import os import py_compile import random import shutil import stat import subprocess import sys import textwrap import threading import time import unittest from uni...
periodics.py
# Copyright 2017 Catalyst IT Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
test_generator_mt19937.py
import sys import pytest import numpy as np 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 Generator, MT19937, SeedSequence random = Generator(MT19937()) @pyt...
PCV3.py
import socket import select import sys import threading from sendImg import * class PCV3: def __init__(self): self.host = "192.168.16.16" self.port = 9123 self.connected = False def connect(self): self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock...
core.py
import asyncio import itertools import uuid from dataclasses import dataclass from enum import Enum from itertools import chain from queue import Empty, Queue from threading import Thread from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Type from structlog import get_logger from .bases import Ta...
SatadishaModule_final_trie.py
# coding: utf-8 # In[298]: import sys import re import string import csv import random import time #import binascii #import shlex import numpy as np import pandas as pd from itertools import groupby from operator import itemgetter from collections import Iterable, OrderedDict from nltk.tokenize import sent_tokenize...
ex05_event.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import threading from random import randint """ 5. Event - 一个线程发送/传递事件, - 另外的线程等待事件的触发。 - 同样用「生产者/消费者」模型举例: - 可以看到事件, 被2个消费者, 比较平均的接收并处理了。 - 如果使用了wait方法,线程就会等待我们设置事件,这有助于保证任务完成。 - 处理过程: - 生产者产生数据: - 产生数据, 并发给消费者(append 到缓冲区) - 消费者处理数据...
PynjectInspector.py
# PYNJECT STANDARD PAYLOAD COLLECTION - https://github.com/am-nobody/pynject/payloads # # Title: Pynject Inspector v1.0 # Author: am-nobody # ================================ # Imports # ================================ preserved = dict(globals()) import gc import os import sys import dis import threadin...
functions.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : functions.py @Contact : 958615161@qq.com @Modify Time @Author @Version @Desciption ------------ ------- -------- ----------- 2020/8/8 20:55 zjppp 1.0 None """ import json import random import re import sys import th...
debug_events_writer_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...
run.py
# Copyright (c) 2016-2017 Anki, 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 in the file LICENSE.txt or at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
jgi_gatewayMule.py
import threading from os import environ import uwsgi from configparser import ConfigParser if __name__ == '__main__' and __package__ is None: from os import sys, path my_dir = path.dirname(path.dirname(path.abspath(__file__))) print('my dir') print(my_dir) sys.path.append(my_dir) from jgi_gateway....
AVR_Miner.py
#!/usr/bin/env python3 """ Duino-Coin Official AVR Miner 2.73 © MIT licensed https://duinocoin.com https://github.com/revoxhere/duino-coin Duino-Coin Team & Community 2019-2021 """ from os import _exit, execl, mkdir from os import name as osname from os import path from os import system as ossystem from platform impor...
test_enum.py
import enum import doctest import inspect import os import pydoc import sys import unittest import threading from collections import OrderedDict from enum import Enum, IntEnum, StrEnum, EnumType, Flag, IntFlag, unique, auto from enum import STRICT, CONFORM, EJECT, KEEP from io import StringIO from pickle import dumps, ...
app.py
# Copyright 2018 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://www.apache.org/licenses/LICENSE-2.0 # # or in the "license...
mesgloop.py
# Copyright (c) 2010-2017 Bo Lin # Copyright (c) 2010-2017 Yanhong Annie Liu # Copyright (c) 2010-2017 Stony Brook University # Copyright (c) 2010-2017 The Research Foundation of SUNY # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files #...
map_dataset_op_test.py
# Copyright 2017 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...
webserver.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Webserver OK, Discord Bot OK" def run(): app.run(host = "0.0.0.0", port=8080) def keep_alive(): t = Thread(target=run) t.start()
detectnsaveimg.py
import numpy as np import cv2 import os,shutil import dlib face_cascade = cv2.CascadeClassifier('./haarcascade_frontalface_default.xml') cam = cv2.VideoCapture(0) # Create Camera Object(cam) datacount=0 detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat")...
sync_daemon.py
#!/usr/bin/env python3 import json import logging import sys import threading import time import urllib.parse import guessit import os import requests import mpv import trakt_key_holder import trakt_v2_oauth log = logging.getLogger('mpvTraktSync') TRAKT_ID_CACHE_JSON = 'trakt_ids.json' config = None last_is_pause...
test.py
import cv2 import numpy as np import time import os import numpy as np import time import threading import queue import multiprocessing os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;udp" class ReadFromWebcam(object): def __init__(self, max_framerate=30.0, webcam_idx=0): ''' Read images fro...
recipe-577025.py
""" LoggingWebMonitor - a central logging server and monitor. Listens for log records sent from other processes running in the same box or network. Collects and saves them concurrently in a log file. Shows a summary web page with the latest N records received. Usage: - Add a SocketHandler to your application:: ...
reporter.py
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
test_net.py
from utils.logger import Writer import threading import torch from torchstat import stat import time from path import Path class TestNet(): def __init__(self,running_on,dev,name,height,width): super(TestNet, self).__init__() self.running_on = running_on self.device = torch.device(dev) ...
output.py
# --------------------------------------------------------------------------- # Console output for MTDA # --------------------------------------------------------------------------- # # This software is a part of MTDA. # Copyright (c) Mentor, a Siemens business, 2017-2020 # # -------------------------------------------...
xbox.py
import subprocess import threading class XBox(object): def __init__(self, wireless_index=0): self.wireless_index = wireless_index self.value = dict(X1=0, Y1=0, X2=0, Y2=0, LT=0, RT=0, du=0, dd=0, dl=0, dr=0, back=0, guide=0, start=0, ...
test_io.py
from __future__ import division, absolute_import, print_function import sys import gzip import os import threading from tempfile import mkstemp, mktemp, NamedTemporaryFile import time import warnings import gc from io import BytesIO from datetime import datetime import numpy as np import numpy.ma as ma from numpy.lib...
distmm.py
import mincemeat from mincemeat import Protocol import socket import time import sys import logging import logging.handlers import multiprocessing from multiprocessing import Pool, Process import optparse import collections import fileiter import pickle from mincemeatpy.registry import Registry import re import string ...
simplebridge.py
from covertutils.handlers import BufferingHandler from threading import Thread from time import sleep class SimpleBridge : """ The Bridge class is used to pass messages between 2 Handler objects. It can be used to bridge an Agent and a Handler using a third host. """ def __init__( self, lhandler, rhandler ) : ...
socket_server.py
import json import socket import uuid from threading import Thread import byte_utils class SocketServer: def __init__(self, ip, port, motd, version_text, kick_message, samples, server_icon, logger, show_hostname, player_max, player_online, protocol): self.sock = socket.socket(socket.AF_INET, socket.SOCK_...
arducam_long.py
#!/usr/bin/env python import sys import os import time import cv2 import threading import numpy as np import signal import json import Image import ArducamSDK import rospy from sensor_msgs.msg import CompressedImage, Image from cv_bridge import CvBridge, CvBridgeError from std_msgs.msg import String global cfg,han...
callme.py
import datetime import os import queue import random import threading import time from flask import jsonify from flask import request from server import app from server.routes import prometheus from twilio.rest import Client from server.config import db # Initialize the Twilio client # # Your Account Sid and Auth T...
test_client.py
"""Tests for parallel client.py""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import division from concurrent.futures import Future from datetime import datetime import os from threading import Thread import time from tornado.concurrent impor...
hydrus_client.py
#!/usr/bin/env python3 # Hydrus is released under WTFPL # You just DO WHAT THE FUCK YOU WANT TO. # https://github.com/sirkris/WTFPL/blob/master/WTFPL.md import locale try: locale.setlocale( locale.LC_ALL, '' ) except: pass try: import os import argparse import sys from hydrus.core import H...
future_test.py
# Copyright 2020 The TensorStore 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...
Gateway_v1.py
from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler from requests_toolbelt.adapters.source import SourceAddressAdapter from datetime import datetime, timezone import config.config as cfg import requests as req import logging as log from socket import * import threading import ssl # init gateway info ...
app.py
import functools import os import threading from flask import ( Flask, request ) import telia app = Flask(__name__) app.config.from_object("config") def check_auth(func): @functools.wraps(func) def wrapper(*args, **kwargs): if request.is_json: data = request.get_json() ...
precompute_alignments.py
import argparse from functools import partial import json import logging import os import threading from multiprocessing import cpu_count from shutil import copyfile import tempfile import openfold.data.mmcif_parsing as mmcif_parsing from openfold.data.data_pipeline import AlignmentRunner from openfold.data.parsers im...
wsgi.py
import base64 import logging import multiprocessing import os import pickle import re import threading import time from datetime import datetime from email.utils import formatdate from io import BytesIO import requests import pylibmc from c3nav.mapdata.utils.cache import CachePackage from c3nav.mapdata.utils.tiles im...
main.py
import time import threading from bank.account import Account from bank.actions import transfer_money, charge_bank_fees def run_example() -> None: jan_account = Account(holder="Jan", money_amount=1_000) alicja_account = Account(holder="Alicja", money_amount=1_000) print(jan_account) print(alicja_ac...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional from PyQt5.QtCore i...
static_object_detector_node.py
#!/usr/bin/env python import cv2 import numpy as np import rospy from sensor_msgs.msg import Image from std_msgs.msg import Float32 from cv_bridge import CvBridge, CvBridgeError from duckietown_msgs.msg import ObstacleImageDetection, ObstacleImageDetectionList, ObstacleType, Rect, BoolStamped import sys import threadin...
executor.py
# Lint as: python3 # Copyright 2020 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
decorators.py
import threading def start_thread(func): def wrapped(*args, **kwargs): thread = threading.Thread(target=func, args=args, kwargs=kwargs, daemon=True) thread.start() return thread return wrapped def standart_position_output(func): """""" def wrapped(self): point = {} ...
generate_LR_noise.py
import os import numpy as np import cv2 import sys from multiprocessing import Process kIMG_FILES = ['png', 'jpeg', 'jpg', 'bmp', 'tiff'] def genNoise(sigma, input_fld): output_fld = os.path.join(sys.argv[3], 'n_{}'.format(sigma)) os.makedirs(output_fld, exist_ok=True) imgs_path_list = [x for x in os.li...
test_router.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import time import threading from nose.tools import assert_equals, assert_raises from ..backends.base import BackendBase from ..apps.base import AppBase from ..router import Router def test_router_finds_apps(): router = Router() router.add_app("rapidsms.con...
DownGame.py
import pdb import mss import time import numpy as np from time import sleep from torchvision import transforms import os import cv2 import subprocess from xvfbwrapper import Xvfb from pynput.keyboard import Controller, Key from multiprocessing import Pipe, Process from transitions import Machine, State from .DownConst ...
ajax.py
import json import logging import os import threading import time import cherrypy import datetime import core from core import config, library, searchresults, searcher, snatcher, notification, plugins, downloaders from core.library import Metadata, Manage from core.movieinfo import TheMovieDatabase, YouTube from core.p...
__init__.py
from __future__ import absolute_import from __future__ import with_statement import socket import sys from collections import deque from datetime import datetime, timedelta from Queue import Empty from kombu.transport.base import Message from kombu.connection import BrokerConnection from mock import Mock, patch from...
import_logs.py
#!/usr/bin/python # vim: et sw=4 ts=4: # -*- coding: utf-8 -*- # # Piwik - free/libre analytics platform # # @link https://piwik.org # @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later # @version $Id$ # # For more info see: https://piwik.org/log-analytics/ and https://piwik.org/docs/log-analytics-tool-...
process.py
import importlib import os import signal import struct import time import subprocess from typing import Optional, List, ValuesView from abc import ABC, abstractmethod from multiprocessing import Process from setproctitle import setproctitle # pylint: disable=no-name-in-module import cereal.messaging as messaging imp...
ro_XMLRPC.py
# # ro_XMLRPC.py -- enhanced XML-RPC services for remoteObjects system # import sys import threading import traceback import base64 from g2base import six def dump_int(_, v, w): w("<value><int>%d</int></value>" % (v)) if six.PY2: import Queue from SimpleXMLRPCServer import (SimpleXMLRPCServer, ...
__init__.py
from __future__ import print_function import sys if sys.version_info[0] < 3: print("pkuseg does not support python2", file=sys.stderr) sys.exit(1) import os import time import multiprocessing from multiprocessing import Process, Queue import pkuseg.trainer as trainer import pkuseg.inference as _inf from p...
motiontracker.py
"""Bluetooth motion tracker module. Copyright 2017 Mark Mitterdorfer Class to read from a Bluetooth MPU6050 device. Obtain acceleration, angular velocity, angle and temperature """ import threading import struct import bluetooth class MotionTracker(object): """Class to track movement from MPU6050 Bluetooth devi...
environment.py
import sys from threading import Thread from ipdb import post_mortem from app.app import app from bdd_tests.modules.thread_bottle import MyServer def begin(server): app.run(server=server) def before_all(context): sys.dont_write_bytecode = True context.base_url = 'http://127.0.0.1:8080' context.ser...
mmalobj.py
# vim: set et sw=4 sts=4 fileencoding=utf-8: # # Python header conversion # Copyright (c) 2013-2017 Dave Jones <dave@waveform.org.uk> # # Original headers # Copyright (c) 2012, Broadcom Europe Ltd # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
test_triggerer_job.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...
utils.py
import datetime import functools import os import sys import threading def get_dir_files(directory): return os.listdir(directory if directory else '.') def get_current_directory(): return os.path.dirname(os.getcwd()) + os.path.normpath('/') def get_platform(): return sys.platform def unix_to_date(un...
nucleo.py
import socket import threading import time ServerSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ServerSocket.bind(('testeserver123.herokuapp.com', 80)) ServerSocket.listen(50) ClientsSocketsList = [] EnderecoList = [] Encode_mode = 'utf-8' def transmitir(mensagem): for EveryClient in ClientsSocke...
test_completed_CompletedProducerOperator.py
#!/usr/bin/env python #################### # Required Modules # #################### # Generic/Built-in import time from multiprocessing import Manager, Process # Libs # Custom from synmanager.config import COMPLETED_QUEUE from conftest import ( PROJECT_KEY, RUN_RECORD_1, RUN_RECORD_2, enumerate_federated_...
callback.py
from utlis.rank import setrank,isrank,remrank,remsudos,setsudo,GPranks,IDrank from utlis.send import send_msg, BYusers, Sendto, fwdto,Name,Glang,getAge from utlis.locks import st,getOR,Clang,st_res from utlis.tg import Bot from config import * from pyrogram import ReplyKeyboardMarkup, InlineKeyboardMarkup, Inlin...
app.py
import argparse import time import torch import random from tqdm import tqdm import math import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import os import numpy as np import data_loader.datasets as module_data import model.loss as module_loss import model.metric as module_met im...
debugger.py
from pyedbglib.hidtransport.hidtransportfactory import hid_transport from pyedbglib.protocols import housekeepingprotocol from pyedbglib.protocols import housekeepingprotocol from pyedbglib.protocols import avr8protocol from pyedbglib.protocols import avr8protocolerrors # Retrieve device info from pymcuprog.deviceinfo...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import (verbose, import_module, cpython_only, requires_type_collecting) from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys import _thread import threading import...
checkpoint.py
"""Utilities for saving/loading Trackable objects.""" # Copyright 2017 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.o...
vnbitmex.py
# encoding: UTF-8 from __future__ import print_function import hashlib import json import ssl import traceback from copy import copy from threading import Thread, Event, Timer, current_thread from queue import Queue, Empty from multiprocessing.dummy import Pool from time import time, sleep from datetime import datetim...
put_files.py
from tkinter import * from tkinter import ttk from tkinter import filedialog from distutils import dir_util from data.loading import Loading # from data import mpy_cross import os import ampy.pyboard import threading import shutil import mpy_cross class PutFiles(Toplevel): def __init__(self, parent, mpy=False)...
benchmarker.py
from setup.linux.installer import Installer from setup.linux import setup_util from benchmark import framework_test from benchmark.test_types import * from utils import header from utils import gather_tests from utils import gather_frameworks import os import json import subprocess import traceback import time import...
supervisor.py
import datetime import importlib import logging import time import os import threading from pathlib import Path from types import ModuleType from typing import List from typing import Optional from flowd.model import logistic_regression from flowd.utils import wnf import pythoncom from flowd import metrics MetricMod...
javascript.py
""" domonic.javascript ==================================== - https://www.w3schools.com/jsref/jsref_reference.asp - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference """ import array import chunk import datetime from datetime import timezone import gc import json import math import mul...
select_ticket_info.py
# -*- coding=utf-8 -*- import datetime import random import os import socket import sys import threading import time import TickerConfig import wrapcache from agency.cdn_utils import CDNProxy, open_cdn_file from config import urlConf, configCommon from config.TicketEnmu import ticket from config.configCommon import sea...
segment.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import json import logging import math import os from os.path import exists, join, split import threading import time import numpy as np import shutil import sys from PIL import Image import torch from torch import nn import torch.backends.cudnn as cudnn...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import support import socket import select import time import datetime import gc import os import errno import pprint import tempfile import urllib.request import traceback import asyncore import weakref import platform import functools ssl =...
train_pg_f18.py
""" Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017 Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany """ import numpy as np import tensorflow as tf import os, gym, logz, time, inspect from multip...
utils.py
import registry import threading import time import requests from . import app ORCHESTRATOR_ENDPOINT = app.config.get('ORCHESTRATOR_ENDPOINT') def validate(data, required_fields): """Validate if all required_fields are in the given data dictionary""" if all(field in data for field in required_fields): ...
bruter.py
# Date: 12/28/2018 # Author: Mohamed # Description: Bruter from time import time, sleep from .browser import Browser from .session import Session from .display import Display from threading import Thread, RLock from .proxy_manager import ProxyManager from .password_manager import PasswordManager from .const...
repl scraper.py
import requests, json, base64, re, random, time, uuid from bs4 import BeautifulSoup from threading import Thread class queue: queue=['https://repl.it/site/repls'] checked=[] def scrapepos(indexpos): currenturl=queue.queue[indexpos] del queue.queue[indexpos] print(f'Scraping: [ {currenturl} ]') sou...
huecontroller.py
from phue import Bridge from threading import Thread import time from rgb_cie import ColorHelper import numpy as np class HueController: LEFT_LAMP_NBR = 1 RIGHT_LAMP_NBR = 3 BRIDGE_IP = '192.168.0.243' def __init__(self, frame_listener): def lamp_controller(): while True: ...
test_ipc.py
""" :codeauthor: Mike Place <mp@saltstack.com> """ import errno import logging import os import threading import pytest import salt.config import salt.exceptions import salt.ext.tornado.gen import salt.ext.tornado.ioloop import salt.ext.tornado.testing import salt.transport.client import salt.transport.ipc impor...
email.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from todoism.extensions import mail def _send_mail_async(app, message): with app.app_context(): mail.send(message) def send_mail(to, subject, template, **kwargs): message = Message(current_ap...
mysql.py
import logging import os import threading from redash.query_runner import ( TYPE_FLOAT, TYPE_INTEGER, TYPE_DATETIME, TYPE_STRING, TYPE_DATE, BaseSQLQueryRunner, InterruptException, JobTimeoutException, register, ) from redash.settings import parse_boolean from redash.utils import js...
atrace_agent.py
# Copyright 2015 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. import optparse import platform import re import sys import threading import zlib import py_utils from devil.android import device_utils from devil.android...
destroy_window.py
import webview import threading import time """ This example demonstrates how a webview window is created and destroyed programmatically after 5 seconds. """ def destroy(): # show the window for a few seconds before destroying it: time.sleep(5) print("Destroying window..") webview.destroy_window() ...
genetic_algorithm.py
import multiprocessing as mp import threading import queue import numpy as np import nn # taken from: # https://machinelearningmastery.com/simple-genetic-algorithm-from-scratch-in-python/ import new_main # genetic algorithm search for continuous function optimization from numpy.random import randint from numpy.rando...
views.py
from django.db import IntegrityError from django.shortcuts import render, redirect from django.http import HttpResponseRedirect from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.views.generic import View, ListView from django.contrib.auth.hashers import check_password from django.cont...
cli.py
#!/usr/bin/env python3 import logging import multiprocessing as mp import os import sys import click import polypuppet.agent.output as out from polypuppet import Config from polypuppet.agent.agent import Agent from polypuppet.agent.vagrant import Vagrant from polypuppet.exception import PolypuppetException from polypu...