source
stringlengths
3
86
python
stringlengths
75
1.04M
padding_fifo_queue_test.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
OnlineLogger.py
import os import sys import time import threading import json import datetime import random import requests import uuid from pathlib import Path import zipfile class Watcher(object): running = True refresh_delay_secs = 1 # Constructor def __init__(self, watch_file, call_func_on_change=None, *args, **...
OnlineSpikePlot.py
#!/usr/bin/env python ''' This is the input node that receives spikes and generates a plot. LINUX VERSION! ''' import numpy import socket import sys import argparse import matplotlib.pyplot as plt import time from multiprocessing import Process, Pipe from select import select # import os, signal # to read back the ...
__main__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # MIT License # Copyright (c) 2020 Stɑrry Shivɑm // This file is part of AcuteBot # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE A...
zhihu_answer.py
import requests import json import re import threading import time import os import hashlib import execjs from spider.ProxyPool import Proxy_pool class zhihu_answer(): question_id = 0 begin_id = 0 similar_question_url_list = [] copy_list = [] question_count = 20 proxy_pool = Proxy_pool() ...
app.py
# encoding: utf-8 ''' A REST API for Salt =================== .. versionadded:: 2014.7.0 .. py:currentmodule:: salt.netapi.rest_cherrypy.app :depends: - CherryPy Python module. Version 3.2.3 is currently recommended when SSL is enabled, since this version worked the best with SSL in internal testing....
jspagescraper.py
from multiprocessing import Process, Manager, cpu_count import webkit_server import dryscrape from sa.database import Database from sa.logger import LOGGER def get_html(urlQ, callback, xpath_hooks): """ This page takes a url from the URL Queue (urlQ) and calls a callbac that will handle the page source. ...
player.py
""" The MIT License (MIT) Copyright (c) 2015-2021 Rapptz Copyright (c) 2021-present Disnake Development 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 limi...
lambda_executors.py
import os import re import json import time import logging import threading import subprocess # from datetime import datetime from multiprocessing import Process, Queue try: from shlex import quote as cmd_quote except ImportError: # for Python 2.7 from pipes import quote as cmd_quote from localstack import ...
test_rest_tracking.py
""" Integration test which starts a local Tracking Server on an ephemeral port, and ensures we can use the tracking API to communicate with it. """ import mock from multiprocessing import Process import os import pytest import socket import time import tempfile from click.testing import CliRunner import mlflow.exper...
test_threads.py
import threading import queue as stdlib_queue import time import pytest from .. import _core from .. import Event, CapacityLimiter, sleep from ..testing import wait_all_tasks_blocked from .._threads import ( to_thread_run_sync, current_default_thread_limiter, from_thread_run, from_thread_run_sync, ...
wallet.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights t...
sim.py
import copy import inspect import itertools from functools import partial import numpy as np import os import random import threading import time as ttime import uuid import weakref import warnings from collections import deque, OrderedDict from tempfile import mkdtemp from .signal import Signal, EpicsSignal, EpicsS...
multithreading_test.py
# Copyright 2019 typed_python 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 a...
alarms.py
import tkinter as tk from tkinter import messagebox from tkinter.font import Font from time import sleep, strftime from threading import Thread try: from alarm import Alarm from sql_connector import SqlConnector except ImportError: from .alarm import Alarm from .sql_connector import SqlConnector class...
management.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Get access to Atlassian User management REST API. You can use the same API key for the organizations REST API and the user management REST API. Create an API key from this URL https://confluence.atlassian.com/x/jPnJOQ This API provides all the access to the User managem...
node_test.py
# (c) Copyright [2015] Hewlett Packard Enterprise Development LP # # 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 r...
main.py
import json import os import tkinter import threading import numpy as np from PIL import Image, ImageTk, ImageSequence from model import PathPlanning from optimizers import fit_value, fit_policy from visualizations import plot_analysis from utils import store_to_file BASE_DIR = os.getcwd() RESULTS_DI...
engine.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/10/28 0028 9:31 # @Author : Hadrianl # @File : engine import traceback from typing import Optional from vnpy.event import Event, EventEngine from vnpy.trader.event import EVENT_TICK, EVENT_TRADE, EVENT_LOG from vnpy.trader.engine import BaseEngine,...
buckethead.py
#!/usr/bin/env python3 # Author: Dwight Hohnstein, Rhino Security Labs (dwight.hohnstein@rhinosecuritylabs.com) from subprocess import check_output, CalledProcessError from os import devnull import logging import sys import traceback from optparse import OptionParser from queue import Queue from threading import Thread...
market_price_batch_view.py
#|----------------------------------------------------------------------------- #| This source code is provided under the Apache 2.0 license -- #| and is provided AS IS with no warranty or guarantee of fit for purpose. -- #| See the project's LICENSE.md for details. -- ...
db_tests.py
from itertools import permutations try: from Queue import Queue except ImportError: from queue import Queue import re import threading from peewee import * from peewee import Database from peewee import FIELD from peewee import attrdict from peewee import sort_models from .base import BaseTestCase from .base ...
allChannels.py
### Script to get all channels from tata sky import threading import requests import json as json API_BASE_URL = "https://kong-tatasky.videoready.tv/" channel_list = [] def getChannelInfo(channelId): url = "{}content-detail/pub/api/v1/channels/{}".format(API_BASE_URL, channelId) x = requests.get(url) ch...
vive_tracker_server.py
""" OpenVr based Vive tracker server """ import argparse import json import logging import logging.handlers import socket from multiprocessing import Queue, Process, Pipe from pathlib import Path from typing import List from typing import Optional import yaml import numpy as np import scipy.spatial.transform as transf...
downl.py
import threading from multiprocessing import cpu_count import cusconf import requests config = cusconf.getconfig() baseheader = { 'User-Agent': config['ua'], 'accept-encoding': 'gzip', 'cookie': config['cookie'] } def Handler(start, end, url, filename): cushander = {'Range': 'bytes=%d-%d' % (start, e...
mesh_release.py
# -*- coding: utf-8 -*- from base.log import * import os from multiprocessing import Process import redis_pool def gen_id(): r = redis_pool.get('dornaemon') return r.incr('deploy_id') def do(release_path, deploy_id): log_path = 'html/deploy_logs/%d.txt' % deploy_id cmd = "python /home/op/mesh_deploy_5.80/no_cat...
chat.py
import websocket import json import logging import asyncio from threading import Thread from threading import Event from realtime_chat.bilibili import blivedm from realtime_chat.bilibili import common from realtime_chat.chats import Chat from realtime_chat.chats import Chats class ChatDownloader(object)...
zeromq.py
# -*- coding: utf-8 -*- """ Zeromq transport classes """ # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import copy import errno import hashlib import logging import os import signal import socket import sys import threading import weakref from random import randint # I...
impl.py
import datetime import locale from multiprocessing import * import os from threading import * from time import sleep import MetaTrader5 as mt5 import toml import wx.stc import ui import impl_config import order import status from enums import * class FrameMainImpl(ui.FrameMain): def __init__(self, *args, **kwds)...
test_rpc.py
import os import time import socket import dgl import backend as F import unittest, pytest import multiprocessing as mp from numpy.testing import assert_array_equal if os.name != 'nt': import fcntl import struct INTEGER = 2 STR = 'hello world!' HELLO_SERVICE_ID = 901231 TENSOR = F.zeros((10, 10), F.int64, F....
main.py
from flask import Flask, request import threading from .grading import gradingProcess from .queryComparison import dataGen app = Flask(__name__) @app.route("/") def index(): return "SQLGrader API" # route for running the grading process by grading_process_id @app.route("/grading/<int:grading_process_id>", method...
api.py
#!/usr/bin/env python3 from threading import Thread from flask import Flask, request from flask_restplus import Resource, Api, fields from parser import parse_instructions from io import open from os.path import isfile app = Flask(__name__) api = Api(app) program = api.model('program', { 'instructions': fields.Li...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import queue as pyqueue import contextlib import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import struct import operator import weakref import test.su...
Server_Socket.py
import socket import threading import Server_GUI import os import cv2 import numpy as np from scipy.linalg import solve import math import time import client TCP_IP = '' TCP_PORT = 1234 send_msg = '' camera_port = 0 rec_result = '' co = 0 # counter of points by mouse when initialize the coordinate ...
happyeyeballs.py
#!/usr/bin/env python # Python implementation of RFC 6555 / Happy Eyeballs: find the quickest IPv4/IPv6 connection # See https://tools.ietf.org/html/rfc6555 # Method: Start parallel sessions using threads, and only wait for the quickest succesful socket connect # If the HOST has an IPv6 address, IPv6 is given a head s...
listener.py
import socket ,signal import sys,os import threading import time from queue import Queue def listener(): NUMBER_OF_THREADS = 2 JOB_NUMBER = [1, 2] queue = Queue() all_connections = [] all_address = [] def controlc_signal(signal,frame): quit_gracefully(signal=None, frame=None) de...
enlaceRx.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ##################################################### # Camada Física da Computação #Carareto #17/02/2018 # Camada de Enlace #################################################### # Importa pacote de tempo import time # Threads import threading # Class class RX(object): ...
test_concurrent_query.py
import os import sys import unittest import threading from redisgraph import Graph, Node, Edge sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from disposableredis import DisposableRedis from base import FlowTestsBase GRAPH_ID = "G" # Graph identifier. CLIENT_COUNT = 16 ...
test_proxy.py
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
test_carbonlookaside_route.py
# Copyright (c) 2015-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the LICENSE # file in the root directory of this source tree. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals...
test_block_until_url.py
#!/usr/bin/python3 # Copyright (c) 2013 The CoreOS 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 http.server import os import select import signal import subprocess import threading import time import unittest from http impor...
Q8-4processos.py
#Dado um vetor A de tamanho N com apenas números inteiros positivos, calcule o fatorial de cada um deles e armazene o resultado em um vetor B. #usando o módulo multiprocessing com 4 processos. import multiprocessing,random def fatorial(n): fat = n for i in range(n - 1, 1, -1): fat = fat * i return (fat) ...
duration.py
# coding: utf-8 import time; import re from systemtools.basics import * from threading import Thread class Timer: def __init__(self, callback, interval, sleepFirst=False, sleepCount=1000): """ interval in seconds """ self.sleepCount = sleepCount self.interval = interva...
run_robot.py
import os import sys import threading import time import numpy as np from PIL import Image from multiprocessing import Process import multiprocessing sys.path.append("/home/ubuntu/Robotics/QuadrupedRobot") sys.path.extend([os.path.join(root, name) for root, dirs, _ in os.walk("/home/ubuntu/Robotics/QuadrupedRobot") f...
calc-network-collaborative-similarity-async.py
import os import sys import phpserialize from multiprocessing import Process from network import Network __DIR__ = os.path.dirname(os.path.abspath(__file__)) if len(sys.argv) != 2 or not sys.argv[1].isdigit(): exit('usage: %s bucket' % sys.argv[0]) # read data file infile = '%s/data/bucket-%03d.txt' % __DIR__ f ...
test_closing.py
from fixtures import * # noqa: F401,F403 from flaky import flaky from lightning import RpcError from utils import only_one, sync_blockheight, wait_for, DEVELOPER, TIMEOUT, VALGRIND, SLOW_MACHINE import os import queue import pytest import re import threading import unittest @unittest.skipIf(not DEVELOPER, "Too slow...
manage.py
#!/usr/bin/env python """ Copyright (c) 2019 - present AppSeed.us """ import os import sys from multiprocessing import Process from detectDrowsiness import cnn def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') try: from django.core.management import execute_from_command_line...
__init__.py
import serial import pynmea2 import threading ser = None lock = threading.Lock() thread = None gga = None gsa = None gsv = None rmc = None def get_gga(): with lock: return gga def __set_gga(val): global gga gga = val def get_gsa(): with lock: return gsa def __set_gsa(val): ...
test_local.py
# Copyright 1999-2021 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
command.py
import os import psutil import signal import subprocess import threading from time import sleep from aim.engine.configs import * from aim.engine.repo import AimRepo class Command: def __init__(self, data): self.name = data.get('name') self.script_path = data.get('script_path') self.argume...
test_events.py
"""Tests for events.py.""" import collections.abc import concurrent.futures import functools import io import os import platform import re import signal import socket try: import ssl except ImportError: ssl = None import subprocess import sys import threading import time import errno import unittest from unitt...
test_platform.py
from unittest.mock import Mock, patch from threading import Thread from . import MockPlatform AUTHENTICATION_COUNT = 10 def test_whenTokenIsSetAndNotExpired_thenIsAuthenticated(): platform = MockPlatform() platform._authenticate() assert platform._is_authenticated() def test_whenTokenIsNotSet_thenIsN...
region.py
from __future__ import with_statement from .. import Lock, NeedRegenerationException from ..util import NameRegistry from . import exception from ..util import PluginLoader, memoized_property, coerce_string_conf from .util import function_key_generator, function_multi_key_generator from .api import NO_VALUE, CachedValu...
testutil.py
# gemato: Test utility functions # vim:fileencoding=utf-8 # (c) 2017-2020 Michał Górny # Licensed under the terms of 2-clause BSD license import errno import functools import io import logging import os import os.path import random import shutil import sys import tempfile import threading import unittest if sys.hexve...
main.py
from binance.client import Client from dotenv import load_dotenv from bin.Token import * from bin.live_updates import * from progress.bar import Bar import os, yaml, json, asyncio, websockets, threading token_instances = {} alerts = [] # Load env variables load_dotenv() client = Client(os.getenv('API_KEY'), os.getenv...
stratum.py
# coding=utf-8 # Copyright 2018-present Open Networking Foundation # SPDX-License-Identifier: Apache-2.0 ''' This module contains a switch class for Mininet: StratumBmv2Switch Prerequisites ------------- 1. Docker- mininet+stratum_bmv2 image: $ cd stratum $ docker build -t <some tag> -f tools/mininet/Dockerfile . Us...
exchange_rate.py
from datetime import datetime import inspect import requests import sys import os import json from threading import Thread import time import csv import decimal from decimal import Decimal from .zcore import COIN from .i18n import _ from .util import PrintError, ThreadJob, make_dir # See https://en.wikipedia.org/wik...
utils.py
import os import time import contextlib import werkzeug.serving import threading import klaus TEST_SITE_NAME = "Some site" HTDIGEST_FILE = "tests/credentials.htdigest" TEST_REPO = os.path.abspath("tests/repos/build/test_repo") TEST_REPO_URL = "test_repo/" UNAUTH_TEST_SERVER = "http://invalid:password@localhost:9876/...
datasets.py
# YOLOv5 dataset utils and dataloaders import glob import hashlib import json import logging import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool, Pool from pathlib import Path from threading import Thread import cv2 import numpy as np import torch...
sound_integration_test.py
import os import sys import threading import unittest from multiprocessing import Process from time import sleep import ev3dev2simulator.config.config as config from unittest.mock import patch, MagicMock from ev3dev2.sound import Sound from ev3dev2.motor import MoveTank, OUTPUT_A, OUTPUT_D, SpeedPercent from ev3dev2...
test_pooling_base.py
# Copyright 2012 10gen, 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 writing, soft...
spatial.py
import bottle #import os import sys import requests import json import pyproj import traceback import math #from datetime import datetime from multiprocessing import Process, Pipe from shapely.geometry import shape,MultiPoint,Point,mapping from shapely.geometry.polygon import Polygon from shapely.geometry.multipolygon...
blind_xss.py
from burp import IBurpExtender, IScannerCheck from burp import ITab from burp import IHttpListener from burp import IInterceptedProxyMessage from burp import IMessageEditorController from burp import IContextMenuFactory, IContextMenuInvocation from javax.swing import (JLabel, JTextField, JOptionPane, JTabbedPane, J...
crawler.py
#! usr/bin/python # encoding=utf-8 import socket import codecs import time from threading import Thread from collections import deque from multiprocessing import Process, cpu_count import bencoder from .utils import get_logger, get_nodes_info, get_rand_id, get_neighbor from .database import RedisClient # 服务器 tracke...
App.py
from Graphics import Config import datetime as dt import importlib import multiprocessing import os import platform import threading import tkinter as tk from tkinter import filedialog from kivy.clock import Clock from kivy.lang.builder import Builder from kivy.metrics import dp from kivy.properties impor...
player.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: omi # @Date: 2014-07-15 15:48:27 # @Last Modified by: AlanAlbert # @Last Modified time: 2018-11-21 14:00:00 """ 网易云音乐 Player """ # Let's make some noise from __future__ import print_function, unicode_literals, division, absolute_import import subprocess impo...
bot.py
from collections import OrderedDict from elecbay import stop_bidding import paho.mqtt.client as mqtt import time import json from random import randrange, uniform from threading import Thread import logging from datetime import datetime, timedelta class BuyerBot: def __init__(self, id): self.id = id ...
views.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import json from functools import wraps from collections import defaultdict from rest_framework import serializers, viewsets from rest_framework.views import APIView from rest_framework.response import Response from rest_framework.exceptions import APIExce...
ca_util.py
#!/usr/bin/python3 ''' SPDX-License-Identifier: Apache-2.0 Copyright 2017 Massachusetts Institute of Technology. Tools for creating a CA cert and signed server certs. Divined from http://svn.osafoundation.org/m2crypto/trunk/tests/test_x509.py The mk_temporary_xxx calls return a NamedTemporaryFile with certs. Usage ; ...
widget.py
# -*- coding: utf-8 -*- # vim: set ts=4 sw=4 et ai: """ | This file is part of the web2py Web Framework | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) GUI widget and services start function -------------------------------------- """ from __futur...
test_wsgi.py
import py import socket, time from oejskit import wsgi #from wsgiref.validate import validator def test_timeout(): def app(environ, start_response): start_response('200 OK', [('content-type', 'text/plain')]) return ['stuff\n'] serverSide = wsgi.WSGIServerSide(0) port = serverSide.get_port...
appLib.py
import os import copy import io import re import pickle import fitz # PyMuPDF import json import mysql import smtplib import openpyxl import xlrd import datetime import holidays import random import pandas as pd import numpy as np from openpyxl.utils.cell import get_column_letter from openpyxl.styles import PatternFil...
scheduling.py
""" This module provides functionality for timing of methods. """ import time import threading def run_function_every_n_seconds(fn, fn_args, seconds): """ Runs a function every n seconds. :param fn: The function to run :param fn_args: Arguments to pass to the function as list :pa...
conftest.py
import multiprocessing import os import tempfile import threading import time import config import pytest from selenium import webdriver from app import app, db class LiveClient(object): def __init__(self): app.config.from_object(config.Config) app.config.from_envvar("WOLFIT_SETTINGS") ...
retinaface.py
import sys import numpy as np import cv2 import onnxruntime import time import queue import threading import json import copy def py_cpu_nms(dets, thresh): """ Pure Python NMS baseline. Copyright (c) 2015 Microsoft Licensed under The MIT License Written by Ross Girshick """ x1 = det...
test_pool.py
import collections import random import threading import time import weakref import sqlalchemy as tsa from sqlalchemy import event from sqlalchemy import pool from sqlalchemy import select from sqlalchemy import testing from sqlalchemy.engine import default from sqlalchemy.testing import assert_raises from sqlalchemy....
DeletePolicyOnAllAccounts.py
#!/usr/bin/env python import boto3 import pprint import argparse import csv from multiprocessing import Process from botocore.exceptions import ProfileNotFound, ClientError parser = argparse.ArgumentParser(description="Parallel, multi-account execution") parser.add_argument('--policy', type=str ) parser.add_argume...
dashboard.py
try: import bokeh.command.bootstrap import bokeh.document # NOQA import bokeh.layouts import bokeh.models import bokeh.models.widgets import bokeh.plotting import bokeh.themes import tornado.gen _available = True except ImportError as e: _available = False _import_error = e ...
sherlock_qot_transform.py
# @file helloworld.py # @brief Sherlock QoT Python Transform # @author Anon D'Anon # # Copyright (c) Anon, 2018. # Copyright (c) Anon Inc., 2018. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # ...
reactive_keyboard.py
import numpy as np #check_import from collections import deque #check_import import logging #check_import # todo: some quick tricks to see if keyboard effects work properly and a small demonstration of the effect. currently doesnt support multiple ripple waves # event with 200 ripples cpu usage is pretty low class R...
test_hunter.py
from __future__ import print_function import inspect import os import platform import subprocess import sys import threading from pprint import pprint import pytest import hunter from hunter import And from hunter import CallPrinter from hunter import CodePrinter from hunter import Debugger from hunter import From f...
local_test.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function USED_DEVICES = "-1" import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES import sys import threading import time import tensorflow as tf from absl import ...
control_cli.py
""" @title @description """ import argparse import threading from auto_drone.drone.tello_drone import TelloDrone class ControlCli: def __init__(self, drone: TelloDrone): self.drone = drone self.running = False self.option_menu = { 'exit': self.destroy, } # m...
audio_recorder.py
import tkinter as tk import threading import pyaudio import wave class App(): chunk = 1024 sample_format = pyaudio.paInt16 channels = 2 fs = 44100 frames = [] def __init__(self, master): self.isrecording = False self.button1 = tk.Button(main, text='Start', width=6, ...
Serial.py
''' Created on 25.10.2016 @author: simon ''' ''' Created on 24.10.2016 @author: simon ''' import numpy as np from devices import * import serial,time,parser import serial.tools.list_ports as lscoms from collections import deque from threading import Thread from gui.terminator import terminatehooks import traceback...
cluster.py
import base64 import configparser import datetime import enum import hashlib import json import os import re import socket import subprocess import sys import tempfile import threading import time import uuid from pathlib import Path from typing import List import bech32 import docker import durations import jsonmerge...
email.py
from flask_mail import Message from app import mail, app from flask import render_template from threading import Thread def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_mail(subject, sender, recipients, text_body, html_body): msg = Message(subject, sender=sender, recip...
__State.py
from multiprocessing import Process from .base import Base ''' The base State class. Code running in a State may be stopped at anytime. ''' class State(Base): ''' name: the name of the State used in logging fsm: the FSM object the State is associated with ''' def __init__(self, name, fsm, add_to_fsm=True): sup...
views.py
import os import shutil import threading import mimetypes from IPython import embed from .models import Bucket, File from django.views.generic import TemplateView from cloud.settings import ARCHIVE_DIR, NODE_NAME from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt f...
test_sys.py
import unittest, test.support from test.script_helper import assert_python_ok, assert_python_failure import sys, io, os import struct import subprocess import textwrap import warnings import operator import codecs import gc import sysconfig import platform # count the number of test runs, used to create unique # strin...
uticker.py
#!/usr/bin/env python import logging import config import tickersources import threading import time from datetime import datetime as dt from colorsys import hsv_to_rgb from PIL import ImageFont from scrollable import Scrollable from unicornhatmini import UnicornHATMini import os dir = os.path.dirname(__file__) loggi...
test_c10d_common.py
# Owner(s): ["oncall: distributed"] import copy import os import sys import tempfile import threading import time from datetime import timedelta from itertools import product from sys import platform import torch import torch.distributed as dist if not dist.is_available(): print("distributed package not availabl...
__init__.py
#flask import from flask import Flask, session from flask.ext.session import Session from flask import Response from flask import stream_with_context, request, Response, make_response from flask import Flask from flask import request from flask import send_file from flask import session from flask import g from flask ...
handler.py
import io import json import logging import socket import struct import threading import traceback import weakref import paramiko import tornado.web import requests import sys from tornado.ioloop import IOLoop from tornado.util import basestring_type from webssh.worker import Worker, recycle_worker, workers from torna...
test_threadworker.py
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted._threads._threadworker}. """ import gc import weakref from twisted.trial.unittest import SynchronousTestCase from threading import ThreadError, local from .. import ThreadWorker, LockWorker, AlreadyQuit class FakeQueue...
wsgi_restart.py
# This code lifted from the mod_wsgi docs. import os import sys import signal import threading import atexit import Queue _interval = 1.0 _times = {} _files = [] _running = False _queue = Queue.Queue() _lock = threading.Lock() def _restart(path): _queue.put(True) prefix = 'monitor (pid=%d):' % os.getpid() ...
request.py
from response import LazyResponse from parser import Parser from threading import Thread from multiprocessing import Pipe class Request(object): """ HTTP request. """ def __init__(self, config): """ Initialize an HTTP request instance for a given configuration. """ sel...
dumping_wrapper_test.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
consumers.py
from asgiref.sync import async_to_sync from channels.generic.websocket import WebsocketConsumer, AsyncWebsocketConsumer import json import base64 from django.http.request import QueryDict import paramiko import socket from threading import Thread import time import os from django.utils.six import StringIO from django.c...
lapse.py
# Lapse-Pi timelapse controller for Raspberry Pi # This must run as root (sudo python lapse.py) due to framebuffer, etc. # # http://www.adafruit.com/products/998 (Raspberry Pi Model B) # http://www.adafruit.com/products/1601 (PiTFT Mini Kit) # # Prerequisite tutorials: aside from the basic Raspbian setup and PiTFT set...