source
stringlengths
3
86
python
stringlengths
75
1.04M
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...
tcpThreadedServer.py
from datetime import datetime from json import loads, dumps from pprint import pprint import socket from threading import Thread class ThreadedServer(Thread): def __init__(self, host, port, timeout=60, debug=False): self.host = host self.port = port self.timeout = timeout self.debu...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class and IPv6 environment import ftplib import threading import asyncore import asynchat import socket import StringIO from unittest import TestCase from test import test_support from test.test_support import HOST # t...
PortScanner.py
#!/usr/bin/python from socket import * # for coloring stuff in the terminal from termcolor import colored, cprint #for printing arguments help and available options for users import optparse # for threading from threading import * import re ''' Description: This tool is part of the ethical hacking...
build_imagenet_data.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...
tasks.py
import uuid import time from functools import partial from collections import Counter from threading import Thread from queue import Queue, Empty class TaskManager: @staticmethod def hash_task(task): return hash(''.join(str(task.get(key, '')) for key in ('package', 'version', 'function'))) def __...
scoring_context.py
import logging import multiprocessing import time from hashlib import sha1 from revscoring import Model, dependencies from revscoring.dependencies import dig from revscoring.extractors import Extractor from revscoring.features import trim logger = logging.getLogger(__name__) class ScoringContext(dict): """ ...
githubqrl.py
# github-qrl signing code from github import Github import threading import db import json import time import scan from os import urandom from pyqrllib import pyqrllib from pyqrllib.pyqrllib import bin2hstr, getRandomSeed, hstr2bin, str2bin, bin2mnemonic, mnemonic2bin, QRLHelper, shake256 import bot_credentials import...
active_learning_topk_baselines.py
import pathlib from multiprocessing import Lock, Process, JoinableQueue from tqdm import tqdm from utils import * OUTPUT_DIR = RESULTS_DIR + "active_learning_topk" logger = logging.getLogger(__name__) process_lock = Lock() def main_accuracy_topk(args: argparse.Namespace, sample=True, eval=True, plot=True) -> None...
stm32uart.py
# Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Allow creation of uart/console interface via stm32 usb endpoint.""" import errno import exceptions import os import pty import select import sys import ...
rotation.py
# -*- coding: utf-8 -*- import os import threading import time import traceback from airtest.core.android.constant import ORI_METHOD, ROTATIONWATCHER_JAR from airtest.utils.logger import get_logger from airtest.utils.nbsp import NonBlockingStreamReader from airtest.utils.snippet import reg_cleanup, is_exiting, on_meth...
test_proxy.py
# -*- coding: utf-8 -*- """Test using a proxy.""" # External imports import multiprocessing import pytest from six.moves import socketserver, SimpleHTTPServer from six.moves.urllib.request import urlopen # Internal imports import vcr # Conditional imports requests = pytest.importorskip("requests") class Proxy(Sim...
runtest.py
#!/usr/bin/python3 ## runtest.py # The runtest.py script runs regression tests on the CuraEngine. # It parses the json file for settings to know which settings can be passed towards the engine. # It runs the following test: # * Defaults # * Bounds/possible values # * Single random value # * All settings random import...
1_disc_golf_range.py
"""Hard coded variables are on lines 27-29. Just run with Python3 1_disc_golf_range.py""" from threading import Semaphore, Thread from time import sleep import random """ UNSYNC CODE # frolfer while True: stash -= N # call for bucket for i in range(0,N): # for each disc in bucket, di...
listener.py
from flask import Flask, request import json from robot import Robot import threading from flask_cors import CORS # UML was made using this software # https://www.planttext.com app = Flask(__name__) cors = CORS(app, resources={r"/*": {"origins": "*"}}) @app.route("/guide_user", methods=["POST"]) # { # "name": "Sher...
processor_stog.py
import warnings warnings.simplefilter('ignore') import logging from threading import Thread from ..models.model_factory import load_inference_model from ..graph_processing.annotator import load_spacy logger = logging.getLogger(__name__) # Setence to Graph processor class ProcessorSTOG(object): def __init__(...
bot.py
import asyncio import base64 import concurrent.futures import datetime import glob import json import math import os import pathlib import random import sys import time from json import dumps, loads from random import randint import re from re import findall import requests import urllib3 from Crypto....
mprofile.py
import subprocess import threading import copy, os import time import json from UTILS.colorful import * # ubuntu command to kill process: kill -9 $(ps -ef | grep fuqingxu | grep teamviewer | grep -v grep | awk '{print $ 2}') arg_base = ['python', 'main.py'] log_dir = './T1-bench-IDL50/' run_group = "bench" # base_co...
ev_loop.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals from threading import Thread import zmq from wolframclient.language import wl from wolframclient.serializers import export from wolframclient.utils.externalevaluate import EXPORT_KWARGS, StdoutProxy, start_zmq_loop from...
base.py
# coding: utf8 # Copyright (c) 2020 PaddlePaddle 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 req...
vsearch4web.py
from flask import Flask, render_template, request, escape, session, copy_current_request_context from vsearch import search4letters from DBcm import UseDatabase, ConnectionError, CredentialError, SQLError from checker import check_logged_in from time import sleep from threading import Thread app = Flask(__name__) app....
stoppable_thread.py
#!/usr/bin/env python # Copyright (c) 2019 Diamond Key Security, NFP # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # - Redistributions of source code must retain the above copyright notice, #...
RPCServer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import json import logging import os import pprint import sys import threading from collections import OrderedDict from functools import wraps from threading import Lock from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler import netifa...
stupid_tracking.py
#!/usr/bin/env python import rospy #!/usr/bin/env python import rospy import tf from nav_msgs.msg import Path from geometry_msgs.msg import PoseStamped,Twist from sensor_msgs.msg import LaserScan from threading import Lock,Thread import math import time class Tracking: def __init__(self): self.arrive = 0.1 ...
data_collector_base.py
import json import logging import os import threading import traceback from abc import ABC, abstractmethod from datetime import datetime import matplotlib.pyplot as plt class DataCollector(ABC): def __init__(self, world, **kwargs): self.world = world now = datetime.now() se...
radar_viewer.py
import multiprocessing import sys import time import webbrowser import threading from server import http_server from acconeer_utils.clients.reg.client import RegClient from acconeer_utils.clients.json.client import JSONClient from acconeer_utils.clients import configs from acconeer_utils import example_utils def ch...
rapid.py
# Python3 libraries required for the successful setup of this script import os import sys import click from termcolor import colored import traceback import subprocess import queue import threading import multiprocessing import giturlparse from giturlparse import parse import urllib3 from bs4 import BeautifulSoup impor...
tests.py
from __future__ import absolute_import import sys import time from django.conf import settings from django.db import transaction, connection from django.db.utils import ConnectionHandler, DEFAULT_DB_ALIAS, DatabaseError from django.test import (TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature) from djang...
Bootstrap_node.py
import time import flask from flask import Flask, render_template, request, redirect, url_for import sys import requests import json from node import node from threading import Thread import hashlib app = Flask(__name__) ip_port = sys.argv[1] replicas = sys.argv[3] # Number of replicas rep_type = sys.ar...
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...
generator.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module is for generating the batch data for training and testing. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from multiprocessing import Process, Queue, Value def get_label_...
experiment_queue.py
##################################################################### # # # /experiment_queue.py # # # # Copyright 2013, Monash ...
algorithms.py
import numpy as np import pulp as p #import multiprocessing class Solver(): """Consists of three solving algorithms""" def __init__(self, S, A, T, R, gamma,):# mdptype, end ): self.S = S #numStates self.A = A #numActions self.T = T #SxAxS self.R = R #SxAxS self.gamma = gamma #[0,1] # self.mdp...
__init__.py
# # Copyright (C) 2018-2019 Nippon Telegraph and Telephone Corporation. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from grpclib.client import Channel from taish import taish_pb2 from taish import taish_grpc import asyncio from ...
backfiller.py
def backfill_now(port=7496, clientId=23, tickers=['TATAMOTOR'], duration="20 D", bar_size="5 mins"): from broker_to_csv import TradingApp, multi_historical_retriver import pandas as pd import threading import time ########## Starting App as Thread ############# def websocket_con(): ...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import test_support import asyncore import socket import select import errno import subprocess import time import os import pprint import urllib, urlparse import shutil import traceback from BaseHTTPServer import HTTPServer ...
Main.py
from MainBot import MainBot from GUI import MainGui import threading import time, random from tkinter.font import Font bot = MainBot() gui = MainGui(bot) def MainLoop(): bot.setupDatabase() while True: time.sleep(0.1) if bot.loggedIn == True: if bot.bot_running == True: ...
ctbserver.py
from osu_parser.beatmap import Beatmap from osu.ctb.difficulty import Difficulty from ppCalc import calculate_pp import os import threading import socket import struct import sys import traceback import time CMD_KEEP_ALIVE = 0 CMD_KEEP_ALIVE_OK = 1 CMD_CALCULATE_CTB = 2 TIMEOUT = 3 def process_exist(imagename): ...
test_blue_dot.py
import pytest from bluedot import MockBlueDot, BlueDotSwipe, BlueDotRotation from bluedot.exceptions import ButtonDoesNotExist from time import sleep from threading import Event, Thread def test_default_values(): mbd = MockBlueDot() assert mbd.device == "hci0" assert mbd.port == 1 assert mbd.running ...
main.py
import numpy import random import threading level_list_snakes={'easy': 5, 'medium': 6, 'hard':7} level_list_ladder={'easy': 7, 'medium': 6, 'hard':5} def check_tail_foot(y_axis): return (9-y_axis)*10 class score: def __init__(self): self.score = 0 @property def check_score(sel...
HolePunchPeerEcho.py
# HolePunchPeerEcho.py # Billy Kihei (c) 2021 # Intelligent Mobile Device Lab @ Kennesaw State University # Part of the 5Gtoolkit for testing commercial 5G networks. # This app measures the Layer 7 delay to send the character '0' to a peer via a NAT hole-punch. # The purpose of this app is to measure the Layer 7 round...
monitor.py
# Copyright 2015 Intel Corporation. # 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 requ...
cli.py
#!/usr/bin/env python ''' brozzler/cli.py - brozzler command line executables Copyright (C) 2014-2019 Internet Archive 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/lic...
bootstrap.py
import sys import threading import os from textwrap import dedent import sublime # Clean up the installed and pristine packages for Package Control 2 to # prevent a downgrade from happening via Sublime Text if sys.version_info < (3,): sublime_dir = os.path.dirname(sublime.packages_path()) pristine_dir = os.pa...
worker.py
import threading import queue import logging logger = logging.getLogger(__name__) class Worker: ''' Producer-Consumer ''' def __init__(self, name='', count=1): self.q = queue.Queue() self.count = count self.name = name self.worker_list = [threading.Thread(target=self...
syncer.py
import os import threading class Syncer(object): def __init__(self, files_to_sync, path, info, onFinished, onSync): self.files_to_sync = files_to_sync self.path = path self.info = info self.onFinish...
main.py
import threading import time from colorama import Fore shop_cap = None input_semaphor = threading.Semaphore(2) output_door_semaphor = threading.Semaphore(1) store_cash_register1_semaphor = threading.Semaphore(1) store_cash_register2_semaphor = threading.Semaphore(1) store_cash_register3_semaphor = threading.Semaphore(...
masterslave.py
from multiprocessing import Process, Semaphore, Queue class Master(object): def __init__(self, epoch, client_num, gather_lock, gather_queue, sendback_queue): self.epoch = epoch self.client_num = client_num self.gather_lock = gather_lock self.gather_queue = gather_queue self...
websocket.py
import asyncio import json import logging import os from threading import ( Thread, ) import websockets from web3.exceptions import ( ValidationError, ) from web3.providers.base import ( JSONBaseProvider, ) RESTRICTED_WEBSOCKET_KWARGS = {'uri', 'loop'} DEFAULT_WEBSOCKET_TIMEOUT = 10 def _start_event_lo...
simsound.py
import multiprocessing as mp import winsound import time import math import threading import os import sys import json class Sound: ''' Highest level sound interface for winsound Unfortunately, winsound always adds a small gap between the beeps. I'm leaving this code in case I need it in the future, b...
test_dota_base_q.py
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import tqdm import argparse from multiprocessing import Queue, Process from utils import...
utils.py
import cv2 import numpy as np import torch import time from torchvision import io from threading import Thread from torch.backends import cudnn def setup_cudnn() -> None: # Speed-reproducibility tradeoff https://pytorch.org/docs/stable/notes/randomness.html cudnn.benchmark = True cudnn.deterministic = Fal...
rosbridge.py
import websocket import threading import json import traceback import time import string import random class RosbridgeSetup: def __init__(self, host, port): self.callbacks = {} self.service_callbacks = {} self.resp = None self.connection = RosbridgeWSConnection(host, port) ...
node.py
import threading import time import utils from config import cfg FOLLOWER = 0 CANDIDATE = 1 LEADER = 2 class Node(): def __init__(self, fellow, my_ip): self.addr = my_ip self.fellow = fellow self.lock = threading.Lock() self.DB = {} self.log = [] self.staged = None...
matrix.py
import _thread import profile import random import operator import sys import time import multiprocessing from Poker.cards import Cards, VALUES MATRIX_WIDTH = VALUES[-1] + 1 MATRIX_HEIGHT = 4 def remove_dup_combo(combo_list): final_combos = [] for i in range(len(combo_list)): for ...
views.py
# -*- coding: UTF=8 -*- __author__ = 'Tomas Hartmann' import threading import time from flask import render_template, request, redirect, url_for, session import webshare import files import os from appwebshare.scripts import config from appwebshare import app @app.route("/") def index(): if 'username' in session:...
eventEngine.py
# encoding: UTF-8 # 系统模块 try: from Queue import Queue, Empty except: from queue import Queue, Empty from threading import Thread from time import sleep from collections import defaultdict # 自己开发的模块 from eventType import * ######################################################################## class EventE...
multiprocessing_benchmark.py
import sys import time from collections import defaultdict from multiprocessing import Pool, Process import numpy as np import psutil import scipy.signal import tensorflow as tf num_trials = 5 # Count the number of physical CPUs. num_cpus = psutil.cpu_count(logical=False) print('Using {} cores.'.format(num_cpus)) ...
app.py
#!/usr/bin/env python # coding: utf-8 """ demo for alternative display for ecFlow suites started with django framework 201502 shifted to Flask, if it can make it lighter 201504 """ from gevent import monkey monkey.patch_all() import time import datetime import os import re from subprocess import Po...
process.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import, with_statement import copy import os import sys import time import errno import types import signal import logging import threading import contextlib import subprocess import multiprocessing import multiprocessing.util # Import salt...
profile.py
#!/bin/python3 import threading from time import sleep import logging import yappi import activitywatch yappi.start(profile_threads=True) print("Starting to profile") thread = threading.Thread(target=activitywatch.start, kwargs={"loglevel": logging.DEBUG}, daemon=False) thread.start() try: sleep(60*60*24) # ...
generate_corpus.py
import requests import logging import xml.etree.ElementTree as ET import codecs import os import sys import time import json import pickle from time import sleep import subprocess import multiprocessing as mp from sqlalchemy.orm.exc import NoResultFound from sqlalchemy import create_engine from sqlalche...
streaming.py
#!/usr/bin/env python3 #!/usr/bin/python3.8 # OpenCV 4.2, Raspberry pi 3/3b/4b - test on macOS from socketIO_client import SocketIO, LoggingNamespace from dto.record import RecordDTO import threading import queue import base64 #https://pypi.org/project/socketIO-client/ class Streaming: def __init__(self): ...
process.py
# -*- coding: utf-8 -*- ############################################## # The MIT License (MIT) # Copyright (c) 2018 Kevin Walchko # see LICENSE for full details ############################################## import multiprocessing as mp class GeckoSimpleProcess(object): """ A simple class to help processes st...
primare_twisted.py
"""Interface to Primare amplifiers using Twisted SerialPort. This module allows you to control your Primare I22 and I32 amplifier from the command line using Primare's binary protocol via the RS232 port on the amplifier. """ import click import logging from threading import Thread from twisted.internet.serialport i...
serve.py
# The MIT License (MIT) # Copyright (c) 2018 by the xcube development team and contributors # # 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...
setup.py
from __future__ import print_function import fnmatch import hashlib import os import shutil import sys import subprocess import traceback import tempfile import zipfile import distutils.sysconfig as dsc from glob import glob from setuptools import find_packages from distutils.core import setup from setuptools.command...
script.py
import tkinter from threading import Thread from time import sleep from tkinter import * from tkinter import scrolledtext from tkinter import messagebox from tkinter import filedialog from tkinter.ttk import Progressbar import urllib.parse as urlparse import urllib.request from urllib.request import urlopen import re i...
store.py
from os import unlink, path, mkdir import json import uuid as uuid_builder from threading import Lock from copy import deepcopy import logging import time import threading import os from changedetectionio.notification import default_notification_format, default_notification_body, default_notification_title # Is ther...
outfeed_example.py
from threading import Thread from tensorflow.python.ipu import ipu_compiler from tensorflow.python.ipu import ipu_infeed_queue from tensorflow.python.ipu import ipu_outfeed_queue from tensorflow.python.ipu import loops from tensorflow.python.ipu import scopes from tensorflow.python.ipu import utils from tensorflow.pyt...
pdataset.py
"""Data fetching with pandas """ # MIT License # # Copyright (c) 2018 Yichun Shi # # 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 righ...
RequestsC.py
import requests, SystemC, json, threading class RequestsCommands: def __init__(self): self.SystemCommands = SystemC.System_Commands() def Get_content(self, user_input): try: r = requests.get(user_input[1]) content = r.content print(content) try: ...
load_test_client.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
server.py
import socket import threading from pyfiglet import figlet_format from termcolor import colored server = socket.socket(socket.AF_INET,socket.SOCK_STREAM) server.bind(("127.0.0.1",5555)) server.listen() print(colored(figlet_format("Server Up"),color="blue")) clients = [] nicknames = [] def broadcast(message): for...
engine.py
from __future__ import absolute_import, division from sqlalchemy.engine.base import Engine from sqlalchemy.exc import StatementError from twisted._threads import ThreadWorker, AlreadyQuit from twisted.internet.defer import Deferred, fail from twisted.python.failure import Failure from threading import Thread try: ...
dothreadlocal.py
import threading local_school = threading.local() def process_student(): std = local_school.student print('Hello, %s (in %s)' % (std, threading.current_thread().name)) def process_thread(name): local_school.student = name process_student() t1 = threading.Thread(target=process_thr...
rlfsm.py
import os import collections import random import time import datetime import threading import logging from dynamo.fileop.base import FileQuery from dynamo.fileop.transfer import FileTransferOperation, FileTransferQuery from dynamo.fileop.deletion import FileDeletionOperation, FileDeletionQuery, DirDeletionOperation f...
inetsocket.py
# -*- coding: utf-8 -*- import Queue as pqueue import socket as psocket import threading as pthread import itertools as it from . import inetheaders, inetmsg, ineterr AUTO_PING_SECONDS = 5.0 class Socket(object): def __init__(self, socket): self._txn_id = it.count(start = 1) ...
forecast_baseline_perf.py
import argparse, json, pickle import os, sys from os.path import join, isfile, basename from glob import glob from time import perf_counter import multiprocessing as mp import traceback from tqdm import tqdm # setting environment variables - we have noticed that # numpy creates extra threads which slows down computat...
procs_py37.py
# tag::PRIMES_PROC_TOP[] from time import perf_counter from typing import Tuple, List, NamedTuple from multiprocessing import Process, SimpleQueue # <1> from primes import is_prime, NUMBERS class Result(NamedTuple): # <3> flag: bool elapsed: float def check(n: int) -> Result: # <5> t0 = perf_counter()...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
ClientDaemons.py
from . import ClientImporting from . import ClientImportOptions from . import ClientImportFileSeeds from . import ClientPaths from . import ClientThreading from . import HydrusConstants as HC from . import HydrusData from . import HydrusExceptions from . import HydrusGlobals as HG from . import HydrusNATPunch from . im...
WSI_Densely_Patches_Extractor.py
import sys, os, getopt import openslide from PIL import Image import numpy as np import pandas as pd from skimage import io import threading import time import albumentations as A import time from torchvision import transforms from skimage import exposure import json import cv2 import argparse np.random.seed(0) pars...
train_tcn.py
import os import numpy as np import argparse import torch from torch import optim from torch import multiprocessing from torch.optim import lr_scheduler from torch.autograd import Variable from torch.utils.data import DataLoader, ConcatDataset from torch.utils.data.sampler import RandomSampler from util import (VideoTr...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import BIP32Node from electrum import constants from electrum.i18n import _ from electrum....
validate.py
import sys import click from compose_lib import builder_data, profile from compose_lib.command_category import CommandCategory from commands import config import tempfile import subprocess import yaml import json import logging from compose_lib.common import os_return, find_nlg_app from threading import Thread, Event...
test_file2k.py
import sys import os import unittest import itertools import select import signal import stat import subprocess import time from array import array from weakref import proxy try: import threading except ImportError: threading = None from test import test_support from test.test_support import TESTFN, run_unitte...
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 json import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CH...
Runner.py
''' Soft Actor-Critic version 2 using target Q instead of V net: 2 Q net, 2 target Q net, 1 policy net add alpha loss compared with version 1 paper: https://arxiv.org/pdf/1812.05905.pdf https://github.com/quantumiracle/SOTA-RL-Algorithms ''' import random import gym import numpy as np import time import torch impor...
scheduler.py
#### WORK IN PROGRESS... NOT SUPPOSED TO WORK YET USAGE = """ ## Example For any existing app Create File: app/models/scheduler.py ====== from gluon.scheduler import Scheduler def demo1(*args,**vars): print 'you passed args=%s and vars=%s' % (args, vars) return 'done!' def demo2(): 1/0 scheduler = Sch...
core_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...
test_dist_graph_store.py
import os os.environ['OMP_NUM_THREADS'] = '1' import dgl import sys import numpy as np import time import socket from scipy import sparse as spsp from numpy.testing import assert_array_equal from multiprocessing import Process, Manager, Condition, Value import multiprocessing as mp from dgl.heterograph_index import cre...
genome_wide_association_studiesServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
taro_test_util.py
from multiprocessing import Queue from multiprocessing.context import Process from pathlib import Path from typing import Dict, Tuple import prompt_toolkit import yaml from prompt_toolkit.output import DummyOutput from taro import paths, JobInfo, Warn, WarningObserver, cfg, ExecutionStateObserver from taro.jobs impor...
download_sqs_worker.py
import botocore import os import signal import time from multiprocessing import Process from django.conf import settings from django.core.management.base import BaseCommand from usaspending_api.common.sqs_helpers import get_sqs_queue_resource from usaspending_api.download.download_exceptions import FatalError from u...
binance.py
import requests from urllib.parse import urlencode import hmac, hashlib, datetime, math, json import traceback from numpy import linspace from pandas import to_numeric from time import time from pytz import reference from ..utils.utils import since from ..utils.types import * ROOT_URL = 'https://api.binance.com/api/v3...
streaming.py
# Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. import httplib from socket import timeout from threading import Thread from time import sleep import urllib from weibopy.auth import BasicAuthHandler from weibopy.models import Status from weibopy.api import API from weibopy.error import WeibopError ...
bootstrap.py
""" Bootstrap an installation of TLJH. Sets up just enough TLJH environments to invoke tljh.installer. This script is run as: curl <script-url> | sudo python3 - Constraints: - The entire script should be compatible with Python 3.6, which is the on Ubuntu 18.04+. - The script should parse in Pytho...
gpu_imagenet_bench.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...
server.py
# ****************************************************************************# # Copyright (c) 2020 Wandemberg Gibaut # # All rights reserved. This program and the accompanying materials # # are made available under the terms of the MIT License # ...