source
stringlengths
3
86
python
stringlengths
75
1.04M
SetpointPublisher.py
import enum import logging import time import threading import uavcan class ControlTopic(enum.Enum): voltage = 'voltage' torque = 'torque' velocity = 'velocity' position = 'position' def __str__(self): return self.value def __call__(self, node_id, value): return { ...
root.py
import asyncio import copy import pickle from re import T from threading import Thread from typing import Union from fastapi import APIRouter, File, Request, Security, UploadFile from fastapi import HTTPException, status from fastapi import Depends import fastapi from fastapi.security import APIKeyHeader import time f...
netview.py
#!/usr/bin/env python # Impacket - Collection of Python classes for working with network protocols. # # SECUREAUTH LABS. Copyright (C) 2021 SecureAuth Corporation. All rights reserved. # # This software is provided under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # f...
out_ohlcv.py
import datetime import os import shutil import threading import time from datetime import date, timedelta import XsCore import json import pandas as pd from PySide6 import QtWidgets from PySide6.QtCore import QTimer from PySide6.QtGui import Qt from PySide6.QtWidgets import QSizePolicy, QHeaderView from XsCore import...
hideout.py
''' track players in hideout ''' import threading import logging from player import players from misc import my_queue, player_joined_q, PLAYER_JOINED_STATUS import config logger = logging.getLogger('bot_log') class Hideout(): ''' monitor player activity in hideout ''' def __init__(self): self.upd...
devtools_browser.py
# Copyright 2019 WebPageTest LLC. # Copyright 2017 Google Inc. # Use of this source code is governed by the Apache 2.0 license that can be # found in the LICENSE file. """Base class support for browsers that speak the dev tools protocol""" import glob import gzip import io import logging import os import re import shut...
test_writer_service.py
import threading from threading import Thread from unittest.mock import MagicMock import pytest from datastore.shared.di import injector from datastore.shared.services import EnvironmentService from datastore.writer.core import ( Database, Messaging, OccLocker, RequestCreateEvent, RequestDeleteEve...
ours.py
import numpy as np import multiprocessing as mp from pdb import set_trace from copy import deepcopy from utmLib import utils from utmLib.clses import Timer from utmLib.parmapper import Xmap from core.contcnet import ContCNet, nn_conf from core.varpick import most_var, hard_max_mincorr from core.tinylib impor...
dist_autograd_test.py
import sys import threading import time import unittest from enum import Enum import torch from datetime import timedelta import torch.distributed as dist import torch.distributed.autograd as dist_autograd import torch.distributed.rpc as rpc import torch.testing._internal.dist_utils from torch.autograd import Function ...
pull.py
#!/usr/bin/env python '''Pull data from database to .h5 storage.''' # Assuming our points tables have the following schema # CREATE TABLE points ( # x INTEGER # , y INTEGER # , z INTEGER # , value FLOAT # ); # We have two database points_pre and points_post import psycopg2 from psycopg2.extras import DictCu...
catalogue_collector.py
#!/usr/bin/env python3 """This is a module for collection of X-Road services information.""" import queue from threading import Thread, Event, Lock from datetime import datetime, timedelta from io import BytesIO import argparse import hashlib import json import logging.config import os import re import shutil import ...
DispatchDialogue.py
########################################################################## # # Copyright (c) 2018, 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: # # * Redistrib...
pyGCluster.py
#!/usr/bin/env python2.7 """ pyGCluster is a clustering algorithm focusing on noise injection for subsequent cluster validation. By requesting identical cluster identity, the reproducibility of a large amount of clusters obtained with agglomerative hierarchical clustering (AHC) is assessed. Furthermore, a multitude of ...
bmn_reader.py
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve. # #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...
trustedcoin.py
#!/usr/bin/env python # # Electrum - Lightweight ILCOIN 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 ...
worker_ps_interaction_test.py
import os import unittest from threading import Thread import numpy as np import tensorflow as tf from elasticdl.proto import elasticdl_pb2 from elasticdl.python.common.args import parse_worker_args from elasticdl.python.common.constants import DistributionStrategy from elasticdl.python.common.hash_utils import int_t...
gui.py
from tkinter import * from tkinter.ttk import * import os import threading import time class mainwindow(Tk): def __init__(self, encrypted_key_b64): Tk.__init__(self) self.title(string="Warning!!!") # Set window title self.resizable(0, 0) # Do not allow to be resized self.configure...
multithread.py
#!/usr/bin/python3 from threading import Thread import http.client, sys import queue import requests concurrent = 8 def doWork(): while True: url = q.get() status, url = getStatus(url) doSomethingWithResult(status, url) q.task_done() def getStatus(ourl): try: req = req...
test_mturk_manager.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import os import time import json import threading import pickle from unittest import mock from parlai.m...
ooc_lauum.py
import math import threading from typing import List, Optional import numpy as np import torch from falkon.cuda import initialization from falkon.utils import devices, PropagatingThread from falkon.utils.helpers import sizeof_dtype from falkon.options import FalkonOptions, LauumOptions from .ooc_utils import calc_blo...
p5.py
from multiprocessing import Process, Lock def display(k, n): k.acquire() print ('Hi', n) k.release() if __name__ == '__main__': lock = Lock() names = ['Alice', 'Bob', 'Carol', 'Dennis'] for n in names: p = Process(target=display, args=(lock,n,)) p.start() ...
utils.py
from line_profiler import LineProfiler from pymongo import MongoClient from threading import Thread import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import itertools from io import BytesIO from PIL import Image import pickle import base64 imp...
maintenance.py
# Copyright 2019 Red Hat, 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...
monitor.py
""" Monitoring (memory usage, cpu/gpu utilization) tools. """ import os import time from math import ceil from multiprocessing import Process, Manager, Queue import numpy as np import matplotlib.pyplot as plt try: import psutil except ImportError: pass try: import nvidia_smi except ImportError: # Use t...
make.py
import glob import json import os import shutil import time import stat import subprocess import threading import webbrowser import shlex import bpy import arm.assets as assets from arm.exporter import ArmoryExporter import arm.lib.make_datas import arm.lib.server import arm.log as log import arm.make_logic as make_l...
datasets.py
import cv2 import numpy as np import os from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread import time FPS = 40 ROTATION = 0 HFLIP = False VFLIP = True RESOLUTION = (640, 480) class PiStream: ''' Pi Camera Setup ''' def __init__(self, resolution = RESOLUTION, fram...
WebServer.py
# coding=utf-8 import threading server = None web_server_ip = "0.0.0.0" web_server_port = "8000" web_server_template = "www" def initialize_web_server(config): ''' Setup the web server, retrieving the configuration parameters and starting the web server thread ''' global web_server_ip, web_server...
cppty.py
"""Cross-platform version of pty""" import platform from threading import Thread if platform.system().lower().startswith('win'): # windows from winpty import PtyProcess import os import sys import re import msvcrt # TODO CRTL+C def spawn(argv, win_repeat_argv0=False, **kwargs): ...
multiprocessing_demo.py
# !/usr/bin/env python # -- coding: utf-8 -- # @Author zengxiaohui # Datatime:7/30/2021 10:40 AM # @File:multiprocessing_demo import multiprocessing import time from multiprocessing.managers import BaseManager class CA(object): def __init__(self): self.name ="A" self.valuey = "a_value" def run...
parking_test.py
import serial import time import math import threading # for test, main 코드에서는 멀티 프로세싱 사용하는 게 목표야. # CONSTANTS for _read(), related with encoder DISTANCE_PER_ROTATION = 54.02 * math.pi # Distance per Rotation [cm] PULSE_PER_ROTATION = 100. # Pulse per Rotation DISTANCE_PER_PULSE = DISTANCE_PER_ROTATION / PULSE_PER_R...
progress.py
# coding=utf-8 from __future__ import absolute_import, division, print_function, unicode_literals import math import sys import threading import time import warnings from contextlib import contextmanager from itertools import chain, islice, repeat from .configuration import config_handler from .logging_hook import in...
_sync.py
# -*- coding: utf-8 -*- import time import functools import threading import collections class RateLimiter(object): """Provides rate limiting for an operation with a configurable number of requests for a time period. """ def __init__(self, max_calls, period=1.0, callback=None): """Initializ...
noise_color_demo.py
import matplotlib.pyplot as plt import numpy as np import scipy as sc import sounddevice as sd def generate_signal_from_spectrum(C_k: np.ndarray)-> np.ndarray: """ generates a real valued time domain signal from frequency coefficients for ifft. Signal is aprox. scaled to ~[-1;1]. :param C_k: np.n...
writeAllCoils.py
import os import threading import random from System.Core.Global import * from System.Core.Colors import * from System.Core.Modbus import * from System.Lib import ipcalc down = False class Module: info = { 'Name': 'DOS Write All Coils', 'Author': ['@enddo'], 'Description': ("DOS With Write All Coils"), ...
task.py
####################################################################### # Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) # # Permission given to modify the code as long as you keep this # # declaration at the top # ################################...
multiprocess.py
from multiprocessing import Process import os # 子进程要执行的代码 def run_proc(name): print('Run child process %s (%s)...' % (name, os.getpid())) while 1: pass if __name__=='__main__': print('Parent process %s.' % os.getpid()) p = Process(target=run_proc, args=('test',)) p.start() ...
demo_single_scale.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import _init_paths import caffe import cv2 import numpy as np from python_wrapper import * import os from timeit import default_timer as timer from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread import imutils from imutils.video...
__init__.py
"""An asynchronous RabbitMQ client usable for RPC calls""" import logging import secrets import sys import threading import time import typing import pika import pika.exceptions from pika.adapters.blocking_connection import BlockingChannel from pika.spec import Basic, BasicProperties class Client: __messaging_lo...
camera_proc.py
from PySide2.QtGui import QImage, QPixmap from PySide2 .QtCore import QObject, Signal, Slot, Property, QBasicTimer, QPoint from PySide2.QtQuick import QQuickPaintedItem, QQuickImageProvider from threading import Thread, Lock from multiprocessing import Process, Pipe, Value, Condition, Array import cv2 import numpy as n...
loop.py
import sys import time import json import threading import traceback import collections try: import Queue as queue except ImportError: import queue from . import exception from . import _find_first_key, flavor_router class RunForeverAsThread(object): def run_as_thread(self, *args, **kwargs): t =...
MicrosoftTeams.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import requests from distutils.util import strtobool from flask import Flask, request, Response from gevent.pywsgi import WSGIServer import jwt import time from threading import Thread from typing import ...
marabuzo.py
##final code for marobuzo recognition # import threading # import pandas as pd # from queue import Queue # import time # file = open("stock_pred.txt", "w") # data = pd.read_csv("C:\\Users\\BEST BUY\\Desktop\\NASDAQ_20200331.csv") # symbols = data.iloc[:,0:1].values # th = Queue(maxsize = 4000) def marabuzo(arg): ...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import absolute_import, print_function, with_statement import os import re import sys import copy import time import types import signal import fnmatch import logging import threading import traceback import contextlib impo...
runboth.py
from django.core.management.base import BaseCommand, CommandError from django.core import management from multiprocessing import Process from journalist.worker import Worker class Command(BaseCommand): help = 'This command run grabber and Django server in different process in parallel' def add_arguments(self...
ch10_listing_source.py
import binascii from collections import defaultdict from datetime import date from decimal import Decimal import functools import json from Queue import Empty, Queue import threading import time import unittest import uuid import redis CONFIGS = {} CHECKED = {} def get_config(conn, type, component, wait=1): key...
flags.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from classes.config.get import ConfigGet from config.main import * import multiprocessing import socket import sys import time import re import pymongo from ipaddress import IPv4Address, IPv4Network from functions import Message class Flags: socket = None def __in...
process.py
""" Orlov Plugins : Minicap Process Utility. """ import os import io import sys import time import logging import threading from queue import Queue import cv2 from PIL import Image import numpy as np import fasteners from orlov.libs.picture import Picture, Ocr PATH = os.path.abspath(os.path.dirname(os.path.dirname(...
test_dependentqueue.py
from multiprocessing import Manager, Process from queue import Queue, Empty import logging from ctypes import c_int import time import pytest from tx.functional.either import Left, Right from tx.functional.maybe import Just from tx.parallex.dependentqueue import DependentQueue, Node from tx.readable_log import getLogge...
util.py
# # Copyright (C) 2012-2013 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import shutil import socket import...
graham_valuation.py
#!/usr/bin/env python3 # Princípios utilizados: # - [x] 1. Sobrevivência: Sobreviveu nos últimos 10 anos. https://www.estrategista.net/o-fracasso-de-benjamin-graham-na-bolsa-atual/ # - [x] 2. Estabilidade ds Lucros: Lucro > 0 nos últimos 10 anos. https://www.estrategista.net/o-fracasso-de-benjamin-graham-na-bolsa-a...
multiverse_pt.py
#!/usr/bin/env python ''' engine_mx Created by Seria at 12/02/2019 3:45 PM Email: zzqsummerai@yeah.net _ooOoo_ o888888888o o88`_ . _`88o (| 0 0 |) O \ 。 / O _____/`-----‘\_____ .’ \|| _ _ ||/ ...
job.py
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
client.py
import json import base64 from zipfile import ZipFile import requests import threading from uuid import UUID from os import urandom from time import timezone, sleep from typing import BinaryIO, Union from binascii import hexlify from time import time as timestamp from locale import getdefaultlocale as locale from .l...
conftest.py
""" Unit test fixture module. """ import threading import time import mock import pytest from mock.mock import MagicMock from core.api.grpc.client import InterfaceHelper from core.api.grpc.server import CoreGrpcServer from core.api.tlv.corehandlers import CoreHandler from core.emane.emanemanager import EmaneManager ...
scheduler.py
"""Distributed Task Scheduler""" import os import pickle import logging from warnings import warn import multiprocessing as mp from collections import OrderedDict from .remote import RemoteManager from .resource import DistributedResourceManager from ..core import Task from .reporter import * from ..utils import AutoG...
coap.py
import logging import random import socket import threading import time import collections from coapthon import defines from coapthon.layers.blocklayer import BlockLayer from coapthon.layers.messagelayer import MessageLayer from coapthon.layers.observelayer import ObserveLayer from coapthon.layers.requestlayer import ...
measure_recorder.py
import time import threading import csv import os.path import datetime import logging class MeasureRecorder: """Records the measures and writes the to csv-file""" def __init__(self, data_file, measure_frequency_sec, board, gps, bme280InCapsule, bme280Outside): self._logger = logging.getLogger(self...
TreeGopher.py
import queue import threading import pituophis import PySimpleGUI as sg import pyperclip import os # This is a graphical Gopher client in under 250 lines of code, implemented with Pituophis and PySimpleGUI for an interface. Pyperclip is used for the "Copy URL" feature. # A tree is used for loading in menus, similar to...
lisp-etr.py
#----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain ...
schedule.py
import time from multiprocessing import Process import asyncio import aiohttp try: from aiohttp.errors import ProxyConnectionError,ServerDisconnectedError,ClientResponseError,ClientConnectorError except: from aiohttp import ClientProxyConnectionError as ProxyConnectionError,ServerDisconnectedError,ClientRespons...
stack_monitor.py
import linecache import logging import os import sys import time import threading import typing as T logger = logging.getLogger(__name__) class StackMonitor: """ Uses code from the hanging_threads library: https://github.com/niccokunzmann/hanging_threads """ def __init__(self, name, **kwargs): ...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test dftzd shutdown.""" from test_framework.test_framework import BitcoinTestFramework from test_framework....
dock_tool.py
import os import re import time import multiprocessing from threading import Thread from collections import defaultdict import json MEMORY_PATH = '/sys/fs/cgroup/memory/docker' CPUACCT_PATH = '/sys/fs/cgroup/cpuacct/docker/' PID_PATH = '/sys/fs/cgroup/devices/docker' PATH_BW = "/proc/net/route" IMAGE_PATH = '/var/lib/...
singleMachine.py
# Copyright (C) 2015-2016 Regents of the University of California # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
read_nii_files_parallel_processing.py
# This code loads the nii files (in parallel) and saves them in to types: 1- all 3 views in one figure; 2) all individual slices in specified folders. # Written by Azam Hamidinekoo, Aberystwyth University, 2019 #------------------------------------------------------------------------------------------------------- im...
partial.py
# flake8: noqa import multiprocessing from builtins import __test_sink, __test_source from functools import partial def a_flows_to_sink(a, b): __test_sink(a) def partial_application_with_tainted(): x = __test_source() partial(a_flows_to_sink, x) def partial_application_with_benign(): x = 1 par...
decorators.py
# -*- coding: utf-8 -*- # @Date : 2016-01-23 21:40 # @Author : leiyue (mr.leiyue@gmail.com) # @Link : https://leiyue.wordpress.com/ def async(func): from threading import Thread from functools import wraps @wraps(func) def wrapper(*args, **kwargs): thr = Thread(target=func, args=args, ...
mitm_relay.py
#!/usr/bin/env python3 import sys import socket import ssl import os import requests import argparse import time import string from http.server import HTTPServer, BaseHTTPRequestHandler from threading import Thread from select import select BIND_WEBSERVER = ('127.0.0.1', 49999) BUFSIZE = 4096 __prog_name__ = 'mitm_...
_GPIO.py
#!/usr/bin/env python # Allison Creely, 2018, LGPLv3 License # Rock 64 GPIO Library for Python # Import modules import os.path from multiprocessing import Process, Value from time import time from time import sleep # Define static module variables var_gpio_root = '/sys/class/gpio' ROCK = 'ROCK' BOARD = 'BOARD' BCM =...
test_restful.py
#!/usr/bin/python3 ''' SPDX-License-Identifier: Apache-2.0 Copyright 2017 Massachusetts Institute of Technology. NOTE: This unittest is being used as a procedural test. The tests must be run in-order and CANNOT be parallelized! Tests all but two RESTful interfaces: * agent's POST /v2/keys/vkey - Done by C...
mutex.py
import time from threading import Thread, Lock mutex = Lock() def foo(id): mutex.acquire() # comment out this line of code to test what happens without the mutex for _ in range(100): print("Thread id:", id) time.sleep(0.05) mutex.release() # comment out this line of code to test what ha...
train_extractive.py
#!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import torch import distributed from models import data_loader, model_builder from models.data_loader import load_dataset from models.model_builder im...
pal_rpc.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # pal_python: pal_rpc.py # # Copyright (c) 2014 PAL Robotics SL. All Rights Reserved # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the # above copyright notice and this permissio...
dist_autograd_test.py
import sys import threading import time import unittest from enum import Enum import torch from datetime import timedelta import torch.distributed as dist import torch.distributed.autograd as dist_autograd import torch.distributed.rpc as rpc import torch.testing._internal.dist_utils from torch.autograd import Function ...
opcua_converter.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 in ...
tankmonitor.py
from threading import Lock, Thread from tornado.web import Application, RequestHandler, HTTPError from tornado.httpserver import HTTPServer from tornado.template import Template from tornado.ioloop import IOLoop, PeriodicCallback from tornado.gen import coroutine from tornado.concurrent import run_on_executor from sock...
utils.py
#---------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. #------------------------------------------------------------------...
GPIOBase.py
from abc import ABC, abstractmethod from enum import Enum from ROCK.Rock64Configs import BaseConfig import sys import os import select from threading import Thread import time ROCK64 = 'ROCK64' BOARD = 'BOARD' BCM = 'BCM' IN = "in" OUT = "out" NONE = "none" RISING = "rising" FALLING = "falling" BOTH = "both" HIGH,...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional from PyQt5.QtCore i...
x8_mmw.py
# # Copyright (c) 2020, Manfred Constapel # This file is licensed under the terms of the MIT license. # # # TI IWR6843 ES2.0 @ mmWave SDK demo of SDK 3.4.0.3 # TI IWR1843 ES1.0 @ mmWave SDK demo of SDK 3.4.0.3 # import sys import json import serial import threading import struct from lib.shell import * from lib.help...
process_replay.py
#!/usr/bin/env python3 import capnp import os import sys import threading import importlib import time if "CI" in os.environ: def tqdm(x): return x else: from tqdm import tqdm # type: ignore from cereal import car, log from selfdrive.car.car_helpers import get_car import selfdrive.manager as manager import ...
sqlInit.py
import multiprocessing as mp from dumpDist import MYSQL_DUMP_DIST from dumpJson import MYSQL_DUMP_JSON from dumpNext import MYSQL_DUMP_NEXT from dumpVertex import MYSQL_DUMP_VERTEX from dumpposter import MYSQL_DUMP_POSTER if __name__ == '__main__': func = [MYSQL_DUMP_DIST, MYSQL_DUMP_JSON, MYSQL_DUMP_NEXT, MYSQL_D...
PortScanner.py
import socket from core import logger class Auxiliary: config={ "RHOST":"127.0.0.1" "Thread":"300" } def show_options(self): print(Fore.YELLOW+"Options"+Style.RESET_ALL) print(Fore.YELLOW+"-------"+Style.RESET_ALL) for key in sorted(self.config.keys()): print(Fore.YELLOW+key, self.config[key], self.ge...
tests.py
# -*- coding:utf-8 -*- from __future__ import unicode_literals import unittest from io import BytesIO from decimal import Decimal import threading from importlib import import_module from ijson import common from ijson.backends.python import basic_parse from ijson.compat import IS_PY2 JSON = b''' { "docs": [ {...
api.py
import threading import copy import logging import jsonpickle from flask import Flask, jsonify, abort, request from flask_cors import CORS from matrx.messages.message import Message from matrx.agents.agent_utils.state import State _debug = True __app = Flask(__name__) CORS(__app) _port = 3001 # states is a list of...
email.py
from flask import current_app def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body): msg = Message(subject, sender=sender, recipients=recipients) msg.body = text_body msg.html = html_body Thread(target=send_async_email, args=(cu...
servers.py
# 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 required by applicable ...
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 traceback import types import io import linecache from code import InteractiveInterpreter from platform import python_version, system try: from t...
HiwinRA605_socket_ros_test_20190626114057.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import HiwinRA605_s...
03_multiprocessing.py
import multiprocessing import time start = time.perf_counter() def do_something(seconds): print(f'Sleep {seconds} second(s)...') time.sleep(seconds) print('Done sleeping...') processes = [] for _ in range(10): p = multiprocessing.Process(target=do_something, args=[1.5]) p.start() processes.a...
worker_handlers.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 us...
quantize_ssd_w6a32.py
#!/usr/bin/env python # -------------------------------------------------------- # Quantize Fast R-CNN based Network # Written by Chia-Chi Tsai # -------------------------------------------------------- """Quantize a Fast R-CNN network on an image database.""" import os os.environ['GLOG_minloglevel'] = '2' import _...
lazy_process.py
import threading import time import subprocess class LazyProcess( object ): """ Abstraction describing a command line launching a service - probably as needed as functionality is accessed in Galaxy. """ def __init__( self, command_and_args ): self.command_and_args = command_and_args s...
parity_check_helper.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # This s...
bsv-pbv-submitblock.py
#!/usr/bin/env python3 # Copyright (c) 2019 Bitcoin Association # Distributed under the Open BSV software license, see the accompanying file LICENSE. """ We will test the following situation where block 1 is the tip and three blocks are sent for parallel validation: 1 / | \ 2 3 4 Blocks 2,4 are hard to valid...
build.py
#!/usr/bin/env python3 # Copyright (c) 2020-2021, Videonetics Technology Pvt Ltd. All rights reserved. # mypy: ignore-errors import argparse import glob import logging import os import pathlib import platform from posixpath import join import shutil import signal import subprocess import sys import time import traceba...
nb_inventory.py
# Copyright (c) 2018 Remy Leone # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = """ name: nb_inventory plugin_type: inventory author: - Remy Leone (@s...
test_basic.py
import gc import re import time import uuid import warnings import weakref from datetime import datetime from platform import python_implementation from threading import Thread import pytest import werkzeug.serving from werkzeug.exceptions import BadRequest from werkzeug.exceptions import Forbidden from werkzeug.excep...
parse_works_metadata_from_htmls_to_db.py
#!/usr/bin/env python3 from urllib.parse import urlsplit, parse_qs, parse_qsl, unquote, quote, urljoin, urlencode, quote_plus import json import time import sqlite3 import sqlalchemy.exc import os import threading, queue from pathlib import Path from typing import Optional, Union from dataclasses import dataclass impor...
sidecar_evaluator_test.py
# Lint as: python3 # Copyright 2020 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 ...