source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
analysis_subprocess.py | #####################################################################
# #
# /analysis_subprocess.py #
# #
# Copyright 2013, Monash University ... |
sim_double_pendulum.py | # Copyright (c) 2018, The SenseAct Authors.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import gym
import time
from senseact.rtrl_base_env import RTRLBaseEnv
from senseact.devices.sim_doubl... |
app.py | from src.kafka_module.kf_service import process_vision_ocr_kf, vision_ocr_request_worker
from anuvaad_auditor.loghandler import log_info
from anuvaad_auditor.loghandler import log_error
from flask import Flask
from flask.blueprints import Blueprint
from flask_cors import CORS
from src import routes
import config
import... |
vnlbank.py | # encoding: utf-8
import urllib
import hashlib
import requests
from Queue import Queue, Empty
from threading import Thread
from time import sleep
API_ROOT ="https://api.lbank.info/v1/"
FUNCTION_TICKER = ('ticker.do', 'get')
FUNCTION_DEPTH = ('depth.do', 'get')
FUNCTION_TRADES = ('trades.do', 'get')
FUNCTION_KLINE... |
D_1_Recalculate_new_levenshtein.py | import pandas as pd
import numpy as np
import math
import Levenshtein
from tqdm import tqdm
from multiprocessing import Process
def recalculate_levenshtein_distance(log_process, process_id, OUTPUT_PATH):
log_process['new_lev_dist'] = -7
for row in range(log_process.shape[0]):
## Very first row
... |
popen.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import copy
import logging
import os
import subprocess
import threading
import time
from .constants import PIPE, STDOUT, DEVNULL
from .exceptions import TimeoutExpired
logger = logging.getLogger(__name__)
class Popen:
'''
... |
utils.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import warnings
import time
import threading
import logging
from bisect import bisect_left
from synphot import SpectralElement
from scipy.interpolate import interp1d
from decimal import Decimal
import astropy.units as u
# Get a... |
manager.py | import collections
import copy
import logging
import queue
import sys
import tempfile
import threading
from . import checker
from . import mutator
from . import options
from . import parser
from . import semantics
Candidate = collections.namedtuple('Candidate', ['counter', 'simplification', 'exprs'])
"""Represents a ... |
pool_scheduler.py | import paho.mqtt.client as mqtt
from threading import Thread
import time
import datetime
global current_temperature
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
client.subscribe("POOL/... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import namedtuple, OrderedDict
import os
import pickle
import platform
import random
import re
import subprocess
import sys
import sysconfig
import textw... |
start.py | import os
import subprocess
from multiprocessing import current_process
from multiprocessing.context import Process
class SubprocessService:
@staticmethod
def start(python_executable,application_name,path:str):
print(f"Application : {application_name}")
print(f"Process Name : {current_process()... |
test_base.py | #!/usr/bin/env python
# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same director... |
test_core.py | from datetime import timedelta
from functools import partial
import itertools
import json
import operator
from operator import add
import os
from time import time, sleep
import sys
import pytest
from tornado import gen
from tornado.queues import Queue
from tornado.ioloop import IOLoop
import streamz as sz
from stre... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import os
import pickle
import random
import re
import subprocess
import sys
import sysconfig
import textwrap
import threading
import ... |
notifications.py | import json
from threading import Thread
from pywebpush import webpush, WebPushException
from flask import current_app
from syllabin.models import User, Group, Subscription, Announcement
from syllabin.components import db
class FlaskThread(Thread):
def __init__(self, *args, **kwargs):
super().__init__(*a... |
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... |
program.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... |
util.py | import io
import os
import re
import socket
import subprocess
import threading
import time
from contextlib import contextmanager
from functools import partial as p
from typing import Dict, List
import docker
import netifaces as ni
import yaml
from tests.helpers.assertions import regex_search_matches_output
from tests... |
events.py | import datetime
from RPi import GPIO
from threading import Lock, Thread
import time
_lock = Lock()
# sets up the buttons and stores which button does what
class Buttons:
button_numbers = {5: "a", 6: "b", 16: "x", 24: "y"}
home_menu_buttons = {"a": "home", "b": "none", "y": "none", "x": "backlight"}
lis... |
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... |
ga_fuzzing.py | import sys
import os
from importlib_metadata import version
from customized_utils import parse_fuzzing_arguments
sys.path.append('pymoo')
sys.path.append('fuzzing_utils')
fuzzing_arguments = parse_fuzzing_arguments()
if not fuzzing_arguments.debug:
import warnings
warnings.filterwarnings("ignore")
if fuzzi... |
ceo.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @author : microfat
# @time : 01/26/21 20:18:18
# @File : factory.py
import sys
import logging
from multiprocessing import Process, cpu_count, Queue
import aioprocessing
from depts import purchasing_dept, production_dept, transportation_dept, operation_dept
from de... |
forsund.py | # -*- coding: utf-8 -*-
# 15/6/27
# create by: snower
from __future__ import absolute_import, division, print_function, with_statement
import os
import sys
import argparse
import multiprocessing
import atexit
from ..forsun import config
from ..utils import is_py3
parser = argparse.ArgumentParser(description='High-pe... |
index.py | # /usr/bin/env python2
# coding=utf-8
import os.path
import sys
import datetime
import traceback
import threading
# import socket
import SocketServer
import logging
import argparse
from enum import Enum
from dnslib import *
import random
import urllib
import json
from IPy import IP
from urlparse import urlparse
import... |
guestsnapshotter.py | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
helpers.py | """High-level functions to help perform complex tasks
"""
from __future__ import print_function, division
import os
import multiprocessing as mp
import warnings
from datetime import datetime
import platform
import struct
import shutil
import copy
import numpy as np
import pandas as pd
import time
pd.options.display.... |
PiRaP-2020-lecture-11.py | import numpy
import time
import math
import multiprocessing as mp
import joblib
# own function definitions
import tasks
def clear_all():
gl = globals().copy()
for var in gl:
if var[0] == '_': continue
if 'func' in str(globals()[var]): continue
if 'module' in str(globals... |
simpleui.py | import tkinter
import threading
from time import sleep
from functools import partial
import queue
##
##t's important that exceptions in my_method do not cause you to miss registering with the mainloop. You may want to put your call to root.after in the finally part of try/finally.
##[10:31:04 AM] Nieri TV: make incomi... |
bitmex_websocket.py | import websocket
import threading
import traceback
from time import sleep
import json
import logging
import urllib
import math
import time, urllib, hmac, hashlib
def generate_nonce():
return int(round(time.time() + 3600))
# Generates an API signature.
# A signature is HMAC_SHA256(secret, verb + path + nonce + d... |
test_consumer_group.py | import collections
import logging
import threading
import time
import pytest
import six
from kafka import SimpleClient
from kafka.conn import ConnectionStates
from kafka.consumer.group import KafkaConsumer
from kafka.coordinator.base import MemberState, Generation
from kafka.structs import TopicPartition
from test.c... |
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... |
ipl_bot.py | import telegram
import threading
import time
import json
import urllib.request
match_json = {}
privious_over_details = {}
prevoius_over_last_run = {}
def if_six_hit():
if_six_hit_bool = False
with urllib.request.urlopen("https://www.cricbuzz.com/match-api/livematches.json") as url:
match_json = json.... |
__init__.py | from threading import Thread, active_count
from typing import Iterable
import time
import os
import logging
from sys import exit as sysexit
from os import _exit as osexit
config = {'STOP':False,'KILLALL':False}
def stop(self, cls):
logging.info('Stop Signal Recieved')
global config
config['STOP'] = True
... |
callbacks_test.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... |
realfunction.py |
import uuid
import numpy as np
import scipy.optimize
from ._population import Population
from pychemia.utils.mathematics import unit_vector
class RealFunction(Population):
def __init__(self, function, ndim, limits, local_minimization=False):
"""
Creates a simple population of points in R^N with
... |
test_container.py | import dic
import threading
import time
import unittest
class Standalone(object):
pass
class SpecialStandalone(Standalone):
pass
class SimpleComponent(object):
def __init__(self, s: Standalone):
self.standalone = s
class SimpleModule(dic.container.Module):
def load(self, builder):
... |
tests.py | # -*- coding: utf-8 -*-
# Unit and doctests for specific database backends.
from __future__ import unicode_literals
import copy
import datetime
from decimal import Decimal, Rounded
import re
import threading
import unittest
import warnings
from django.conf import settings
from django.core.exceptions import Improperly... |
spotify_lyrics.py | #!/usr/bin/env python3
import atexit
import os
import textwrap
import threading
import time
import urllib.parse
from pathlib import Path
from subprocess import call
from urllib.request import urlretrieve
import dbus.mainloop.glib
import dbus.service
import ueberzug.lib.v0 as ueberzug
from gi.repository import GLib
i... |
server.py | import os
import sys
sys.path.append(os.path.abspath('.\src'))
sys.path.append(os.path.abspath('.'))
sys.path.append(os.path.abspath('..'))
os.environ['PYTHONPATH'] = os.path.abspath('..') + ";" + os.path.abspath('.')
import logging
import threading
import pika
from config.custom_logging import LogConfig
from config... |
main.py | from cpu import cpuUsage
from memSwap import memory
import argparse
from process import Top10ProcessesMemory
def main(t=10,i=1,**kwargs):
import threading
cputhread = threading.Thread(target=cpuUsage,args=(t,i))
memSwapthread = threading.Thread(target=memory,args=(t,i))
cputhread.start()
memSwapthr... |
test_html.py | from __future__ import print_function
import glob
import os
import re
import threading
import warnings
# imports needed for Python 3.x but will fail under Python 2.x
try:
from importlib import import_module, reload
except ImportError:
import_module = __import__
from distutils.version import LooseVersion
i... |
processes_barrier.py | import multiprocessing
from multiprocessing import Barrier, Lock, Process
from time import time
from datetime import datetime
def test_with_barrier(synchronizer_p, serializer_p):
name = multiprocessing.current_process().name
synchronizer_p.wait()
now = time()
with serializer_p:
print("process ... |
serveravg.py | from flcore.clients.clientavg import clientAVG
from flcore.servers.serverbase import Server
from utils.data_utils import read_client_data
from threading import Thread
class FedAvg(Server):
def __init__(self, device, dataset, algorithm, model, batch_size, learning_rate, global_rounds, local_steps, join_clients,
... |
worker.py | import logging
import traceback
from time import sleep
import sys
from multiprocessing import Process, Value, Pipe
from abc import abstractmethod
import dwf_client_util.util as util
import dwf_client_util.server as server
import dwf_client_util.task_manager as task_manager
ClientStatus = util.ClientStatus
Signals = u... |
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
Adapted for pytorch version by Ning Dai
"""
import numpy as np
import pdb
import torch
import ... |
tieba_sign.py | #!/usr/bin/env python3
# coding=utf-8
import hashlib
import json
import os
import prettytable as pt
import pyzbar.pyzbar as pyzbar
import requests
import time
from io import BytesIO
from PIL import Image
from random import choice
from threading import Thread
import schedule
class Tieba(object):
def __init__(self,... |
OcsCatchupArchiverThreads.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# +
# import(s)
# -
from __future__ import print_function
import argparse
import sys
import threading
import time
from ocs_common import *
from OcsLogger import *
from OcsEvents import *
from OcsStates import *
from SALPY_catchuparchiver import *
# +
# dunder string(s)
... |
common.py | # http://inamidst.com/saxo/
# Created by Sean B. Palmer
# You know your code is good when you don't have a generic module
import base64
import collections
import os
import pickle
import signal
import socket
import sys
import threading
# Usage as of 534f8c68:
# b64pickle: client
# b64unpickle: client, scheduler
# err... |
PySC2_A3C_FullyConv.py | """
PySC2_A3C_AtariNetNew.py
A script for training and running an A3C agent on the PySC2 environment, with reference to DeepMind's paper:
[1] Vinyals, Oriol, et al. "Starcraft II: A new challenge for reinforcement learning." arXiv preprint arXiv:1708.04782 (2017).
Advantage estimation uses generalized advantage estimat... |
simulate.py | from contextlib import contextmanager
import multiprocessing as mp
import subprocess
import pickle
import json
import tqdm
import time
import sys
import os
import re
import numpy as np
from simulator import get_simulator
from pscan import walk_space, organize_pscans
from config import maxseed, workpath
import mpi
def... |
__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,
List,
Type,
)
import... |
common.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
test_p2p_grpform.py | #!/usr/bin/python
#
# P2P group formation test cases
# Copyright (c) 2013, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import time
import threading
import Queue
import hwsim_utils
import uti... |
recording.py | # Copyright 2019 École Polytechnique Fédérale de Lausanne. 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 r... |
main.py | def exit(exit_code):
global drivers,locks
try:
with locks[3]:
try:drivers
except NameError:pass
else:
for driver in drivers:
try:Process(driver).terminate()
except:pass
except:pass
finally:
if exit_code:
print_exc()
stdout.write('\r[INFO] Exitting with exit code %d\n'%exit_code)
_e... |
train_dynamicdata.py | #!/usr/bin/env python
"""Train models using alternate dynamic data loader."""
import os
import signal
import torch
from pprint import pformat
import onmt.opts as opts
import onmt.utils.distributed
from onmt.utils.misc import set_random_seed
from onmt.utils.logging import init_logger, logger
from onmt.train_single im... |
broker.py | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... |
Hiwin_RT605_ArmCommand_Socket_20190627175339.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
main.py | from socket import *
import threading
import time
import random
import json
import pymysql
random.seed(time.time())
lock = threading.Lock()
connected_com = dict()
connected_dev = dict()
connected_mob = dict()
def getLog():
while True:
now = time.localtime()
print("%02d:%02d:%02d" % ((now.tm_hour+... |
test_kudu.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... |
sslproxy_test.py | """Test routines to generate dummy certificates."""
import BaseHTTPServer
import shutil
import signal
import socket
import tempfile
import threading
import time
import unittest
import certutils
import sslproxy
class Client(object):
def __init__(self, ca_cert_path, verify_cb, port, host_name='foo.com',
... |
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... |
draw.py | #!/usr/bin/python3
"""MathDraw - a virtual whiteboard
with batteries included.
"""
# Controls:
# lmb =paint
# rmb =erase
# mmb =cycle colors
# arrow keys =move canvas
# t =text input
# T =cli input
# return =finish text input
# double lmb =cycle colors
import os, subprocess... |
3.py | from multiprocessing import Process
import time
import os
from functools import wraps
start_time = time.time()
def timefn(fn):
@wraps(fn)
def measure_time(*args, **kwargs):
t1 = time.time()
result = fn(*args, **kwargs)
t2 = time.time()
print(f"@timefn: {fn.__name__} took {t2 -... |
utils.py | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
util.py | # -*- coding: utf-8 -*-
"""
(C) 2014-2019 Roman Sirokov and contributors
Licensed under BSD license
http://github.com/r0x0r/pywebview/
"""
import inspect
import json
import logging
import os
import re
import sys
import traceback
from platform import architecture
from threading import Thread
from uuid import uuid4
i... |
dqn_test.py | """
Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University.
All rights reserved.
Description :
dqn algorithm used for controling the steer to make a vehicle keep lane.
Author:Team Li
"""
import tensorflow as tf
import cv2, math, sys, random, threading
from keep_lane.basic_net.dqn_utils im... |
threadpool.py | import asyncio
import logging
import threading
import time
from queue import Queue
from mmpy_bot.scheduler import default_scheduler
from mmpy_bot.webhook_server import WebHookServer
log = logging.getLogger("mmpy.threadpool")
class ThreadPool(object):
def __init__(self, num_workers: int):
"""Threadpool c... |
common_cache_test.py | # Copyright 2018-2021 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
mpi.py | """
A work manager which uses MPI to distribute tasks and collect results.
"""
import collections
import logging
import threading
from mpi4py import MPI
from westpa.work_managers import WorkManager, WMFuture
log = logging.getLogger(__name__)
class Task:
# tasks are tuples of (task_id, function, args, keyword... |
crypto_util_test.py | """Tests for acme.crypto_util."""
import itertools
import socket
import threading
import time
import unittest
import six
from six.moves import socketserver #type: ignore # pylint: disable=import-error
import josepy as jose
import OpenSSL
from acme import errors
from acme import test_util
class SSLSocketAndProbeS... |
padding_fifo_queue_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
tcp.py | # -*- coding: utf-8 -*-
'''
TCP transport classes
Wire protocol: "len(payload) msgpack({'head': SOMEHEADER, 'body': SOMEBODY})"
'''
# Import Python Libs
from __future__ import absolute_import
import logging
import msgpack
import socket
import os
import weakref
import time
import traceback
import errno
# Import Salt... |
smc_udp_WPreceiver.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket, threading, time
from contextlib import closing
import rospy
from autoware_msgs.msg import Lane, Waypoint
import struct
from ctypes import *
#class DesiredCommand(Structure):
#class DesiredCommand(LittleEndianStructure):
class WAYPOINT(BigEndianStructure... |
utils.py | """
Executable tools. This module defines the classes :class:`Option` and
:class:`BaseCommand` that allow to develop automatically executable
commands. A utilitary script ``egglib`` will load this module at runtime
and let the user run any of this commands as if they were independent
programs.
"""
__license__ = """... |
lisp-etr.py | #-----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain ... |
rdd.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... |
test_insert.py | import pytest
from pymilvus import DataType, ParamError, BaseException
from utils.utils import *
from common.constants import *
from common.common_type import CaseLabel
ADD_TIMEOUT = 60
uid = "test_insert"
field_name = default_float_vec_field_name
binary_field_name = default_binary_vec_field_name
default_single_query ... |
igmpTest.py |
# Copyright 2017-present Open Networking Foundation
#
# 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 ag... |
server.py | import os
import sys
import threading
from collections import defaultdict
from enum import Enum
from itertools import groupby
import yaml
from dotenv import load_dotenv
from flask import Flask, jsonify, redirect, render_template, request, send_file
from werkzeug.utils import secure_filename
load_dotenv()
APP_ROOT = ... |
perf2.py | # perf2.py
# nb short request per second
import time
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('', 25000))
n = 0
from threading import Thread
def monitor():
global n
while True:
time.sleep(1)
print("{0} req/s".format(n))
n = 0
th = Thread(target=monitor)
t... |
controller.py | """
Game mode - controller:
Game - Abstract Game Class
SingleGame - LocalSingleGame
"""
import tkinter
from abc import abstractmethod
from threading import Thread
from typing import Callable, Dict, Tuple
from rules import Rule
from model import Manager
from player import LocalPlayer, Player
from view import B... |
faces.py |
#!git clone https://github.com/26medias/keras-face-toolbox.git
#!mv keras-face-toolbox/models models
#!mv keras-face-toolbox/utils utils
#!rm -r keras-face-toolbox
#!gdown https://drive.google.com/uc?id=1H37LER8mRRI4q_nxpS3uQz3DcGHkTrNU
#!mv lresnet100e_ir_keras.h5 models/verifier/insightface/lresnet100e_ir_keras.h5
#... |
run_dispatcher.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import os
import logging
from multiprocessing import Process
from django.conf import settings
from django.core.cache import cache as django_cache
from django.core.management.base import BaseCommand
from django.db import connection as django_connection
from komb... |
managed_event_loop.py | # Copyright 2020 Google LLC
#
# 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, s... |
_trimesh.py | from __future__ import division
import collections
import logging
import threading
import pyglet
import trimesh.viewer
from .. import model as model_module
logger = logging.getLogger('trimesh')
logger.setLevel(logging.ERROR)
class TrimeshSceneViewer(trimesh.viewer.SceneViewer):
def __init__(self, resolution... |
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... |
ami.py | import logging
import time
from importlib import import_module
from threading import Thread
import numpy as np
from ophyd.device import Device, Component as Cpt, Staged
from ophyd.signal import Signal
from ophyd.status import Status
from ophyd.utils.errors import ReadOnlyError
from toolz.itertoolz import partition
fr... |
Chembl_loader.py | import os.path as osp
import multiprocessing as mp
import gzip
import torch
from torch_geometric.data import Dataset, Data
# from chemreader.readers import Smiles
from rdkit import Chem
import numpy as np
from tqdm import tqdm
from util import get_filtered_fingerprint
class ChemBLFP(Dataset):
# allowable node... |
waiting_animation_thread.py | import os
from threading import Thread, Event
class WaitingAnimationThread:
MESSAGE = ":~$ ReuBERT is reading and understanding text to answer your question. $~:"
def __init__(self):
self.stopping_event = Event()
self.sleep_interval = 0.07
self.thread = Thread(target=self.run, daemon=... |
mock_static_file_server.py | from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
import os
import http.server
import socketserver
from threading import Thread
import logging
log = logging.getLogger(__name__)
PORT = 8999
def serve(port=PORT):
'''Serves test XML files over HTTP'''
... |
Player1.py | # encoding: utf-8
import os
from pygame import freetype
__author__ = "Yoann Berenguer"
__credits__ = ["Yoann Berenguer"]
__version__ = "1.0.0"
__maintainer__ = "Yoann Berenguer"
__email__ = "yoyoberenguer@hotmail.com"
import random
import socket
import _pickle as cpickle
import threading
import ti... |
ex7.py | #!/usr/bin/env python
from net_system.models import NetworkDevice, Credentials
from netmiko import ConnectHandler
import django, datetime, multiprocessing
def show_arp(device):
remote_conn = ConnectHandler(device_type=device.device_type,
ip=device.ip_address,
... |
test_cli.py | import os
import json
import pytest
import textwrap
from unittest.mock import patch
from multiprocessing import Process, Event
from pymem.cli import main, format_output
from click.testing import CliRunner
@pytest.fixture
def cli():
return CliRunner()
def test_invalid_pid(cli):
pid = os.getpid()
with pat... |
start_host.py | # Copyright 2019 Google LLC
#
# 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, ... |
test_cgo_engine.py | import json
import os
import sys
import threading
import unittest
import logging
import time
import torch
from pathlib import Path
from nni.retiarii.execution.cgo_engine import CGOExecutionEngine
from nni.retiarii.execution.logical_optimizer.logical_plan import LogicalPlan
from nni.retiarii.execution.logical_optimize... |
bldc_monitor.py | '''
bldc_monitor.py
Distributed under MIT License
Copyright (c) 2020 Haoze Zhang | Brown Engineering
'''
import os
import time
import threading
import yaml
import serial
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from scope import Scope
from messenger import Messenger
import cmd_pb2
i... |
collective_ops_test.py | # Copyright 2020 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 applicab... |
main-signlal-handling.py | import multiprocessing
import signal
import sys
import time
def main():
signal.signal(signal.SIGTERM, lambda signum, frame: signal_handler('main', signum, frame))
processes = []
for process_id in range(5):
processes.append(multiprocessing.Process(target=run, args=(process_id,)))
for proce... |
babigen.py |
import pickle
import numpy as np
from shutil import rmtree
import os
from os import listdir, mkdir
from os.path import join, isfile, isdir, dirname, basename, normpath, abspath, exists
import subprocess
import death.DNC.archi.param as param
from threading import Thread
import time
def create_dictionary(files_list):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.