source
stringlengths
3
86
python
stringlengths
75
1.04M
BPCL_ch_final.py
''' # Copyright (C) 2020 by ZestIOT. All rights reserved. The # information in this document is the property of ZestIOT. Except # as specifically authorized in writing by ZestIOT, the receiver # of this document shall keep the information contained herein # confidential and shall protect the same in whole or ...
agent.py
# Copyright 2020 Kaggle 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, ...
genetic_attack.py
# coding: utf-8 from __future__ import division from __future__ import print_function from __future__ import unicode_literals import sys import os import numpy as np import time import random import torch import torch.nn.functional as F try: import cPickle as pickle except ImportError: import pickle from modifi...
build_mtt.py
"""Converts MagnaTagATune dataset to TFRecord files. """ import os import pandas as pd import tensorflow as tf from threading import Thread from queue import Queue from madmom.audio.signal import LoadAudioFileError from sample_cnn.data.audio_processing import (audio_to_sequence_example, ...
server.py
""" server reads file and send to client """ import datetime import pickle import socket import threading import time import numpy as np from src.packet import packet # Connection handler def handleConnection(addr, ): drop_count = 0 packet_count = 0 fragment_size = 500 time.sleep(0.5) if lossSim...
email.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from . import mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(to, subject, template, **kwargs): app = current_app._get_current_object() msg = Message(app.conf...
cache_worker.py
#!/usr/bin/python import zmq import sys import urllib import urllib2 import optparse from multiprocessing import Process AGENTS = ["MSIE", "Chrome", "Firefox", "Safari", "Opera"] # The "worker" functions listen on a zeromq PULL connection for "work" # (URLs to be warmed) from the ventilator, warm those urls for all...
ls_ruuvi.py
import argparse import subprocess import queue import threading import time import logging import ruuvitag from prometheus_client import start_http_server from prometheus_client.core import REGISTRY, GaugeMetricFamily logging.basicConfig( level=logging.INFO, format='%(levelname)-8s %(name)-12s %(message)s' ) ...
index.py
#!/usr/bin/env python import boto3 # import urllib.request as urllib2 import os import json import threading import requests import time from requests.exceptions import HTTPError website_url = json.loads(os.environ['Website_URL']) metricname = os.environ['metricname'] timeout = int(...
mitm.py
#!/usr/bin/env python3 import socket import argparse import threading import signal import json import requests import sys import time import traceback from queue import Queue from contextlib import contextmanager CLIENT2SERVER = 1 SERVER2CLIENT = 2 running = True num_atm_messages = 0 num_bank_responses = 0 bank_add...
test_comms.py
import asyncio import os import sys import threading import types import warnings from functools import partial import dask import distributed import pkg_resources import pytest from distributed.comm import ( CommClosedError, connect, get_address_host, get_local_address_for, inproc, listen, ...
test_logging.py
# Copyright 2001-2017 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...
facerec.py
import threading import mjpgweb import webrequest def onWebcam(): mjpgweb.onWebcam() #start webcam stream server print("start webcam") if __name__=='__main__': camThread=threading.Thread(target=onWebcam) camThread.start() os.system('python3 webrequest.py')
test__transaction.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2001, 2002, 2005 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should acc...
ProcessLineReaderWin.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (C) 2018 Intel 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 b...
app.py
from flask import Flask, jsonify, request import requests from urllib.request import urlopen import json import os import threading import time as sleeptime from datetime import datetime import subprocess import pickle import numpy as np from flask import make_response app = Flask(__name__) @app.route('/<ip_server>/<...
clientw.py
""" gRpc client for interfacing with CORE. """ import logging import threading from contextlib import contextmanager from queue import Queue from typing import Any, Callable, Dict, Generator, Iterable, List, Optional, Tuple import grpc from core.api.grpc import ( configservices_pb2, core_pb2, core_pb2_gr...
devtools_browser.py
# Copyright 2017 Google Inc. All rights reserved. # Use of this source code is governed by the Apache 2.0 license that can be # found in the LICENSE file. """Base class support for browsers that speak the dev tools protocol""" import glob import gzip import logging import os import re import shutil import subprocess im...
miner.py
import multiprocessing import random import time from multiprocessing import Process from mushicoin import custom, api from mushicoin import tools from mushicoin.blockchain import BlockchainService from mushicoin.service import Service, threaded, lockit class MinerService(Service): """ Simple miner service. ...
block_profiler_test.py
import os import time import unittest import random import threading try: # python 2 from urllib2 import urlopen except ImportError: # python 3 from urllib.request import urlopen import stackimpact from stackimpact.runtime import min_version, runtime_info from test_server import TestServer class ...
try_process.py
from multiprocessing import Process def f(name): print('hello', name) if __name__ == '__main__': p = Process(target=f, args=('bob',)) p.start() p.join()
ucemulator.py
# Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: # - Ralph ...
run-spec-test.py
#!/usr/bin/env python3 # Author: Volodymyr Shymanskyy # Usage: # ./run-spec-test.py # ./run-spec-test.py ./core/i32.json # ./run-spec-test.py ./core/float_exprs.json --line 2070 # ./run-spec-test.py ./proposals/tail-call/*.json # ./run-spec-test.py --exec ../build-custom/wasm3 # ./run-spec-test.py --engine...
liveReceiver.py
from .liveProcessor import LiveProcessor import threading from .cameraAPI import RecordMode import time import socket from urllib.parse import urlparse import binascii from queue import Queue class LiveReceiver: def __init__(self, cameraManager): self.cameraManager = cameraManager self.queue = Que...
rtest.py
#!/usr/bin/python3 """Copyright 2021 Advanced Micro Devices, Inc. Run tests on build""" import re import os import sys import subprocess import shlex import argparse import pathlib import platform from genericpath import exists from fnmatch import fnmatchcase from xml.dom import minidom import multiprocessing import t...
MiniMir.py
# -*- coding:UTF-8 -*- import hashlib import logging import threading import time from concurrent.futures.thread import ThreadPoolExecutor from datetime import datetime from queue import Queue import schedule from minimir.BattleAction import BattleAction from minimir.CityAction import CityAction from minimir.GameActi...
camera_obdet.py
#!/usr/bin/env python3 import sys import numpy as np import cv2 import os import tensorflow as tf import threading import time from collections import OrderedDict import re import random from base_camera import BaseCamera # ---------- UDP socket -------- import socket UDP_IP = "<IP ADDRESS>" UDP_PORT = 5005 sock...
test_largefile.py
"""Test largefile support on system where this makes sense. """ import os import stat import sys import unittest import socket import shutil import threading from test.support import requires, bigmemtest from test.support import SHORT_TIMEOUT from test.support import socket_helper from test.support.os_hel...
store.py
import json import uuid as uuid_builder import os.path from os import path from threading import Lock from copy import deepcopy import logging import time import threading # Is there an existing library to ensure some data store (JSON etc) is in sync with CRUD methods? # Open a github issue if you know something :)...
allreduce.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 hdfs as hopshdfs from hops import tensorboard from hops import devi...
scraper.py
from utils import Logger, find_between import requests from bs4 import BeautifulSoup from datetime import datetime import json from threading import Thread log = Logger('log.txt') locationNames = ["Brower+Commons", "Livingston+Dining+Commons", "Busch+Dining+Hall", "Neilson+Dining+Hall"] locationNum = ['01','03','04',...
test_functools.py
import abc import collections import copy from itertools import permutations import pickle from random import choice import sys from test import support import unittest from weakref import proxy import contextlib try: import threading except ImportError: threading = None import functools py_functools = suppor...
08_threadinglocal.py
import time import threading v = threading.local() def func(arg): # 内部会为当前线程创建一个空间用于存储:phone=自己的值 v.phone = arg time.sleep(2) print(v.phone, arg) # 去当前线程自己空间取值 for i in range(10): t = threading.Thread(target=func, args=(i,)) t.start()
test_ki.py
import pytest import sys import os import signal import threading import contextlib import time from async_generator import async_generator, yield_, isasyncgenfunction from ... import _core from ...testing import wait_all_tasks_blocked from ..._util import acontextmanager, signal_raise from ..._timeouts import sleep ...
process_handler.py
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import io import multiprocessing import sys from abc import ABC, abstractmethod class ProcessHandler(ABC): """An abstraction of process handling calls using the same interface as subpr...
controlsd.py
#!/usr/bin/env python3 import os import gc from cereal import car, log from common.android import ANDROID, get_sound_card_online from common.numpy_fast import clip from common.realtime import sec_since_boot, set_realtime_priority, set_core_affinity, Ratekeeper, DT_CTRL from common.profiler import Profiler from common.p...
thread.py
from __future__ import print_function import logging import warnings import sys _log = logging.getLogger(__name__) try: from itertools import izip except ImportError: izip = zip from functools import partial import json import threading try: from Queue import Queue, Full, Empty except ImportError: f...
cmdlineframes.py
from __future__ import absolute_import, division, print_function from iotbx.reflection_file_reader import any_reflection_file from cctbx.miller import display2 as display from crys3d.hklview import jsview_3d as view_3d from crys3d.hklview.jsview_3d import ArrayInfo from cctbx import miller from libtbx.math_utils impo...
run_fuzz_multiprocess_main.py
# Lint as: python3 # # Copyright 2020 The XLS 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...
TestContext.py
# -*- coding: utf-8 -*- """ Test pdtContext """ import sys import time import parsedatetime as pdt from parsedatetime.context import pdtContext if sys.version_info < (2, 7): import unittest2 as unittest else: import unittest class test(unittest.TestCase): def setUp(self): self.cal = pdt.Calenda...
test_stim_client_server.py
import threading import time from nose.tools import assert_equal, assert_raises from mne.realtime import StimServer, StimClient from mne.externals.six.moves import queue from mne.utils import requires_good_network @requires_good_network def test_connection(): """Test TCP/IP connection for StimServer <-> StimClie...
common.py
# Copyright 2021 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. from enum import Enum from functools import wraps from pathlib import...
server.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 applica...
_linux_driver.py
from __future__ import annotations import asyncio import os from codecs import getincrementaldecoder import selectors import signal import sys import termios from time import time import tty from typing import Any, TYPE_CHECKING from threading import Event, Thread if TYPE_CHECKING: from rich.console import Consol...
common_a3c.py
# -*- coding:utf8 -*- # File : common_a3c.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 3/21/17 # # This file is part of TensorArtist. import collections import threading import numpy as np from tartist.core import get_env from tartist.app import rl PlayerHistory = collections.namedtuple('...
classification.py
# Copyright (c) HP-NTU Digital Manufacturing Corporate Lab, Nanyang Technological University, Singapore. # # This source code is licensed under the Apache-2.0 license found in the # LICENSE file in the root directory of this source tree. import sys, os lib_path = os.path.abspath(os.path.join('scripts/ncs2')) ...
base_events.py
"""Base implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a c...
data_update_ui.py
#!usr/bin/env python #-*- coding:utf-8 _*- """ @version: author:Sleepy @time: 2017/08/08 @file: data_update.py @function: @modify: """ import copy import traceback import threading from PyQt5.QtCore import QTimer, pyqtSignal from PyQt5.QtWidgets import QHeaderView from Utiltity.common import * from Utiltity.ui_utilit...
test_rpc.py
import os import time import socket import dgl import backend as F import unittest, pytest import multiprocessing as mp from numpy.testing import assert_array_equal if os.name != 'nt': import fcntl import struct INTEGER = 2 STR = 'hello world!' HELLO_SERVICE_ID = 901231 TENSOR = F.zeros((10, 10), F.int64, F....
CasesSolver_baseline.py
import csv import os import sys import shutil import time import numpy as np import scipy.io as sio import yaml import signal import argparse import subprocess from easydict import EasyDict from os.path import dirname, realpath, pardir from hashids import Hashids import hashlib sys.path.append(os.path.join(dirname(re...
update_repository_manager.py
""" Determine if installed tool shed repositories have updates available in their respective tool sheds. """ import logging import threading from sqlalchemy import false import tool_shed.util.shed_util_common as suc from galaxy import util from tool_shed.util import common_util from tool_shed.util import encoding_uti...
server.py
# -*- coding: utf-8 -*- # ================================================================= # # Authors: Tom Kralidis <tomkralidis@gmail.com> # Angelos Tzotsos <tzotsos@gmail.com> # # Copyright (c) 2016 Tom Kralidis # Copyright (c) 2015 Angelos Tzotsos # Copyright (c) 2016 James Dickens # Copyright (c) 2016 Ri...
_server.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...
coco.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch import torchvision from torchvision.io.image import ImageReadMode import torch.multiprocessing as mp from maskrcnn_benchmark.structures.image_list import ImageList, to_image_list from maskrcnn_benchmark.structures.bounding_box import ...
extract_mini_srcgame_dream_2.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function USED_DEVICES = "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 import...
Server_Main_ChatRoom_20200513092509.py
import os import sys import threading import time import socket import select import errno import queue import json from PyQt5.QtWidgets import QApplication, QMainWindow, QDialog from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import QFile from logzero import logger as log from Options_Server import Ui_Dia...
step_prepare.py
"""Batching file prepare requests to our API.""" import collections import threading import time from six.moves import queue # Request for a file to be prepared. RequestPrepare = collections.namedtuple( 'RequestPrepare', ('prepare_fn', 'on_prepare', 'response_queue')) RequestFinish = collections.namedtuple('Requ...
exchangeRecon.py
#!/usr/bin/python3 # # This tool connects to the given Exchange's hostname/IP address and then # by collects various internal information being leaked while interacting # with different Exchange protocols. Exchange may give away following helpful # during OSINT or breach planning stages insights: # - Interna...
visualiser.py
# Copyright (C) 17/1/20 RW Bunney # 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 3 of the License, or # (at your option) any later version. # This program is distributed in the...
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( ...
santa_claus.py
from threading import Semaphore,Thread, Barrier import random import time def renos(num_reno): global c_renos while True: mut_renos_i.acquire() print('El reno %d se va de vacaciones' % num_reno) mut_renos_i.release() time.sleep(10) mut_renos_i.acquire() print('¡...
test_functionality.py
import os import sys import time import threading import unittest import yappi import _yappi import utils import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6 import subprocess _counter = 0 class BasicUsage(utils.YappiUnitTestCase): def test_callback_function_int_...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from __future__ import with_statement import os import pickle import random import subprocess import sys import time import unittest from test import support try: imp...
UpdateBlueprint.py
######################################################################################### # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # SPDX-License-Identifier: MIT-0 # # ...
local.py
# PyAlgoTrade # # Copyright 2011-2014 Gabriel Martin Becedillas Ruiz # # 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...
shotcontrol.py
import signal import sys import threading import time def intSI(x): x = str(x) units = x.find('M') if units >= 0: return int(x[0:units])*1000000 else: units = x.find('k') if units >= 0: return int(x[0:units])*1000 else: return int(x) class Action...
build_image_data.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
test_time.py
import os import threading import time from datetime import datetime as dt from datetime import timezone as tz import pytest from astropy import units as u from panoptes.utils import error from panoptes.utils.time import CountdownTimer from panoptes.utils.time import current_time from panoptes.utils.time import wait_...
test.py
import gzip import json import logging import os import io import random import threading import time import helpers.client import pytest from helpers.cluster import ClickHouseCluster, ClickHouseInstance, get_instances_dir from helpers.network import PartitionManager from helpers.test_tools import exec_query_with_retr...
benchmark_cluster.py
################################################################################ # # MRC FGU Computational Genomics Group # # $Id$ # # Copyright (C) 2009 Andreas Heger # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as publish...
run_agents.py
from multiprocessing import Process, JoinableQueue import sys from glob import glob from os import path from run import main import json agent_configs = sys.argv[1] q = JoinableQueue() NUM_THREADS = 24 def run_single_config(queue): while True: conf_path = queue.get() params = json.load(open(conf_p...
videocaptureasync.py
# https://github.com/gilbertfrancois/video-capture-async import threading import cv2 import time WARMUP_TIMEOUT = 10.0 class VideoCaptureAsync: def __init__(self, src=0, width=640, height=480): self.src = src self.cap = cv2.VideoCapture(self.src) if not self.cap.isOpened(): ...
languageLearner.py
#!/usr/bin/env python import sys sys.path.append('../cvk2') import cvk2 import cv2 import httplib import microsoftCogServicesHelper as msCogServs import numpy as np import requests import socket import urllib import utils import time import threading _CVkey = 'e80f8ece393f4eebb3d98b0bb36f04d0' _translatorKey = '420c6a...
monitor.py
from threading import Thread import Queue import time class TemperatureMonitor(object): MAX_RECORD_NUMBER = 64 def __init__(self, sensor, interval=0.5): self.__sensor = sensor self.__interval = interval self.records = [] self.worker = Thread(target=self.__mointor_sensor) ...
tcpserver.py
#!/usr/bin/env python3 import errno import os import signal import socket import struct import sys import threading import time from optparse import OptionParser from fprime.constants import DATA_ENCODING try: import socketserver except ImportError: import SocketServer as socketserver __version__ = 0.1 __d...
mupen64plus_env.py
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import abc import array import inspect import itertools import json import os import subprocess import threading import time from termcolor import cprint import yaml import gym from gym import error, spaces, utils from gym.utils import seeding import nump...
recognize_head_gesture.py
# This is an example to run the graph in python. import datetime from multiprocessing import process import time # import IPython import numpy as np from pikapi.head_gestures import YesOrNoEstimator import pikapi.utils.logging from collections import defaultdict import cv2 import click import pikapi import pikapi.me...
test_nntplib.py
import io import socket import datetime import textwrap import unittest import functools import contextlib import os.path import re import threading from test import support from nntplib import NNTP, GroupInfo import nntplib from unittest.mock import patch try: import ssl except ImportError: ssl = None certf...
morePing.py
#!/usr/bin/python3 # -*- coding:utf-8 -*- import os, sys, re import threading, gevent import queue import json from argparse import ArgumentParser, RawTextHelpFormatter from alive_progress import alive_bar from gevent import monkey monkey.patch_all() import requests import time # global variables task_queue = queue...
agent.py
#!/usr/bin/env python # # AzureMonitoringLinuxAgent Extension # # Copyright 2021 Microsoft Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
test_stack.py
import os import threading import time import timeit import pytest from ddtrace.vendor import six from ddtrace.vendor.six.moves import _thread from ddtrace.profiling import recorder from ddtrace.profiling.collector import stack from . import test_collector TESTING_GEVENT = os.getenv("DD_PROFILE_TEST_GEVENT", False...
IndexFiles.py
# SJTU EE208 INDEX_DIR = "IndexFiles.index" import sys, os, lucene, threading, time, re from datetime import datetime from java.io import File from java.nio.file import Path from org.apache.lucene.analysis.miscellaneous import LimitTokenCountAnalyzer from org.apache.lucene.analysis.standard import StandardAnalyzer f...
copyutil.py
# cython: profile=True # 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 # "...
PC_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Python PC Miner (v2.5.7) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## # Import libraries import sys from configparser import ...
monitor.py
# =============================================================================== # Copyright 2011 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/licens...
generate_val_3.py
import json import os from multiprocessing import Process def chunks(lst, n): """Yield successive n-sized chunks from lst.""" for i in range(0, len(lst), n): yield lst[i:i + n] def cut_videos(cmds, i): for i in range(len(cmds)): cmd = cmds[i] print(i, cmd) os.system(cmd) ...
main.py
from components import mqtt_controller,ipmi_controller from threading import Thread import paho.mqtt.client as mqtt def on_connect(client, userdata, flags, rc): print("Connected with result code {0}".format(str(rc))) client.subscribe( mqtt_controller.mqtt_control_topic) def on_message(client, userdat...
conftest.py
# Copyright © 2020 Interplanetary Database Association e.V., # Planetmint and IPDB software contributors. # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 """Fixtures and setup / teardown functions Tasks: 1. setup test database before starting the tests 2. delete test ...
terminal.py
import sublime import os import time import base64 import logging import tempfile import threading from queue import Queue, Empty from .ptty import TerminalPtyProcess, TerminalScreen, TerminalStream from .utils import responsive, intermission from .view import panel_window, view_size from .key import get_key_code fro...
test_util.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...
echo.py
""" OCCAM Copyright (c) 2011-2017, SRI International 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 con...
camera.py
from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread import cv2 import time class PiVideoStream: def __init__(self, resolution=(640, 480), framerate=32): # initialize the camera and stream self.camera = PiCamera() self.camera.resolution = resolut...
conftest.py
import time from threading import Thread from typing import Set, Optional import pytest from hallo.function_dispatcher import FunctionDispatcher from hallo.hallo import Hallo from hallo.test.server_mock import ServerMock DEFAULT_MODULES = { "ascii_art", "bio", "channel_control", "convert", "euler...
load-graph.py
#! /usr/bin/env python # # This file is part of khmer, http://github.com/ged-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2013. It is licensed under # the three-clause BSD license; see doc/LICENSE.txt. Contact: ctb@msu.edu # """ Build a graph from the given sequences, save in <htname>. % python s...
test_uow.py
# pylint: disable=broad-except, too-many-arguments import threading import time import traceback from typing import List from unittest.mock import Mock import pytest from src.allocation.domain import model from src.allocation.service_layer import unit_of_work from ..random_refs import random_sku, random_batchref, rando...
parallelblast.py
#!/usr/bin/python # -*- coding: utf-8 import argparse from textwrap import dedent from uuid import uuid4 as uuid from collections import deque from ruffus import * import subprocess from threading import Thread from optparse import OptionParser import multiprocessing from math import frexp import os, sys ...
agent.py
# -*- coding:utf-8 -*- """ The MIT License (MIT) Copyright (c) 2015 Mauricio Galdieri 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 t...
subproc_vec_env.py
import multiprocessing from collections import OrderedDict from typing import Sequence import gym import numpy as np from neorl.rl.baselines.shared.vec_env.base_vec_env import VecEnv, CloudpickleWrapper def _worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.var() ...
usbtest_rw_buf.py
#!/usr/bin/env python import logging import threading import time from usblib import device_from_fd from usblib import shell_usbdevice from usblib import CP210xSerial LOGGER = logging.getLogger(__name__) # ---------------------------------------------------------------------------- def main(fd, debug=False): ...
webserver.py
from flask import Flask import threading app = Flask("supervisor") @app.route("/") def hello_world(): return "<p>Hello, World!</p>" def startServer(): # starts the app server in a thread and returns the thread webServer = threading.Thread(name='webServer', target=_startWebServer) webServer.setDaemon(...