source
stringlengths
3
86
python
stringlengths
75
1.04M
runner.py
import threading, time, multiprocessing def MainRunner(): import main.main def WebServer(): import main.website.app def SetServer(): import main.definitions as holder import main.website.ApiShare as server server.SetApi(holder.Server) if __name__ == "__main__": threading.Thread(target=SetSer...
profinet_set_ip.py
from icssploit import ( exploits, print_success, print_status, print_table, print_error, validators, ) import threading from icssploit.protocols.pn_dcp import * from scapy.arch import get_if_hwaddr from scapy.sendrecv import sendp, sniff TABLE_HEADER = ['Device Name', 'Device Type', "MAC Addre...
qt.py
#!/usr/bin/env python # # Electrum - Lightweight Bitcoin Client # Copyright (C) 2015 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...
Thread.py
# Thread from threading import Thread def disp(a, b): for i in range(5): print("Child Thread") print(a,b) t = Thread(target=disp, args=(10, 20)) t.start() for i in range(5): print("Main Thread")
myemail.py
""" @FileName : myemail.py @Author : Chen Wang @Version : Python3.8 、Windows or Linux @Description: 实现用户注册时发送的邮箱验证码 @Time : 2020/1/30 11:01 @Software : PyCharm @Contact : 1416825008@qq.com @Github : https://github.com/JackMin1314/Python_Study @Gitee : https://gitee.com/JackMin1314/Python_St...
sink.py
import json import signal import threading from http.server import BaseHTTPRequestHandler, HTTPServer from time import time # This module collects metrics from collectd and can echo them back out for # making assertions on the collected metrics. # Fake the /v1/collectd endpoint and just stick all of the metrics in a...
protomo2aligner.py
#!/usr/bin/env python # # This script provides the user access to the protomo command line interface, # allowing for the initial coarse alignment and subsequent iterative alignments # to be performed serially. from __future__ import division import os import sys import glob import time import shutil import subprocess...
test_backfill_job.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...
utils.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. 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...
clean-check.py
import json import subprocess from time import sleep import argparse import threading def readJsonFile(): f = open(File, encoding = 'utf-8') fload = json.loads(f.read()) cluster = fload['cluster'] meta = cluster['meta']['nodes'] data = cluster['data'] global metaport, metadir, dataport, datadi...
server.py
from gevent import monkey monkey.patch_all() import serial #install pySerial import time import threading from flask_bootstrap import Bootstrap from flask import Flask, render_template, request, json from flask_socketio import SocketIO, emit, join_room, leave_room from dataclasses import dataclass # Flask Setup...
iptestcontroller.py
# -*- coding: utf-8 -*- """IPython Test Process Controller This module runs one or more subprocesses which will actually run the IPython test suite. """ #----------------------------------------------------------------------------- # Copyright (C) 2009-2011 The IPython Development Team # # Distributed under the t...
phishingRunner.py
###################################################### # # # SOCIALFISH v2.0 # # # # by: UNDEADSEC # # ...
demo_tilt.py
from freenect import * import time import threading import random dev = None def tilt_and_sense(): global dev while not dev: time.sleep(1) while 1: time.sleep(3) led = random.randint(0, 6) tilt = random.randint(0, 30) print('Led[%d] Tilt[%d]' % (led, tilt)) ...
worker.py
from datetime import datetime import multiprocessing as mp import time import queue import threading import subprocess import logging from bson.objectid import ObjectId from database import Database logger = logging.getLogger('demucs-frontend') def worker_process(q): logger.info('Worker process started') db...
kb_AmpliconServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
service.py
import datetime import json import time from multiprocessing import Process, Queue from os import remove import cv2 import numpy as np from flask import Flask, request, render_template, jsonify pqueue = Queue() from config_movimiento_frente_camara import FILE_CONFIG_MOVE_DETECT, constante_cambio_area ###########...
screens.py
import asyncio from decimal import Decimal import threading from typing import TYPE_CHECKING, List, Optional, Dict, Any from kivy.app import App from kivy.clock import Clock from kivy.properties import ObjectProperty from kivy.lang import Builder from kivy.factory import Factory from kivy.uix.recycleview import Recycl...
cloud.py
""" Object Store plugin for Cloud storage. """ import logging import multiprocessing import os import os.path import shutil import subprocess import threading import time from datetime import datetime from galaxy.exceptions import ObjectInvalid, ObjectNotFound from galaxy.util import ( directory_hash_id, safe...
UtilityFunctions.py
# ## Utility Functions to support re-use in python scripts. ## ## Includes functions for running external commands, etc ## ## Copyright Microsoft Corporation, 2017 ## from __future__ import print_function #support Python3 and 2 for print import os import logging import datetime import shutil import threading import...
多线程.py
import time import threading #GIL是解释器用于同步线程的一种机制 #它使得任何时刻仅有一个线程在执行 (就算你是多核处理器也一样) #使用GIL的解释器只允许同一时间执行一个线程 #常见的使用GIL的解释器有 CPython 与 Ruby MRI #如果你用JPython没有GIL锁 #CPU 多线程 def start():#单纯计算 消耗CPU资源 没有实际意义 data = 0 for _ in range(10000000):#连续加 data += 1 return if __name__ == "__ma...
Console.py
import threading import MGBotBuilder.exceptions as exceptions import MGBotBuilder.utils as utils class VirtualCommandConsole: def __init__(self): self.registry = [] def command(self, *cmdrule, permission=[]): def deco(f): for i in cmdrule: cmd = utils.parse_rule(i)...
main.py
from threading import Thread from register import * # type: ignore from adherence_helper import * # type: ignore from solidity_helper import * # type: ignore from blockchain import * # type: ignore from oracle import * # type: ignore import schedule,os # Keywords such as BL_timestamp signify what type of data will be ...
run_tests.py
#!/usr/bin/env python3 """ This script tests multiple python scripts or Jupyter Notebooks. A test is considered to have been completed successfully if it returns with the '0' exit code, which should signify that no uncaught exceptions were encountered. This script will return a non-zero exit code if any tests fail. U...
test_asyncore.py
import asyncore import unittest import select import os import socket import threading import sys import time from test import test_support from test.test_support import TESTFN, run_unittest, unlink from StringIO import StringIO HOST = test_support.HOST class dummysocket: def __init__(self): ...
app.py
from flask import Flask, render_template import threading from websockets import websock_start_server app = Flask(__name__) app.config['SECRET_KEY'] = 'secret!' # socketio = SocketIO(app) from views import index t = threading.Thread(target=websock_start_server) t.start()
utils.py
# Copyright 2015-2017 Yelp 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 writin...
job.py
import abc import threading from queue import Queue from pymcwrapper.event import Event class CommandSequenceJobEvent(Event): def __init__(self, title: str, text: str): self._title = title self._text = text @property def title(self): return self._title @property def text...
index.py
from PIL import Image import os import re import threading def split_list(a_list): half = int(len(a_list)/2) return a_list[:half], a_list[half:] def transform_images(imageList): print("Transforming",imageList) for file in imageList: im = Image.open(file) im2 = Image.new( 'RGB',im.size,...
test_fcntl.py
"""Test program for the fcntl C module. """ import platform import os import struct import sys import unittest from multiprocessing import Process from test.support import verbose, cpython_only from test.support.import_helper import import_module from test.support.os_helper import TESTFN, unlink # Skip test if no fcn...
old_ssh.py
import logging import os import socket import sys import time import traceback try: from queue import Queue except ImportError: # Python 2.7 fix from Queue import Queue from threading import Thread from tlz import merge from tornado import gen logger = logging.getLogger(__name__) # These are handy for cr...
testDownloadXML.py
import hashlib import multiprocessing import os import random import sys import time sys.path.append('..') import core from createXml import createXmlfile def getHashFile(filename: str) -> bytes: BLOCK_SIZE = 128 * 64 sha2 = hashlib.sha256() file = open(filename, 'rb') while True: data = fil...
test_synchronization_decorator.py
import functools from threading import Lock, RLock, Thread import time import random def synchronized(wrapped): """ Synchronization decorator. """ meta_lock = Lock() @functools.wraps(wrapped) def _wrapper(self, *args, **kwargs): with meta_lock: lock = vars(self).get("__lock_"+wra...
dump_reader_multipart.py
# Copyright (C) 2013 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the ...
jenkins_generic_job.py
import CIME.wait_for_tests from CIME.utils import expect, run_cmd_no_fail from CIME.case import Case import os, shutil, glob, signal, logging, threading, sys, re, tarfile, time ############################################################################## def cleanup_queue(test_root, test_id): #######################...
build_address_cache.py
__author__ = 'mdavid' # System Imports import binascii from datetime import datetime import multiprocessing from multiprocessing.queues import Empty import os import pybitcointools from redis import Redis import resource import simpleflock import socket import struct import sys import time # Addressimo Imports from a...
commons.py
import abc import cProfile import inspect import io import logging import math import multiprocessing import os import pstats import re import shutil import subprocess from io import StringIO from multiprocessing import Process from typing import Any, Iterable, Callable, Union, Dict, Tuple, List import pandas import s...
pose_estimater.py
import numpy as np import cv2 as cv import json import os import matplotlib.pyplot as plt #import multiprocessing import scipy.linalg as linalg import math class PoseEstimater(): def __init__(self, _algorithm='SIFT', min_match=25): self.camera_matrix = None self.distor_matrix = None self.mi...
parallel.py
import atexit import os import random import time import traceback from mpire.pool import WorkerPool import pickle from ditk import logging import tempfile import socket from os import path from typing import Callable, Dict, List, Optional, Tuple, Union, Set from threading import Thread from ding.framework.event_loop i...
benchmark.py
#!/usr/bin/env python3 ''' ' test/main.py ' ' Run a series of benchmarks comparing Levenshtein song-matching ' method to syntax-based method. ' ' Will Badart <wbadart@live.com> ' created: DEC 2017 ''' import logging from collections import defaultdict from functools import partial, wraps from itertools import product...
player.py
import vlc import urllib2 import threading class Player: """Represent radio Player.""" def __init__(self): self.vlc_player = None self.error_callback = None self.title_recieved_callback = None self.media_state_changed_callback = None self._init_vlc_player() def _i...
grabber.py
#!/usr/bin/python import yt_dlp import os import sys import re from itertools import repeat as repeat from threading import Thread as Thread from threading import Lock as Lock import metadator import eyeD3 # TODO: adapt code to curent structure and paths global_artwork = metadator.albumArtwork('./tmp') global_settin...
passive_operations.py
#!/usr/bin/env python #/******************************************************************************* # Copyright (c) 2012 IBM Corp. # 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 # h...
__init__.py
import hashlib import json import os import threading from typing import Optional, List, Callable import paho.mqtt.client as mqtt from platypush.backend import Backend from platypush.config import Config from platypush.context import get_plugin from platypush.message import Message from platypush.message.event.mqtt i...
patch_training.py
from __future__ import print_function from __future__ import absolute_import import warnings import copy import time import numpy as np import threading try: import queue except ImportError: import Queue as queue from .topology import Container from .. import backend as K from .. import optimizers from .. imp...
gpumonitor.py
from gpuutils import GpuUtils from multiprocessing import Process from pathlib import Path import time from torch.utils.tensorboard import SummaryWriter def monitor(path: Path, period: int): """Performs monitoring of GPU utilization Args: path: Path to write monitors. ...
Arlo.py
## # Copyright 2016 Jeffrey D. Walter # # 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 w...
test_rsocket.py
import py, errno, sys from rpython.rlib import rsocket from rpython.rlib.rsocket import * import socket as cpy_socket from rpython.translator.c.test.test_genc import compile def setup_module(mod): rsocket_startup() def test_ipv4_addr(): a = INETAddress("localhost", 4000) assert a.get_host() == "127.0.0.1...
alert.py
import urwid import time import threading def run_thread(func): def f(*args): thread = threading.Thread(target=func, args=args) thread.daemon = True thread.start() return f class Alert(urwid.AttrWrap): def __init__(self, text=""): self.text = urwid.Text(text) supe...
util.py
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ Various low-level utilities. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import datetime import json import math import os import re import select import si...
autonomous_v3.py
import car import cv2 import numpy as np import os import serial import socket import sys import threading import time # KERAS stuff from keras.layers import Dense, Activation from keras.models import Sequential import keras.models SIGMA = 0.33 stop_classifier = cv2.CascadeClassifier('cascade_xml/stop_sign.xml') time...
test_flush.py
import time import pdb import threading import logging from multiprocessing import Pool, Process import pytest from milvus import IndexType, MetricType from utils import * dim = 128 index_file_size = 10 collection_id = "test_flush" DELETE_TIMEOUT = 60 nprobe = 1 tag = "1970-01-01" top_k = 1 nb = 6000 tag = "partition...
plugin.py
'''The plugin module.''' from functools import wraps from queue import Queue from threading import Thread, Lock import logging from coqide.vimsupport import VimSupport from coqide.views import TabpageView, SessionView from coqide.session import Session logger = logging.getLogger(__name__) class _ThreadExecutor: ...
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...
upnp.py
import logging import threading from queue import Queue from typing import Optional try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) class UPnP: thread: Optional[threading.Thread] = None queue: Queue = Queue() def __init__(self): def run(): t...
do_queue.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from multiprocessing import Process, Queue import os, time, random # 写数据进程执行的代码: def write(q): print('Process to write: %s' % os.getpid()) for value in ['A', 'B', 'C']: print('Put %s to queue...' % value) q.put(value) time.sleep(random.ran...
main.py
from __future__ import division import warnings warnings.filterwarnings("ignore", category=FutureWarning) warnings.filterwarnings("ignore", message="size changed") import sys import os import time import math import random try: import Queue as queue except ImportError: import queue import threading import h5py...
worker.py
# -*- coding: utf-8 -*- """ 工作线程(后台工作部分) """ import bucket # 加载全局变量 import threading import time import inspect import ctypes def _async_raise(tid, exctype): """raises the exception, performs cleanup if needed""" if not inspect.isclass(exctype): raise TypeError("Only types can be raised (not instanc...
entry_ps_controller.py
#!/usr/bin/env python import threading import time from ps import ParameterServerController from ps.calculator_many import CalculatorMany from ps.calculator_one import CalculatorOne from util.config import config def loop_calculator(calculator): while True: calculator.loop() time.sleep(0.001) d...
fingbers.py
from flask import Flask, render_template from flask_socketio import SocketIO, send, emit from object_detection.utils import ops as utils_ops from object_detection.utils import label_map_util from object_detection.utils import visualization_utils as vis_util from collections import defaultdict import tensorflow as tf im...
27_11.py
# import packages ######################################################################################### import sys import pyaudio import datetime import pandas as pd import numpy as np import keyboard as kb #import simpleaudio import msvcrt import wave import glob from psychopy import core import mult...
data_gen.py
import multiprocessing as mp import threading import numpy as np import random import argparse from tqdm import tqdm from generate_one_image import generate_one_training_image, DownsamplingImage from PIL import Image import cv2 import json import os parser = argparse.ArgumentParser(description='Generate synthetic tr...
test_nntplib.py
import io import socket import datetime import textwrap import unittest import functools import contextlib import os.path from test import support from nntplib import NNTP, GroupInfo import nntplib from unittest.mock import patch try: import ssl except ImportError: ssl = None try: import threading except Im...
test_docxmlrpc.py
from xmlrpc.server import DocXMLRPCServer import http.client import sys from test import support threading = support.import_module('threading') import time import socket import unittest PORT = None def make_request_and_skipIf(condition, reason): # If we skip the test, we have to make a request because # the s...
recovery_gsi.py
import copy import logging import threading from threading import Thread import time from .base_gsi import BaseSecondaryIndexingTests, ConCurIndexOps from couchbase.n1ql import CONSISTENCY_REQUEST from couchbase_helper.query_definitions import QueryDefinition from lib.memcached.helper.data_helper import MemcachedClien...
test_fakeredis.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from time import sleep, time from redis.exceptions import ResponseError import inspect from functools import wraps import os import sys import threading from nose.plugins.skip import SkipTest from nose.plugins.attrib import attr import redis import redis.client import fak...
base_protocol.py
#!/usr/bin/env python # -*- coding:utf-8 -*- """ 基础协议类 内存拼接和消息处理由协议类来处理 进程主要用来控制心跳 """ import time import datetime import threading import logging logger = logging.getLogger('plugin') class BaseProtocol(object): def __init__(self, protocol_params): self.protocol_params = protocol_params self.pr...
crawl_book_info.py
import urllib.request, queue, time import threading class ThreadManager(): def __init__(self, thread_num): self.lock = threading.Lock() self.to_crawl = queue.Queue() self.max_count_num = 59000 self.end_flag = False for i in range(self.max_count_num): s...
clang-tidy-diff.py
#!/usr/bin/env python # # This file is based on # https://github.com/llvm-mirror/clang-tools-extra/blob/5c40544fa40bfb85ec888b6a03421b3905e4a4e7/clang-tidy/tool/clang-tidy-diff.py # # ===- clang-tidy-diff.py - ClangTidy Diff Checker ----------*- python -*--===# # # Part of the LLVM Project, under the Apache License v2....
coro4.py
import asyncio from functools import partial from threading import Thread async def a(): await asyncio.sleep(1) return 'A' def start_loop(loop): asyncio.set_event_loop(loop) loop.run_forever() def shutdown(loop): loop.stop() async def b1(): new_loop = asyncio.new_event_loop() t = Thr...
views.py
""" Django views used by the reporting application. The methods in views define the views used to interact with the reports in the redistricting application. This file is part of The Public Mapping Project https://github.com/PublicMapping/ License: Copyright 2010-2012 Micah Altman, Michael McDonald License...
data.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2015, Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can # be found in the LICENSE file. """This module allows you to bring up and tear down keyspaces.""" import cgi import json import subprocess import thre...
mp_demo6.py
from multiprocessing import Process, Pipe def f(conn): conn.send([42, None, 'hello']) conn.close() if __name__ == '__main__': parent_conn, child_conn = Pipe() p = Process(target=f, args=(child_conn,)) p.start() print(parent_conn.recv()) # prints "[42, None, 'hello']" p.join()
job.py
""" **job** module handles all the job running logic: - consistent exception handling and logging - currently 2 job runners are implemented: - SimpleJobRunner runs the jobs sequentially. - ParallelJobRunner queues the jobs and run them in a dedicated thread """ from concurrent.futures import ThreadPoolExecutor, Pr...
io_usb.py
"""-------------------------------------------------------------------- COPYRIGHT 2014 Stanley Innovation Inc. Software License Agreement: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code m...
multiprocessing.py
"""Multi-Processing Utilities.""" import torch.multiprocessing as mp def run_parallel_returns( function, args_list, num_cpu=None, max_process_time=300, max_timeouts=4 ): """Run a function in parallel and gather the return value of the function. Parameters ---------- function: callable. Fu...
DispatchLink.py
from PySide2.QtCore import * from .DispatchSession import * ''' Interface for separate Dispatch Dispatch connected either inline, or as app link ''' # todo 18 (API, module-dispatch, v2) +0: remote dispatcher # todo 258 (module-dispatch, error, ux) +0: handle retries class DispatchLink(QObject): sigDeviceFound =...
reader.py
import threading import serial import collections class Reader: ''' Ringbuffer size should be at least: longest combination of (expected buffer + tag length) ''' def __init__(self, port, baudrate, ringbuffer_size): self.serialPort = serial.Serial(port=port, baudrate=baudrate, bytesize=...
test_create_organization.py
#!/usr/bin/python # Copyright 2017 Northern.tech AS # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
pcrender.py
from __future__ import print_function import numpy as np import ctypes as ct import os import cv2 import sys import torch import argparse import time import gibson.core.render.utils as utils import transforms3d import json import zmq from gibson import assets from torchvision import datasets, transforms from torch.au...
database.py
import sqlite3 try: from queue import Queue except ImportError: from Queue import Queue import threading import time import os class SQLiteWriter: db = None scan = 0 todo = Queue(maxsize=0) db_file = None active = True _db_thread = None seen_entries = [] def init(self, dbfile...
flexural_strength.py
import logging import sys, os import numpy as np sys.path.append('../') sys.modules['cloudpickle'] = None import threading import time from pymeasure.display.Qt import QtGui from pymeasure.display.windows import ManagedWindow from pymeasure.experiment import Procedure, Results from pymeasure.experiment import Intege...
test_events.py
"""Tests for events.py.""" import collections.abc import concurrent.futures import functools import gc import io import os import platform import re import signal import socket try: import ssl except ImportError: ssl = None import subprocess import sys import threading import time import errno import unittest ...
manager.py
from dataclasses import dataclass import logging import threading import time import traceback from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Set, Tuple from concurrent.futures.thread import ThreadPoolExecutor from blspy import G1Element from chiapos import DiskProver from shamrock.c...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import electrum from electrum.bitcoin import TYPE_ADDRESS from electrum import WalletStorage, Wallet from electrum_gui.kivy.i18n import _ from electrum.paymentrequest import InvoiceStore from electr...
manager.py
import logging import threading import time import traceback from functools import reduce from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Set, Tuple from concurrent.futures.thread import ThreadPoolExecutor from blspy import G1Element from chiapos import DiskProver from chia.consensus....
generator_ui.py
import os import re from threading import Thread from easelenium.ui.generator.page_object_generator import PageObjectGenerator from easelenium.ui.root_folder import RootFolder from easelenium.ui.string_utils import StringUtils from easelenium.ui.utils import FLAG_ALL_AND_EXPAND from easelenium.ui.widgets.image.selecta...
diagnose_error.py
from __future__ import with_statement, print_function import os, sys, tempfile, subprocess, re, time, math, glob, threading, shutil, traceback from Popen_noblock import Popen_async, Empty from memoize import memoize from file_util import clean_v_file from util import re_escape from custom_arguments import LOG_ALWAYS fr...
rpc_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
example_test.py
import re import os import socket from threading import Thread import ssl from tiny_test_fw import DUT import ttfw_idf import random import subprocess try: import BaseHTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler except ImportError: import http.server as BaseHTTPServer from http.ser...
detectDetours.py
#!/usr/bin/python from __future__ import print_function from contextlib import closing import configparser from queue import Queue from operator import itemgetter import threading import subprocess import getopt import time import MySQLdb as pymysql import ipaddress import random import sys import os import traceback ...
traffic-forwarder.py
import socket import sys import threading import time def server(local_port, remote_cid, remote_port): try: dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) dock_socket.bind(('', local_port)) dock_socket.listen(5) while True: client_socket = dock_socket.a...
Audio.py
#!/usr/bin/python3 """Example of syncing lights to audio.""" from enum import IntEnum import time import multiprocessing import pyaudio # import scipy.signal import numpy as np import matplotlib import matplotlib.pyplot as plt from LightBerries import LightPatterns from LightBerries.LightControls import LightControlle...
ConnectSyncChannel.py
import socket, threading import subprocess from com.cleverworld.spring.transmitor import Utils from multiprocessing import Process, Queue import time class ConnectSyncChannel(Process): isRunning = True terminatorList = {} def __init__(self, endForConnectSyncChannel, queueWithBL, queueWithCSCL, utils): ...
test_sys.py
from test import support from test.support.script_helper import assert_python_ok, assert_python_failure import builtins import codecs # import gc import locale import operator import os import struct import subprocess import sys import sysconfig import test.support import textwrap import unittest import warnings # co...
server_deployer.py
# Copyright (c) 2021-2022, NVIDIA CORPORATION. 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 ...
LRUCacheTest.py
########################################################################## # # Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redis...
test_live_monitor.py
""" Module for testing LiveMonitoring. """ import unittest from nose.tools import assert_raises import os import multiprocessing as mp try: import zmq except: raise unittest.SkipTest import pylearn2 from pylearn2.scripts.train import train import pylearn2.train_extensions.live_monitoring as lm def train_mlp...
datasets.py
import carla_utils as cu import os from os.path import join import random import numpy as np import multiprocessing as mp import torch from torch.utils.data import Dataset from .data_master import DataMaster class DatasetTemplate(Dataset): DataMaster = DataMaster def __init__(self, config, mode): ...
co2meter.py
""" Class for reading data from CO2 monitor. (c) Vladimir Filimonov, 2016-2018 E-mail: vladimir.a.filimonov@gmail.com """ try: import hid except AttributeError as e: if 'windll' in e.message: raise ImportError(('Import failed with an error "AttributeError: %s". ' 'Pos...