source
stringlengths
3
86
python
stringlengths
75
1.04M
server3.py
# import flask from flask import Flask, request, render_template from flask_socketio import SocketIO, emit, send import datetime import time from random import random from numpy import genfromtxt from threading import Thread sample_data = genfromtxt("data-group6.csv", delimiter=",") index_data = 0 file = open("my-pr...
esloader_finnews_mt2.py
import csv from datetime import datetime from elasticsearch import Elasticsearch import json import sys import argparse import os from multiprocessing import Process from elasticsearch.helpers import bulk from elasticsearch.helpers import streaming_bulk from elasticsearch.helpers import parallel_bulk impor...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from collections import OrderedDict import os import pickle import random import re import subprocess import sys import sysconfig import textwrap import threading import ...
test_networking.py
import contextlib import enum import json import logging import subprocess import threading import time import uuid from collections import deque import pytest import requests import retrying import test_helpers from dcos_test_utils import marathon from dcos_test_utils.helpers import assert_response_ok __maintaine...
scip_tuning_dqn_learner.py
import time from collections import deque import pyarrow as pa import zmq import threading import time import numpy as np from utils.data import Transition import os from gnn.models import SCIPTuningQnet import torch import torch.optim as optim import torch.nn.functional as F from torch_scatter import scatter_mean, sca...
ros_arrowhead.py
#!/usr/bin/env python3 import rospy import threading from arm_control.srv import * def get_keyboard_input(): while(True): inp = input("type something ") if inp == "follow": pass elif inp == "forward": pass elif inp == "left": pass elif i...
test_signal.py
import enum import errno import inspect import os import random import signal import socket import statistics import subprocess import sys import threading import time import unittest from test import support from test.support import os_helper from test.support.script_helper import assert_python_ok, spawn_python try: ...
common.py
import inspect import json import os import random import subprocess import ssl import time import requests import ast import paramiko import rancher import pytest from urllib.parse import urlparse from rancher import ApiError from lib.aws import AmazonWebServices from copy import deepcopy from threading import Lock fr...
ip_lib.py
# Copyright 2012 OpenStack Foundation # 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 requ...
_coreg_gui.py
# -*- coding: utf-8 -*- u"""Traits-based GUI for head-MRI coregistration. Hierarchy --------- This is the hierarchy of classes for control. Brackets like [1] denote properties that are set to be equivalent. :: CoregFrame: GUI for head-MRI coregistration. |-- CoregModel (model): Traits object for estimating the h...
SecondTimer.py
import threading class SecondTimer(object): def __init__(self, seconds): object.__init__(self) self.__executors = [] self.__seconds = seconds self.__elapsed = 0 def get_elapsed(self): return self.__elapsed def set_elapsed(self, elapsed): self.__elapsed = e...
autologin2.py
import time import pythoncom from manuallogin import * from PyQt5 import QtWidgets from PyQt5.QtCore import QTimer from multiprocessing import Process from PyQt5.QAxContainer import QAxWidget sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from utility.setting import openapi_path app = QtWi...
conftest.py
import fcntl import inspect import json import os import platform import re import shutil import signal import stat import subprocess import sys import tempfile import time from multiprocessing import Process import pytest from unit.check.go import check_go from unit.check.isolation import check_isolation from unit.c...
tofino-model.py
# coding=utf-8 # Copyright 2018-present Open Networking Foundation # SPDX-License-Identifier: Apache-2.0 ''' This module contains a switch class for Mininet: StratumTofinoModel Usage ----- From withing the Docker container, you can run Mininet using the following: $ mn --custom tools/mininet/tofino-model.py --switch ...
conftest.py
import asyncio import errno import logging import os import socket import tempfile import threading import time from unittest import mock import pytest from aiohomekit import Controller from aiohomekit.controller.ip import IpPairing from aiohomekit.model import Accessory, mixin as model_mixin from aiohomekit.model.ch...
PiRadio.py
# # # # # # # # # # # # # # # # # # # # Pi Radio # # By # # Jackson # # Hoggard # # (c)2018 # # # # # # # # # # # # # # # # # # # # import os, argparse, random from colorama import Fore, Back, Style from multiprocessing import Process parser = argparse.ArgumentParser(pr...
main.py
from tkinter import * import sqlite3 from datetime import date from datetime import datetime import re import time import random #from decimal import * from tkinter import ttk import threading root = Tk() root.title("Stock App") root.geometry("620x300") #root.grid_rowconfigure(0, weight=1) #root.grid_co...
sfx.py
#!/usr/bin/env python3 # coding: latin-1 from __future__ import print_function, unicode_literals import re, os, sys, time, shutil, signal, threading, tarfile, hashlib, platform, tempfile, traceback import subprocess as sp """ to edit this file, use HxD or "vim -b" (there is compressed stuff at the end) run me with...
vec_env.py
''' A wrapper for running multiple environments with multiple processes Reference: https://github.com/openai/baselines/blob/master/baselines/common/vec_env/subproc_vec_env.py ''' import multiprocessing as mp from rlcard.utils import reorganize class VecEnv(object): ''' The wrraper for a vector of environments...
taskproc.py
import sys,os import json import threading import time from abc import ABCMeta,abstractmethod import logging import logging.handlers import traceback import requests as rq from requests.exceptions import ConnectionError from .neutuseurl import neutuse_url class TaskProcessor(): ''' This class is the b...
magpy_gui.py
#!/usr/bin/env python from __future__ import print_function import wx from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure try: from pubsub import pub except: try: # Necessary for w...
wsgi_liveserver.py
# -*- coding: utf-8 -*- """ wsgi-liveserver provides a simple LiverServerTestCase class that can be used to help start a web server in the background to serve a WSGI compliant application for use with testing. Generally it will be used in conjuction with something like Selenium to perform a series of functional tests u...
process.py
import multiprocessing def f() -> None: print('I am in\n') p = multiprocessing.Process(target=f) p.start() p.join()
pranjan77_ContigFilterServer.py
#!/usr/bin/env python 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, ServerError, InvalidRequestE...
nonblocking_acquire.py
#!/usr/bin/env python3 """ Two shoppers adding items to a shared notepad """ import threading import time items_on_notepad = 0 pencil = threading.Lock() def shopper(): global items_on_notepad name = threading.current_thread().getName() items_to_add = 0 while items_on_notepad <= 20: ...
ConductorWorker.py
# # Copyright 2017 Netflix, 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...
lfu.py
import threading,time,subprocess,shlex import argparse import time import random from readerwriterlock import rwlock from collections import defaultdict time_dict = [] workload = "" capacity = 0 freq = defaultdict(int) big_lock = threading.Lock() def deploy(workload, id): return "sudo ./deploy_gpu.sh {0} {0}{1} >...
main.py
import cv2 import sys from mail import sendEmail from flask import Flask, render_template, Response from camera import VideoCamera import time import numpy as np import threading import os email_update_interval = 60 # sends an email only once in this time interval object_classifier = cv2.CascadeClassifier("haarcascad...
common_utils.py
r"""Importing this file must **not** initialize CUDA context. test_distributed relies on this assumption to properly run. This means that when this is imported no CUDA calls shall be made, including torch.cuda.device_count(), etc. torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported....
jenkinslib.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2010, Willow Garage, 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...
test_forward.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
serialConn.py
'''Communicates directly with arduinos and other serial controlers Connections will be global ''' import serial import serial.tools.list_ports import threading def start (): for p in serial.tools.list_ports.comports(): if "Arduino" in p[1]: serialConn.serialConns.append(serialConn(p[0])) ...
leaderelection.py
# Copyright 2021 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 applicable law or agreed to ...
server.py
import csv from hashlib import sha1 import os import pickle import random import socket from threading import ( Lock, Thread, ) from ciphers import ( Caesar_Cipher, ) from constants import ( PORT, ) from message import ( Header, Message, ) from utils import ( gen_keys, modularquickpow, ...
tests.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...
distributed.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. """Distributed helpers.""" import multiprocessing import os import random import signal import threading import trace...
main.py
import os import pdb import sys import time import copy import socket from threading import Thread from PyQt5.QtGui import QIcon, QPalette, QBrush, QPixmap, QColor from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox, QListWidgetItem from PyQt5.QtCore import QTimer, pyqtSignal, Qt, QSize fro...
trt_yolo_tracklite_mysql_500executemany.py
"""trt_yolo.py This script demonstrates how to do real-time object detection with TensorRT optimized YOLO engine. """ import os import time import argparse import cv2 import pycuda.autoinit # This is needed for initializing CUDA driver import mysql.connector from mysql.connector import pooling import pymysql from...
test_vissharedmemreaderwriter.py
# === Start Python 2/3 compatibility from __future__ import absolute_import, division, print_function, unicode_literals from future.builtins import * # noqa pylint: disable=W0401, W0614 from future.builtins.disabled import * # noqa pylint: disable=W0401, W0614 # == End Python 2/3 compatibility import logging import...
source.py
import logging import os import re from contextlib import contextmanager from hashlib import md5 from queue import Queue from threading import Thread from typing import ContextManager, Iterable import tensorflow as tf from tf_bodypix.utils.image import resize_image_to, ImageSize, ImageArray # pylint: disable=import...
app.py
from flask import Flask, render_template, redirect, request, flash, jsonify from flask import session from flask_session import Session from config import Config from forms import UserNameForm from forms import postUrlForm from markupsafe import escape import BlurtChain as BC import threading app = Flask(__name__) ap...
rpc_test.py
import concurrent.futures import contextlib import json import os import sys import threading import time import unittest from collections import namedtuple from functools import partial from threading import Event from threading import Lock from unittest import mock import torch import torch.nn as nn import torch.di...
ssh.py
# Date: 07/27/2018 # Author: Pure-L0G1C # Description: Secure shell import os import ssl import socket import subprocess from queue import Queue from threading import Thread from socket import timeout as TimeOutError class Communicate(object): def __init__(self, session): self.recvs_decryp...
__init__.py
""" A package for creating Extract-Transform-Load (ETL) programs in Python. The package contains a number of classes for filling fact tables and dimensions (including snowflaked and slowly changing dimensions), classes for extracting data from different sources, classes for defining 'steps' in an ETL f...
TaskList.py
#!/usr/bin/python3.4 # -*-coding:Utf-8 -* '''module to manage task list''' import xml.etree.ElementTree as xmlMod import os, re, math, threading, socket, time from usefullFunctions import * from save import * from TaskList.Task import * from TaskList.FileInfo.FileInfo import * class TaskList: '''class to manage task ...
confirm.py
from threading import Thread from typing import Callable from django.conf import settings from django.core.mail import EmailMultiAlternatives from django.template.loader import render_to_string from django.urls import get_resolver from django.utils import timezone from .errors import InvalidUserModel, NotAllFieldComp...
wallet.py
import copy, hashlib, json, logging, os import time from .device import Device from .key import Key from .util.merkleblock import is_valid_merkle_proof from .helpers import der_to_bytes from .util.base58 import decode_base58 from .util.descriptor import Descriptor, sort_descriptor, AddChecksum from .util.xpub import ge...
BuildReport.py
## @file # Routines for generating build report. # # This module contains the functionality to generate build report after # build all target completes successfully. # # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made a...
events.py
import base64 import datetime import socket import select from threading import Thread import xml from xml.dom import minidom from . import strings POLL_TIME = 5 STATE_CNTRLS = ['ST', 'LUMIN', 'CLITEMP', 'CLIHUM', 'UV', 'BATLVL', 'TPW', 'CC', 'CV'] class EventStream(socket.socket): def __init__(self, parent, los...
multiple_threads.py
#!/usr/bin/env python3 """ Threads that waste CPU cycles """ import os import threading # a simple function that wastes CPU cycles forever def cpu_waster(): while True: pass def start_n_wasters(n=12): print('\nStarting 12 CPU Wasters...') for i in range(n): threading.Threa...
gui.py
# -*- coding: utf-8 -*- import asyncio import logging import threading import aiohttp import tornado.ioloop import tornado.web import api.chat import config import main import models.avatar import models.translate import models.database import update import window.main from window.console import ConsoleHandler def...
app.py
import os import re import math import sys import shutil import json import traceback import PIL.Image as PilImage import threading import tkinter as tk from tkinter import messagebox from tkinter import ttk from tkinter import filedialog from constants import * from config import ModelConfig, OUTPUT_SHAPE1_MAP, NETWOR...
FuzzingInTheLarge.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This material is part of "The Fuzzing Book". # Web site: https://www.fuzzingbook.org/html/FuzzingInTheLarge.html # Last change: 2020-10-13 15:12:25+02:00 # #!/ # Copyright (c) 2018-2020 CISPA, Saarland University, authors, and contributors # # Permission is hereby grant...
dogcamsocket.py
from dogcamlogger import DogCamLogger, DCLogLevel import websocket import threading import time import json class DogCamSocket(): __socket = None __thread = None __processing = False __reconnect = False __reconnectTimeout = 0.0 __maxTimeout = 0.0 URL = "" def __init__(self, dest, MaxTim...
_threadedselect.py
# -*- test-case-name: twisted.test.test_internet -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Threaded select reactor The threadedselectreactor is a specialized reactor for integrating with arbitrary foreign event loop, such as those you find in GUI toolkits. There are three things...
cluster_coordinator_test.py
# 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 required by applicable ...
mi_ms.py
import sys, os import skimage import skimage.io as skio #sys.path.insert(0,'/data2/johan/buildse/SimpleITK-build/Wrapping/Python') import SimpleITK as sitk from multiprocessing import Process, Queue #def parse_log_str(s): # ss = 'Final metric value = ' # ind = s.find(ss) + len(ss) # print(ind) # prin...
main.py
import asyncio import json import logging import os import re import sys import threading from typing import Dict, List, Tuple, Optional import markdown import urllib3 import urllib.parse import discord import matrix from appservice import AppService from cache import Cache from db import DataBase from errors import ...
traffic_util.py
""" Copyright (c) 2017-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. """ import copy import ctypes i...
chapter9_8.py
# This example referenced Miguel Grinberg's code on Github: # https://github.com/miguelgrinberg/oreilly-flask-apis-video/blob/master/camera/camera.py # from flask import Flask, url_for, jsonify, request,\ make_response, copy_current_request_context from flask_sqlalchemy import SQLAlchemy from chapter9_pexpect_1 im...
TESTui.py
from numpy.core.fromnumeric import var from models import create_model from data import CreateDataLoader import sys, os, math, threading, time import tkinter as tk import tkinter.font as font from tkinter import * from tkinter import tix,ttk, filedialog, scrolledtext from options.test_options import TestOptions from u...
multiprocapplyevents.py
from piestats.update.applyevents import ApplyEvents from setproctitle import setproctitle import multiprocessing import Queue import os class MultiProcApplyEvents(ApplyEvents): def __init__(self, *args, **kwargs): super(MultiProcApplyEvents, self).__init__(*args, **kwargs) self.workers = [] self.kill...
streams.py
# -*- coding: utf-8 -*- from queue import Queue, Empty from threading import Thread from core.helpers.decode import OutputDecoder """ Helper classes to manage streams """ class OutputReader(object): """ Non-blocking stream reader. Uses in WebConsole. """ def __init__(self, stream): """...
test_io.py
from __future__ import division, absolute_import, print_function import sys import gzip import os import threading import time import warnings import io import re import pytest from tempfile import NamedTemporaryFile from io import BytesIO, StringIO from datetime import datetime import locale import numpy as np impor...
tests.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...
modbus_connector.py
# Copyright 2021. ThingsBoard # # 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 ...
tools.py
import glob import os import platform import re import subprocess import time from threading import Thread import json import cv2 import numpy as np import TRTYolov5 as trt import traceback img_formats = ['bmp', 'jpg', 'jpeg', 'png', 'tif', 'tiff', 'dng', 'webp', 'mpo'] # acceptable image suffixes vid_formats = ['mov...
test_dist_graph_store.py
import os os.environ['OMP_NUM_THREADS'] = '1' import dgl import sys import numpy as np import time import socket from scipy import sparse as spsp from numpy.testing import assert_array_equal from multiprocessing import Process, Manager, Condition, Value import multiprocessing as mp from dgl.heterograph_index import cre...
sim.py
#!/usr/bin/env python3 from animals import Beaver, Position, Lynx from threading import Thread from time import sleep from sys import exit from tkinter import * class WorldCanvas(Canvas): def __init__(self, master): Canvas.__init__(self, master, bg="green", width=500, height=500) self._beavers = [...
client.py
import sys import signal from threading import Thread from scripts.client_p import ClientP, SplitTextBlock from scripts.log_output import log_output from scripts.client_socket import client_socket from client_config import CLIENT_USER, CLIENT_PASS class Client(): def __init__(self): self._client_p = None ...
thread_callbacks.py
#!/usr/bin/env python2 import urllib2 as u import json import time import threading as t import random class Observer(object): """ The oberver here works like an event dispatcher, executing the callbacks in the order they were registered """ def __init__(self): self.callback_list = [] ...
original.py
from matrix import* from random import* import time import LED_display as LMD import threading from score import* def LED_init(): #LED에 불 들어오게 하기 위한 함수(threading) thread=threading.Thread(target=LMD.main, args=()) thread.setDaemon(True) thread.start() return def draw_matrix(m): #...
controller.py
# External Dependencies import time import re from multiprocessing import Process, Queue from subprocess import call import os, sys from embit import bip32, script, ec from embit.networks import NETWORKS from embit.descriptor import Descriptor from binascii import hexlify from threading import Thread from queue import ...
webserver.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "I'm alive" def run(): app.run(host='0.0.0.0', port=8080) def keep_alive(): t = Thread(target=run) t.start()
process_util.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2015 Baidu, 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/LICE...
mediafrost_remote.py
import socket import sys import os import traceback import errno import time import threading from sets import Set import mediafrost as frost self_path = os.path.realpath(__file__) self_dir = os.path.dirname(self_path) self_test_cache = os.path.join(os.path.join(self_dir, 'test'), 'cache') #frost.printDiskInfo() fs...
simulation_3.py
import network_3 import link_3 as link import threading from time import sleep # configuration parameters router_queue_size = 0 # 0 means unlimited # give the network_3 sufficient time to transfer all packets before quitting simulation_time = 10 if __name__ == '__main__': object_L = [] # keeps track of objects,...
test_cmd_serve.py
import functools import os import time import threading from .test_utils import ( CliTestCase, skip_if_environ, TEST_REPOS_DIR, ) from . import network_util class ServeTestCase(CliTestCase): @skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS") def test_serve(self): port = network_util.get_free_...
p2pchat.py
# Some starter code from: https://medium.com/swlh/lets-write-a-chat-app-in-python-f6783a9ac170 # Created by AJ Natzic import socket import sys import threading import tkinter as tk import webbrowser # Used to listen for peer (acts as host) def listen(portd, si) : si = socket.socket() si.bind(('', portd)) ...
mcall.py
#!/usr/bin/env python import argparse # Local module import subprocess as sp import traceback import os.path as path import os import errno import threading as t import sys import datetime from time import time,gmtime,sleep import signal import queue as qu helpText="""\ Evaluate a list of calls, in parallel. The ca...
ConsumerManager.py
from BrokerManager import BrokerManager from MessageMonitor import MessageMonitor from MultiTopicConsumer import MultiTopicConsumer from printer import console_out import random from random import shuffle import time import threading from printer import console_out_exception class ConsumerManager: def __init__(sel...
cli.py
# -*- coding: utf-8 -*- # Copyright 2015-2016 Cisco Systems, 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/LI...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from electrum.wal...
linkchecker.py
import os import http.client import urllib.request import sys import threading import time def StartServer(): try: print("\n Attempting To Start Server With Process ID " + str(os.getpid())) os.system('php -S localhost:80 -t ' + sys.argv[1]) except(IndexError): print ("\n Server Startup ...
fifo_queue_test.py
"""Tests for tensorflow.ops.data_flow_ops.FIFOQueue.""" import random import re import time import tensorflow.python.platform import numpy as np import tensorflow as tf class FIFOQueueTest(tf.test.TestCase): def testConstructor(self): with tf.Graph().as_default(): q = tf.FIFOQueue(10, tf.float32, name=...
test.py
from tag import * from tkinter.ttk import * from tkinter import * from PIL import ImageTk, Image import threading from time import sleep import math import datetime import csv minDistance = 5 t1name = "Phillip Gaskin" t2name = "Josh Hutchins" t3name = "James Anderson" t4name = "Jacob Beach" t5name = "Zephan Spencer"...
observable.py
import abc import logging import threading import time from typing import TypeVar, Generic T = TypeVar('T') LOGGER = logging.getLogger('script_server.observable') class ObservableBase(Generic[T], metaclass=abc.ABCMeta): def __init__(self): self.observers = [] self.closed = False self.cl...
exp_utils.py
#!/usr/bin/env python # Copyright 2018 Division of Medical Image Computing, German Cancer Research Center (DKFZ). # # 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...
stress.py
#!/usr/bin/env python3 import argparse import os, atexit import textwrap import time import threading, subprocess import signal import random import time from enum import Enum from collections import defaultdict, OrderedDict PROCESSES_BASE_IP = 11000 class ProcessState(Enum): RUNNING = 1 STOPPED = 2 T...
fixtures.py
# coding: utf-8 # Original work Copyright Fabio Zadrozny (EPL 1.0) # See ThirdPartyNotices.txt in the project root for license information. # All modifications Copyright (c) Robocorp Technologies Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file e...
report.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Simple example for a search & report tool using the pyILT2 library. (c) 2018 Frank Roemer; see http://wgserve.de/pyilt2 Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php """ from . import (properties, prop2abr, abr2prop, query, __vers...
basic_ops.py
import json from random import choice, randint from threading import Thread from BucketLib.BucketOperations import BucketHelper from BucketLib.bucket import Bucket from basetestcase import BaseTestCase from Cb_constants import constants, CbServer, DocLoading from cb_tools.cbepctl import Cbepctl from cb_tools.cbstats i...
05_多线程.py
import threading # #################### 1. 计算密集型多线程无用 #################### # v1 = [11, 22, 33] # +1 # v2 = [44, 55, 66] # 100 # # # def func(data, plus): # for i in range(len(data)): # data[i] = data[i] + plus # # # t1 = threading.Thread(target=func, args=(v1, 1)) # t1.start() # print(v1) # # t2 = thread...
wamplite.py
# Light-weight wamp client, for python 2 & python 3 # # Copyright (c) 2017 Darren Smith # # pywamp is free software; you can redistribute it and/or modify # it under the terms of the MIT license. See LICENSE for details. # import logging import base64 import hashlib import hmac import json import ssl import threading...
test_client.py
"""aiotwitter client tests""" from http import server, HTTPStatus from random import randrange from threading import Thread from time import sleep from unittest import mock, IsolatedAsyncioTestCase, TestCase from ..aiotwitter import client, nonce class MockAPI(server.BaseHTTPRequestHandler): """mock twitter back...
base_transform.py
#!/usr/bin/env python3 import os, time, multiprocessing import ujson as json from BML import utils from BML.utils import ProcessingQueue from BML.data.routes import dumpRoutes, getUpdatesInfos, parseUpdate, updateRoutes from math import ceil class BaseTransform(utils.BmlProcess): computeRoutes = True comput...
pivideostream.py
# import the necessary packages from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread import cv2 class PiVideoStream: def __init__(self, resolution=(320, 240), framerate=32): # initialize the camera and stream self.camera = PiCamera() self.camera.r...
reducer_test.py
# Copyright 2020 Petuum, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
util.py
import hashlib import http.server import json import os import re import shutil import socketserver import subprocess from contextlib import contextmanager, ExitStack from itertools import chain from multiprocessing import Process from shutil import rmtree, which from subprocess import check_call import requests impor...
threadingPython.py
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at # McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/) # # 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...