source
stringlengths
3
86
python
stringlengths
75
1.04M
process.py
import youtube_dl import os import threading import logging import json logger = logging.getLogger("RaspberryCast") volume = 0 def launchvideo(url, config, sub=False): setState("2") os.system("echo -n q > /tmp/cmd &") # Kill previous instance of OMX #if config["new_log"]: #os.system("sudo fbi -...
KISSInterface.py
from .Interface import Interface from time import sleep import sys import threading import time import RNS class KISS(): FEND = 0xC0 FESC = 0xDB TFEND = 0xDC TFESC = 0xDD CMD_UNKNOWN = 0xFE CMD_DATA = 0x00 CMD_TXDELAY = ...
dpl_com.py
#!/usr/bin/python __author__ = 'gdiaz' # DPL ZMQ COM INTERFACE """Provides a high level interface over ZMQ for dpl data exchange. """ """Description DPL comunication: node1 & node2 commands: read cmds(int) from node1 and execute cmd console: send state(int, int) to node2 ...
test_telnetlib.py
import socket import selectors import telnetlib import contextlib from test import support import unittest threading = support.import_module('threading') HOST = support.HOST def server(evt, serv): serv.listen() evt.set() try: conn, addr = serv.accept() conn.close() except socket.timeo...
grpc_comm_manager.py
import logging from typing import List from concurrent import futures import threading import sys import time import json import grpc import time,os from ..gRPC import grpc_comm_manager_pb2_grpc, grpc_comm_manager_pb2 lock = threading.Lock() from fedml.fedml_core.distributed.communication.base_com_manager import Ba...
base.py
"""Executor base classes.""" import threading from collections import OrderedDict from testplan.common.entity import Resource, ResourceConfig from testplan.common.utils.thread import interruptible_join class ExecutorConfig(ResourceConfig): """ Configuration object for :py:class:`Executor <testplan.runn...
winInputHook.py
#winInputHook.py #A part of NonVisual Desktop Access (NVDA) #Copyright (C) 2006-2008 NVDA Contributors <http://www.nvda-project.org/> #This file is covered by the GNU General Public License. #See the file COPYING for more details. import threading import comtypes.client import time from ctypes import * from ...
deeproute_generate_aug_data.py
import os import mmcv import numpy as np import pickle from mmcv import track_iter_progress import glob from mmcv.ops import roi_align from os import path as osp from mmdet3d.core.bbox import box_np_ops as box_np_ops from mmdet3d.datasets import build_dataset from mmdet.core.evaluation.bbox_overlaps import bbox_overla...
TFSparkNode.py
# Copyright 2017 Yahoo Inc. # Licensed under the terms of the Apache 2.0 license. # Please see LICENSE file in the project root for terms. """This module provides low-level functions for managing the TensorFlowOnSpark cluster.""" from __future__ import absolute_import from __future__ import division from __future__ im...
Receive_MainEnvironmentSimulator.py
#Receive_MainEnvironmentSimulator.py #Environment simulator + REST-Server + AdvantEDGE #Version:4 #Date:2020-04-15 #Author: Jaime Burbano #Description: This set of files are used to run the first simulation of the system using AdvantEDGE #runs with python 3 #python3 MainEnvironmentSimulator v002 #TYPE: HNA-IN...
test_multiprocessing.py
# # Unit tests for the multiprocessing package # ## FIXME: remove when https://bugs.pypy.org/issue1644 is resolved import sys if sys.platform.startswith('freebsd'): raise Exception("This test hangs on FreeBSD. Test deactivated for now until https://bugs.pypy.org/issue1644 get resolved") import unittest import Que...
all_test_2.py
import os import random import numpy as np import time from tqdm import tqdm import multiprocessing import subprocess P = [0.1, 0.2, 0.3] T = [5, 10, 20, 40, 80] S = ["2", "3", "4", "5", "6", "7"] nodeNum = 8 nodeList = [ "cd /data/ost0;", "cd /data/ost1;", "cd /data/ost2;", "cd /data/ost3;", "cd /data/ost4;"...
scheduler.py
from Queue import PriorityQueue as PQ import time from SocketServer import ThreadingTCPServer, StreamRequestHandler import socket import threading time_slice = 5 threshold = 60 starving = 3600 port = 8888 ban_list = [] cfq = {} mutex_sch = threading.Lock() mutex_cfq = threading.Lock() def topo(file="controller/top...
runExperiments.py
import os import argparse from multiprocessing import Process from datetime import datetime from train import train from train import parse_args as parse_args_other cmdBase = "python train.py".split() cmdNumAdv = "--num-adversaries 3".split() cmdNumEpisodes = "--num-episodes 60000".split() cmdNumUnits = "--num-units 6...
popen_spawn.py
"""Spawn interface using subprocess.Popen """ import os import threading import subprocess import sys import time import signal import shlex try: from queue import Queue, Empty # Python 3 except ImportError: from Queue import Queue, Empty # Python 2 from .spawnbase import SpawnBase, SpawnBaseUnicode, PY3 fr...
tpu_estimator.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...
HEAT_HAI.py
from threading import Thread from time import sleep import queue from statistics import mean from counterdown import CounterDown import random import Pins as pins import RPi.GPIO as GPIO class HEAT_HAI(object): __instance = None def __init__(self, master_): if HEAT_HAI.__instance is not None: ...
gap.py
r""" Interface to GAP Sage provides an interface to the GAP system. This system provides extensive group theory, combinatorics, etc. The GAP interface will only work if GAP is installed on your computer; this should be the case, since GAP is included with Sage. The interface offers three pieces of functionality: #....
main.py
import argparse import atexit import fcntl import os import platform import re import shutil import signal import stat import subprocess import sys import tempfile import time import unittest from multiprocessing import Process class TestUnit(unittest.TestCase): current_dir = os.path.abspath( os.path.joi...
http_malleable.py
from __future__ import print_function import os, sys, logging, time, copy, string, base64, json, random, ssl from pydispatch import dispatcher from flask import Flask, request, make_response, Response, send_from_directory # extras from builtins import str from builtins import object import logging import base64 import...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 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 bitcoind shutdown.""" from test_framework.test_framework import BitcoinTestFramework from test_framewo...
test_functools.py
import abc import builtins import collections import collections.abc import copy from itertools import permutations import pickle from random import choice import sys from test import support import threading import time import typing import unittest import unittest.mock from weakref import proxy import contextlib imp...
dependency_manager.py
from contextlib import closing from collections import namedtuple import logging import os import threading import traceback import time import shutil from codalab.lib.formatting import size_str from codalab.worker.file_util import remove_path, un_tar_directory from codalab.worker.fsm import BaseDependencyManager, Dep...
docserver.py
# ----------------------------------------------------------------------------- # Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. # -----------------------------------------------------------------...
Imaging.py
import cv2 import matplotlib.pyplot as plt import cvlib as cv import time import queue from cvlib.object_detection import draw_bbox import warnings from .Cameras import * from .MotorControl import * from .Config import * class Imaging: """The Imaging class is responsible for calculating the velocities etc for Mot...
params.py
#!/usr/bin/env python3 """ROS has a parameter server, we have files. The parameter store is a persistent key value store, implemented as a directory with a writer lock. On Android, we store params under params_dir = /data/params. The writer lock is a file "<params_dir>/.lock" taken using flock(), and data is stored in...
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development team # 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 ...
test_filters.py
''' Some tests for filters ''' import math import numpy from numpy.testing import (assert_equal, assert_allclose, assert_array_almost_equal, assert_array_equal, assert_almost_equal, suppress_warnings, assert_) import pytest from pytest im...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
crucible.py
import logging from time import time from multiprocessing import Process import os from os.path import dirname, join, abspath, isfile from sys import exit import traceback from settings import ALGORITHMS import json import shutil from os import getcwd, listdir, makedirs from algorithms import run_algorithms class Cru...
olympian_client.py
from __future__ import print_function # This is a placeholder for a Google-internal import. from grpc.beta import implementations import tensorflow as tf from tensorflow_serving.apis import predict_pb2 from tensorflow_serving.apis import prediction_service_pb2 import time import threading import sys tf.app.flags.D...
_v5_proc_recorder.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # COPYRIGHT (C) 2014-2020 Mitsuo KONDOU. # This software is released under the MIT License. # https://github.com/konsan1101 # Thank you for keeping the rules. import sys import os import time import datetime import codecs import glob import queue import threading impor...
pyarctan.py
import threading from typing import List class ThreadWithReturnValue(threading.Thread): def __init__(self, group=None, target=None, name=None, args=(), kwargs={}, Verbose=None): threading.Thread.__init__(self, group, target, name, args, kwargs) self._return = None def run(self): if sel...
savelocation.py
# Copyright 2004-2014 Tom Rothamel <pytom@bishoujo.us> # # 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, m...
robolink.py
# Copyright 2015-2020 - 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 or agr...
app2th.py
#!C:/Python35/python.exe # -*- coding: UTF-8 -*- # # belmih 2016 # import threading import queue import argparse import os import time import zipfile import shutil import xml.etree.cElementTree as ET import csv abspath = os.path.abspath(__file__) workdir = os.path.dirname(abspath) os.chdir(workdir) CSV_ID_LEVEL = "...
sampler.py
""" This is a 'fake' RL algorithm that does not do learning of any kind. All it does is it samples environments as quickly as possible using all CPU cores and random actions. Designed to establish the upper bound on the RL algorithm throughput. """ import ctypes import multiprocessing import os import signal import t...
pancreas.py
# -*- coding: utf-8 -*- import sys import os import time import torch if hasattr(sys, 'frozen'): os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH'] from PyQt5 import QtWidgets from PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGui, uic from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5...
worker.py
#!/usr/bin/env python # # Copyright 2012 Dominic May # # 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 applic...
evaluate_dist.py
import sys sys.path.append('.') import os import tqdm import torch import random import shutil import argparse import numpy as np import multiprocessing from collections import defaultdict from torch.utils.data import DataLoader from data.aug import ops from data.dataset import DOTA from data.aug.compose import C...
support_RegExp_test.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
__init__.py
# -*- coding: utf-8 -*- """ This file is covered by the LICENSING file in the root of this project. """ from werkzeug.exceptions import HTTPException __author__ = 'Junbo Wang' __version__ = '2.0' from flask import Flask from flask_restful import Api from flask_cors import CORS from datetime import timedelta from ut...
serve.py
from __future__ import print_function # Most of this code is: # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # The server command includes the additional header: # For discussion of daemonizing: ...
ex3_redis.py
import multiprocessing import redis # python -m timeit -s "import ex3_redis" "ex3_redis.run_workers()" # 81 ms rds = redis.StrictRedis() REDIS_KEY = "ex3_redis_key" def work(max_count): for n in range(max_count): rds.incr(REDIS_KEY) def run_workers(): NBR_PROCESSES = 4 MAX_COUNT_PER_PROCESS = ...
test__ffi.py
import py import sys from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC class Test__ffi(BaseTestPyPyC): def test__ffi_call(self): from pypy.rlib.test.test_libffi import get_libm_name def main(libm_name): try: from _ffi import CDLL, types ...
network.py
#!/usr/bin/env python3 import os import sys # Necessary on macOS if the folder of libdnet is not in # ctypes.macholib.dyld.DEFAULT_LIBRARY_FALLBACK # because the newer macOS do not allow to export # $DYLD_FALLBACK_LIBRARY_PATH with sudo if os.name == "posix" and sys.platform == "darwin": import ctypes.macholib.dy...
monasca.py
# # Copyright 2015 Hewlett Packard # (c) Copyright 2018 SUSE 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 app...
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): if 0: app = current_app._get_current_object() ...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet import Wallet, InternalAddressCorrup...
test_auth.py
############################################################################## # Copyright 2018 Rigetti Computing # # 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://ww...
wsgi.py
""" WSGI config for logue project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ """ import os import threading import time import requests from django.core.wsgi import get_wsgi_appli...
ipc-server.py
#!/usr/bin/env python import sys import os import time import threading import zmq # Machinekit specific, can only use on local machine from machinekit import config # Machinetalk bindings from pymachinetalk.dns_sd import ServiceDiscovery, ServiceDiscoveryFilter from pymachinetalk.application import ApplicationStatus ...
robolink.py
# Copyright 2015-2020 - 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...
main.py
from exceptions import SetupNotComplete import threading from config import config from config_vars import watch_dir, compressed_files_dir, \ text_file_extension, zip_file_extension from config_vars import response_actions as ra from watcher import watchman from setup_actions import setup_dir from config_vars import ...
work_queue_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
bridge.py
#!/usr/bin/env python3 import argparse import carla # pylint: disable=import-error import math import numpy as np import time import threading from cereal import log from multiprocessing import Process, Queue from typing import Any import cereal.messaging as messaging from common.params import Params from common.numpy...
host.py
from typing import * import types import py_env import importlib import importlib.util import socket import queue import threading import sys import os import traceback import argparse import copy from py_env.protocol import TaskDone, Message from py_env.utils import log, old_stderr, old_stdout import traceback class ...
cli.py
# encoding: utf-8 from __future__ import print_function import collections import csv import multiprocessing as mp import os import datetime import sys from pprint import pprint import re import itertools import json import logging from optparse import OptionConflictError import traceback from six import text_type f...
__init__.py
import multiprocessing as mp import inspect import os import signal import sys from functools import wraps import erdos.internal as _internal from erdos.streams import (ReadStream, WriteStream, LoopStream, IngestStream, ExtractStream) from erdos.operator import Operator, OperatorConfig from...
EventLoop.py
########################################################################## # # Copyright (c) 2011-2012, John Haddon. All rights reserved. # Copyright (c) 2011-2015, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted prov...
GUI.py
# Imports import tkinter as tk from tkinter import * import cv2 from PIL import Image, ImageTk import os import numpy as np import cv2 from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten from keras.layers import Conv2D from keras.optimizers import Adam from keras.layers import MaxPoo...
threading_mixin_socket_server.py
# -*- coding: utf-8 -*- #!/usr/bin/env python # This program is optimized for Python 2.7 import os import socket import threading import SocketServer SERVER_HOST = 'localhost' SERVER_PORT = 0 BUF_SIZE = 1024 def client(ip, port, message): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect...
pre_commit_linter.py
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
app.py
from flask import Flask, request, abort, send_from_directory from flask_cors import CORS import time import json import random import threading import http.client from collections import defaultdict app = Flask(__name__) CORS(app) # Storage # Log contains tuples of (simulated event time, name, success) log = [] #...
things_board_bridge.py
#!/usr/bin/python3 import paho.mqtt.client as mqtt import json from queue import Queue from threading import Thread from time import sleep class LocalMQTT: def __init__(self, config, callback, debug=False): self.callback = callback self.debug = debug client = mqtt.Client() client...
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' 项目入口文件 ''' __author__ = 'alex' __version__ = '0.0.1' import logging import os import datetime import sys from multiprocessing import Process from app.config.app import AppConfig from app.converter.converter_pdf import ConverterPdf from app.converter.converter_docx ...
test_launcher.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the ...
stockrow_rtd.py
"""Excel RTD (RealTimeData) Server sample for real-time stock quote. Periodically polling stock quote from the stockrow.com. """ import excel_rtd as rtd from datetime import datetime import threading import pythoncom import win32api import win32com.client from win32com.server.exception import COMException import logg...
ela.py
#!/usr/bin/python from __future__ import print_function from PIL import Image, ImageChops, ImageEnhance import sys import os import threading import argparse parser = argparse.ArgumentParser(description=""" Performs Error Level Analysis over a directory of images """) parser.add_argument('--dir', dest='directory', re...
execution.py
import datetime import os import uuid import copy import json import shutil import threading import time from abc import ABC, abstractmethod from pathlib import Path from typing import Union, Optional, Tuple from ludwig.api import LudwigModel from ludwig.backend import RAY, initialize_backend from ludwig.callbacks imp...
test_LightSwitch.py
from threading import Lock, Thread from lox import LightSwitch from copy import copy from time import sleep, time SLEEP_TIME = 0.01 N_WORKERS = 5 common_lock = None counting_lock = None resp_lock = None resource = None def common_setup(): global common_lock, counting_lock, resp_lock common_lock = Lock() ...
helper.py
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
manager.py
#!/usr/bin/env python3 import datetime import os import signal import subprocess import sys import traceback from multiprocessing import Process from typing import List, Tuple, Union import cereal.messaging as messaging import selfdrive.sentry as sentry from common.basedir import BASEDIR from common.params import Para...
sbp_arbitrator_no_latency.py
#!/usr/bin/env python #https://stackoverflow.com/questions/34337514/updated-variable-into-multiprocessing-python #https://stackoverflow.com/questions/44219288/should-i-bother-locking-the-queue-when-i-put-to-or-get-from-it/44219646 import rospy import os import datetime import subprocess import json import sbp.msg impo...
vc.py
# -*- coding: utf-8 -*- """Prompt formatter for simple version control branches""" # pylint:disable=no-member, invalid-name import os import sys import queue import builtins import threading import subprocess import xonsh.tools as xt def _get_git_branch(q): denv = builtins.__xonsh__.env.detype() try: ...
_a4c_create.py
from cloudify import ctx from cloudify.exceptions import NonRecoverableError from cloudify.state import ctx_parameters as inputs import subprocess import os import re import sys import time import threading import platform from StringIO import StringIO from cloudify_rest_client import CloudifyClient from cloudify im...
webcamcv2.py
# Import packages import os import cv2 import numpy as np import tensorflow as tf import sys import time from datetime import datetime import requests from werkzeug.utils import secure_filename import threading import json sys.path.append("..") Threshold = 0.9 MODEL_NAME = 'inference_graph' CWD_PATH = os.getcwd() PAT...
Queues.py
""" Mostly implemented to Producer Consumer problems FIFO: First In First Out Like when you are on a line waiting to catch a bus you will get your ticket based on when you alived and first to come will be first to be served Queues class in Python can be -List -collections.deque queue.LifoQueue """ #Implementing a Queue...
utility.py
import os import math import time import datetime from multiprocessing import Process from multiprocessing import Queue import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import imageio from torchvision.transforms import ToPILImage import torch import torch.optim as optim impor...
main.py
from fastapi import FastAPI, Response from starlette.status import HTTP_204_NO_CONTENT import uuid, random, requests, json, hashlib, os, rsa, sys, datetime, trace, time, logging from threading import Thread from queue import PriorityQueue from Crypto.PublicKey import RSA from pydantic import BaseModel from typing impor...
utils.py
# # Copyright (c) 2017 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 by applicable law or agreed to...
secs1ontcpipcommunicator.py
import threading import socket import secs class AbstractSecs1OnTcpIpCommunicator(secs.AbstractSecs1Communicator): def __init__(self, device_id, is_equip, is_master, **kwargs): super(AbstractSecs1OnTcpIpCommunicator, self).__init__(device_id, is_equip, is_master, **kwargs) self.__sockets = list(...
mpqueue.py
from multiprocessing import Process from multiprocessing import Queue from random import random from time import sleep def hej(q): print("sdfsdf") for i in range(3): sleep(1) print(f"{i}") d = [i for i in range(5000)] return q.put(["wut",d]) if __name__ == '__main__': q = Queue() jobs = lis...
utility.py
################################### # Script: # 1) Contains trivial and useful # functions # # ganesans - Salilab - UCSF # ganesans@salilab.org ################################### import os import glob from collections import Counter from multiprocessing import Process import numpy as np import logging def dict_to_J...
http_fetch_test.py
import logging import os import sys # Add parent path to use local src as package for tests root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir, os.path.pardir )) sys.path.append(root_dir) import asyncio from multiprocessing import Process import pytest import uvicorn fr...
swir-python-sink.py
# Copyright 2020 SWIR 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...
BluetoothConnection.py
import logging from comm.Connection import Connection import threading import select import socket logger = logging.getLogger(__name__) LINE_ENCODING = 'utf-8' CR = 13 # Carriage Return class BluetoothConnection(Connection): """Bluetooth RFCOMM-based communication with lego hub. """ def __init__(self, ...
rs485.py
# -*- coding: utf-8 -*- ''' python -m pip install pyserial python -m pip install paho-mqtt ''' import os import os.path import serial import socket import time import platform import threading import json import logging import logging.config import logging.handlers import configparser import paho.mqtt.client as mqtt fr...
experiment_Setup.py
import os import mspbe import torch import shutil import datetime import numpy as np import pandas as pd import torch.multiprocessing as mp class Experiment_Setup: def __init__(self, num_epoch, exp_settings, saving_dir_path=None, multi_process_exps=False, use_gpu=False, num_processes=2, batch_size=1, num_workers=0...
avistorageserver.py
############################################################################### # AVI storage array data streamer # Urs Utzinger # 2021 Initial release ############################################################################### ############################################################################### # Impo...
test_pool.py
import threading import pytest from milvus import Milvus, NotConnectError, VersionError from milvus.client.pool import ConnectionPool class TestPool: def test_pool_max_conn(self): pool = ConnectionPool(uri="tcp://127.0.0.1:19530", pool_size=10) def run(_pool): conn = _pool.fetch() ...
getquotes.py
import requests from bs4 import BeautifulSoup import threading from collections import Counter def textGetter(link): ''' Returns all the text from a wepage of a given link. ''' r = requests.get(link) # grabs web content as BeautifulSoup object soup = BeautifulSoup(r.content, 'html.parser') ...
start.py
# -*- coding: utf-8 -*- import multiprocessing import urllib2 import time from selenium import webdriver import controller def start_web(): print 'start web server...' controller.app.run(host='0.0.0.0', port=5000, threaded=True) # controller.app.run(host='127.0.0.1', port=5000, threaded=True) if __nam...
main.py
from gui import make_gui from multiprocessing import Process if __name__ == "__main__": gui_process = Process(target=make_gui()) gui_process.start()
conftest.py
# -*- coding: utf-8 -*- """Testing conf module.""" # standard library import os import threading # third-party import pytest from falcon import testing from .Custom.app import app_db_1, app_dual_1, app_dual_2 from .Syslog.syslog_server import TestSyslogServers # the log directory for all test cases _LOG_DIRECTORY = ...
tf_data_feeder.py
import tensorflow as tf import tensorflow.contrib.staging as tf_staging import threading from dataset import BaseDataset class DataFeederTF(object): """ Creates a tensorflow feeder in computational graph. The output variables are defined by the input dataset object. Uses threads to enqueue data asynchron...
dag_processing.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...
2_rms_bankers_gui.py
import matplotlib matplotlib.use('TkAgg') from functools import reduce from sys import * import numpy as np import random as r import ping_code as pc import socket import struct import subprocess as sp import threading from threading import Thread import ast import time import datetime as dt import os import getpass as...
Punch.py
import requests import time import json import sys import threading LogIn_URL = "http://seat1.lib.hlju.edu.cn/libseat-ibeacon/wechatIndex?type=index&" Guard_URL = "http://seat1.lib.hlju.edu.cn/libseat-ibeacon/getUserBookHistory" Check_URL = "http://seat1.lib.hlju.edu.cn/libseat-ibeacon/checkIn?bookId=" def guard(stu): ...
app.py
import json import logging import multiprocessing as mp import os import signal import sys import threading from logging.handlers import QueueHandler from typing import Dict, List import yaml from peewee_migrate import Router from playhouse.sqlite_ext import SqliteExtDatabase from playhouse.sqliteq import SqliteQueueD...