source
stringlengths
3
86
python
stringlengths
75
1.04M
helpers.py
import multiprocessing import time import socket import logging import re from contextlib import contextmanager from playhouse.test_utils import _QueryLogHandler from data.database import LogEntryKind, LogEntry3 class assert_action_logged(object): """ Specialized assertion for ensuring that a log entry of ...
serial_listener.py
#!/usr/bin/env python #-*- coding: utf-8 -*- # 1. Copyright # 2. Lisence # 3. Author """ Documents """ from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals import time import threading from . import deco from . import s...
transaction.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 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...
single_sensor.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'interface.ui' # # Created by: PyQt5 UI code generator 5.10.1 # # WARNING! All changes made in this file will be lost! import os, sys, glob from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.uic import loadUiType import numpy as np import ...
main.py
# Copyright 2020 Google Research. 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...
crawler.py
import urllib3 from bs4 import BeautifulSoup from queue import Queue import argparse import threading import sys import os # Disable warnings for https urllib3.disable_warnings() #link class has url and depth class Link (): ''' Plain class to store links including the url and their depth depth is how fa...
test.py
import curio import threading from curio.thread import AsyncThread from curio.workers import run_in_thread import time # A thread - standard python def producer(): print("Producer") time.sleep(1) print('Producer done') return "Done" async def run_in_thread_in(): at = AsyncThread(target=producer) ...
thread_local.py
# encoding=utf-8 # 一个ThreadLocal变量虽然是全局变量,但每个线程都只能读写自己线程的独立副本,互不干扰。 # ThreadLocal解决了参数在一个线程中各个函数之间互相传递的问题。 import threading # 创建全局ThreadLocal对象: local_school = threading.local() def process_student(): # 获取当前线程关联的student: std = local_school.student print('Hello, %s (in %s)' % (std, threading.current_thre...
common.py
"""Test the helper method for writing tests.""" import asyncio import functools as ft import json import logging import os import uuid import sys import threading from collections import OrderedDict from contextlib import contextmanager from datetime import timedelta from io import StringIO from unittest.mock import M...
FunctionCall_Client_example.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division, print_function from os.path import split, dirname, abspath from os import getpid import sys import time import multiprocessing as mp # Add parent directory to beginning of path variable sys.path = [split(dirname(abspath(__file__)))[0]] + s...
__init__.py
import os import re import subprocess import sys import time from threading import Thread, Event import psutil import streamlink import youtube_dl from common import logger from common.timer import Timer fake_headers = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Encod...
main.py
""" GitHub Ulauncher Extension """ import json import logging import os import re from threading import Thread, Timer from github.MainClass import Github from github.GithubException import GithubException from ulauncher.api.client.EventListener import EventListener from ulauncher.api.client.Extension import Extension ...
relay.py
import rospy import re from std_msgs.msg import String from pymodbus.client.sync import ModbusTcpClient as MbClient import threading import time import rostopic NODE_NAME = 'ROS_MODBUS_RELAY' PUB_TOPIC = 'modbus_tcp_data' SUB_TOPIC = 'modbus_tcp_cmd' CMD_PATTERN = '(READ|WRITE)\s+(\w+)\s+(COUNT)\s+(\w+)(\s*[\w|\W]*){0...
diggfiUpdater.py
import logging import threading import json import requests import mysql.connector from mysql.connector import connect, Error, errorcode from web3 import Web3 import datetime from datetime import datetime import time import csv config = { 'user': 'diggsqluser', 'password': 'foo', 'host': 'local...
test_dispatcher.py
import numpy as np import threading import warnings from contextlib import contextmanager from numba import cuda, float32, float64, int32, int64, void from numba.core.errors import NumbaDeprecationWarning from numba.cuda.testing import skip_on_cudasim, unittest, CUDATestCase from numba.tests.support import ignore_inte...
setInterval.py
from threading import Timer, Thread """ @Todos - Create a method that will call the stop method when the process exits. Because the timer thread continues to run even if the main program/thread is killed by keyboard interrupt, which means that the stop method is never called. - Create a method that allow...
Blog.py
from kivy.lang import Builder from kivy.uix.popup import Popup from kivy.uix.floatlayout import FloatLayout from kivy.uix.screenmanager import Screen from kivy.properties import ObjectProperty from kivy.utils import platform import os import webbrowser, time import threading class FunctionWidget(): def main(self)...
win32spawn.py
# # File : win32spawn.py # This file is part of RT-Thread RTOS # COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 ...
plot.py
import asyncio import logging from threading import Lock import threading import backtrader as bt import tornado.ioloop from ..app import BacktraderPlotting from ..webapp import Webapp from ..schemes import Blackly from ..live.client import LiveClient _logger = logging.getLogger(__name__) class LivePlotAnalyzer(b...
keeper.py
import logging import logging.config import time import json import requests import threading import math from web3 import Web3, HTTPProvider, middleware import eth_utils from eth_utils import encode_hex from eth_account import Account from web3.middleware import construct_sign_and_send_raw_middleware, geth_poa_middle...
utils.py
############################################################################## # # Copyright (c) 2005 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS I...
stl_capture_test.py
#!/router/bin/python from .stl_general_test import CStlGeneral_Test, CTRexScenario from trex_stl_lib.api import * import os, sys import pprint import zmq import threading import time import tempfile import socket from scapy.utils import RawPcapReader from nose.tools import assert_raises, nottest def ip2num (ip_str): ...
test_intergration_with_eve.py
# -*- coding: utf-8 -*- import time import unittest from multiprocessing import Process from uuid import uuid4 import six from evc import Evc from eve import Eve from pymongo import MongoClient if six.PY3: from functools import reduce def map2(*args, **kwargs): if six.PY3: return [x for x in map(*a...
advanced-reboot.py
# # ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";...
TandemRepeats_landmlServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
test.py
# -*- coding: utf8 -*- import sys import os IS_PY3 = sys.version_info[0] == 3 IS_PY2 = not IS_PY3 MINOR_VER = sys.version_info[1] # coverage doesn't work in python 3.1, 3.2 due to it just being a shit # python HAS_UNICODE_LITERAL = not (IS_PY3 and MINOR_VER in (1, 2)) cov = None if HAS_UNICODE_LITERAL: run_idx =...
tests.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import errno import os import shutil import sys import tempfile import time from datetime import datetime, timedelta from io import BytesIO try: import threading except ImportError: import dummy_threading as threading from djang...
u2p2_main_before_epoll.py
import os import sys import time import spidev import threading is_on_raspberry_pi = False with open('/etc/os-release') as os_version_file: is_on_raspberry_pi = 'raspbian' in os_version_file.read().lower() spi = None if is_on_raspberry_pi: spi = spidev.SpiDev(0, 0) # rasp print("I'm on Raspberry Pi!") ...
check_projects.py
#!/usr/bin/env python # Copyright 2016 The Kubernetes 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 appli...
port_scanner.py
import argparse import socket # for connecting from colorama import init, Fore from threading import Thread, Lock from queue import Queue init() GREEN = Fore.GREEN RESET = Fore.RESET GRAY = Fore.LIGHTBLACK_EX N_THREADS = 100 # thread queue q = Queue() print_lock = Lock() def port_scan(port): """ Scan a po...
test_controller.py
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
interactive.py
# Standard Library Imports from typing import Union, List, Tuple, Type, Callable import multiprocessing as mp from copy import deepcopy import argparse import runpy import sys # Package imports from kodi_addon_dev import displays from kodi_addon_dev.repo import LocalRepo from kodi_addon_dev.support import Addon, logge...
ipc.py
# Copyright 2016 SAP SE # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
thread_local_tests.py
from threading import Thread import typing as t from unittest.mock import MagicMock, patch import pytest from collections import abc from uzi.graph.core import Graph from uzi.scopes import ThreadLocalScope xfail = pytest.mark.xfail parametrize = pytest.mark.parametrize _T = t.TypeVar("_T") _T_FnNew = abc.Callab...
tab_base_classes.py
##################################################################### # # # /tab_base_classes.py # # # # Copyright 2013, Monash University ...
pyflooder.py
# -*- coding: utf-8 -*- # Author : D4Vinci # Recoded by : codex31 # Cleaned by : igosad # Moved from python2 to python3 # All copyrights to Squnity team # Source: https://github.com/D4Vinci/PyFlooder import random import socket import string import sys import threading import time # Parse inputs host = "" ip = "" por...
test_resume.py
from multiprocessing import Process from repro.cli.hpop import main from repro.utils.tests.compare import compare_dict from tempfile import mkdtemp import json import math import time import os tmp_dir = mkdtemp() def make_arguments(experience, workers=1, max_trials=10, more_args=None): if more_args is None: ...
server.py
""" Module: server Description: defines a tcp server through which simple push and pull operation are possible. """ import socket from threading import Thread from threading import Lock class ClientThread(Thread): """ Defines a client thread that will facilitate communication between ...
test_zeromq.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Thomas Jackson <jacksontj.89@gmail.com>` ''' # Import python libs from __future__ import absolute_import import os import time import threading # linux_distribution deprecated in py3.7 try: from platform import linux_distribution except ImportError: from di...
pitft_touchscreen.py
# -*- coding: utf-8 -*- # piTFT touchscreen handling using evdev """ This file is a modified copy of pitft_touchscreen.py, originally from: Repository: https://github.com/pigamedrv/pitft_touchscreen Commit: 1111a18989bfa5cca50fbcae333312840063d8ea Copyright PiGameDrv, licensed under GPL v3 (see GPLv3.txt in this dire...
blockchain.py
#!/usr/bin/env python # # Fermatum - lightweight IoP client # Copyright (C) 2012 thomasv@ecdsa.org # # 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 l...
interactive.py
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko is free software; you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 2.1 of the License, or (a...
main.py
#qpy:webapp:Hello Qpython #qpy://127.0.0.1:8080/ """ This is a sample for qpython webapp """ from bottle import Bottle, ServerAdapter from bottle import run, debug, route, error, static_file, template ######### QPYTHON WEB SERVER ############### class MyWSGIRefServer(ServerAdapter): server = None ...
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 # coun...
server_grpc.py
# Copyright 2021 Cortex Labs, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
mitm.py
#!/usr/bin/env python from scapy.all import * import threading import os import sys # ARP poison , dns MITM # SPSE COURSE CODED BY SPSE 850 ACIDR4IN --> # COULD DO WITH SOME MORE ERROR HANDLING MAYBE A SERVER FUNCTION TO SERVE YOUR OWN PAGES # ALSO POSSIBLY AN SSL STRIP FUNCTION # 16/2/2013 # CTRL_C KILL ADDED (set...
MultiSourceSeq2Seq.py
import collections import gc import sys import time from functools import partial from pathlib import Path from typing import Dict, List, NoReturn, Optional, Tuple import numpy as np import torch import torch.nn import torch.nn.utils from recordclass import RecordClass from seutil import IOUtils, LoggingUtils from ro...
store.py
import json import uuid as uuid_builder import os.path from os import path from threading import Lock from copy import deepcopy import logging import time import threading # Is there an existing library to ensure some data store (JSON etc) is in sync with CRUD methods? # Open a github issue if you know something :)...
main.py
import csv from multiprocessing.dummy import Pool import threading import queue import random import requests import bs4 import sys import asyncio cores = 4 pool = Pool(cores) seen = queue.Queue() def loop(): global cores idx = 0 while True: cond, msg = seen.get(block=True) if cond: ...
notifier.py
#!/usr/bin/python3 -OO # Copyright 2007-2019 The SABnzbd-Team <team@sabnzbd.org> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any late...
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, Sequence from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from el...
test_rollbar.py
import base64 import copy import json import socket import threading import uuid import sys try: from unittest import mock except ImportError: import mock try: from StringIO import StringIO except ImportError: from io import StringIO import unittest import rollbar from rollbar.lib import python_majo...
AliceServerQCU.py
# Copyright (c) 2016 Gabriel Oliveri (<gabrieloandco@gmail.com>) # # 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,...
vnokex.py
# encoding: UTF-8 import hashlib import zlib import json from time import sleep from threading import Thread import traceback import websocket import requests import sys import ssl # API文档 https://github.com/okcoin-okex/OKEx.com-api-docs from vnpy.api.okex.okexData import SPOT_TRADE_SIZE_DICT,SPOT_REST_ERROR_DICT, F...
data_generator.py
import os import random import numpy as np import tensorflow as tf import gzip import io import multiprocessing SHUFFLE_BUFFER_SIZE = 2048 TRAIN_BATCH_SIZE = 32 def load_file(fname): return np.load(io.BytesIO(gzip.open(fname,'rb').read())) def get_batch_data(input_folder): fnames = os.listdir(input_folder) ...
client_sync.py
import typing from .client_async import DiscordClientAsync import asyncio import threading class DiscordClientSync: def __init__(self, token: str, use_socket: bool = True, proxies: dict = None, default_timeout: int = 10): """ wrapper template return asyncio.run_coroutine_threadsafe( ...
StopOrder.py
# Copyright (C) 2021 LYNX B.V. All rights reserved. # Import ibapi deps from ibapi.client import EClient from ibapi.wrapper import EWrapper from ibapi.contract import * from ibapi.order import * import threading import time class App(EWrapper, EClient): def __init__(self, ipaddress, portid, clientid): EC...
multiple.py
#!/usr/bin/python3 #-*-coding:utf-8-*- from threading import Thread import pymysql from Sqlcore import Sqlcore ''' 入口功能 ''' '''vmode打印显示模式full/standard/simple''' #生产环境的photo相册 conn = {"hostname":"xxxxxx.mysql.rds.aliyuncs.com","username":"forpython","password":"Ffu398fh_GFUPY","database":"dbuser","hostport":3708...
server.py
import sys import shelve from socket import * from select import select from multiprocessing import Process from settings import * def listen(sock_server, pipe_server): # IO多路复用:循环监听套接字 rlist = [sock_server, pipe_server] wlist = [] xlist = [] print("等待连接...") while True: rs, ws, xs = s...
FriendNotifications.py
# -*- coding: utf-8 -*- import time import json from threading import Thread from gui import SystemMessages from Avatar import PlayerAvatar from gui.app_loader import g_appLoader from gui.shared import g_eventBus, events from messenger import storage, MessengerEntry from debug_utils import LOG_CURRENT_EXCEP...
test.py
import json import random import re import string import threading import time from multiprocessing.dummy import Pool import pytest from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster cluster = ClickHouseCluster(__file__) node1 = cluster.add_instance('node1', ...
backgroundTestServers.py
import os import time import platform import tempfile import threading import multiprocessing # sys.path.append(rootPath) from rtCommon.structDict import StructDict from rtCommon.scannerDataService import ScannerDataService from rtCommon.subjectService import SubjectService from rtCommon.exampleService import ExampleSe...
gui.py
# coding:utf8 import tkinter as tk import os import tkinter.ttk import tkinter.filedialog import random from docx import Document from docx.shared import Inches from vulscan import * global output def handlerAdaptor(fun, **kwds): return lambda event, fun=fun, kwds=kwds: fun(event, **kwds) ...
tracing_backend.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import cStringIO import json import logging import socket import threading import weakref from telemetry.core import trace_result from telemetry.core.backen...
ethereum.py
import hashlib import binascii import string import re import os from . import Manticore from .manticore import ManticoreError from .core.smtlib import ConstraintSet, Operators, solver, issymbolic, istainted, taint_with, get_taints, Constant, operators from .core.smtlib.visitors import simplify from .platforms import e...
eval.py
from dataloader import EvalDataset, TrainDataset from dataloader import get_dataset import argparse import torch.multiprocessing as mp import os import logging import time import pickle backend = os.environ.get('DGLBACKEND') if backend.lower() == 'mxnet': from train_mxnet import load_model_from_checkpoint fro...
house_keeping.py
# Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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...
logger.py
#!/usr/bin/env python """ Class for dealing with logger-function used across all TOBIAS tools @author: Mette Bentsen @contact: mette.bentsen (at) mpi-bn.mpg.de @license: MIT """ import sys import os from datetime import datetime import logging import logging.handlers import multiprocessing as mp im...
sshobj_popen.py
''' Created on Aug 27, 2017 @author: arnon ''' from concepts.sshcmd_popen import sshcmd import pickle import os from concepts.sshtypes import RemoteWorker import struct import multiprocessing as mp import sys from subprocess import Popen, PIPE import threading as th import queue ''' Prerequisite: set .profile w...
crawleb.py
#!/usr/bin/python """ This task starts the crawler using the configuration provided. After loading the configuration, it set the logging queue and the signal handler. Afterwards loads all the spiders in the `spiders` directory. The task will spawn one process for each spider and it will start the crawling. Each spid...
threading_names_log.py
import logging import threading import time def worker(): logging.debug('Starting') time.sleep(0.2) logging.debug('Exiting') def my_service(): logging.debug('Starting') time.sleep(0.3) logging.debug('Exiting') logging.basicConfig( level=logging.DEBUG, format='[%(levelname)s] (%(thr...
test_weakref.py
import gc import sys import doctest import unittest import collections import weakref import operator import contextlib import copy import threading import time import random from test import support from test.support import script_helper, ALWAYS_EQ from test.support import gc_collect # Used in ReferencesTestCase.tes...
detector_utils.py
# Utilities for object detector. import numpy as np import sys import tensorflow as tf import os from threading import Thread from datetime import datetime import cv2 from utils import label_map_util from collections import defaultdict detection_graph = tf.Graph() sys.path.append("..") # score threshold for showing...
to_reliable_multicast.py
import os import sys import multiprocessing import time import uuid import threading sys.path.append(sys.path[0] + "/../..") from src.protocol.multicast.to_message import TotalOrderMessage from src.core.utils.configuration import Configuration from src.core.utils.channel import Channel from src.protocol.base import Me...
consoles.py
"""Open a persistent console over a socket. NOTE: While it is very useful to open a console in a server process, be very careful about opening one because anyone who can connect to the console may execute arbitrary Python code in the server process, which is a huge security vulnerability. """ import code as _code # ...
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...
build_imagenet_data.py
#!/usr/bin/python # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
account.py
#!/usr/bin/python3 import json import threading import time from collections.abc import Iterator from getpass import getpass from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union import eth_account import eth_keys import rlp from eth_utils import keccak from hexbytes import HexBytes fro...
rpcMixin.py
# # This was modified from rpcMixin.py distributed with wxPython # #---------------------------------------------------------------------- # Name: rpcMixin # Version: 0.2.0 # Purpose: provides xmlrpc server functionality for wxPython # applications via a mixin class # # Requires: (1) Pyt...
controls.py
import sys, trace, multiprocessing, time from playsound import playsound from pymongo import MongoClient from bson.objectid import ObjectId from datetime import datetime class AlarmController: def __init__(self): self.debug = "" self.port = "" self.mongoURI = "" self.mongoDB = "" self.mongoAlColl = "" s...
paho_mqtt_client.py
#!/usr/bin/env python import paho.mqtt.client as mqtt_client import asyncio import traceback import threading import functools from uuid import getnode as get_mac from homie.mqtt.mqtt_base import MQTT_Base import logging logger = logging.getLogger(__name__) mqtt_logger = logging.getLogger("MQTT") mqtt_logger.setLe...
upload.py
import io import threading from qcloud_cos import CosConfig from qcloud_cos import CosS3Client secret_id = 'AKIDcq7HVrj0nlAWUYvPoslyMKKI2GNJ478z' secret_key = '70xZrtGAwmf6WdXGhcch3gRt7hV4SJGx' region = 'ap-chengdu' config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key) # 2. 获取客户端对象 client = CosS3...
test_manager.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...
test-client-metrics-bridge.py
#!/usr/bin/env python3 # Creates a ghostunnel. Ensures that /_status endpoint works. from subprocess import Popen from common import * import urllib.request, urllib.error, urllib.parse, socket, ssl, time, os, signal, json, http.server, threading received_metrics = None class FakeMetricsBridgeHandler(http.server.Bas...
SWHear.py
""" this is a stripped down version of the SWHear class. It's designed to hold only a single audio sample in memory. check my githib for a more complete version: http://github.com/swharden """ import pyaudio import time import numpy as np import threading def getFFT(data, rate): """Given some d...
test_client.py
from courier import * import cluster_manager import threading import paramiko import os """ prog_name id socket ndb-manager""" base_cmd = './%s %d "%s" "%s"' base_cmd_flag = "./%s --id %d --manager %s --epoch %d " kill_cmd = "pkill %s" clear_cmd = "rm %s" ## remove the log file output_log_cmd = "...
cronjob.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import logging from multiprocessing import Process from os.path import abspath, dirname sys.path.append(abspath(dirname(abspath(__file__)) + '../../../')) from core.brain.main import Brain, worker import zmq context = zmq.Context() from optparse import OptionPar...
run.py
import json import traceback from ed25519.keys import SigningKey, VerifyingKey from . import gpg_utils from .utils import eprint, merkley_helper, hashfunc from .block import BlockHandler, generate_message from .exceptions import * from .udp_utils import Client from .constants import * import os import random import t...
ftp_client.py
#coding: utf-8 ## Please append ## /home/pi/max/cmd_def.py -> 'dl_file':[general_def.FTP_DOWNLOAD_PORT], ## /home/pigeneral.conf -> FTP_DOWNLOAD_PORT=PortNumber ## Port Number(ex. 9010) import sys, os dir = os.path.dirname(__file__) sys.path.append( dir +'/modules') import read_conf import time import i...
message_receiver.py
from config import Config from threading import Thread class MessageReceiver: def __init__(self, remote_control, motion_module): print("Initializing message receiver...") self.remote_control_connection = remote_control.subscribe(Config.motion_control_topic) self.motion_module = motion_modu...
test_common.py
from __future__ import absolute_import import socket from mock import patch from kombu import common from kombu.common import ( Broadcast, maybe_declare, send_reply, isend_reply, collect_replies, declaration_cached, ignore_errors, QoS, PREFETCH_COUNT_MAX, entry_to_queue, ) from kombu.exceptions i...
parallel.py
from multiprocessing import Process, Queue import warnings class ErrorInProcessException(RuntimeError): """Exception raised when one or more parallel processes raises an exception""" def __init__(self, message, errors, *args, **kwargs): self.message = message self.errors = errors sup...
test_bulk_insertion.py
# -*- coding: utf-8 -*- from common import * import csv import time import threading from click.testing import CliRunner from redisgraph_bulk_loader.bulk_insert import bulk_insert redis_con = None port = None redis_graph = None def run_bulk_loader(graphname, filename): runner = CliRunner() runner.invoke(bulk...
lcm_process.py
import lcm from time import perf_counter from protocol import state_t, command_t from multiprocessing import Process, Manager # address = "udpm://239.255.76.67:7667?ttl=1" states = Manager().Namespace() commands = Manager().Namespace() def state_callback(channel, data): state_data = state_t.decode(data) stat...
matmul_thread.py
import numpy as np import cupy as cp import time import sys from parla import Parla, get_all_devices from parla.array import copy, clone_here from parla.cpu import cpu from parla.cuda import gpu from parla.function_decorators import specialized from parla.ldevice import LDeviceSequenceBlocked from parla.tasks import ...
endServer.py
import socket import os import signal import threading import hashlib import fcntl import struct from Crypto import Random import Crypto.Cipher.AES as AES from Crypto.PublicKey import RSA from lazyme.string import color_print def get_ip_address(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ret...
hex.py
# -*- coding: utf-8 -*- """ UART hex. Simplest example for UART test. """ import binascii import threading import time import serial def uart_read(uart): """UART read.""" while True: result = uart.read(uart.in_waiting) if result: print("r:", " ".join([("%02X" % i) for i in result...
opus_class_server.py
import asyncio import zlib import queue import threading import audioop from collections import namedtuple from google.cloud import speech from opuslib import Decoder from config.config import Config from config.config import Server from config.config import Opus dec = Decoder(Opus.rate, Opus.channels) class VoiceT...
opt_neuron.py
from ANNarchy import setup, Population, get_population, reset import numpy as np import traceback import CompNeuroPy.neuron_models as nm import CompNeuroPy.model_functions as mf import CompNeuroPy.simulation_functions as sif import CompNeuroPy.system_functions as syf from .Experiment import Experiment # hyperopt from ...
piestop.py
#!/usr/bin/env python3 import websocket import threading import time import json import RPi.GPIO as GPIO # Global Values address = '127.0.0.1' # The address of the spjs. port = '8989' # The port that spjs is using. # Setup pi button stuff. GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP) c...