source
stringlengths
3
86
python
stringlengths
75
1.04M
parallel.py
# Parallel implementation for sampling a multi-order echelle spectrum. # Because the likelihood calculation is independent for each order, the # runtime is essentially constant regardless of how large a spectral range is used. # Additionally, one could use this to fit multiple stars at once. # parallel.py is meant to...
TestMirror.py
# -*- coding: utf-8 -*- from __future__ import print_function import locale from threading import Thread import time import traceback import urllib import feedparser try: from Tkinter import * import Tkinter as tk except ImportError: from tkinter import * import tkinter as tk import datetime import p...
uncontrolled.py
from multiprocessing import Process, Queue import chargingmodel.preprocessing as preprocessing import chargingmodel.optimize as optimize import chargingmodel.tools as tools # Uncontrolled charging. # Every agent charges immediately and as much as possible after arriving at a charging station. # Runs for all r...
kiritan.py
# coding: UTF-8 import os import sys import time import hashlib import logging import threading import subprocess from win32con import * from win32gui import * from win32process import * # 共通設定 waitSec = 0.1 windowName = "VOICEROID+ 東北きりたん EX" # WAV生成(排他) lock = threading.Lock() def talk(input): with lock: retur...
functions.py
import math import threading from neopixel import * import mido import datetime import psutil import time import socket import RPi.GPIO as GPIO def get_ip_address(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) local_ip = s.getsockname()[0] s.close() return local...
NyxunToolKit-Nuker.py
import requests import discord import os import sys import colorama import threading from itertools import cycle from datetime import datetime from colorama import Fore, init, Style import ctypes import urllib import time import json import random import string import itertools from re import findall import json import...
server.py
from prometheus_client import start_http_server, Gauge, Counter, Histogram, Summary import redis import json import logging import sys from subprocess32 import call import psutil from schema import validate_schema, Prom_Type from jsonschema import ValidationError from config import CHANNEL_NAME, DEFAULT_BUCKETS, UNIX...
data_store_test.py
#!/usr/bin/env python # -*- mode: python; encoding: utf-8 -*- """These are basic tests for the data store abstraction. Implementations should be able to pass these tests to be conformant. """ import csv import functools import hashlib import inspect import logging import operator import os import random import strin...
SocialFishTermux.py
#!/usr/bin/python3 #-*- coding: utf-8 -*- # SOCIALFISH v2.0 # by: An0nUD4Y # ########################### from time import sleep from sys import stdout, exit from os import system, path from distutils.dir_util import copy_tree import multiprocessing from urllib.request import urlopen, quote, unquote from platform ...
phase3_log_daemon.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # import needed libraries import glob import ray import threading import time from google.cloud import storage # type: ignore from builds.build_utilities import uploads_data_to_gcs_bucket # type: ignore @ray.remote class PKTLogUploader(object): """Implements a ba...
sharpsocks.py
# # Execute sharpsocks on a session # import os import time import argparse import threading from lib import shellcode __description__ = "Create a SOCKS tunnel over HTTP/HTTPS\n" __author__ = "@_batsec_, @rbmaslen" __type__ = "module" # identify the task as shellcode execute USERCD_EXEC_ID = 0x3000 # should we exe...
__init__.py
#!/usr/bin/python3 -OO # Copyright 2007-2020 The SABnzbd-Team <team@sabnzbd.org> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any late...
edit.py
"""The module that contains the plot edit partent widget.""" import logging import threading from matplotlib import pyplot as plt from PyQt5.QtWidgets import (QComboBox, QHBoxLayout, QPushButton, QVBoxLayout, QWidget) from views.plot import Plot log = logging.getLogger(__name__) class ...
running.py
# -*- coding: utf-8 -*- """Code for maintaining the background process and for running user programs Commands get executed via shell, this way the command line in the shell becomes kind of title for the execution. """ import collections from logging import getLogger import os.path import re import shlex import si...
handlers.py
import ast import datetime import json import logging import copy from django.http import HttpResponse from multiprocessing import Process from threading import Thread, local try: from mongoengine.base import ValidationError except ImportError: from mongoengine.errors import ValidationError from multiprocess...
main.py
from message_board import MSGBoard from node import Actor def foo(bar, baz, nay): return bar + baz + nay def bar(): return 3 def baz(): return 30 def kay(): return 300 def jay(): return 3000 def nay(kay, jay): return kay + jay def show(foo): print(foo) return True def shu...
run_generator.py
# Copyright (c) 2019, NVIDIA Corporation. All rights reserved. # # This work is made available under the Nvidia Source Code License-NC. # To view a copy of this license, visit # https://nvlabs.github.io/stylegan2/license.html import argparse import numpy as np import PIL.Image import dnnlib import dnnlib.tflib as tfli...
app.py
#encoding: utf-8 from flask import Flask from exts import db import flask import config from forms import RegistForm from models import UserModel,QuestionModel,AnswerModel from decorators import login_required from sqlalchemy import or_ import json,requests import os from threading import Thread def async(f): d...
client.py
""" SDClient A base class for interacting with the sdsim simulator as server. The server will create on vehicle per client connection. The client will then interact by createing json message to send to the server. The server will reply with telemetry and other status messages in an asynchronous manner. Author: Tawn K...
reduction.py
# # Module to allow connection and socket objects to be transferred # between processes # # multiprocessing/reduction.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = ['reduce_socket', 'reduce_connection', 'send_handle', 'recv_handle'] import os import sys import ...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Hello, I am alive!" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()
server.py
import subprocess import threading from os import system from time import sleep # Open new process opening bedrock_server.exe that pipes input and output here process = subprocess.Popen('bedrock_server.exe', stdin=subprocess.PIPE, stdout=subprocess.PIPE) # Allows for input from the console def input_loop(): whi...
threadDemo.py
#! python3 # threadDemo.py import time import threading print('Start of program.') def takeANap(): time.sleep(5) print('Wake up!') threadObj = threading.Thread(target=takeANap) threadObj.start() print('End of program.')
utils.py
from bitcoin.core import COIN # type: ignore from bitcoin.rpc import RawProxy as BitcoinProxy # type: ignore from bitcoin.rpc import JSONRPCError from contextlib import contextmanager from pathlib import Path from pyln.client import RpcError from pyln.testing.btcproxy import BitcoinRpcProxy from collections import Or...
axel.py
# axel.py # # Copyright (C) 2016 Adrian Cristea adrian dot cristea at gmail dotcom # # Based on an idea by Peter Thatcher, found on # http://www.valuedlessons.com/2008/04/events-in-python.html # # This module is part of axel and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php # ...
main.py
# -*- coding: utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. 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/LICENS...
test_crud.py
# Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
manager.py
import zipfile import os import sys import struct import difflib import math import time import threading import xml.etree.ElementTree as etree import logging import datetime import traceback def init_plog( log_folder_path, filename = None, format=None, datefmt = None, keep_logs=10 ): logger = logging.getLogger()...
example_8_parallel.py
import simtk.unit as unit import multiprocessing as mp # ParaMol imports from ParaMol.System.system import * # ParaMol Tasks imports from ParaMol.HMC.hmc_sampler import * from ParaMol.Utils.settings import * # --------------------------------------------------------- # # Preparation ...
vnrpc.py
# encoding: UTF-8 import threading import traceback import signal import zmq from msgpack import packb, unpackb from json import dumps, loads import pickle pDumps = pickle.dumps pLoads = pickle.loads # 实现Ctrl-c中断recv signal.signal(signal.SIGINT, signal.SIG_DFL) ###################################################...
account.py
import urllib from urllib.request import urlopen from urllib.parse import urlencode, quote from http.cookiejar import CookieJar, FileCookieJar,LWPCookieJar import sys import pymongo import re import requests, pickle, http from html import unescape #import thread_file import time import threading from bs4 import Beautif...
edgeServer.py
import pickle import socket import sys import time import sched import selectors import hashlib import os sys.path.insert(0, "../") from _thread import * from threading import Timer, Thread, Lock from config import * from messages.edge_heartbeat_message import * from messages.content_related_messages import * EDGE...
game_client.py
# This file defines the back end of the Tetris game # # GameState is the base class of GameClient. # # GameClient.Run() will start two threads: # - _ProcessActions: Process the action list every x seconds # - _AutoDrop: Auto drops the current piece. # # GameClient: # - current piece # - held piece # - piece list...
smashbot.py
import os, sys sys.path.append(os.path.dirname(__file__)) from slackclient import SlackClient import bot_config import db import collections from match_making import gather_scores, get_player_name import time from websocket import WebSocketConnectionClosedException from multiprocessing import Process from datetime imp...
memuse.py
#!/usr/bin/python import sys sys.path.insert(0, './src') import argparse import threading, time from target_machine import * from target_xml import * from thread_input import * thread_args = [] def menu(): parser = argparse.ArgumentParser(description='memuse for Ostro') parser.add_argument('--ip', '-i', na...
openloris_test_ros.py
#!/usr/bin/env python # Copyright (C) <2019-2021> Intel Corporation # SPDX-License-Identifier: MIT # Authors: Siyuan Lu; Xuesong Shi from __future__ import print_function import argparse from collections import OrderedDict import glob import logging import psutil #import rosbag import rospy import sys import time im...
state_anno.py
import socket import json import sys import time import threading import cv2 import torch import numpy as np from utils import combine_states import torchvision from resnet_utils import myResnet from Model_strategy import Agent from Batch import create_masks import subprocess from PyQt5.QtWidgets import QApplication fr...
web_service.py
# 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 required by appli...
installwizard.py
from functools import partial import threading import os from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform...
Suduko.py
import pygame from GameClock import GameClock from SudukoPuzzleMaker import SudukoPuzzleMaker import pygame as pg import threading as t # Init pg.init() pg.font.init() clock = GameClock() # Window WIN_WIDTH, WIN_HEIGHT = 500, 500 window = pg.display.set_mode((WIN_WIDTH, WIN_HEIGHT), pg.RESIZABLE) pg.display.set_capt...
basic_multiprocessing.py
""" "멀티프로세싱"절 예시 `multiprocessing` 모듈을 이용해 새로운 프로세스들을 생성하는 방법을 설명한다. """ from multiprocessing import Process import os def work(identifier): print(f'Hey, I am the process ' f'{identifier}, pid: {os.getpid()}') def main(): processes = [Process(target=work, args=(number,)) for number in range(5)] for proc...
utils.py
from __future__ import annotations import asyncio import contextvars import functools import importlib import inspect import json import logging import multiprocessing import os import pkgutil import re import socket import sys import tempfile import threading import warnings import weakref import xml.etree.ElementTre...
tello.py
import threading import socket import time import datetime import struct import sys import os from . import crc from . import logger from . import event from . import state from . import error from . import video_stream from . utils import * from . protocol import * from . import dispatcher log = logger.Logger('Tello...
batching.py
"""Functions to generate batches for the reinforcement learning part. Mainly intended for training, though during the playing phase, the same functions are used.""" from __future__ import print_function, division import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import models as mode...
tui.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os import time import random import textwrap import re import socket import curses import string import inspect import threading import math import pymysql import json # for putty connections we need the following env os.environ['NCURSES_NO_UTF8_ACS'] = "1" ...
client.py
""" gRpc client for interfacing with CORE, when gRPC mode is enabled. """ from __future__ import print_function import logging import threading from contextlib import contextmanager import grpc from core.api.grpc import core_pb2 from core.api.grpc import core_pb2_grpc from core.nodes.ipaddress import Ipv4Prefix, Ip...
jobsSample.py
''' /* * Copyright 2010-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://aws.amazon.com/apache2.0 * * or in the "...
remote_test.py
# Copyright (c) 2018 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 required by app...
interactive_debugger_plugin_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_logging.py
# Copyright 2001-2014 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...
prefix_mgr_client_tests.py
#!/usr/bin/env python # # Copyright (c) 2014-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from...
process.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os import tempfile import subprocess import tensorflow as tf import numpy as np import tfimage as im import threading import time import multiprocessing edge_pool = None parser = argp...
test_transport.py
import unittest from threading import Thread from six.moves.xmlrpc_client import ServerProxy from locust_xmlrpc import LocustXmlRpcTransport from locust.stats import global_stats class TestTransport(unittest.TestCase): def setUp(self): from .server import server, start_server self.server = server...
virtualcenter.py
# coding: utf-8 """Backend management system classes Used to communicate with providers without using CFME facilities """ from __future__ import absolute_import import atexit import operator import re import ssl import threading import time from datetime import datetime from distutils.version import LooseVersion from...
DeviceManager.py
from threading import Thread from queue import Queue from easysnmp import Session from config_app.backend.helpers import get_thread_output from manage_app.backend import parse_model, static class DeviceManager: """ This class is used to create multiple device objects by retrieving data via SNMP from all devic...
event_based_scheduler_job.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
connection.py
# Copyright DataStax, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softwa...
Chap10_Example10.4.py
from threading import * def my_msgprint(i): for loop in range(1,i): print(f"{current_thread().getName()} thread running count is {loop}") mthread = Thread(target = my_msgprint, name = 'MyChildThread', args = (5,)) mthread.start() for i in range(1,5): print(f"Main thread running count is {i}")
uploader.py
#!/usr/bin/env python import os import time import stat import random import ctypes import inspect import requests import traceback import threading from selfdrive.swaglog import cloudlog from selfdrive.loggerd.config import DONGLE_ID, DONGLE_SECRET, ROOT from common.api import api_get def raise_on_thread(t, exctype...
server.py
import socket import sys import time import threading x = socket.socket() h_name= socket.gethostname() print("server will start on host: ", h_name) port= 1234 x.bind((h_name, port)) print( "server done binding to host and port successfully") print("server is waiting for incoming connections") x.listen() connection,ad...
main2.py
import serial import requests import json import time import threading def worker(end_point, data): headers = {'Accept': 'application/json', 'Content-Type': 'application/json'} try: r = requests.post('http://78.160.156.154:8000/api/{}/'.format(end_point), data=json.dumps(data), headers=headers) ...
subdomainfinder.py
import requests import threading domain = input("Enter domain: ") file = open('wordlist.txt','r') content = file.read() subdomains = content.splitlines() for subdomain in subdomains: url1 = f"http://{subdomain}.{domain}" url2 = f"https://{subdomain}.{domain}" try: requests.get(url1) print(f"Discov...
__main__.py
import sys import argparse import ipaddress import threading from queue import Queue import socket import paramiko from pynventory.hosts import LinuxHost parser = argparse.ArgumentParser(description='Create a DokuWiki friendly inventory table or system hostfile of your ' ...
com.py
from ctypes import byref, oledll, windll from ctypes.wintypes import DWORD, HANDLE import logging import threading from comtypes import CoInitializeEx, CoUninitialize from comtypes.client import CreateObject, GetEvents import psutil __all__ = ( 'ITUNES_PLAYER', 'ITUNES_PLAYER_STATE_STOPPED', 'ITUNES_PLAYER_STATE_...
Hiwin_socket_ros_20190521121514.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import Hiwin_socke...
RTTclient.py
import socket import time import random import numpy as np import serial import random import logging import multiprocessing as mp from queue import Queue import traceback import re import csv class WarpConnectorClass(object): #TODO: Need to impliment exception handling at each socket use dataBuffer = [0,0,0,0,0,...
test_fork1.py
"""This test checks for correct fork() behavior. """ import _imp as imp import os import signal import sys import time from test.fork_wait import ForkWait from test.support import (reap_children, get_attribute, import_module, verbose) threading = import_module('threading') # Skip test if f...
installwizard.py
import sys from PyQt4.QtGui import * from PyQt4.QtCore import * import PyQt4.QtCore as QtCore import electrum_dash from electrum_dash.i18n import _ from seed_dialog import SeedDisplayLayout, SeedWarningLayout, SeedInputLayout from network_dialog import NetworkChoiceLayout from util import * from password_dialog impo...
demo_local.py
# -*- coding: utf-8 -*- # Copyright 2018 The Blueoil 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 # # Unles...
mqtt_ssl_example_test.py
from __future__ import print_function from __future__ import unicode_literals from builtins import str import re import os import sys import ssl import paho.mqtt.client as mqtt from threading import Thread, Event from tiny_test_fw import DUT import ttfw_idf event_client_connected = Event() event_stop_client = Event(...
run.py
#!/usr/bin/env python3 import configargparse import subprocess import os import pwd import threading import shutil import errno import select import urllib import json import time import http.server import socketserver import sys import random import datetime from enum import Enum from os import path from os import lis...
aiohttp_test_server.py
import asyncio import logging import threading import time import requests from aiohttp import web from pyctuator.pyctuator import Pyctuator from tests.conftest import PyctuatorServer # mypy: ignore_errors # pylint: disable=unused-variable class AiohttpPyctuatorServer(PyctuatorServer): def __init__(self) -> No...
thread.py
from threading import Thread #func(arg) #{ #function body #} #main loop() #{ #loop body #variable=Thread(target=func, args= arg) #variable.start() #loop body continues #}
eval_coco_format.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 applicab...
tracking_manager.py
import torch import numpy as np import torch.multiprocessing as mp import os,sys import queue import time import psutil import pynvml import numpy as np from track_sequence import track_sequence,im_to_vid import argparse pynvml.nvmlInit() sys.path.insert(0,"I24-video-ingest") from utilities import get_recording_par...
projects.py
import time, os, re from samweb_client import json, convert_from_unicode from samweb_client.client import samweb_method, get_version from samweb_client.http_client import escape_url_path from exceptions import * from itertools import ifilter @samweb_method def listProjects(samweb, stream=False, **queryCriteria): ...
freetests.py
#!/usr/bin/env python3 # coding: utf-8 # Copyright 2013 Abram Hindle # # 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 ...
Entity.py
from pyramid.response import Response from pyramid.view import view_config import os import sys import time import json from datetime import datetime, timedelta from lxml import etree, html from .config import Config import logging log = logging.getLogger(__name__) import networkx as nx from networkx.readwrite impo...
process_test.py
#!/usr/bin/python # coding=utf8 import math import sys from multiprocessing import Pool from multiprocessing import Process def f(x): return x*x #if __name__ == '__main__': # p = Pool(5) # print(p.map(f, range(100000000))) def process_fun(num): sum = 0 while(1): sum += 1 p = math....
database.py
from threading import Thread from collections import defaultdict, OrderedDict import schedule import time import os import glob import glob2 import json from tqdm import tqdm import concurrent.futures as cf from functools import partial import pickle from bson.binary import Binary import datetime from . import Params ...
test_session.py
import os import threading import time import socket from http.client import HTTPConnection import pytest from path import Path from more_itertools import consume import cherrypy from cherrypy._cpcompat import HTTPSConnection from cherrypy.lib import sessions from cherrypy.lib import reprconf from cherrypy.lib.httput...
eval_mini_srcgame.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function USED_DEVICES = "0,1,2,3" import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES import sys import threading import time import tensorflow as tf from absl im...
test_sys.py
import builtins import codecs import gc import locale import operator import os import struct import subprocess import sys import sysconfig import test.support from test import support from test.support import os_helper from test.support.script_helper import assert_python_ok, assert_python_failure from test.support imp...
fmos_trainer#2_odorassociation.py
''' FMOS Trainer 2 - Freely Moving Olfactory Search - ODOR ASSOCIATION Written: Teresa Findley, tmfindley15@gmail.com Last Updated: 04.26.2021 --Records tracking data via OSC communication with custom code in Bonsai (open source computer vision software -- https://bonsai-rx.org/) --Records signal data through...
tcp-chatroom.py
import threading import socket host = '127.0.0.1' port = 55555 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((host, port)) server.listen() clients = [] nicknames = [] def broadcast(message): for client in clients: client.send(message) def handel(client): while True: ...
mfork.py
import socket import pickle from threading import Thread import multiprocessing import values class Fork: def __init__(self,index,host,port): #ID of each fork process so that philosopher can address it by its index and # it is easy to pass int message self.id=index #Assume that in...
writer.py
# # Copyright (c) 2020, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
data.py
import threading from functools import wraps from abc import ABCMeta, abstractmethod import numpy as np class DatasetSplit(object): """Represent a dataset split such as training or validation. Is meant to be used as an organized dictionary to help BaseDataLoader """ def __init__(self, name, filepath...
download.py
# -*- coding: utf-8 -*- # filename : download.py # description : Handles downloading of movies # author : LikeToAccess # email : liketoaccess@protonmail.com # date : 08-01-2021 # version : v2.0 # usage : python main.py # notes : # lice...
functional_tests.py
#!/usr/bin/env python # NOTE: This script cannot be run directly, because it needs to have test/functional/test_toolbox.py in sys.argv in # order to run functional tests on repository tools after installation. The install_and_test_tool_shed_repositories.sh # will execute this script with the appropriate p...
clock.py
import asyncio import time from threading import Thread from jukebox.lcd import LCD, LCDRow class Clock(object): def __init__(self, lcd: LCD, sleep_after: int = 120): self.__lcd = lcd self.__running = False self.__sleep_after = sleep_after def start(self): if self.__running ...
conftest.py
import asyncio import json import os import threading import time import typing import pytest import trustme from cryptography.hazmat.primitives.serialization import ( BestAvailableEncryption, Encoding, PrivateFormat, ) from uvicorn.config import Config from uvicorn.main import Server from httpx import UR...
multiprocess_iterator.py
from __future__ import division from collections import namedtuple import multiprocessing from multiprocessing import sharedctypes import signal import sys import threading import warnings import numpy import six from chainer.dataset import iterator _response_time = 1. _short_time = 0.001 _PrefetchState = namedtupl...
variable_scope.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...
websocket_client.py
# encoding: UTF-8 import json import ssl import sys import traceback import socket from datetime import datetime from threading import Lock, Thread from time import sleep import websocket class WebsocketClient(object): """ Websocket API After creating the client object, use start() to run worker and pi...
diode_server.py
#!flask/bin/python # Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved. import aenum import dace import dace.serialize import dace.frontend.octave.parse as octave_frontend from dace.codegen import codegen from diode.DaceState import DaceState from dace.transformation.optimizer import SDFGOptimiz...
eval.py
import os import pickle import shutil import torch from dgl import model_zoo from utils import MoleculeDataset, set_random_seed, download_data,\ mkdir_p, summarize_molecules, get_unique_smiles, get_novel_smiles def generate_and_save(log_dir, num_samples, max_num_steps, model): with open(os.path.join(log_dir, ...
thread.py
import threading # global variable x x = 0 def increment(): """ function to increment global variable x """ global x x += 1 def thread_task(): """ task for thread calls increment function 100000 times. """ for _ in range(100000): increment() def main_task(): global x # setting global var...
base_event_executor.py
from logging import Logger from multiprocessing import Process from pipert2.utils.method_data import Method from pipert2.utils.dummy_object import Dummy from pipert2.utils.interfaces import EventExecutorInterface from pipert2.utils.annotations import class_functions_dictionary from pipert2.utils.consts import KILL_EVEN...
crawler.py
# Copyright 2017 The Forseti Security 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 ap...