source
stringlengths
3
86
python
stringlengths
75
1.04M
test.py
# -*- coding: utf-8 -*- import sys import os import time import datetime import platform import threading import locale import unittest try: import greenlet greenlet_installed = True except ImportError: greenlet_installed = False BASEDIR = os.path.abspath( os.path.join(os.path.dirname(os.path.abspath(...
imagemee.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os, sys, io, urllib, re from PIL import Image from http.server import SimpleHTTPRequestHandler import socketserver from webbrowser import open_new_tab import threading PORT = 8000 IMAGE_FILE_REGEX = '^.+\.(png|jpg|jpeg|tif|tiff|gif|bmp)$' IMAGES_PER_ROW = 3 IMAGES...
maindecoder_sox.py
#!/usr/bin/env python #import snowboydecoder import snowboydetect #import pyaudio import collections import time import os import logging import subprocess import threading import wave import signal logging.basicConfig() logger = logging.getLogger("snowboy") logger.setLevel(logging.INFO) TOP_DIR = os.path.dirname(os.p...
clone_eleven_eval_mini_srcgame_add_map_bn.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function USED_DEVICES = "4,5" 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 import...
glance_common.py
#!/usr/bin/env python # Copyright (c) 2019 Rackspace US, 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 applica...
test_web_profile.py
""" Test the web profile using Python classes that have been adapted to act like a web client. We can only put a single test here because only one hub can run with the web profile active, and the user might want to run the tests in parallel. """ import os import threading import tempfile from ...extern import six fro...
thumbnail_converter.py
# Code Listing #1 # マルチスレッドのいちばん単純な起動方法の実演コード """ Thumbnail converter using URLs """ import threading import urllib.request # Install PILL via Pillow from PIL import Image # PIL でサイズの小さい画像に変換してディスクに保存する def thumbnail_image(url, size=(64, 64), format='.png'): """ Convert image to a specific format """ im = ...
prompt.py
""" Line editing functionality. --------------------------- This provides a UI for a line input, similar to GNU Readline, libedit and linenoise. Either call the `prompt` function for every line input. Or create an instance of the :class:`.PromptSession` class and call the `prompt` method from that class. In the secon...
grpc.py
""" Utilities for running GRPC services: compile protobuf, patch legacy versions, etc """ from __future__ import annotations import os import threading from typing import NamedTuple, Tuple, Optional, Union, Any, Dict, TypeVar, Type, Iterator, Iterable, Sequence import grpc import numpy as np import torch from hivem...
reader.py
# Copyright (c) 2019 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...
test_utils.py
import asyncio import threading import time from contextlib import ExitStack import pytest from playwright.async_api import Page from idom.backend import flask as flask_implementation from idom.backend.utils import find_available_port from idom.backend.utils import run as sync_run from idom.backend.utils import trave...
mapper.py
import contextlib import os import queue import requests import sys import threading import time FILTERS = [".jpg", ".gif", ".png", ".css"] TARGET = "http://boodelyboo.com/wordpress" THREADS = 10 answers = queue.Queue() web_paths = queue.Queue() def gather_paths(): for root, _, files in os.walk('.'): fo...
algo_convergence.py
import sys sys.path.insert(0, '../') from algo.dqn import run_dqn, run_dqn_test from algo.td import run_td, run_td_test from algo.td_realtime import run_td_realtime, run_td_realtime_test from algo.a3c import run_a3c from nets.net import init_nn_library import pickle import shutil import os def run_dqn_thread(baseDir...
client.py
""" Web socket client mixins. | Copyright 2017-2021, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | """ import asyncio # pylint: disable=unused-import from collections import defaultdict import logging import requests from retrying import retry from threading import Thread import time from bson import json_...
1217_test.py
import sys, time import threading import keyboard import numpy as np from bledevice import scanble, BLEDevice Device1 = BLEDevice("DD:43:89:16:43:81") Device2 = BLEDevice("F4:82:B3:50:ED:55") time.sleep(0.5) sum_time = 0; mean_time = 0; count = 0; STOP = 0 MOVE_FWD = 1 MOVE_BWD = 2 MOVE_FWR_R = 10 MOVE_FWR_L = 11 MO...
xla_client_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_poller.py
import multiprocessing import os import signal import time from psutil import Process from pytest import mark from sure import expect from swf.models import Domain from simpleflow.swf.process import Poller from tests.utils import IntegrationTestCase class FakePoller(Poller): """ This poller only waits 2 sec...
__init__.py
# pylint: disable=too-many-lines # (Yes, it has a point!) from __future__ import division, absolute_import, print_function __copyright__ = "Copyright (C) 2009-2013 Andreas Kloeckner" __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated docume...
fusion_center.py
#!/usr/bin/env python ############################################################################### # Imports ############################################################################### from __future__ import print_function from optparse import OptionParser from gnuradio.eng_option import eng_option import sys i...
multiple_vn_vm_test.py
# Need to import path to test/fixtures and test/scripts/ # Ex : export PYTHONPATH='$PATH:/root/test/fixtures/:/root/test/scripts/' # # n specific tests, # You can do 'python -m testtools.run -l tests' # Set the env variable PARAMS_FILE to point to your ini file. Else it will try to pick params.ini in PWD # import os fr...
unit_test_Cache.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import six import re, os, tempfile, json import time, datetime, random from mock import MagicMock, patch from nose.tools import assert_raises, assert_equal, assert_is_non...
computation_data_processor.py
from multiprocessing import Queue from Queue import Empty, Full from threading import Thread, Lock from flare.common.communicator import CTCommunicator, AgentCommunicator from flare.common.utils import concat_dicts, split_dict class ComputationDataProcessor(object): """ This class batches the data from the Ag...
example.py
import logging import threading import time from ZtjJsonLogging import JsonFormatter from ZtjJsonLogging import JsonLogger # 定义格式化器 formatter = JsonFormatter() formatter.set_ensure_ascii(False) formatter.set_indent(4) # 定义处理器 handler = logging.StreamHandler() handler.setLevel(logging.DEBUG) handler.setFormatter(form...
upgrade_through_versions_test.py
from distutils.version import LooseVersion import operator import os import pprint import random import signal import time import uuid import logging import pytest import psutil from collections import defaultdict, namedtuple from multiprocessing import Process, Queue from queue import Empty, Full from cassandra imp...
lock.py
from six.moves import urllib import os import sys import threading import time class Lock: def __init__( self, name, base_uri='http://localhost:13131', lock_callback=None, lock_lost_callback=None): self.name = name self.base_uri = base_uri self.maintainer = None ...
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...
streaming_client.py
import socket import cv2 import pickle import struct import threading import argparse import errno watching = True # thread that listens for any input, used to terminate stream loop def key_capture_thread(): global watching input() watching = False print("starting exit process") if __name__ == '__ma...
launch.py
"""Launching tool for DGL distributed training""" import os import stat import sys import subprocess import argparse import signal import logging import time import json import multiprocessing import re from functools import partial from threading import Thread from typing import Optional DEFAULT_PORT = 30050 def cle...
test_comparison.py
import logging import threading import time import unittest import requests import flask from frtc import TestClient logging.getLogger('werkzeug').setLevel(logging.ERROR) class ComparisonTestCase(unittest.TestCase): endpoint = "/foo" @staticmethod def endpoint_fn(): return "Foo" @classmet...
test_cursor.py
# Copyright 2009-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...
connection_test.py
import os import signal import sys import tempfile import threading import time import testlib import mitogen.core import mitogen.parent class ConnectionTest(testlib.RouterMixin, testlib.TestCase): def test_broker_shutdown_while_connect_in_progress(self): # if Broker.shutdown() is called while a connect...
preview_thread.py
from threading import Thread, Event from PIL import Image as PillowImage import cStringIO as StringIO from kivy.core.image import ImageData as CoreImageData from kivy.graphics.texture import Texture #from jpegtran import JPEGImage import math import errorlog WAITING = 0 COMPLETE = 1 FAILED = 3 CRASHED = 4 class Previ...
twh.py
import socket import sys import threading import time ################################### # CONSTANTS # Twitch Contants SERVER = "irc.twitch.tv" PORT = 6667 # Name of Personal Acc/Acc that is acting as "BOT" name = "nan" # Do not share - Our Idenifier Key password = "nan # Channel the clinet is observing channelName ...
subscriber.py
#!/usr/bin/env python # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
sensor.py
from multiprocessing import Process # Run all python scripts at the same time def one(): import bme280 def two(): import ccs811 def three(): import top_phat_button def four(): import weather_bom Process(target=one).start() Process(target=two).start() Process(target=three).start() Process(target=four).start()
stats_manager.py
# std import logging from datetime import datetime, timedelta from typing import List from threading import Thread from time import sleep # project from . import HarvesterActivityConsumer, WalletAddedCoinConsumer, FinishedSignageConsumer from .stat_accumulators.eligible_plots_stats import EligiblePlotsStats from .stat...
test_content.py
from __future__ import print_function import logging import os import re import sys import json import time import argparse import threading import subprocess import traceback from time import sleep import datetime from distutils.version import LooseVersion import pytz from google.cloud import storage from google.ap...
autobahn_test_servers.py
# -*- coding: utf-8 -*- import logging def run_cherrypy_server(host="127.0.0.1", port=9008): """ Runs a CherryPy server on Python 2.x. """ import cherrypy from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool from ws4py.websocket import EchoWebSocket cherrypy.config.updat...
proc_base.py
import functools import threading import logging import time from time import sleep from datetime import datetime, timedelta # ==== TIMEOUT CONSTANTS ==== # timeout in seconds represents approximately 3 years TIMEOUT_INFINITY = 99999999 TIMEOUT_24_HOURS = 86400 TIMEOUT_12_HOURS = 43200 TIMEOUT_10_HOURS = 36000 TIMEOU...
BrewController.py
from threading import Thread import glob, os from time import sleep, time from TemperatureSensorsController import TemperatureSensors import StatusController from GPIOController import GPIOController temperatureSensors = TemperatureSensors() gpioController = GPIOController() def statusSync(): tempTank1, tempTank3...
mcom_testing.py
import os, copy, atexit, time import numpy as np from colorama import init; init() from multiprocessing import Process from UTILS.colorful import * from UTILS.network import get_host_ip, find_free_port mcom_fn_list_define = [ "v2dx", "flash", "plot", "figure", "hold", "box", "pause", "clf", "xlim", "ylim", "xlabel...
spinel-cli.py
#!/usr/bin/python # # Copyright (c) 2016, Nest Labs, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # notice, thi...
test_tcp.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Thomas Jackson <jacksontj.89@gmail.com>` ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import threading import tornado.gen import tornado.ioloop import tornado.concurrent from tornado.testing import AsyncTestCase,...
run_server.py
#!/usr/bin/env python # ~*~ coding: utf-8 ~*~ from threading import Thread import os import subprocess try: from config import config as env_config, env CONFIG = env_config.get(env, 'default')() except ImportError: CONFIG = type('_', (), {'__getattr__': None})() BASE_DIR = os.path.dirname(os.path.abspa...
test_InfoExtractor.py
#!/usr/bin/env python3 # Allow direct execution import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import threading from test.helper import FakeYDL, expect_dict, expect_value, http_server_port from yt_dlp.compat import compat_etree_fromstring, compat_...
airsim_gui.py
""" GUI designed for the Cycle-of-Learning experiments using Microsoft AirSim. The main goals are to display in real time to the user: - agent's confidence level; - who is controlling the vehicle (agent or human); - camera feed; - [optional] joystick inputs; - [optional] Q value plot for each state...
agent_a3c_mulep_hg.py
#!/usr/bin/env python from __future__ import print_function import numpy as np import cv2 import tensorflow as tf import threading import sys import time import os def MakeDir(path): try: os.makedirs(path) except: pass lab = False load_model = False train = True test_display = False test...
signal_threads.py
#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2008 Doug Hellmann All rights reserved. # """ """ __version__ = "$Id$" #end_pymotw_header import signal import threading import os import time def signal_handler(num, stack): print 'Received signal %d in %s' % \ (num, threading.currentThread().nam...
conftest.py
import pytest import time from context import HGECtx, HGECtxError, ActionsWebhookServer, EvtsWebhookServer, HGECtxGQLServer, GQLWsClient, PytestConf import threading import random from datetime import datetime import sys import os from collections import OrderedDict def pytest_addoption(parser): parser.addoption( ...
concurrency_test.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
core.py
# -*- coding: utf-8 -*- # # 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, software ...
executors.py
import logging import tempfile import threading import os from abc import ABCMeta, abstractmethod from typing import Dict, Text, Any, Tuple, Set, List from schema_salad.validate import ValidationException from .builder import Builder from .errors import WorkflowException from .mutation import MutationManager from .j...
fb_executor.py
""" fb_executor module This is built for interfacing with the ForceBalance command line interface. """ import os import shutil import subprocess import time import copy import threading import numpy as np from forcebalance.nifty import lp_load from forcebalance.parser import gen_opts_types, tgt_opts_types from force...
test_concurrent_query.py
import os import sys import threading from redisgraph import Graph, Node, Edge from base import FlowTestsBase GRAPH_ID = "G" # Graph identifier. CLIENT_COUNT = 16 # Number of concurrent connections. graphs = None # One graph object per client. assertions = ...
tlocal.py
#threadLocal1 import threading local_school=threading.local() def process_student(): print 'Hello, %s (in %s) \n' %(local_school.student,threading.current_thread().name) def process_thread(name): local_school.student=name process_student() t1=threading.Thread(target=process_thread,args=('Alice',),name='Thread...
networking.py
""" Defines helper methods useful for setting up ports, launching servers, and creating tunnels. """ from __future__ import annotations import os import socket import threading import time import warnings from typing import TYPE_CHECKING, Optional, Tuple import fastapi import requests import uvicorn ...
athenad.py
#!/usr/bin/env python3 import base64 import hashlib import io import json import os import sys import queue import random import select import socket import threading import time from collections import namedtuple from functools import partial from typing import Any import requests from jsonrpc import JSONRPCResponseM...
spectrometer_task.py
# =============================================================================== # Copyright 2013 Jake Ross # # 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...
executor.py
from multiprocessing import Queue as PQueue from multiprocessing import Process from queue import Queue from threading import Thread,Lock from datetime import datetime import process from exe.proto import * def waiter(pdata,data,pin): host,msg=pdata data['send'].put((host,msg)) ret=Queue() data['subsc...
main.py
from telegram.ext import Updater from telegram.ext import CommandHandler from telegram.ext import MessageHandler, Filters from telegram import ReplyKeyboardMarkup from telegram import ReplyKeyboardRemove import configparser import logging import threading import json logging.basicConfig(format='%(asctime)s - %(name...
__init__.py
# vim: ts=4:sw=4:et:cc=120 import collections import datetime import gc import importlib import inspect import io import logging import os, os.path import queue import shutil import signal import socket import ssl import stat import sys import tarfile import tempfile import threading import time import uuid from mult...
01-torque_control_cyclic.py
#! /usr/bin/env python3 ### # KINOVA (R) KORTEX (TM) # # Copyright (c) 2019 Kinova inc. All rights reserved. # # This software may be modified and distributed # under the terms of the BSD 3-Clause license. # # Refer to the LICENSE file for details. # ### ### # * DESCRIPTION OF CURRENT EXAMPLE: # =====================...
_cancel_many_calls_test.py
# Copyright 2016 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...
__main__.py
import typer from typing import Generator, Optional import multiprocessing as mp from waxstream.messaging import Header from waxstream.messaging import ( extract_block_info_from_block, extract_transaction_info_from_block, extract_action_info_from_block, ) from waxstream.network import WAX # Init typer CL...
audiowrite.py
import io import numpy as np import threading from pathlib import Path import soundfile from scipy.io.wavfile import write as wav_write from nt.utils.mapping import Dispatcher int16_max = np.iinfo(np.int16).max int16_min = np.iinfo(np.int16).min def dump_audio( obj, path, *, sample_...
client.py
# Reference: https://www.youtube.com/watch?v=WrtebUkUssc """Script for Tkinter GUI chat client.""" from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import tkinter import pyttsx3 # Pytsx is a cross-platform text-to-speech wrapper. engine = pyttsx3.init() # Imports id for female voice en_voic...
gstreamer.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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
GarlandHeckbertRefinement.py
import collections import sys import threading import startinpy import numpy as np from math import floor from scipy.spatial import KDTree from heapq import * TRIANGULATION_THRESHOLD = 0.2 def shift_left(input_list): collection = collections.deque(input_list) collection.rotate(-1) return list(collect...
test_search_20.py
import multiprocessing import numbers import pytest from time import sleep from base.client_base import TestcaseBase from utils.util_log import test_log as log from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from utils.util_pymilvus import...
decorators.py
from threading import Thread def run_in_background(func): """ Apply this decorator on any function to run that function as a background process """ def decorator(*args, **kwargs): t = Thread(target=func, args=args, kwargs=kwargs) t.daemon = True t.start() return decor...
process.py
# -*- coding: utf-8 -*- ''' Functions for daemonizing and otherwise modifying running processes ''' # Import python libs from __future__ import absolute_import, with_statement, print_function, unicode_literals import copy import os import sys import time import errno import types import signal import logging import th...
timing.py
import threading import time class ScheduledTask: def __init__(self, interval, task, *args, adaptive_interval=False, **kwargs): self.interval = interval self.task = task self.args = args self.kwargs = kwargs self.adaptive_interval = adaptive_interval self.shutdown ...
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...
frontend_test.py
#!/usr/bin/env python """Unittest for grr http server.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import hashlib import os import socket import threading import time from future.builtins import range from future.utils import iteritems import ipad...
Main.py
#============================================================================== # Created on Feb 10, 2020 # # @author: Ramin Mehdizad Tekiyeh # This code is written in Python 3.7.4 , Spyder 3.3.6 #============================================================================== #===========================...
ws.py
#!/usr/bin/env python import json import time from threading import Thread from urlparse import urlparse from websocket import WebSocketApp from supervisoragent.systemstat import stats START = 'start' STOP = 'stop' RESTART = 'restart' class WebSocketConnection(object): push_interval = 0.0 thread = None ...
__init__.py
import re import yaml import time import boto3 import botocore import json import os import threading import uuid import tempfile import mimetypes import tldextract NAME = "S3lify" CWD = os.getcwd() MANIFEST_FILE = ".s3lify.manifest" MIMETYPE_MAP = { '.js': 'application/javascript', '.mov': 'video/quickt...
4_can_loopback.py
import os import time import random import threading from panda import Panda from nose.tools import assert_equal, assert_less, assert_greater from .helpers import panda_jungle, start_heartbeat_thread, reset_pandas, time_many_sends, test_all_pandas, test_all_gen2_pandas, clear_can_buffers, panda_connect_and_init # Rese...
test_python_server_image_builder.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...
ecomap_etl.py
"""ECOMAP ETL.""" import logging import multiprocessing from etl import ETL from etl.helpers import OBOHelper from files import TXTFile from transactors import CSVTransactor from transactors import Neo4jTransactor class ECOMAPETL(ETL): """ECOMAP ETL.""" logger = logging.getLogger(__name__) # Query tem...
installwizard.py
import sys import threading import os import traceback from PyQt5.QtCore import * from qtum_electrum import Wallet, WalletStorage from qtum_electrum.util import UserCancelled, InvalidPassword from qtum_electrum.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALLET, GoBack from qtum_electrum.i18n import _ from .se...
test.py
import json import os.path as p import random import subprocess import threading import logging import time from random import randrange import math import pika import pytest from google.protobuf.internal.encoder import _VarintBytes from helpers.client import QueryRuntimeException from helpers.cluster import ClickHous...
ssm_create_file.py
import sys from util import * from threading import Thread def test_create_100M_0KB_thread(max_number): """ submit SSM action througth Restful API in parallel """ cids = [] dir_name = TEST_DIR + random_string() for j in range(max_number): # each has 200K files cid = create_file(dir...
upload_to_google_storage.py
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Uploads files to Google Storage content addressed.""" import hashlib import optparse import os import Queue import re import st...
spawn_action_process.py
import multiprocessing from presqt.api_v1.utilities.multiprocess.watchdog import process_watchdog def spawn_action_process(self, method_to_call, action): """ Spawn a separate process on the Python kernel to run independently of the main request thread. This also starts a watch dog to supervise the spawne...
makefile.py
#! /usr/bin/env python # -*- coding: UTF-8 -*- #——————————————————————————————————————————————————————————————————————————————————————————————————— # Releases #——————————————————————————————————————————————————————————————————————————————————————————————————— # 1.0: march 18th, 2015 # first release # 2.0: oct...
database.py
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) """ These tests check the database is functioning properly, both in memory and in its file """ import datetime import func...
tf_task_common.py
import logging import sys from typing import Union, List, Optional, Tuple, Dict import re import skein import tensorflow as tf from tf_yarn import event from tf_yarn.tensorflow import Experiment, KerasExperiment from tf_yarn._internal import MonitoredThread from tf_yarn._task_commons import ( _setup_container_log...
ReadUBX_backup.py
""" Largely borrowed from UBX Examples """ from sys import platform from io import BufferedReader from threading import Thread from time import sleep from pyubx2 import UBXMessage, POLL, SET#, UBX_CONFIG_MESSAGES from pyubx2.ubxreader import UBXReader from pyubx2.exceptions import UBXStreamError from serial import S...
threads.py
"""Threads The easy Python threading module. """ from functools import wraps try: import threading except ImportError: import dummy_threading as threading class Empty(object): """An empty value. ``Empty`` is a uniquely identifiable object that signifies a ``Channel`` is empty. ``False`` or `...
binomial_trees_plot.py
from math import ceil from multiprocessing import Process, Queue import matplotlib.pyplot as plt from options.pricing.binomial_trees import BinomialTreePricer from options.option import OptionType, Option class OptionPricePlotter: def __init__(self, otype=OptionType.PUT, spot=50, strike=52, rate...
oak_viewer_app.py
import kivy kivy.require('2.0.0') import time import threading import os from kivy.app import App from kivy.lang import Builder from kivy.core.window import Window Builder.load_file('gui/oak_viewer.kv') from oak_viewer.gui.oak_viewer import OakViewer from oak_viewer.oak_d_cam import OakDCamera from oak_viewer.types...
fuzzer.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, softw...
test_sigma_dut.py
# Test cases for sigma_dut # Copyright (c) 2017, Qualcomm Atheros, Inc. # Copyright (c) 2018-2019, The Linux Foundation # # This software may be distributed under the terms of the BSD license. # See README for more details. import binascii import errno import fcntl import hashlib import logging logger = logging.getLog...
manual_multiprocessing.py
import multiprocessing from construct import * def worker(q): obj = q.get() print(obj) if __name__ == '__main__': queue = multiprocessing.Queue() p = multiprocessing.Process(target=worker, args=(queue,)) p.start() obj = Container(name="test") print(obj) queue.put(obj) # Wait f...
test_tls.py
import contextlib import http.server import os import ssl import threading from typing import Iterator, Tuple import pytest import requests from determined.common.api import certs, request TRUSTED_DOMAIN = "https://google.com" UNTRUSTED_DIR = os.path.join(os.path.dirname(__file__), "untrusted-root") UNTRUSTED_CA = o...
main.py
from flask import Flask, request from multiprocessing import Process import RPi.GPIO as GPIO #Alexa from flask_ask import Ask, statement import spidev import time #Twilio from twilio.twiml.messaging_response import MessagingResponse from .notifications import send_sms from .notifications import send_email # for tes...
session_debug_testlib.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...
fakeserial.py
import asyncio from asyncio import Protocol, StreamReader, Event, Queue, AbstractEventLoop from threading import Thread from callblocker.core.modem import ModemType, SerialDeviceFactory from callblocker.core.modems import CX930xx from callblocker.core.service import AsyncioService, ServiceState, AsyncioEventLoop CX93...
gsi_rebalance_gsi.py
from datetime import datetime import random import threading from membase.api.rest_client import RestConnection, RestHelper from queue import Queue from lib import testconstants from lib.couchbase_helper.query_definitions import SQLDefinitionGenerator, QueryDefinition, RANGE_SCAN_TEMPLATE from lib.couchbase_helper.tu...