source
stringlengths
3
86
python
stringlengths
75
1.04M
utils.py
######## # Copyright (c) 2018-2020 GigaSpaces Technologies 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/LICENSE-2.0 # # U...
pc.py
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '8/4/2020 10:26 AM' import queue import time import threading msg_queue = queue.Queue(10) count = 0 def producer(index): global count while True: count += 1 msg_queue.put("the {} ith cook made the {} ith item".format(index,...
test_socket_manager.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import time import uuid from unittest import mock from parlai.mturk.core.socket_manager import Packet, S...
test_futures.py
from __future__ import with_statement import logging import multiprocessing import re import sys import threading import time import unittest try: from StringIO import StringIO except ImportError: from io import StringIO try: from test.test_support import run_unittest except ImportError: from test.sup...
__init__.py
import requests import datetime import dateutil import logging import boto3 import gzip import io import csv import time import os import sys import json import hashlib import hmac import base64 import re from threading import Thread from io import StringIO import platform import azure.functions as func sentinel_cust...
inference_network.py
import torch import torch.nn as nn import torch.optim as optim import torch.optim.lr_scheduler as lr_scheduler import torch.distributed as dist from torch.utils.data import DataLoader import sys import time import os import shutil import uuid import tempfile import tarfile import copy import math import warnings from t...
handler.py
import sys import os.path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))) import threading from logging import Handler from talkbot import TwitterDownloaderBot from TwitterEngine.secrets import google_user_name, google_password, administrator_jid class GTalkHandler(Handler)...
test_spark.py
import os import sys import time from typing import Iterator import threading from unittest import mock import numpy as np import pandas as pd import pytest import pyspark from pyspark.sql.types import ArrayType, DoubleType, LongType, StringType, FloatType, IntegerType from pyspark.sql.utils import AnalysisException ...
alignment.py
import os import sys import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.manifold import TSNE from sklearn.cluster import KMeans from tqdm import tqdm import swalign from multiprocessing import Process, Queue from utils.color import getRandomColor from utils.manager im...
driver.py
# Copyright 2020 Uber Technologies, 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 applica...
server.py
#!/usr/bin/env python import json, threading from http.server import HTTPServer, BaseHTTPRequestHandler from time import sleep from urllib.parse import parse_qs class LoriRequestHandler(BaseHTTPRequestHandler): def log_request(self, code='-', size='-'): # This method overrides the method in the base clas...
data_util.py
""" This code is based on https://github.com/fchollet/keras/blob/master/keras/utils/data_utils.py """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import numpy as np import threading import multiprocessing import traceback try: import queu...
robot_workspace.py
from robocorp_ls_core.workspace import Workspace, Document from robocorp_ls_core.basic import overrides from robocorp_ls_core.cache import instance_cache from robotframework_ls.constants import NULL from robocorp_ls_core.robotframework_log import get_logger from robotframework_ls.impl.protocols import ( IRobotWorks...
protoc_test.py
# Copyright 2020 The gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
caching.py
import datetime import threading import time import cherrypy from cherrypy.lib import cptools, http class MemoryCache: def __init__(self): self.clear() t = threading.Thread(target=self.expire_cache, name='expire_cache') self.expiration_thread = t t.setDaemon(True) t.s...
main.py
import multiprocessing as mp from ConfigParser import SafeConfigParser import lcm import modules.dashboard_buttons as dash_buttons import modules.dashboard_display as dash_display import modules.telemetry_storage as tele_storage import modules.accessory_controller as ax_controller import modules.camera_reader as cam_...
fileStore.py
# Copyright (C) 2015-2016 Regents of the University of California # # 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...
monitor.py
# -*- coding: utf-8 -*- # File: monitor.py import json import numpy as np import operator import os import re import shutil import time from collections import defaultdict from datetime import datetime import six import threading from ..compat import tfv1 as tf from ..libinfo import __git_version__ from ..tfutils.su...
terminal.py
#!/usr/bin/env python3 from asciimatics.widgets import Frame, TextBox, Layout, Widget from asciimatics.effects import Background from asciimatics.scene import Scene from asciimatics.screen import Screen from asciimatics.exceptions import ResizeScreenError from asciimatics.parsers import AnsiTerminalParser from asciima...
camera.py
# Python import logging import picamera from picamera.array import PiRGBArray from picamera import PiCamera import numpy as np #from concurrent.futures import ThreadPoolExecutor from threading import Thread # from multiprocessing.pool import ThreadPool logging.basicConfig() # https://github.com/dtreskunov/rpi-sen...
GuiUtils.py
import queue import threading import tkinter as tk from Utils import local_path def set_icon(window): er16 = tk.PhotoImage(file=local_path('data', 'ER16.gif')) er32 = tk.PhotoImage(file=local_path('data', 'ER32.gif')) er48 = tk.PhotoImage(file=local_path('data', 'ER32.gif')) window.tk.call('wm', 'icon...
subprocess_server.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...
consumer.py
#!/usr/bin/python # -- Content-Encoding: UTF-8 -- """ Greeting service consumer :author: Thomas Calmant :copyright: Copyright 2014, isandlaTech :license: Apache License 2.0 .. Copyright 2014 isandlaTech Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS # environment import ftplib import asyncore import asynchat import socket import io import errno import os import threading import time try: import ssl except ImportError: ssl = None from unittest import Test...
predict.py
import numpy as np import tensorflow as tf from sklearn.model_selection import train_test_split from sklearn.preprocessing import normalize import glob import pickle import time import datetime import functools from PIL import ImageGrab import cv2 import VLSTM_model as model from Controller import Controller from threa...
terminator.py
""" Cyberdyne Systems Series 800 Model 101 Infiltration Unit - Terminator T800. Logic for the CSM101 T800 infiltration unit. Provides access to visual cortex and Heads-Up-Display (HUD) analysis. * TerminatorVision: The T800 Visual cortex. * HeadUpDisplay: The HUD analysis. """ import cv2 # OpenCV module. import ...
timer.py
import threading import time tLock = threading.Lock() def timer(name,delay,repeat): print('Timer: '+name+ " Started") tLock.acquire() print("name "+name+" has acquire the lock") while repeat>0: time.sleep(delay) print(name+' : '+str(time.ctime(time.time()))) repeat -=1 pr...
spark_backend.py
import pkg_resources import sys import os import json import socket import socketserver from threading import Thread import py4j import pyspark from typing import List import hail as hl from hail.utils.java import Env, scala_package_object, scala_object from hail.expr.types import dtype from hail.expr.table_type impo...
tests.py
from __future__ import unicode_literals import threading from datetime import datetime, timedelta from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections from django.db.models.fields import Field from django.db.models.manager im...
test_base_events.py
"""Tests for base_events.py""" import concurrent.futures import errno import math import socket import sys import threading import time import unittest from unittest import mock import asyncio from asyncio import base_events from asyncio import constants from test.test_asyncio import utils as test_utils from test imp...
__init__.py
from enum import Enum from threading import Thread, RLock from time import sleep from uuid import uuid4 from ..action import * from ..bus import Bus from ..bus.action_bus import ActionBus from ..event import StopEvent from ..utils import * class WorkerState(Enum): Initializing = 'Initializing' Ready = 'Ready'...
web_visualizer.py
import ipywidgets import traitlets import IPython import json import threading import functools import open3d as o3d @ipywidgets.register class WebVisualizer(ipywidgets.DOMWidget): """Open3D Web Visualizer based on WebRTC.""" # Name of the widget view class in front-end. _view_name = traitlets.Unicode('W...
mavros_offboard_yawrate_test.py
#!/usr/bin/env python2 #*************************************************************************** # # Copyright (c) 2020 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: #...
main.py
# # Drug Dealer Bot # 08 Nov 2021 # # Craig Vear - cvear@dmu.ac.uk # """server script for receiving robot movement instructions from Dmitriy's C++ CV script""" # import python modules import sys import serial from time import sleep import atexit import threading import queue # import project modules from modules.rer...
SerialArduino.py
import time import abc import sys import glob import serial from serial import Serial import select import threading #from Errors.NoAvailablePorts import NoAvailablePorts class SerialArduino(): __metaclass__ = abc.ABCMeta __timeout = 0.010 __baudrate = 9600 __thread = None __threadFlag = False...
go.py
#!/usr/bin/env python # Standard Imports from __future__ import print_function from os import chmod, remove from sys import exit, stderr from threading import Thread from time import sleep, time # Constants TAG_PREFIX = 'wrf-ecs-{0}-' IAM_PATH = '/{0}/' ECS_ASSUME_ROLE_POLICY_DOC = '{"Version": "2012-10-17", "State...
pavi.py
from __future__ import print_function import logging import os import os.path as osp import time from datetime import datetime from threading import Thread import requests from six.moves.queue import Empty, Queue from .base import LoggerHook from ...utils import master_only, get_host_info class PaviClient(object):...
watch.py
""" fs.watch ======== Change notification support for FS. This module defines a standard interface for FS subclasses that support change notification callbacks. It also offers some WrapFS subclasses that can simulate such an ability on top of an ordinary FS object. An FS object that wants to be "watchable" must pr...
start_to_middle.py
import threading import os import time import random import requests import json from bit import Key from bit.format import bytes_to_wif import traceback # maxPage = int(pow(2, 256) / 128) maxPage = 904625697166532776746648320380374280100293470930272690489102837043110636675 middle = int(maxPage / 2) def getRandPage(...
ffmpeg.py
import datetime import logging import math import os import platform import socketserver import tempfile import subprocess import threading import time from pathlib import Path import ffmpeg from ffmpeg.nodes import filter_operator, FilterNode from qtpy import QtWidgets from qtpy.QtCore import Signal, QRunnable, QObje...
py64gen.py
from time import sleep from contextlib import contextmanager import hashlib import os import dill from reloading import reloading import shazzam.globals as g from shazzam.Instruction import Instruction from shazzam.defs import CodeFormat, CommentsFormat, DirectiveFormat, System, DetectMode, Alias, DirectiveDelimiter,...
test_queue_simple_inverted.py
# -*- coding: utf-8 -*- # # @autor: Ramón Invarato Menéndez # @version 1.0 import multiprocessing from quick_queue.quick_queue import QQueue """ Execute this script to see result in console Add some values to qqueue """ def _process(qq): qq.put("A") qq.put("B") qq.put("C") qq.end() if __name__ =...
testclient.py
#!/usr/bin/python # # Modified version of the Python First Principles client that allows # for better testing of the sled server. This code should not be # used outside of this test suite. # # Copyright (C) 2013 Wilbert van Ham # from __future__ import print_function from collections import deque import copy import b...
makecorpus_from_vocab.py
import argparse import os import numpy as np from multiprocessing import Process, Queue from Queue import Empty import ioutils from representations.explicit import Explicit from statutils.fastfreqdist import CachedFreqDist SAMPLE_MAX = 1e9 def worker(proc_num, queue, out_dir, in_dir, count_dir, vocab_dir, sample=1e...
wsgi_server.py
# Copyright Allen Institute for Artificial Intelligence 2017 """ ai2thor.server Handles all communication with Unity through a Flask service. Messages are sent to the controller using a pair of request/response queues. """ import ai2thor.server import json import logging import threading import os try: from queu...
netcat.py
import os,subprocess,threading,socket,sys,argparse #to run a command def run(cmd): if cmd[:2]=='cd': os.chdir(cmd[3:]) return return subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read() #recv from remotely connected machine def recvfrom(client): re...
diff.py
#!/usr/bin/env python3 # PYTHON_ARGCOMPLETE_OK import argparse import sys from typing import ( Any, Callable, Dict, Iterator, List, Match, NoReturn, Optional, Pattern, Set, Tuple, Type, Union, ) def fail(msg: str) -> NoReturn: print(msg, file=sys.stderr) sys...
litex_term.py
#!/usr/bin/env python3 # # This file is part of LiteX. # # Copyright (c) 2015-2020 Florent Kermarrec <florent@enjoy-digital.fr> # Copyright (c) 2015 Sebastien Bourdeauducq <sb@m-labs.hk> # Copyright (c) 2016 whitequark <whitequark@whitequark.org> # SPDX-License-Identifier: BSD-2-Clause import sys import signal import...
run_tests.py
# Adapted from a Karma test startup script # developed by the Jupyter team here; # https://github.com/jupyter/jupyter-js-services/blob/master/test/run_test.py # # Also uses the flow where we assign a os process group id and shut down the # server based on that - since the subprocess actually executes the kbase-narrativ...
program.py
import logging import queue import threading from .manager import Manager from .pipeline import Node, Pipeline LOGGER = logging.getLogger(__name__) class Program: def __init__(self, lifespan): self.queue = queue.Queue() self.lifespan = lifespan self.pipeline = Pipeline(self) sel...
BruteForce.py
import requests as r import threading import argparse import time import json import progressbar import sys def Banner(): banner = """ ____ _ ______ | _ \ | | | ____| | |_) |_ __ _ _| |_ ___ ____...
input.py
# coding=utf-8 import cv2 import random import numpy as np import time import queue import threading import globals as g_ from concurrent.futures import ThreadPoolExecutor W = H = 256 #原图像224*224需缩放至256*256 class Shape: def __init__(self, list_file): with open(list_file) as f: self.label = int...
test_errno.py
zaimportuj unittest, os, errno z ctypes zaimportuj * z ctypes.util zaimportuj find_library spróbuj: zaimportuj threading wyjąwszy ImportError: threading = Nic klasa Test(unittest.TestCase): def test_open(self): libc_name = find_library("c") jeżeli libc_name jest Nic: podnieś uni...
server__main__.py
import os.path import traceback import sys __file__ = os.path.abspath(__file__) if __file__.endswith((".pyc", ".pyo")): __file__ = __file__[:-1] _critical_error_log_file = os.path.join( os.path.expanduser("~"), "robotframework_server_api_critical.log" ) def _stderr_reader(stream): from robocorp_ls_core....
ExplicitSolver.py
""" Copyright (c) 2012-2017, Zenotech Ltd 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, this list of conditions and th...
eight_asyn_train.py
import argparse from multiprocessing import Process, Manager, Lock, Queue, Value from baselines import deepq from baselines.common import set_global_seeds from baselines import logger import gym from deepq.asyn_trainer_actor.actor_interaction import actor_inter from deepq.asyn_trainer_actor.trainer_simple import learn...
rob_service.py
import time import asyncio import threading import math from adafruit_servokit import ServoKit pca = ServoKit(channels=16) pca.frequency = 50 # define 12 servos for 4 legs # define servos ports servo_pin = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]] # Размеры составных частей робота (в мм) ------------...
base_crash_reporter.py
# Electrum - lightweight Bitcoin client # # 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 use, copy, modify, merge, # publish...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
main.py
import image_recognition as ir import framework as fw from util import * from multiprocessing import Process, Pipe, Queue, Array, set_start_method from random import randint GRID_SIZE = 15 RESOLUTION = (1920, 1080) GRID_RESOLUTION = (int(RESOLUTION[0] / GRID_SIZE), int(RESOLUTION[1] / GRID_SIZE)) # pre-compute this PL...
test_SexpVector.py
import unittest import sys import rpy2.rinterface as ri ri.initr() def evalr(string): rstring = ri.StrSexpVector((string, )) res = ri.baseenv["parse"](text = rstring) res = ri.baseenv["eval"](res) return res def floatEqual(x, y, epsilon = 0.00000001): return abs(x - y) < epsilon class WrapperSex...
test_reader_search.py
import threading from datetime import timezone import pytest from fakeparser import Parser from utils import naive_datetime from utils import rename_argument from utils import utc_datetime from utils import utc_datetime as datetime from reader import Content from reader import Enclosure from reader import EntrySearch...
MediaPlayer.py
# read frames using opencv and display frames as a video import cv2 as cv from threading import Thread import src.video_retrieval.Lock as Lock import src.video_retrieval.FrameGetter as Fg from src.video_retrieval import Queue class MediaPlayer: # initialise state def __init__(self): self.lock = Lock....
common.py
import redis from threading import Thread, RLock import socket import time # 需要 “可配置” 的能够使用 redis 连接的类 # 直接传入字典进行实例化,或者通过 from_settings 这种方式来实现 class Initer: lock = RLock() @classmethod def redis_from_settings(cls, **kw): # 这里的字典完全就是 redis.StrictRedis 对象的所有默认参数 d = dict( host...
cli.py
import os import sys import threading from contextlib import contextmanager import click import six from dagster import check, seven from dagster.cli.workspace import Workspace, get_workspace_from_kwargs, workspace_target_argument from dagster.cli.workspace.cli_target import WORKSPACE_TARGET_WARNING from dagster.core....
MSC-RL_3_8.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- from __future__ import division """ ily """ import threading import numpy as np import os import tensorflow as tf import tensorflow.contrib.slim as slim import gym from atari_wrappers import wrap_deepmind from time import sleep import random from replaymemory_1 import Rep...
fake.py
# This file is Copyright (c) 2010 by the GPSD project # BSD terms apply: see the file COPYING in the distribution root for details. """ gpsfake.py -- classes for creating a controlled test environment around gpsd. The gpsfake(1) regression tester shipped with GPSD is a trivial wrapper around this code. For a more int...
chaos_commons.py
import os import threading import glob import delayed_assert from chaos import constants from yaml import full_load from utils.util_log import test_log as log def check_config(chaos_config): if not chaos_config.get('kind', None): raise Exception("kind is must be specified") if not chaos_config.get('sp...
TProcessPoolServer.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...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2019 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test virclesd shutdown.""" from test_framework.test_framework import SyscoinTestFramework from test_fr...
mqtt2rest.py
import paho.mqtt.client as mqtt import credentials as cred import re from flask import Flask from flask_restful import Api, Resource, reqparse import sensor from threading import Thread import requests def push_to_gateway(thingID, what, value): urlPushGateway = "http://localhost:9091/" urlSensor = urlPushGate...
tf_util.py
import joblib import numpy as np import tensorflow as tf # pylint: ignore-module import copy import os import functools import collections import multiprocessing def switch(condition, then_expression, else_expression): """Switches between two operations depending on a scalar value (int or bool). Note that bot...
loggingrli.py
""" $Id: loggingrli.py,v 1.41 2006/04/24 14:49:23 jp Exp $ """ import plastk.rl from plastk.rl import RLI from plastk.params import Parameter from plastk import rand #from Scientific.IO.NetCDF import NetCDFFile from scipy.io.netcdf import netcdf_file as NetCDFFile import time,sys,threading,os NewColumn = 'new column'...
nanny.py
import asyncio from contextlib import suppress import errno import logging from multiprocessing.queues import Empty import os import psutil import shutil import threading import uuid import warnings import weakref import dask from dask.system import CPU_COUNT from tornado.ioloop import IOLoop, PeriodicCallback from to...
train_pg_f18.py
""" Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017 Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany """ import numpy as np import tensorflow as tf import gym import logz import os import time im...
video_read.py
import cv2 import time from logging import getLogger from multiprocessing import Process, Queue, Array class VideoReader: def __init__(self, src): """ 初期化 Args: src: 動画を読み取るソース """ self.logger = getLogger(__name__) self.src = src # 幅, 高さ, フレーム数,...
graph_detect.py
#!/usr/bin/env python # Copyright 2019 Xilinx 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 ...
parameter_server.py
""" Utility functions to retrieve information about available services and setting up security for the Hops platform. These utils facilitates development by hiding complexity for programs interacting with Hops services. """ import os from hops import devices, tensorboard, hdfs from hops.experiment_impl.util import ex...
scale.py
from PyQt4 import QtGui, QtCore from libra import Libra import libra from scale_qt4 import MainWindow import sys import signal import serial import serial.tools.list_ports import time from threading import Thread def close(*args): QtGui.QApplication.quit() signal.signal(signal.SIGINT, close) class Window(MainWindow...
package_cache.py
# Copyright Contributors to the Rez project # # 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 ...
__init__.py
import requests import datetime import dateutil import logging import boto3 import gzip import io import csv import time import os import sys import json import hashlib import hmac import base64 import re from threading import Thread from io import StringIO import azure.functions as func sentinel_customer_id = os.en...
test_asyncio_change_stream.py
# Copyright 2017-present MongoDB, 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 wri...
process_replay.py
#!/usr/bin/env python3 import importlib import os import sys import threading import time import signal from collections import namedtuple import capnp import cereal.messaging as messaging from cereal import car, log from cereal.services import service_list from common.params import Params from common.timeout import ...
test_restart_services.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...
driver_listener.py
# Copyright 2018 Rackspace, US Inc. # Copyright 2019 Red Hat, 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 # # Unle...
threads.py
import time from threading import Thread def ask_user(): start = time.time() user_input = input("Enter Your Name") greet = f"Hello, {user_input}" print(greet) print(f'ask_user, {time.time() - start}') def complex_calculation(): start = time.time() print('Started calculation...') [x**...
live.py
import time import threading import pyaudio import numpy as np import librosa from bokeh.io import show, output_notebook import bokeh.models as md from bokeh.layouts import row, column from bokeh.plotting import figure, ColumnDataSource from .core import DEFAULT_FRAMESIZE, DEFAULT_SAMPLERATE, Parameter from .delay ...
exp_orbiting_usedinoriginalexperiment.py
import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) import os import csv import time import threading import numpy as np from math import * from picamera import PiCamera from lib_utils import * from lib_fin import Fin from lib_leds import LEDS from lib_vision import Vision from lib_depthsensor impo...
_metadata_flags_test.py
# Copyright 2018 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
worker.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import atexit import collections import colorama import hashlib import inspect import json import numpy as np import os import redis import signal import sys import threading import time import traceback # Ray...
listener.py
import threading import websocket import requests import messages import asyncio import json import time #TODO : clean event_message (separate the decorator and the function) global func func=None def event_message(function_to_decorate=None, event=None): global func if event == {} : return if func != None:...
robolink.py
# Copyright 2015-2021 - RoboDK Inc. - https://robodk.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 a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law o...
__init__.py
import os import re import sys import inspect import warnings import functools import threading from timeit import default_timer from flask import request, make_response, current_app from flask import Flask, Response from flask.views import MethodViewType from werkzeug.serving import is_running_from_reloader from prom...
openstack_api_endpoint.py
""" Copyright (c) 2017 SONATA-NFV and Paderborn University 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...
api.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...
test_local.py
import copy import time from functools import partial from threading import Thread import pytest from werkzeug import local def test_basic_local(): ns = local.Local() ns.foo = 0 values = [] def value_setter(idx): time.sleep(0.01 * idx) ns.foo = idx time.sleep(0.02) v...
threading.py
#region @threaded def threaded(method: any, *args, **kwargs): def wrap(method): def thread_logic(*args, **kwargs): from threading import Thread Thread = Thread(target=method, args=(args, kwargs)) return thread_logic() return wrap #endregion
workflows_scaling.py
#!/usr/bin/env python """A small script to drive workflow performance testing. % ./test/manual/launch_and_run.sh workflows_scaling --collection_size 500 --workflow_depth 4 $ .venv/bin/python scripts/summarize_timings.py --file /tmp/<work_dir>/handler1.log --pattern 'Workflow step' $ .venv/bin/python scripts/summarize_...
xen_api.py
from subprocess import Popen, PIPE from glob import glob import shutil import os, errno import socket import sys import ConfigParser import logging import zmq import json from logging.handlers import RotatingFileHandler from pyxs import Client, PyXSError from threading import Thread config = ConfigParser.ConfigParser...
Network_2_1.py
import argparse import socket import threading from time import sleep import random import RDT_2_1 as RDT ## Provides an abstraction for the network layer class NetworkLayer: # configuration parameters prob_pkt_loss = 0 prob_byte_corr = 0.1 prob_pkt_reorder = 0 # class variables sock = None ...