source
stringlengths
3
86
python
stringlengths
75
1.04M
overlfow.py
#!/usr/bin/python # -*- coding: UTF-8 -*- import ninja import argparse import timeit import multiprocessing as mp import sys # save_data์˜ ๊ฒฝ์šฐ๋Š” ํ•จ์ˆ˜๋งˆ๋‹ค ๊ณต๊ฒฉ์˜ ๊ฒฐ๊ณผ๊ฐ’์„ ํŒ๋‹จํ•˜๋Š” ํŒจํ„ด์ด ๋‹ค๋ฅด๋ฏ€๋กœ ๊ฐœ๋ณ„๋กœ ์ •์˜ class overflow(ninja.web): # timeout๋‚œ ๊ฒƒ๋“ค๋งŒ ๋ชจ์•„์„œ ์•„๋ž˜์˜ ํ•จ์ˆ˜๋ฅผ ๋‹ค์‹œ ์ž‘์„ฑ def save_data(self, method, case, url, payloads, res): self.col...
tcp.py
# -*- coding: utf-8 -*- ''' Syslog TCP listener for napalm-logs. ''' from __future__ import absolute_import from __future__ import unicode_literals # Import pythond stdlib try: import Queue as queue except ImportError: import queue import time import random import socket import logging import threading # Impo...
__init__.py
""" fs.expose.dokan =============== Expose an FS object to the native filesystem via Dokan. This module provides the necessary interfaces to mount an FS object into the local filesystem using Dokan on win32:: http://dokan-dev.github.io/ For simple usage, the function 'mount' takes an FS object and new device mount...
views.py
from django.shortcuts import render import base64 import json import logging import pickle from queue import Queue from threading import Thread import time # Create your views here. from django.http import HttpResponse, JsonResponse from dwebsocket.decorators import accept_websocket from .services import synthetic_audi...
test_logging.py
# Copyright 2001-2017 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
MotifFinderMdscanServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
test_socket.py
import inspect import struct import select import re import threading import signal import psutil import os import socket import json import math import sys from utils import util #define DUMP_START "DUMP START\n" #define DUMP_END "DUMP END\n" #define DUMP_STACK_START "STACK START\n" #define DUMP_STACK_END "STACK EN...
tcp_server.py
import socket import threading class TcpServer(object): def __init__(self, ip_address, port, on_connection): self._ip_address = ip_address self._port = port self._on_connection = on_connection self._server = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP) ...
test_function.py
import threading import unittest import mock import six import cupy from cupy import testing from cupy_tests.core_tests.fusion_tests import fusion_utils class FusionTestBase(unittest.TestCase): def generate_inputs(self, xp, nargs, dtype): inputs = [ testing.shaped_random((3, 4), xp, dtype, s...
dht.py
from protocol import proto_store from urlparse import urlparse import constants import datastore import hashlib import json import logging import os import routingtable import time from threading import Thread import network_util class DHT(object): def __init__(self, transport, market_id, settings, db_connection...
generate_protocol.py
# !/usr/bin/env/python3.6 #Install instructions for psutil - https://github.com/giampaolo/psutil/blob/master/INSTALL.rst #Follow the same instructions for pygame import os #Create directory import sys #Allows program to exit on completion import psutil #Gives access to USB drive mount events import time #Gives access ...
gatewayconfig_app.py
import sentry_sdk import threading from gpiozero import Button, LED from hm_pyhelper.hardware_definitions import is_rockpi, is_raspberry_pi, \ variant_definitions from gatewayconfig.logger import get_logger from gatewayconfig.processors.bluetooth_services_processor import ...
event_loop.py
# stdlib import asyncio import atexit import os from typing import Any as TypeAny from typing import Dict as TypeDict from typing import Optional # third party import nest_asyncio # syft relative from ...logger import info from .environment import is_interactive from .environment import is_jupyter # Depending on whe...
sync_handler_manager.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """This mo...
autocast_variable_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...
Roulette.py
import logging, coloredlogs from threading import Thread from random import randrange from modules.config import * from modules.timer import Timer from modules.database import Database database = Database(db_host, db_user, db_pass, db_name, db_autocommit) database.database_connection() class Roulette: CommandMain ...
my_assistant.py
#!/usr/bin/env python3 # Copyright 2017 Google 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...
main.py
import threading import gi gi.require_version('Gst', '1.0') gi.require_version('GstRtspServer', '1.0') from gi.repository import Gst, GstRtspServer, GLib class RtspSystem(GstRtspServer.RTSPMediaFactory): def __init__(self, **properties): super(RtspSystem, self).__init__(**properties) self.data = ...
settings.py
import platform import subprocess import os import sys import locale import time from PySide2 import QtGui import psutil from PySide2.QtGui import * from PySide2.QtCore import * from PySide2.QtWidgets import * import globals from languages import * from tools import * from tools import _ from FramelessWindow impor...
exemplul1.py
from threading import Thread def my_concurrent_code(nr, msg): """ Functie care va fi rulata concurent """ print ("Thread", nr, "says:", msg) # creeaza obiectele corespunzatoare thread-urilor t1 = Thread(target = my_concurrent_code, args = (1, "hello from thread")) t2 = Thread(target = my_concurre...
train.py
import argparse import logging import math import os import random import time from copy import deepcopy from pathlib import Path from threading import Thread import numpy as np import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_sche...
dispatchers.py
"""Dispatchers implementing the OnRamp PCE API. Exports: Files: Access visible files from job runs. Modules: View, add, update, and remove PCE educational modules. Jobs: Launch, update, remove, and get status of PCE jobs. Cluster: View cluster status. """ import logging import os from multiprocessing ...
test_s3boto3.py
import gzip import pickle import threading from datetime import datetime from textwrap import dedent from unittest import mock, skipIf from urllib.parse import urlparse from botocore.exceptions import ClientError from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core....
__init__.py
from __future__ import annotations import collections from datetime import datetime from decimal import Decimal from functools import wraps import operator import os import re import string from typing import ( TYPE_CHECKING, Callable, ContextManager, Counter, Iterable, ) import warnings import nu...
framework.py
#!/usr/bin/env python from abc import * import os import subprocess import unittest import tempfile import time import resource from time import sleep from Queue import Queue from threading import Thread from inspect import getdoc from hook import StepHook, PollHook from vpp_pg_interface import VppPGInterface from vpp...
graph.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import numpy as np import pickle import random from time import time from six.moves import range from six import iterkeys from collections import defaultdict, Iterable from scipy.sparse import issparse, csr_matrix from sklearn.preprocessing import normalize...
shell.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...
tfl_backend.py
import subprocess import os from directory_manager import python_paths, base_Directory, currentVE, totalVEs from shutil import rmtree import sqlite3 from pakages import messagebox Current_default_env='None'; Current_default_env_dir = 'None' thread_lock = 'open' activeVE = '' base_Directory = base_Directory act...
run_server.py
""" cd /d %~dp0 explorer http://localhost:3000 powershell -ExecutionPolicy ByPass -Command "docsify serve" """ from multiprocessing import Process import time import os print('Global_print', os.getpid()) def run_proc(name): time.sleep(2) os.system('explorer http://localhost:3000') print('Run child proce...
jrpc_py.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import json import random import time from builtins import * import zmq try: import queue except ImportError: import queue as queue import threading import msgp...
atari.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: atari.py # Author: Yuxin Wu <ppwwyyxxc@gmail.com> import numpy as np import time import os import cv2 from collections import deque import threading import six from six.moves import range from tensorpack.utils import (get_rng, logger, execute_only_once) from tensor...
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...
GO_Elite.py
###GO-Elite #Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California #Author Nathan Salomonis - nsalomonis@gmail.com #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 ...
fn_api_runner.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...
wedding_photobooth.py
###################################################################### # # # MATT CAM # # Version : 1.1 # # ...
Interfaces.py
from math import sqrt from multiprocessing import Process, Pipe from aiprocess import aiprocess, move2str from chessengine import * from guiengine import * WIDTH = 800 HEIGHT = 600 SCALE = 1 / 15 GAME = None CHOOSINGPROMOTION = False PIPE = None AI_PROC = None WAITING = False PVP = False def set_globals(): glob...
sbcmdline_img_featurizer.py
#Deprecated from __future__ import print_function import os import sys import threading import subprocess as sub import numpy as np from .generic_featurizer import GenericFeaturizer from ..common.dl import download_file, mkpath SENTIBANK_FILE = "caffe_sentibank_train_iter_250000" SENTIBANK_PROTOTXT = "sentibank.pr...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
test_cuda.py
from itertools import repeat, chain, product from typing import NamedTuple import collections import contextlib import ctypes import gc import io import pickle import queue import sys import tempfile import threading import unittest import torch import torch.cuda import torch.cuda.comm as comm from torch.nn.parallel i...
commander.py
__author__ = "Sean Toner" __license__ = "Apache License 2.0" __version__ = "0.1" __email__ = "stoner@redhat.com" __status__ = "Alpha" from subprocess import Popen, PIPE, STDOUT import threading import os import shlex from functools import wraps try: import queue except ImportError: import Queue as queue from ...
smpp_send.py
import logging import sys import time import datetime from smpplib import gsm from smpplib.client import Client from smpplib import consts from models.channel import Channel from models.sms import Sms from app import db import threading # if you want to know what's happening logging.basicConfig(level='DEBUG') chan...
get_descriptor_images.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 30 13:20:14 2019 @author: marcelo """ try: from numpy import array, transpose import os import cv2 import pandas as pd from threading import Thread from multiprocessing import Process from time import time from mahota...
temp - PLOT.py
''' * * Position tracking of magnet based on Finexus * https://ubicomplab.cs.washington.edu/pdfs/finexus.pdf * * VERSION: 0.2 * - 2 Modes of operations * (1) Continuous sampling * (2) Guided Point-by-Point * - Plot stuff * - Standoffs, raising three of the sensors to .1m * * KNOWN ISSUES: * - Z-axis...
main.py
from __future__ import division from Game.solitaire_engine import * from IA.mcts_stocha import * import threading import time import numpy as np import pandas as pd import os.path from multiprocessing import Process, Queue, Pipe NB_THREAD = 1 NB_TRAJECTORIES = 50 SAMPLING_WIDTH = 10 NB_GAMES = 10 class myThread (thre...
Conflict_Identifier.py
#! /usr/bin/env python3 import os import sys import ast import json import time import requests import numpy as np import pandas as pd import ipaddress as ip import multiprocessing as mp from urllib.parse import quote # Import Utilities from ..Utilities.Database import * from ..Utilities.Utilities import * class Co...
test_speech_to_text_v1.py
from unittest import TestCase import os from watson_developer_cloud.websocket import RecognizeCallback, AudioSource import watson_developer_cloud import pytest import threading @pytest.mark.skipif( os.getenv('VCAP_SERVICES') is None, reason='requires VCAP_SERVICES') class TestSpeechToTextV1(TestCase): text_to_...
xair-remote.py
#!/usr/bin/env python3 import argparse import threading from lib.midicontroller import MidiController from lib.xair import XAirClient, find_mixer from lib.mixerstate import MixerState if __name__ == '__main__': parser = argparse.ArgumentParser(description = 'Remote control X-Air mixers with a midi controller') ...
dispatcher.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """GRPC client. Implements loading and execution of Python workers. """ import asyncio import concurrent.futures import logging import os import queue import sys import threading from asyncio import BaseEventLoop from loggin...
scan_econ.py
''' Python side of measurement gathering. ''' from X4_Python_Pipe_Server import Pipe_Server, Pipe_Client import threading from pathlib import Path import os, sys import webbrowser import json, io # import csv this_dir = Path(sys.executable).parent bgasm = this_dir.joinpath("extensions", "BGASM_Econ", "python", "BGASM...
follow_waypoints.py
#!/usr/bin/env python import threading import rospy import actionlib from smach import State,StateMachine from geometry_msgs.msg import PoseStamped from mbf_msgs.msg import MoveBaseAction, MoveBaseGoal, MoveBaseResult from geometry_msgs.msg import PoseWithCovarianceStamped, PoseArray ,PointStamped from std_msgs.msg im...
modos.py
# -*- coding: utf-8 -*- import sys import time import socket import random from scapy.all import * from datetime import datetime from threading import Thread from termcolor import colored from fake_useragent import UserAgent version = "2.2" def showBanner(): with open("lib/banner.txt") as f: print(colored(f.read...
dfu.py
#!/usr/bin/env python """ Tool for flashing .hex files to the ODrive via the STM built-in USB DFU mode. """ from __future__ import print_function import argparse import sys import time import threading import platform import struct import requests import re import io import os import usb.core import fibre import odriv...
base_url_manager.py
""" BaseURLManagerๅฎšไน‰ๆ–‡ไปถ """ from threading import Thread from abc import ABC, abstractmethod from .utilities import get_logger class BaseURLManager(ABC): """ ไปŽ็›ฎๅฝ•้กต่Žทๅ–ๆ–‡็ซ URL๏ผŒไธบSpiderๆไพ›ๅพ…็ˆฌๅ–็š„URL """ def __init__(self, start_page=1, end_page=-1): """ ๅˆๅง‹ๅŒ– ๆณจๆ„๏ผšๆฏไธช็›ฎๅฝ•้กตๅŒ…ๅซๅคšไธชurl :param...
app.py
from flask import Flask, render_template, request import os import queue import logging import requests import threading from datetime import datetime from signal import signal, SIGINT app = Flask(__name__) wsgi_app = app.wsgi_app log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR) q = queue.Queue() thr...
pysoda.py
# -*- coding: utf-8 -*- ### Import required python modules from gevent import monkey; monkey.patch_all() import platform import os from os import listdir, stat, makedirs, mkdir, walk, remove, pardir from os.path import isdir, isfile, join, splitext, getmtime, basename, normpath, exists, expanduser, split, dirname, ge...
tests_sp3.py
""" Instax SP* Socket Tests James Sutton 2020 """ from instax import DebugServer, SP3, InstaxImage import time import unittest import threading import pytest test_image = "instax/tests/test_image.png" server_batt = 2 server_remain = 10 server_total = 20 progress_log = [] def updateProgress(count, total, status=''):...
pool.py
import logging import os import random import signal import sys import time import traceback from datetime import datetime from uuid import uuid4 import collections from multiprocessing import Process from multiprocessing import Queue as MPQueue from queue import Full as QueueFull, Empty as QueueEmpty from django.con...
__init__.py
# Copyright (c) 2014 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Test harness for testing chrome apps / extensions.""" import argparse import cStringIO import contextlib import hashlib import logging import os ...
plot_benchmarks.py
#!/usr/bin/env python3 # Copyright Hans Dembinski 2019 # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt from matplotlib import pyplot as plt, lines import shelve import json import subprocess as subp import sys from co...
__init__.py
# For a plugin, make a directory named as its name, then put it under this directory. # A plugin must have a plugin_config.json in it, and the name key must be as same as the # plugin directory name. # If the plugin only contains one module, make it __init__.py. import json import os from datetime import datetime from...
interactive_debugger_plugin.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...
tello.py
# coding=utf-8 import logging import socket import time import threading import cv2 # type: ignore from threading import Thread from typing import Optional from .enforce_types import enforce_types threads_initialized = False drones: Optional[dict] = {} client_socket: socket.socket @enforce_types class Tello: """...
convert_tfrecords.py
# Copyright 2018 Changan Wang # 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, so...
boo.py
import requests import threading url='https://www.choicehomewarranty.com/get-a-quote/confirm.php' req_obj={ "Bcode": "email50", "status": "Customer", "home_phone": "5854063161", "ac": "3", "Azip": "14216", "quote_id": "6314010", "id": "15234723", "Aemail": "test@gmail.com", "ptype"...
test_message.py
import time from typing import * from threading import Thread import pytest from redis import Redis from rdisq.configuration import get_rdisq_config from rdisq.request.handler import _HandlerFactory from rdisq.request.rdisq_request import RdisqRequest, MultiRequest from rdisq.request.dispatcher import RequestDispatch...
test_emr.py
import copy import gzip import io import threading import time import pytest from dagster.seven import mock from dagster.utils.test import create_test_pipeline_execution_context from dagster_aws.emr import EmrClusterState, EmrError, EmrJobRunner from dagster_aws.utils.mrjob.utils import _boto3_now from moto import moc...
calculator4.py
#!/usr/bin/env python3 import sys import os import csv from collections import namedtuple from multiprocessing import Process,Queue,Pool incomequeue = Queue() computequeue = Queue() #writequeue = Queue() IncomeTaxQuickLookupItem = namedtuple( 'IncomeTaxQuickLookupItem', ['start_point', 'tax_rate', 'quick_su...
runners.py
# -*- coding: utf-8 -*- import locale import os import struct from subprocess import Popen, PIPE import sys import threading import time import signal from .util import six # Import some platform-specific things at top level so they can be mocked for # tests. try: import pty except ImportError: pty = None tr...
mirror_cache.py
#coding=utf-8 import sys if __name__.endswith('qgb.N.mirror_cache'):from .. import py else: from pathlib import Path gsqp=Path(__file__).absolute().parent.parent.parent.absolute().__str__() if gsqp not in sys.path:sys.path.append(gsqp)#py3 works # print(sys.path,gsqp) # print(Path(__file__).parent.parent.p...
Misc.py
## @file # Common routines used by all tools # # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## # Import Modules # from __future__ import absolute_import import sys import string import threading import time import re import ...
debug_ext.py
import json import os import sys import subprocess import shlex import time import re from threading import Thread import threading from idf_py_actions.errors import FatalError from idf_py_actions.tools import ensure_build_directory PYTHON = sys.executable def action_extensions(base_actions, project_path): OPEN...
util.py
# Electrum-Ganja - lightweight Ganjacoin client # Copyright (C) 2011 Thomas Voegtlin # Copyright (C) 2018 GanjaProject # # 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, #...
interface_VCF.py
import os,multiprocessing from VCFprocessor import * import shutil import yaml import time import warnings warnings.filterwarnings("ignore") def Vcf(opts): base_dir=os.getcwd() config_file=opts.Config_file f=open(config_file) config_list=yaml.load(f) #######read and parse parameter print "Start reading and parsin...
run.py
import logging import os import signal import subprocess import threading from contextlib import contextmanager from dvc.utils import fix_env from .decorators import relock_repo, unlocked_repo from .exceptions import StageCmdFailedError logger = logging.getLogger(__name__) CHECKPOINT_SIGNAL_FILE = "DVC_CHECKPOINT"...
download_captions_thread.py
from threading import Thread import time from pytube import YouTube from .step import Step from .step import StepException class DownloadCaptionsThread(Step): def process(self, data, inputs, utils): start = time.time() threads = [] for i in range(4): print('registering thre...
test_table.py
import random import pdb import pytest import logging import itertools from time import sleep from multiprocessing import Process import numpy from milvus import Milvus from milvus import IndexType, MetricType from utils import * dim = 128 delete_table_interval_time = 3 index_file_size = 10 vectors = gen_vectors(100,...
module.py
import os import io import socket import threading from itsdangerous import bytes_to_int from Queue import Queue from alize.log import Log from alize.exception import * import cv2 import numpy as np from PIL import Image L = Log("Minicap.Library.ALIZE") MAX_SIZE = 5 class Banner(object): def __init__(self): ...
pc.py
import sys from configparser import ConfigParser from datetime import datetime from hashlib import sha1 from json import load as jsonload from locale import LC_ALL, getdefaultlocale, getlocale, setlocale from os import _exit, execl, mkdir from os import name as osname from os import environ as osenviron from p...
rand-cam.py
# from selenium.webdriver.firefox.firefox_binary import FirefoxBinary # from selenium.webdriver.common.keys import Keys # from selenium import webdriver import cv2 import time import tkinter as tk from tkinter import * import requests from PIL import ImageTk, Image from bs4 import BeautifulSoup from skimage import io ...
msg.py
from utlis.rank import setrank ,isrank ,remrank ,setsudos ,remsudos ,setsudo,IDrank,GPranks from utlis.send import send_msg, BYusers, sendM,Glang,GetLink from handlers.delete import delete from utlis.tg import Bot, Ckuser from handlers.ranks import ranks from handlers.locks import locks from handlers.gpcmd import gpcmd...
comment-douyu.py
import socket import time import random import threading import re import json import sys import os import platform import notify2 from urllib import request g_rid= b'265352' g_username= b'visitor42' g_ip= b'danmu.douyutv.com' g_port= 8601 g_gid= b'0' g_exit= False sysinfo = platform.system() def notify(title, messag...
annoysim.py
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals import sys reload(sys) sys.setdefaultencoding("utf-8") """ Annoy Trainer This is the implementation of Annoy, developed by Spotify. The source code of Annoy Library and documentation about it can be found at: https://github.com/spotify...
base.py
import base64 import hashlib import io import json import os import threading import traceback import socket import sys from abc import ABCMeta, abstractmethod from six import text_type from six.moves.http_client import HTTPConnection from six.moves.urllib.parse import urljoin, urlsplit, urlunsplit from ..testrunner i...
check_mem_usage.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2020 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 ma...
test_delivery_herald.py
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
utility.py
import os import math import time import datetime from multiprocessing import Process from multiprocessing import Queue import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import imageio import torch import torch.optim as optim import torch.optim.lr_scheduler as lrs class time...
utils.py
""" Changelog: 2016.11.22 fix function to strip *.i input semantically 2016.08.12 add option to show memory usage 2015.07.10 changed KeyboardInterrupt handling (was not killing the backend on Ubuntu) 2014.10.09 linemarkerinfo method 2014.10.07 improved timeout management (Class Command: ctrl-C...
_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...
build_mscoco_data.py
# Copyright 2016 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...
threading_helper.py
import threading def process_threaded(call, args_list, num_workers=8): def thread_target(): global c global num_done while True: c.acquire() remaining = len(args_list) if remaining == 0: num_done += 1 if num_done == num_wo...
serverapp.py
"""A tornado based Jupyter server.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import binascii import datetime import errno import gettext import hashlib import hmac import inspect import ipaddress import json import logging import mimetypes import os import p...
plot_img_formovie_mp.py
#!/usr/bin/env python3 import matplotlib matplotlib.use("Agg") import numpy import pylab import sys import os import multiprocessing def plot(dirname, data, pos, xlen, ylen): pylab.rcParams["font.size"]=8 pylab.rcParams["legend.fontsize"]=8 #pylab.rcParams["lines.linewidth"]=1 #pylab.rcParams["axes.li...
test_manager.py
""" switchboard.tests.test_manager ~~~~~~~~~~~~~~~ :copyright: (c) 2015 Kyle Adams. :license: Apache License 2.0, see LICENSE for more details. """ from __future__ import unicode_literals from __future__ import absolute_import import threading import pytest from mock import Mock, patch from webob import Request from ...
ipc_util.py
#!/usr/bin/python3 import socket import os, sys, time import threading import collections import enum import fcntl """ [note] message format: ##HEAD##|<payload>|##END## payload format: <command>][<data>, <data>, ... server response spec (after receiving message from client): MSG][ <message content>; -1 for error on...
host.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyright (c) 2012 University Of Minho # (c) Copyright 2013 Hewlett-Pa...
process.py
import itertools import logging import multiprocessing import time from typing import Any, AsyncGenerator, List, NamedTuple, Optional, Tuple # noqa: F401 from lahja import BroadcastConfig, ConnectionConfig from lahja.tools.benchmark.backends import BaseBackend from lahja.tools.benchmark.constants import ( DRIVER_...
fs_heartbeat.py
"""Filesystem heartbeat wrapper Perl might be better for efficiency. But we will use python for now. Non-zero status means *this* failed, not the wrapped command. """ import argparse import os import socket import sys import threading import time DESCRIPTION = """ We wrap a system call to produce both a heartbeat an...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from el...
capture.py
#!/usr/bin/python3 import cv2 import sys import time import numpy from threading import Thread, Lock capture = cv2.VideoCapture(int(sys.argv[2])) fourcc = cv2.VideoWriter_fourcc(*'XVID') FPS = 12.5 SPF = 1.0 / FPS width, height = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)), int(capture.get(cv2.CAP_PROP_FRAME_HEIGH...
http_requester_test.py
from context import web_monitor # noqa from web_monitor.http_requester import do_requests from http.server import HTTPServer, BaseHTTPRequestHandler import random import threading import pytest random.seed(1987) class MockRequestHandler(BaseHTTPRequestHandler): def do_GET(self): if self.path in ['/', '/...