source
stringlengths
3
86
python
stringlengths
75
1.04M
listener.py
"""Implement Listener class.""" import json import time from threading import Thread from google.api_core.exceptions import GoogleAPICallError, NotFound from factiva import helper from factiva.core import const def default_callback(message, subscription_id): """Call to default callback function.""" print('...
conftest.py
# Copyright BigchainDB GmbH and BigchainDB 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 database after running the tests """ import json i...
dltop.py
#!/usr/bin/python3 """ This is a more efficient version, since it does not read the entire file """ import sys import os import time import datetime import threading import datalogger4 class LiveReaderData(object): def __init__(self, ts, initial, mode="last"): self.previous = (ts-0.1, dict(initial)) # to ...
tests.py
# -*- coding: utf-8 -*- # Unit and doctests for specific database backends. from __future__ import absolute_import, unicode_literals import datetime from decimal import Decimal import threading from django.conf import settings from django.core.management.color import no_style from django.db import (connection, connec...
accounts_multiprocessing.py
import sys import random from multiprocessing import Process, Manager, Lock class Account(): def __init__(this, id, starting_value): this.id = id this.balance = starting_value def worker(accounts, locks, worker_count): local_locks = dict(locks) for i in range(100*1000 // worker_count): ...
ESPNAPIScheduleAdapter.py
import json import re import threading import Queue from Constants import * from Hashes import * from StringUtils import * from TimeZoneUtils import * from Vectors import * from ..Data.ESPNAPIDownloader import * from ScheduleEvent import * espnapi_abbreviation_corrections = { LEAGUE_NBA: { "GS": "G...
main.py
""" GitHub Ulauncher Extension """ import json import logging import os import re from threading import Thread, Timer from github import Github, GithubException from ulauncher.api.client.EventListener import EventListener from ulauncher.api.client.Extension import Extension from ulauncher.api.shared.action.ExtensionCu...
master.py
# -*- coding: utf-8 -*- ''' This module contains all of the routines needed to set up a master server, this involves preparing the three listeners and the workers needed by the master. ''' # Import python libs from __future__ import absolute_import, with_statement, print_function, unicode_literals import copy import c...
abs_task.py
# Adopted from ESPNet: https://github.com/espnet/espnet from abc import ABC from abc import abstractmethod import argparse from dataclasses import dataclass from distutils.version import LooseVersion import functools import logging import os from pathlib import Path import sys from typing import Any from typing import...
test_grpc_gateway_runtime.py
import asyncio import copy import json import multiprocessing import time from multiprocessing import Process import pytest from jina import Document, DocumentArray from jina.clients.request import request_generator from jina.helper import random_port from jina.parsers import set_gateway_parser from jina.serve import...
Pista01.py
import time import threading from robworld.RobotThymio2 import RobotThymio2 # Requiere simulador corriendo el "Pista01.world" class Pista01(): def __init__( self ): pass def run( self ): # los datos de conexion al simulador host = "127.0.0.1" port = 44444 # creamos lo...
miniterm.py
#!/home/pi/cansat-gs/.venv/bin/python3 # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause import codecs import os import sys import threading import serial from serial.tool...
example_name.py
""" Demonstrate the changing of the display name. Run a simple animation in the Cairo surface, on a thread. Then run a server on localhost:5902 / localhost:2 which should display the animation. The display name is updated with the number of seconds that the animation has been running for. """ import math import thre...
test_local.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 use ...
brain.py
import gpiozero import time import threading import multiprocessing import iglass_vision from bot import DialogflowBot from speak_out import SpeakOut from speech_to_text import SpeechRecognizer button = gpiozero.Button(17) # respeaker 2-mics button iglass_project_id = "musty-1563232769915" iglass_bot = DialogflowBo...
controller.py
import re import time from datetime import datetime from threading import Thread from typing import List, Set, Type from bauh.api.abstract.controller import SoftwareManager, SearchResult, ApplicationContext from bauh.api.abstract.disk import DiskCacheLoader from bauh.api.abstract.handler import ProcessWatcher from bau...
14_mmw.py
# # Copyright (c) 2018, Manfred Constapel # This file is licensed under the terms of the MIT license. # # # TI IWR1443 ES2.0 EVM @ mmWave SDK demo of SDK 1.2.0.5 # TI IWR1443 ES3.0 EVM @ mmWave SDK demo of SDK 2.1.0.4 # import sys, json, serial, threading from lib.shell import * from lib.helper import * from lib.uti...
__init__.py
""" m2wsgi: a mongrel2 => wsgi gateway and helper tools ==================================================== This module provides a WSGI gateway handler for the Mongrel2 webserver, allowing easy deployment of python apps on Mongrel2. It provides full support for chunked response encoding, streaming reads of large ...
panel.py
#!/usr/bin/env python # coding=utf-8 """Module Description Copyright (c) 2018 Jianfeng Li <lee_jianfeng@sjtu.edu.cn> This code is free software; you can redistribute it and/or modify it under the terms of the MIT License. @Gene-panel sequencing analysis pipeline in nocontrol mode @status: experimental @version: 1.0 @...
test.py
#!/usr/bin/python3 """A script to start `Server && Client` throught launch file and responsible for killing the Server""" from threading import Thread import time import os import sys import signal import shutil import psutil signal.signal(signal.SIGINT, signal.SIG_DFL) sleep_time = 3 launchCmd = 'ros2 launch ros2...
threadpool.py
# xpyBuild - eXtensible Python-based Build System # # This class is responsible for working out what tasks need to run, and for # scheduling them # # Copyright (c) 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use ...
CmdQueue.py
import logging from multiprocessing import Queue from threading import Thread from time import sleep from elMsg import elMsg from MsgServo import * from Drivers.ServoEnums import * from Factory.ServoFactory import * from Factory.CameraFactory import * from MsgPic import * class CmdQueue: log = logging.getLogger('...
tests.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import errno import os import shutil import sys import tempfile import time import unittest try: from urllib.request import urlopen except ImportError: # Python 2 from urllib2 import urlopen import zlib from datetime import da...
network_manager.py
import errno import datetime import threading from time import sleep from futuquant.common.utils import * from futuquant.quote.quote_query import parse_head from .err import Err from .sys_config import SysConfig from .ft_logger import make_log_msg if IS_PY2: import selectors2 as selectors import Queue as queue...
ReD_ppo_discrete.py
""" Dependencies: tensorflow 1.8.0 gym 0.9.2 ReD-PPO for discrete action. and there are bad actors. """ import tensorflow.compat.v1 as tf tf.disable_eager_execution() import numpy as np import matplotlib.pyplot as plt import gym, threading, queue EP_MAX = 2000 EP_LEN = 500 GAMMA = 0.9 # reward discount factor A_LR ...
trezor.py
import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum_blk.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum_blk.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path from electrum_blk impo...
PlexAPI.py
#!/usr/bin/env python """ Collection of "connector functions" to Plex Media Server/MyPlex PlexGDM: loosely based on hippojay's plexGDM: https://github.com/hippojay/plugin.video.plexbmc Plex Media Server communication: source (somewhat): https://github.com/hippojay/plugin.video.plexbmc later converted from httplib ...
demo_loader.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import atexit import copy import queue import threading import time import cv2 import slowfast.utils.loggings as logging from slowfast.visualization.utils import TaskInfo logger = logging.get_logger(__name__) class Video...
sampler.py
#! /usr/bin/python #The MIT License (MIT) # A script to manage Dylos air quality monitor and Aerocet 531S, colocated sampling for calibration of dylos to get reading in ug/m3 # (C)2014 Nishadh K A <nishadhka@gmail.com> # Requiers miniterm.py from http://cs.earlham.edu/~charliep/ecoi/serial/pyserial-2.2/examples/minite...
thread_test.py
#!/usr/bin/env pytest # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test Python threading # Author: Even Rouault <even dot rouault at spatialys.com> # ########################################################...
maximum_throughput.py
#!/usr/bin/env python from elasticsearch import Elasticsearch import threading from threading import Thread import subprocess, Queue, os, sys, time import math if len(sys.argv) == 2: debug = (1 if sys.argv[1] == "d" else 0) else: debug = 0 def max_throughput(time_a, time_b, mean_packet_loss): # Expected TCP ...
tcp_toggle_v2.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: Tcp Toggle # Generated: Fri Jul 31 19:18:30 2020 ################################################## from gnuradio import eng_notation from gnuradio import gr from gnuradio import uhd...
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 applica...
syn_extraction.py
# =============================================================================== # Copyright 2014 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...
midicontroller.py
import threading import logging import sys from mido import Message, open_input, open_output, get_input_names, get_output_names from .atem import clean_shutdown logging = logging.getLogger(__name__) class MidiController: """ Handles communication with the MIDI surface. X-Touch Mini must be in MC mode! ...
threadtest1.py
# encoding: UTF-8 import threading import time data = 0 lock = threading.Lock() def func(): global data print('%s acquire lock...' % threading.currentThread().getName()) # 调用acquire([timeout])时,线程将一直阻塞, # 直到获得锁定或者直到timeout秒后(timeout参数可选)。 # 返回是否获得锁。 if lock.acquire(): print('%s get t...
ws.py
import threading import logging import atexit import json import ssl from queue import Queue, Empty from urllib.parse import urlparse from awxkit.config import config log = logging.getLogger(__name__) class WSClientException(Exception): pass changed = 'changed' limit_reached = 'limit_reached' status_change...
test_server.py
#!/usr/bin/python """Script to create the protofile It compiles the proto definition and then creates the proto file from the text specified in query1.txt or query2.txt """ import logging import os import requests from flask import Flask, request import test_initialisation from proto import request_pb2 A...
test_debug.py
import importlib import inspect import os import re import sys import tempfile import threading from io import StringIO from pathlib import Path from unittest import mock from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection from djan...
common.py
############################################################### # ███████╗ █████╗ ████████╗██╗ ██╗██████╗ ███╗ ██╗███████╗ # ██╔════╝██╔══██╗╚══██╔══╝██║ ██║██╔══██╗████╗ ██║██╔════╝ # ███████╗███████║ ██║ ██║ ██║██████╔╝██╔██╗ ██║█████╗ # ╚════██║██╔══██║ ██║ ██║ ██║██╔══██╗██║╚██╗██║██╔══╝ # ██...
build_dataset_mask_labeler.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_threading_local.py
import unittest from doctest import DocTestSuite from test import support import weakref import gc # Modules under test _thread = support.import_module('_thread') threading = support.import_module('threading') import _threading_local class Weak(object): pass def target(local, weaklist): weak = Weak() lo...
heartbeat_control_API.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: i2cy(i2cy@outlook.com) # Filename: heartbeat_control_API # Created on: 2020/9/17 import socket import time import threading KILL_COMMAND = "taskkill /IM 小栗子框架-快载.exe" START_COMMADN = ".\\小栗子框架-快载.exe" class timeKey: # 64-Bits Live key generator/ma...
main.py
# Copyright 2018 Jiří Janoušek <janousek.jiri@gmail.com> # Licensed under BSD-2-Clause license - see file LICENSE for details. import os import sys from argparse import ArgumentParser from multiprocessing import Process from typing import List from fxwebgen.utils import SmartFormatter from fxwebgen.postprocessor impo...
test_auto_scheduler_search_policy.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
__init__.py
import sys import io import time import json import threading import traceback import collections import bisect try: import Queue as queue except ImportError: import queue # Patch urllib3 for sending unicode filename from . import hack from . import exception __version_info__ = (12, 7) __version__ = '.'.jo...
zuul_swift_upload.py
#!/usr/bin/env python3 # # Copyright 2014 Rackspace Australia # Copyright 2018 Red Hat, 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 # # ...
recipe-65202.py
def _get_method_names (obj): from types import * if type(obj) == InstanceType: return _get_method_names(obj.__class__) elif type(obj) == ClassType: result = [] for name, func in obj.__dict__.items(): if type(func) == FunctionType: result.append((name,...
test_progress.py
import datetime import threading import unittest import mock from sia_load_tester import progress # Arbitrarily-chosen timeout to make sure we don't get stuck in a deadlock # waiting for a test to complete. WAIT_SECONDS = 0.5 class MonitorTest(unittest.TestCase): def setUp(self): self.mock_tracker = m...
mul_thread.py
from multiprocessing import Process, Queue import os import time import random class ProcessWrapper(object): def __init__(self, func, tasks: list, num_workers: int): self.func = func self.tasks = tasks self.num_workers = num_workers self.queue = Queue() self.processes = [...
cloud_fraction.py
import numpy as np import os, glob from matplotlib import pyplot as plt import camera as cam import time, sys import stat_tools as st from scipy.ndimage import morphology,filters, measurements ####more efficient than skimage from scipy import signal from skimage.morphology import remove_small_objects from collections ...
main.py
import fnmatch import os import numpy as np import argparse import cv2.cv2 as cv2 import datetime import glob import threading, queue from sklearn.cluster import KMeans from skimage import exposure from skimage import io from glob import glob from kivy.config import Config from time import time from...
dataset_sampler.py
from __future__ import annotations import argparse import multiprocessing import os from tempfile import NamedTemporaryFile import numpy as np from . import iproc from .pairwise_transform import pairwise_transform class DatasetSampler: def __init__(self, filelist, config): self.filelist = filelist self.config...
parallel.py
import os import sys from collections import OrderedDict, deque from threading import Event, Semaphore, Thread from tox import reporter from tox.config.parallel import ENV_VAR_KEY as PARALLEL_ENV_VAR_KEY from tox.exception import InvocationError from tox.util.main import MAIN_FILE from tox.util.spinner import Spinner ...
httpserver.py
import threading import logging from http.server import HTTPServer, BaseHTTPRequestHandler from urllib import parse _LOGGER = logging.getLogger(__name__) class LinakHTTPServer: def __init__(self, connector): self.connector = connector self.http_server = None def attachConnector(self, conne...
server.py
# --- SERVER CONFIGURATION --- INTERFACE = "0.0.0.0" # 0.0.0.0 to serve on all available interfaces PORT = 31415 USERPASS = None # "username:password" or None, overridden by sys args # --- END SERVER CONFIGURATION -- VERSION = "0.1.1" import base64 import http.server import json import logging import signal import s...
test_deployment.py
# Copyright 2019 Regents of the University of Minnesota. # # 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...
utils.py
import jwtoken as jwt import threading m3ustr = '#EXTM3U x-tvg-url="https://github.com/Shra1V32/epg/raw/master/epg.xml.gz" \n\n' kodiPropLicenseType = "#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha" def processTokenChunks(channelList): global m3ustr kodiPropLicenseUrl = "" if not chann...
MultithreadOutput.py
import queue, threading import time, sys import random q = queue.Queue() keepRunning = True def loop_output(): thread_outputs = dict() while keepRunning: try: thread_id, data = q.get_nowait() thread_outputs[thread_id] = data except queue.Empty: ...
countmerge.py
import sys import argparse from Queue import Empty from multiprocessing import Process, Queue from googlengram import indexing from representations import sparse_io import ioutils YEARS = range(1900, 2001) def main(proc_num, queue, out_dir, in_dir): merged_index = ioutils.load_pickle(out_dir + "merged_index.pkl...
dataset-maker.py
import audioplayer import os import tkinter import threading import pyaudio import wave import sentences SOUNDS_PATH = "sounds/" WAV_PREFIX = "speaker_" METADATA_PATH = "metadata.csv" SENTENCE_ID = 0 IS_RECORDING = False IS_PLAYING_BACK = True IS_WRITING_SOUND_FILE = False DONE_SENTENCES = [] SOUND_ID = -1 METADATA_...
server.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Author: robertking # @Date: 2017-09-23 01:24:29 # @Last Modified by: robertking # @Last Modified time: 2017-10-05 00:16:04 import socketserver import subprocess import threading import time # Emmm... A little bit nasty here. tasks = [ type('task', (object,),...
PyShell.py
#! /usr/bin/env python3 import getopt import os import os.path import re import socket import subprocess import sys import threading import time import tokenize import io import linecache from code import InteractiveInterpreter from platform import python_version, system try: from tkinter import * except ImportE...
dmx.py
import logging import os import threading import time import requests logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) logger.addHandler(logging.StreamHandler()) class DmxClient(object): def __init__(self, base_url): self.base_url = base_url self._dmx = bytearray(''.join(['00']...
master.py
import re import time import json import itchat import argparse from threading import Thread, Lock from http.server import HTTPServer from http.server import BaseHTTPRequestHandler class CustomHandler(BaseHTTPRequestHandler): alert_record = { } def do_GET(self): length = int(self.headers['content-leng...
test_general.py
""" Collection of tests for unified general functions """ # global import os import math import time import einops import pytest import threading import numpy as np from numbers import Number from collections.abc import Sequence import torch.multiprocessing as multiprocessing # local import ivy import ivy.functional....
Core.py
#-*- coding:utf-8 -*- import threading as td import socket as line import time __verson__ = '0.3.1' def HostIP(): try: s = line.socket(line.AF_INET, line.SOCK_DGRAM) s.connect(('8.8.8.8', 80)) ip = s.getsockname()[0] finally: s.close() return ip class Execute(td.Thread...
__init__.py
#-----------------------------------------------------------------------------# # # This file is part of Pbrt4Blender, the Pbrt-v4 integration for Blender # # Copyright 2020, Pedro A. "povmaniac" # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compli...
ferramentas.py
from psutil import virtual_memory from time import sleep import gi from threading import Thread from datetime import datetime, timedelta, date, time # noqa from json import load gi.require_version('Notify', '0.7') from gi.repository import Notify # noqa class Notificacao: def __init__(self, urgencia, *args, **k...
serialmidi.py
from PyInquirer import style_from_dict, Token, prompt from rtmidi.midiutil import open_midiinput from serial.tools import list_ports import queue import rtmidi import serial import threading import logging import sys import time import argparse # Serial MIDI Bridge # Ryan Kojima and Skyler Lewis style = style_from_di...
SSLReplay.py
#!/bin/env python3 ''' ''' # 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 ...
chromedebugger.py
# Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. from threading import Thread from ws4py.server.wsgirefserver import WSGIServer, WebSocketWSGIRequestHandler from ws4py.server.wsg...
test_py_reader_using_executor.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 appli...
utils_test.py
from __future__ import annotations import asyncio import copy import functools import gc import inspect import io import logging import logging.config import os import queue import re import shutil import signal import socket import subprocess import sys import tempfile import threading import uuid import warnings imp...
EzLibrarianApplication.py
import sys import cv2 import Adapter.TableAdapter as TableAdapter import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec from SmartLib_LibrarianUI import Ui_MainWindow from Scanner.CameraScanner import CameraScanner from CameraViewerWidget import CameraViewerWidget from DAO import BookDAO, UserDAO, Bo...
main.py
# Original code by Prieyudha Akadita S. # Source: https://https://github.com/ydhnwb/autodm_base # Re-code by Fakhri Catur Rofi under MIT License # Source: https://github.com/fakhrirofi/twitter_autobase from .clean_dm_autobase import delete_trigger_word from .process_dm import ProcessDM from .twitter import Tw...
websocket.py
from __future__ import absolute_import import logging log = logging.getLogger(__name__) import threading import uuid from tornado import websocket, ioloop from tornado.web import Application from tornado.httpserver import HTTPServer from bokeh import protocol from .wsmanager import WebSocketManager from .zmqsub im...
test_2.py
import os import threading import xml.etree.ElementTree as ET from PyQt5 import QtCore, QtGui, QtWidgets import acquisition_and_plot import time root = os.getcwd() root = root.replace('\\', '/') os.chdir(root) freq = '/114MHZ' folders = ['/car', '/bicycle', '/human', '/wall', '/pillar'] tree = ET.parse('va...
tools.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __version__ = '1.7.18' import sqlite3 import sys from subprocess import Popen, PIPE, STDOUT import threading import multiprocessing from multiprocessing import shared_memory import time import datetime import collections import socket import json from hashlib import b...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import absolute_import, print_function, with_statement, unicode_literals import os import re import sys import copy import time import types import signal import random import fnmatch import logging import threading import ...
tuner.py
# # Copyright (c) 2022 TUM Department of Electrical and Computer Engineering. # # This file is part of MLonMCU. # See https://github.com/tum-ei-eda/mlonmcu.git for further info. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You m...
blockchain_processor.py
#!/usr/bin/env python # Copyright(C) 2011-2016 Thomas Voegtlin # # 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, m...
threads.py
import logging import multiprocessing import queue import sys import threading from . core import WorkManager, WMFuture import westpa.work_managers as work_managers log = logging.getLogger(__name__) class Task: def __init__(self, fn, args, kwargs, future): self.fn = fn self.args = args s...
sample_vertices_data.graph.gt.gz.py
import argparse import logging as log import numpy as np from graph_tool import * import os import threading def sample_vertices_job( dataset, k, sem ): """creates a sampled sub graph from dataset with k vertices and corresponding edges""" with sem: if log: log.info( 'Reconstructing graph ...
moto_server.py
import asyncio import functools import logging import os import threading import socket import http.server from typing import Dict, Any # Third Party import moto.server import wrapt import aiohttp import werkzeug.serving def get_free_tcp_port(release_socket=False): sckt = socket.socket(socket.AF_INET, socket.SOC...
hrclib_server_v6.py
# Python3 Interfaces for ARC actions libraries - Intelligent Human-Robot Collaboration System # It connects to py2 servers, with py3 clients # Email: yiwen.chen@u.nus.edu # import rospy import rospy import actionlib import moveit_commander import time import threading # msgs from actionlib_msgs.msg import GoalStatus ...
translate.py
from pathlib import Path import queue import staticanalyser.shared.config as config import staticanalyser.translator.descriptor as descriptor from staticanalyser.shared.platform_constants import MODEL_DIR from os import path, getcwd, name import multiprocessing as mp import re import logging def lookup_parser(extensi...
run_ai.py
# coding: utf-8 # センサー値を取得し、予測を実行する import time import logging import threading import numpy as np #from fabolib.kerberos import Kerberos from fabolib.kerberos_vl53l0x import KerberosVL53L0X as Kerberos from lib.ai import AI import sys # ログ設定 logging.basicConfig(level=logging.DEBUG, format='[%(lev...
log_printer.py
import _thread as thread import sys from collections import namedtuple from itertools import cycle from queue import Empty from queue import Queue from threading import Thread from docker.errors import APIError from . import colors from compose.cli.signals import ShutdownException from compose.utils import split_buff...
locators.py
# -*- coding: utf-8 -*- # # Copyright (C) 2012-2015 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import gzip from io import BytesIO import json import logging import os import posixpath import re try: import threading except Impo...
scheduler.py
""" Scheduler for running and managing everything around the SFT tests. """ import logging import time from Queue import Queue, Empty from threading import Thread from sft.housekeeper import Housekeeper from sft.publisher import Publisher import sft.sft_globals as g class Scheduler(object): """ Scheduler, takes ...
messenger.py
from __future__ import absolute_import # # 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, Ver...
display.py
import pygame from pygame.locals import DOUBLEBUF from frame import Frame import numpy as np import cv2 from helpers import myjet def annotate(frame: Frame, img : np.ndarray) -> np.ndarray: # paint annotations on the image for i1 in range(len(frame.key_points)): u1, v1 = int(round(frame.key...
fish_tank_server.py
import os import socket import threading import pickle import atexit import json from flask import Flask, jsonify, request, render_template, flash, request, redirect, url_for, send_from_directory from flask_cors import CORS from werkzeug.utils import secure_filename app = Flask(__name__) CORS(app) fish_data = {} de...
shell.py
import os import signal import sys import subprocess from StringIO import StringIO from threading import Thread from core import cmd class Shell(cmd.Cmd): intro = 'Welcome to shell\n' def __init__(self): cmd.Cmd.__init__(self) self.prompt = os.path.abspath(os.path.curdir) + ">" self.history = [] def def...
__init__.py
# -*- coding: utf-8 -*- """Miscellaneous helper functions (not wiki-dependent).""" # # (C) Pywikibot team, 2008-2019 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, division, unicode_literals import collections import gzip import hashlib from importlib import import_module...
ExecuteCmd.py
#!/usr/bin/env python3 # # Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow # # $HEADER$ # from builtins import str import sys import select import subprocess import time import datetime import signal import os, threading, errno from contextlib import contex...
winRegWzk.py
""" Some functions need admin level permission value of .docx was xxx.xxx.12 """ import winreg import tkinter as tk import threading class WinReg(object): def __init__(self, mytop): self.top = mytop self.key_entry = tk.Entry(self.top, width=100) self.valueName_entry = tk.Entry(self.top, wi...
test_xmlrpc.py
import base64 import datetime import decimal import sys import time import unittest from unittest import mock import xmlrpc.client as xmlrpclib import xmlrpc.server import http.client import http, http.server import socket import threading import re import io import contextlib from test import support ...
common.py
import time, threading import random import logging import os, sys import signal import pkg.types.types as types import pkg.events.events as events import string import pkg.result.chaosresult as chaosresult import pkg.maths.maths as maths #WaitForDuration waits for the given time duration (in seconds) def WaitForDu...