source
stringlengths
3
86
python
stringlengths
75
1.04M
fault_tolerance_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 requ...
_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...
utils.py
# -*- coding: utf-8 -*- # Copyright 2012-2020 CERN # # 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...
trustedcoin.py
#!/usr/bin/env python # # Electrum - Lightweight Bitcoin Client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
plotwindow.py
""" plotwindow.py - wxPython control for displaying matplotlib plots Chris R. Coughlin (TRI/Austin, Inc.) """ __author__ = 'Chris R. Coughlin' import ui_defaults from controllers.plotwindow_ctrl import PlotWindowController, ImgPlotWindowController, MegaPlotWindowController from models import workerthread from models...
test_reload.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2019-2021 tecnovert # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. """ export TEST_RELOAD_PATH=/tmp/test_basicswap mkdir -p ${TEST_RELOAD_PATH}/bin/{particl,bitcoin}...
G_O_D.py
from __future__ import print_function from sys import argv,exit import sys import subprocess as sp from datetime import datetime import socket from threading import * import zipfile import argparse import optparse import os d=sys.platform if(d=="win32" or d=="win62"): sp.call('cls',shell=True) else: ...
LedStrip.py
import colorsys import logging from threading import Thread, Event from time import sleep from Animation import LinearInterpolateAnimation class LedStrip: LED_COUNT = 180 def __init__(self, node): self.node = node self.rgb_colors = [0, 0, 0] self.animation = None self.color_b...
mainbot.py
# Import the twython module from . import twythonaccess # import time and sys import time # import the users class from .users import Users # import markov from .markov import Markov # import fastreplystreamer from .fastreplystreamer import FastReplyStreamer # import apikeys to authenticate streamer from . import apike...
histdata.py
import queue from dataclasses import dataclass, field from datetime import datetime, date from threading import Thread from typing import List, Callable import pandas from dateutil.relativedelta import relativedelta from ibapi.client import EClient from ibapi.contract import Contract as IBcontract from ibapi.wrapper i...
segmentNucAndGFP.py
# segmentNucAndGFP.py ####################################################### # # Segmentation pipeline for : # - Load original images # - Detect lipid droplets (LDs) and nuclei # - Save the "cleaned" images # ####################################################### import os import cv2 import numpy as np...
network_benchmark_rate_basic.py
import requests import time import json import pdb import random import optparse import threading import sys import os def jsonPrint(r): """Pretty-print JSON""" return json.dumps(r.json(), indent=4, sort_keys=True) + "\n" def ordered(obj): """Order map for comparison https://stackoverflow.com/quest...
mocker.py
# Copyright (C) 2018 by eHealth Africa : http://www.eHealthAfrica.org # # See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with # the License. Y...
Runner.py
import threading class Runner: def __init__(self): pass @staticmethod def run(launcher, *args): t = threading.Thread(target=launcher.run, args=args, name=launcher.__class__) t.setDaemon(True) t.start() return t
main.py
""" mlperf inference benchmarking tool """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import json import logging import os import threading import time from queue import Queue import mlperf_loadgen as lg import numpy as np import dat...
ego_vehicle.py
#!/usr/bin/env python # # Copyright (c) 2018-2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # """ Classes to handle Carla vehicles """ import math import numpy from icvSubscriber import Subscriber #import rospy from protoco...
dev_test_cex_full_non_stop.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: dev_test_cex_full_non_stop.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api # Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api # PyPI: https:...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
LightPicture.py
""" VERSION INFO Current: v_4_2 Tested TriangeMeshBuilder basic functionality, saving to 3mf file, timing * see test test_random_big_file for details of usage History: v_4_1 Added TriangleMeshBuilder class Integrated TriangleMesh and ...
controller.py
import re import time from datetime import datetime from threading import Thread from typing import List, Set, Type from bauh.api.abstract.controller import SoftwareManager, SearchResult, ApplicationContext from bauh.api.abstract.disk import DiskCacheLoader from bauh.api.abstract.handler import ProcessWatcher from bau...
__init__.py
""" S3 Binding Module with logging handler and stream object """ __author__ = 'Omri Eival' import atexit import signal import threading import queue import gzip import codecs import os from logging import StreamHandler from io import BufferedIOBase, BytesIO from boto3 import Session import datetime from aws_logging_...
views.py
import sys import threading from Assets.models import AssetList from ApolloScanner.dingtalk import dingtalker from Configuration.models import Configuration from VulnerableScan.models import ExploitRegister, VulnerableScanTasks, VulnerableScanResult class MyLogger: def __init__(self, exp_id, debug_flag): ...
domain_status.py
#! /usr/bin/env python3 import threading import time import socket import libvirt import sys sys.path.append("./common") import xml_parsing import sockets HEARTBEATS_LOSS = 3 HEARTBEAT_CYCLE = 60 class HypervisorConnect(): def __init__(self, hypervisorURI): self.__conn = self.__conn_hypervisor(hyperviso...
worker.py
from contextlib import contextmanager import atexit import faulthandler import hashlib import inspect import io import json import logging import os import redis import sys import threading import time import traceback from typing import Any, Dict, List, Iterator # Ray modules from ray.autoscaler._private.constants im...
manager.py
#!/usr/bin/env python2.7 import os import sys import fcntl import errno import signal import subprocess from common.basedir import BASEDIR sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR def unblock_stdout(): # get a non-blocking stdout child_pid, child_pty = os.forkpty() if ch...
websocket_test.py
""" https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websockets#websockets Speech samples https://raw.githubusercontent.com/Azure-Samples/cognitive-services-speech-sdk/f9807b1079f3a85f07cbb6d762c6b5449d536027/samples/cpp/windows/console/samples/whatstheweatherlike.wav https://www.signalogic.com/index.pl...
pipeline.py
import json import os import pathlib import threading import time from collections import OrderedDict from collections.abc import Iterable from flask import Flask, request, Response, jsonify, render_template from multiprocessing.pool import ThreadPool from signal import SIGABRT, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGQUI...
test__transaction.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2001, 2002, 2005 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should acc...
test_gcs_pubsub.py
import sys import threading import ray import ray._private.gcs_utils as gcs_utils from ray._private.gcs_pubsub import GcsPublisher, GcsErrorSubscriber, \ GcsLogSubscriber, GcsAioPublisher, GcsAioSubscriber from ray.core.generated.gcs_pb2 import ErrorTableData import pytest @pytest.mark.parametrize( "ray_star...
distribute_coordinator_test.py
# Copyright 2015 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...
data.py
import atexit import itertools import multiprocessing as mp import os import pickle import random import zlib import numpy as np import tree import stats import utils def train_test_split(data_dir, subset=None, test_ratio=.1): if subset: filenames = stats.SUBSETS[subset]() filenames = [name + '.pkl' for na...
abstract.py
""" Multi-threading with GIL in python is useful for blocking I/O # Threads to make multiple system calls in parallel Threading with the system calls will all run in parallel from multiple Python threads even though they're limited by the GIL. The GIL prevents my Python code from running in parallel, but it has no neg...
test_mainwindow.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © Spyder Project Contributors # # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) # ----------------------------------------------------------------------------- """ Te...
servidor.py
import socket import threading import sys import pickle import os class Servidor(): def __init__(self, host=socket.gethostname(), port=59989): self.clientes = [] self.sock = socket.socket() self.sock.bind((str(host), int(port))) self.sock.listen(20) self.sock.setblocking(False) aceptar = threading.Thread...
email.py
from flask_mail import Message from flask import render_template, current_app from decouple import config from . import mail from time import sleep from threading import Thread def send_async_email(app, msg): with app.app_context(): # block only for testing parallel thread for i in range(10, -1...
NeewerLite-Python.py
############################################################# ## NeewerLite-Python ## by Zach Glenwright ############################################################# ## > https://github.com/taburineagle/NeewerLite-Python/ < ############################################################# ## A cross-platform Python scri...
main.py
#-*-coding:utf-8-*- #qpy:webapp:PyConChina2015 #qpy:drawer #qpy://127.0.0.1:8080/ """ PyConChina2015 App's sourcecode @Author river """ from bottle import Bottle, ServerAdapter from bottle import run, debug, route, error, static_file, template, redirect import urllib2 import os import json #### 常量定义 ######### AS...
test_package_parallel.py
import traceback import py from tox.session.commands.run import sequential def test_tox_parallel_build_safe(initproj, cmd, mock_venv, monkeypatch): initproj( "env_var_test", filedefs={ "tox.ini": """ [tox] envlist = py install_cmd...
snake.py
#!/usr/bin/env python2 import sys import os import tty import select import json import termios from copy import deepcopy as copy from multiprocessing import Process from time import sleep from random import randint class Snake: def __init__(self): self.height = 20 self.width = 20 self.length = 1...
choose_remote_dir.py
import difflib import logging import os import threading import time from enum import Enum from queue import Empty, Queue from prompt_toolkit.application.current import get_app from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.layout import HSplit, VSplit from prompt_toolkit.layout.containers impo...
russound.py
#!/usr/bin/env python3 """ Polyglot v2 node server Russound status and control via RNET protocol Copyright (C) 2020 Robert Paauwe """ try: import polyinterface except ImportError: import pgc_interface as polyinterface import sys import time import datetime import requests import threading import socket import ...
AsynchronousThreading.py
""" """ import threading from UsefulTools.UtilsFunctions import pt import traceback import json def object_to_json(object, attributes_to_delete=None): """ Convert class to json with properties method. :param attributes_to_delete: String set with all attributes' names to delete from properties method ...
__init__.py
from selenium import webdriver from JupJup import Login, Present, Share from JupJup import config from multiprocessing import Process import time class CoinJupJupManager: def __init__(self): self.data = config.USERDATA def start(self): p_collect = Process(target=self.collect_task) p_s...
test_autograd.py
import gc import sys import io import math import random import tempfile import time import threading import unittest import warnings from copy import deepcopy from collections import OrderedDict from itertools import product, permutations from operator import mul from functools import reduce, partial import torch fro...
manager.py
from dataclasses import dataclass import logging import threading import time import traceback from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Set, Tuple from concurrent.futures.thread import ThreadPoolExecutor from blspy import G1Element from chiapos import DiskProver from chia.conse...
chat.py
# -*- coding: utf-8 -*- """ :author: Grey Li (李辉) :url: http://greyli.com :copyright: © 2018 Grey Li <withlihui@gmail.com> :license: MIT, see LICENSE for more details. """ from flask import render_template, redirect, url_for, request, Blueprint, current_app, abort,flash from flask_login import c...
scheduler.py
import time from datetime import datetime from threading import Thread class Scheduler: def __init__(self, timezone : int = 0, granularity : int = 30): self.scheduled = {} self.running = True self.thread = None self.timezone = timezone self.granularity = granularity d...
topology_test.py
import re import time import pytest import logging from threading import Thread from cassandra import ConsistencyLevel from ccmlib.node import TimeoutError, ToolError from dtest import Tester, create_ks, create_cf from tools.assertions import assert_almost_equal, assert_all, assert_none from tools.data import insert...
test_lock.py
"""license: Apache License 2.0, see LICENSE for more details.""" import uuid import threading from nose.tools import eq_, ok_ from kazoo.exceptions import CancelledError from kazoo.exceptions import LockTimeout from kazoo.testing import KazooTestCase from kazoo.tests.util import wait class KazooLockTests(KazooTestC...
omsagent.py
#!/usr/bin/env python # # OmsAgentForLinux Extension # # Copyright 2015 Microsoft 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....
utils.py
# from sklearn.gaussian_process.kernels import ConstantKernel # from sklearn.gaussian_process.kernels import Matern # the sklearn kernels do not implement gradients! from skopt.learning.gaussian_process.kernels import ConstantKernel from skopt.learning.gaussian_process.kernels import HammingKernel from skopt.learning.g...
test_util_test.py
# Copyright 2015 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...
client.py
# -*- coding: utf-8 -*- ''' Created on 2016年4月16日 @author: fly ''' import threading import time import socket def sendToServer(client): time.sleep(4) client.send('hello world.'.encode()) address = ('127.0.0.1', 31500) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.conne...
test_concurrency.py
from __future__ import print_function import akumulid_test_tools as att import datetime import itertools import json import math import multiprocessing import os import sys import time import traceback try: from urllib2 import urlopen, HTTPError except ImportError: from urllib import urlopen, HTTPError HOST = ...
test_elasticsearch.py
# Copyright The OpenTelemetry 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 in ...
camera.py
"""camera.py This code implements the Camera class, which encapsulates code to handle IP CAM, USB webcam or the Jetson onboard camera. In addition, this Camera class is further extended to take a video file or an image file as input. This file was modified from: https://github.com/jkjung-avt/tensorrt_demos/blob/master...
test_kernel.py
# coding: utf-8 """test the IPython Kernel""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import ast import io import os.path import sys import time import nose.tools as nt from flaky import flaky from IPython.testing import decorators as dec, tools as tt fro...
views.py
from .models import Problem, TestCase from . import forms as problems_forms from django.http import Http404 from django.shortcuts import render, redirect from django.core.urlresolvers import reverse from django.contrib import messages from django.contrib.auth.decorators import login_required from django.template.contex...
wrappers.py
# coding=utf-8 # Copyright 2021 The Google Research 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 applicab...
garbage-collector.py
#!/usr/bin/env python3.6 # # Multi-Threaded Garbage Collection Example by NOP-Gate/StackCanary # from random import randint from datetime import datetime as dt from time import sleep from uuid import uuid4 from cmd import Cmd from threading import Thread, Lock COLLECTOR_PERIOD = 30 # Seconds LOG_NAME = 'garbage-coll...
server.py
# Python std lib import contextlib import multiprocessing import os import pickle import random import signal import socket import sys import tempfile import threading from concurrent import futures from typing import Iterable # 3rd party libs import cv2 import grpc import numpy as np from simber import Logger # Loca...
ControlledBoat.py
# !/usr/bin/python3 """ ControlledBoat - remote control boat This is an implementation of the CommsController to allow a controller object to be linked to a boat object and optionally have a listener display the status of the boat. """ import math import sys from CommsController import CommsController ...
test_dbdict.py
#!/usr/bin/env python import unittest from threading import Thread from functions_cache.engines.storage.dbdict import DbDict, DbPickleDict from tests.test_custom_dict import BaseCustomDictTestCase class DbdictTestCase(BaseCustomDictTestCase, unittest.TestCase): def test_bulk_commit(self): d = DbDict(self...
read_ahead_cursor.py
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license" file...
vectors.py
import math from typing import Tuple, Optional, Union import random import webbrowser import rlbot.utils.structures.game_data_struct as game_data_struct from utilities.utils import * VectorArgument = Union[float, game_data_struct.Vector3] class Vector2: def __init__(self, x: VectorArgument, y: Optional[float]...
get_nto_config.py
#!/usr/bin/env python ################################################################################# ## ## File: get_nto_config.py ## Date: March 7, 2017 ## Author: Fred Mota (fmota@ixiacom.com) ## ## History: ## ## Description: ## This script gets and saves in a text file the configuration (all the details) ##...
3_edf_bankers_Speak.py
# Author Emeka Ugwuanyi Emmanuel from functools import reduce from sys import * import numpy as np import random as r import ping_code as pc import socket import struct import subprocess as sp from threading import Thread import threading import ast import time import os import psutil import datetime as dt import getp...
cracke-dit.py
import sys, glob, os, argparse, itertools, time from threading import Thread, Event import ntds_parser as ntds, outputs from database import HashDatabase, DomainDoesntExist BANNER = """\033[91m __ ___ __ ______________ ______/ /_____ ____/ (_) /_ / ___/ ___/ __ `/ _...
plot-time-difference.py
""" file: plot-time-difference.py brief: Initial attempt at doing event correlation on a table. author: S. V. Paulauskas date: February 22, 2019 """ import keyring import psycopg2 import pandas as pd import threading import time import yaml import sys def chunk_data_frame(frame, n): df_len = len(frame) chunk_...
webui.py
from multiprocessing import Queue, Manager, Process from time import sleep from flask import Flask, render_template, request, redirect, url_for, flash from time import sleep from wtforms import Form, SelectField, SelectMultipleField, BooleanField, widgets, FieldList from os import system import common, colors import js...
wallet_multiwallet.py
#!/usr/bin/env python3 # Copyright (c) 2017-2020 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 multiwallet. Verify that a bitcoind node can load multiple wallet files """ from decimal import D...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
diffie_hellman_key_exchange.py
import numpy as np import hashlib as hl import binascii from Crypto.Cipher import AES from base64 import b64encode from base64 import b64decode import json import time import threading import os prime_order_p = 16069 generator_g = 21 lock = threading.Lock() # semaphore = threading.Semaphore() # Given the generator ...
dataHistory.py
import json from datetime import datetime import time import threading from os.path import exists from smbus import SMBus import struct # Address of the Arduino 1 - Adresse de l'Arduino 1 ARDUINO1_I2C_ADDRESS = 18 class BackgroundHistory(object): def __init__(self,interval = 10,number_elements = 10): s...
variable_scope_shim_test.py
# Copyright 2015 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...
main.py
import cleverbotfree.cbfree import sys import discord import asyncio import json import random, time, threading from discord.ext.tasks import loop bot = discord.Client(description="xddd", self_bot=True) gs={"a":"text"} writer="" olw="" token = "" print("Creating handler...") gs["rs"]=cleverbotfree.cbfree.Cleverbot() gs...
usb_monitor.py
import usb.core import usb.util import time import re import threading import logging log = logging.getLogger(__name__) class UsbDescriptor: def __init__(self, device_id, bus, address, device): self.device_id = device_id self.bus = bus self.address = address self.device = device ...
qt.py
#!/usr/bin/env python # # Electrum - Lightweight Bitcoin Client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
driver.py
import threading import asyncio from typing import Dict, Union, List, Optional from typing_extensions import Literal from aiogram import Bot, Dispatcher, executor, types from aiogram.types import ContentType from unified_message_relay.Core.UMRType import UnifiedMessage, MessageEntity, ChatAttribute, ChatType, EntityTyp...
boringproxy_local_client.py
#!/usr/bin/env python3 import logging import os import subprocess import threading logger = logging.getLogger(__name__) class BoringproxyLocalClient: BINARY_NAME = "boringproxy" def __init__(self, server_host, token, client_name, binary_path=None): self.server_host = server_host self.toke...
wxRaven_JSON_Viewer_Logic.py
''' Created on 6 mars 2022 @author: slinux ''' from wxRavenGUI.application.wxcustom import * from .wxRavenShellDesign import wxRaven_General_JSONViewer import threading import time import sys,math import json import requests import libs.pyperclip import ast class wxRaven_JSON_ViewerLogic(wxRaven_General_JSONViewer...
exporter.py
from datetime import date, timedelta, datetime from os import path, makedirs from shutil import copyfile from threading import Thread from os.path import isfile from telethon.tl.types import MessageService from exporter import HTMLTLWriter from media_handler import MediaHandler from tl_database import TLDatabase cl...
mcedit.py
# !/usr/bin/env python2.7 # -*- coding: utf_8 -*- # import resource_packs # not the right place, moving it a bit further #-# Modified by D.C.-G. for translation purpose #.# Marks the layout modifications. -- D.C.-G. """ mcedit.py Startup, main menu, keyboard configuration, automatic updating. """ import splash impor...
apps.py
# -*- coding: utf-8 -*- import pandas_datareader.data as web import datetime import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objs as go from dash.dependencies import Input, Output import requests import pandas as pd # multiprocessing handel static data request imp...
effect.py
import time from threading import Thread from rpi_ws281x import Color class Effect: def __init__(self, strip): self.strip = strip def update(self): pass class EffectManager: def __init__(self, strip): self.strip = strip self.arg = 0 self.states = { 'idle': IdleEffect(strip), '...
PiCam.py
# built upon: https://github.com/jrosebr1/imutils/blob/master/imutils/video/pivideostream.py from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread # import cv2 # import numpy as np import json class PiCam: def __init__(self, resolution=(640, 480)): # initialize...
main.py
from quixstreaming import QuixStreamingClient from quixstreaming.state.localfilestorage import LocalFileStorage import quixstreaming as qs # use feed parser import feedparser import os from datetime import datetime import json import time import threading storage = LocalFileStorage() client = QuixStreamingClient() ...
test_num_threads.py
# -*- coding: utf-8 -*- from __future__ import print_function, absolute_import, division import sys import os import re import multiprocessing import unittest import numpy as np from numba import (njit, set_num_threads, get_num_threads, prange, config, threading_layer, guvectorize) from numba.np.u...
UIC_Spider.py
#coding:utf-8 from Html_Downloader import HtmlDownloader from Html_Parser import HtmlParser from Data_Output import DataOutput import csv from multiprocessing import Process import time class SpiderMan(object): def __init__(self): self.downloader = HtmlDownloader() self.parser = HtmlPars...
cache_result_manager.py
#!/usr/bin/python import sys import zmq import time import signal import optparse from multiprocessing import Process # The "results_manager" function receives each result from multiple workers, # and prints those results. When all results have been received, it signals # the worker processes to shut down. def resu...
websocket_client.py
import json import logging import socket import ssl import sys import traceback from datetime import datetime from threading import Lock, Thread from time import sleep from typing import Optional import websocket from quantitativetrader.trader.utility import get_file_logger class WebsocketClient: """ Websoc...
gui.py
#!/usr/bin/python3 import json import os import threading import time import textwrap import subprocess from bottle import Bottle from bottle import redirect from bottle import template from bottle import TEMPLATE_PATH from bottle import request from bottle import response from distutils.util import strtobool from qu...
_ItemWidget.py
import threading import R from Utils.WebUtil import setLabelImg from ui.ui_designer.ui_file.uic_itemWidget import Ui_item class _ItemWidget(Ui_item): def __init__(self, params): """ :param params: {'url', 'title', 'latest' , 'area', 'time' , 'stars'} """ self.params = params ...
debug.py
import code import gc import logging import os import signal import socket import threading import traceback import tracemalloc from types import FrameType from django.conf import settings from django.utils.timezone import now as timezone_now from typing import Optional logger = logging.getLogger('zulip.debug') # I...
project_files_monitor_test.py
# 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. # pyre-unsafe import os import socket import tempfile import threading import unittest from unittest.mock import MagicMock, patch from .. im...
Hiwin_RT605_Socket_v3_20190628101422.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd_v3 as TCP import HiwinRA605_socket_Taskcmd_v3 as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.s...
signals.py
from django.db.models.signals import post_save from django.dispatch import receiver from django.conf import settings import threading import sendgrid import time from sendgrid.helpers.mail import Mail from .models import Email def create_data(text, date): data = { "data": { "sent_dat...
main.py
#!/usr/bin/env python """ Streams in always on microphone, transcribes (speech (audio) to text), runs results through function to find user defined wake words and commands. Main components: -this file, master file which creates shared queues, starts up threads, kills threads -STT - GCP -server - TCP sock...
dask_remote_scheduler.py
import distributed from tornado.ioloop import IOLoop from threading import Thread from distributed import Scheduler, Worker, Executor import paramiko import select import getpass import os import socket import select import threading from pipeline import msg try: import SocketServer except ImportError: impor...
backend.py
from thonny.common import ( InputSubmission, InterruptCommand, EOFCommand, parse_message, ToplevelCommand, ToplevelResponse, InlineCommand, InlineResponse, UserError, serialize_message, BackendEvent, ValueInfo, ) import sys import logging import traceback import queue fro...