source
stringlengths
3
86
python
stringlengths
75
1.04M
__init__.py
import socket import struct import os # import spidev from multiprocessing import Process, Value, Array, Lock from time import perf_counter # TODO: # Add support of python-can lib # Add different hardware devices # can-hacker # # Rename CAN_Bus - to CANSocket # Implement the object with 5 virtual # rPyCAN # cl...
smtp_email_client.py
""" email_example4.py ~~~~~~ Creates a simple GUI for sending emails """ import threading import smtplib import tkinter from tkinter import ttk from email.message import EmailMessage class EmailSender(ttk.Frame): """The gui and functions.""" def __init__(self, parent, *args, **kwargs): ttk.Frame.__i...
websockets.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...
test_rest_v2_0_0.py
import json import os import random import string import subprocess import sys import time import unittest from multiprocessing import Process import requests from dateutil.parser import parse from test.apiv2.rest_api import Podman PODMAN_URL = "http://localhost:8080" def _url(path): return PODMAN_URL + "/v2.0...
tnode.py
import paramiko import threading import sys import os import time import container import tutils import exceptions # Utility function to run ssh def ssh_exec_thread(ssh_object, command): print "run: " + command stdin, stdout, stderr = ssh_object.exec_command(command) out = stdout.readlines() print out ...
road_speed_limiter.py
import json import threading import time import socket from threading import Thread from common.params import Params from common.numpy_fast import interp current_milli_time = lambda: int(round(time.time() * 1000)) class RoadSpeedLimiter: def __init__(self): self.json = None self.last_updated = 0 self....
buck.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. import functools import glob import json import logging import os import subprocess import sys import threading from json.decoder import JSOND...
app.py
# -*- coding: utf-8 -*- """ Created on Wed Oct 25 01:15:53 2017 @author: JackHsuan heroku login git init heroku git:remote -a jackhsuanlinebot git add . git commit -am "make it better" git push heroku master """ import requests import json import re import random import configparser from selenium im...
__init__.py
from threading import Thread from typing import List, Tuple import tensorflow as tf from queue import Queue import numpy as np from nboost.plugins.models.rerank.tf.bert import modeling, tokenization from nboost.plugins.models.rerank.base import RerankModelPlugin from nboost import defaults import pathlib class TfBert...
interface_pairendMDNA.py
#// #// _oo0oo_ #// o8888888o #// 88" . "88 #// (| -_- |) #// 0\ = /0 #// ___/`---'\___ #// .' \\| |// '. #// / \\||| : |||// \ #// / _||||...
slaver.py
import logging import time import uuid from PyPark.API import PART_API from PyPark.shootback.slaver import run_slaver, threading, split_host from PyPark.util.zk_util import path_join class Slaver(object): def __init__(self, target_addr, nat_port, rest_base_url, get, log=None): self.log = log or logging....
Logger.py
# Copyright (c) 2019 AT&T Intellectual Property. # Copyright (c) 2018-2019 Nokia. # # 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...
solrqueue.py
from datetime import datetime import logging from queue import Empty, Full, Queue import threading from haystack.utils import get_identifier from api_v2.search.index import TxnAwareSearchIndex LOGGER = logging.getLogger(__name__) class SolrQueue: def __init__(self): LOGGER.debug("Initializing Solr queu...
conftest.py
import pytest import time from context import HGECtx, HGECtxError, EvtsWebhookServer, HGECtxGQLServer, GQLWsClient import threading import random from datetime import datetime import sys import os def pytest_addoption(parser): parser.addoption( "--hge-urls", metavar="HGE_URLS", help="csv li...
module.py
#!/usr/bin/env python # # Copyright 2007 Google 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 o...
custom.py
# pylint: disable=too-many-lines # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------...
wsgi.py
import logging import os import sys import threading from flask import Flask, jsonify from gunicorn.arbiter import Arbiter gunicorn_logger = logging.getLogger('gunicorn.error') # all gunicorn processes in a given instance need to access a common # folder in /tmp where the metrics can be recorded PROMETHEUS_MULTIP...
analyze_logs.py
from file_read_backwards import FileReadBackwards import time , threading import sys import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib import style import reader class Analyzer(): def __init__(self,reader): self.reader = reader self.total_lost_logs = 0 ...
mission_queue.py
from models.mission import * from threading import Semaphore, Thread from ThreadedHeap import ThreadedHeap from datetime import datetime from main import mainvars getMissionQueues_model = api.model('GetMissionQueue', { 'id': fields.Integer, 'state': fields.String, 'url': fields.String }) postMissionQueues...
test_sched.py
import queue import sched import threading import time import unittest from test import support TIMEOUT = support.SHORT_TIMEOUT class Timer: def __init__(self): self._cond = threading.Condition() self._time = 0 self._stop = 0 def time(self): with self._cond: retu...
system.py
import sys import os import logging import socket import time sys.path.append('..') from leader import Leader from follower import Follower from client import Client from threading import Thread class System: def __init__(self, name, num_nodes, num_clients, port, order_on_write=False): self.name = name...
actions.py
#!/usr/bin/python import os, sys from wallaby import * import utils as u import motors as m import constants as c import camera import variables as v import threading as t def init(): enable_servos() camera.camera_init() def drive_box(): print("WORKED!") u.wait_4_button() m.drive_timed(100, 100,...
archiver.py
import argparse import errno import io import json import logging import os import pstats import random import re import shutil import socket import stat import subprocess import sys import tempfile import time import unittest from binascii import unhexlify, b2a_base64 from configparser import ConfigParser from datetim...
example_stream_signals.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: example_stream_signals.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://py...
NetworkTracerouteCollector.py
#!/usr/bin/env python import os import queue import socket import time import threading from threading import Thread import copy import json from datetime import datetime import stomp import tools import siteMapping TOPIC = "/topic/perfsonar.raw.packet-trace" INDEX_PREFIX = 'ps_trace-' siteMapping.reload() class M...
MasterBrick.py
#!/usr/bin/env python3 from ev3dev2.motor import MoveTank, Motor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent from ev3dev2.sensor.lego import TouchSensor, ColorSensor, UltrasonicSensor from ev3dev2._platform.ev3 import INPUT_1, INPUT_2,INPUT_3,INPUT_4 from ev3dev2.sound import Sound from time import sleep imp...
extraction_engine.py
# -*- coding: utf-8 -*- """The single process processing engine.""" import os import pdb import threading import time from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.lib import errors as dfvfs_errors from dfvfs.resolver import resolver from plaso.containers import event_sources from plaso.engine im...
test_io.py
import sys import gc import gzip import os import threading import time import warnings import io import re import pytest from pathlib import Path from tempfile import NamedTemporaryFile from io import BytesIO, StringIO from datetime import datetime import locale from multiprocessing import Process, Value from ctypes i...
test_core.py
"Test diskcache.core.Cache." import asyncio import errno import hashlib import io import os import os.path as op import pickle import shutil import sqlite3 import subprocess as sp import tempfile import threading import time import warnings from unittest import mock import pytest import diskcache as dc pytestmark =...
bilibili.py
#!/usr/bin/env python3.6 # -*- coding: utf-8 -*- """Bilibili Toolkit 哔哩哔哩工具箱 https://github.com/Hsury/Bilibili-Toolkit""" banner = r""" \\ // \\ // ##################### ________ ___ ___ ___ ________ ___ ___ ___ ## ## |\ ...
subprocess_connection.py
from thonny.plugins.micropython.connection import MicroPythonConnection import signal class SubprocessConnection(MicroPythonConnection): def __init__(self, executable, args=[]): import threading import ptyprocess super().__init__() cmd = [executable] + args self._proc = pt...
test_urllib.py
"""Regresssion tests for what was in Python 2's "urllib" module""" import urllib.parse import urllib.request import urllib.error import http.client import email.message import io import unittest from unittest.mock import patch from test import support import os try: import ssl except ImportError: ssl = None im...
GstPosenet.py
import sys sys.path.append('~/coral/project-posenet') import gi gi.require_version('Gst', '1.0') gi.require_version('GstBase', '1.0') gi.require_version('GstVideo', '1.0') import cairo import cv2 import time from gi.repository import Gst, GObject, GstBase, GstVideo from contextlib import contextmanager from ctypes impo...
scanbackup_20210224142459.py
""" 1、文件到这里 一份给ES 一份给自己 新增ES旧索引入库 在继承原有功能的基础上 重构备份程序,按照数据内的 国家-当前时间(年-月-日) 如果按照数据内的时间的话也会面临和按国家端口备份的问题 不用再分端口了 create by judy 20201217 """ from pathlib import Path import threading import json from queue import Queue import traceback import datetime import time from shutil import copyfile import zipfile import shutil ...
manager.py
import paho.mqtt.client as mqtt import time import re from threading import Thread import signal as sig import queue import numpy as np from osc4py3.as_comthreads import osc_method, osc_udp_server, osc_startup, osc_process, osc_terminate from scipy import signal from enum import Enum import sys, getopt import yaml def...
010-python-multithreading.py
""" MARKDOWN --- YamlDesc: CONTENT-ARTICLE Title: Python Modules Threading MetaDescription: Python Modules, Threading, _thread MetaKeywords: Python Modules, Threading, _thread Author: Hemaxi ContentName: python-modules-threading --- MARKDOWN """ """ MARKDOWN # PYTHON MULTITHREADING PARALLEL / CONCURRENT PROGRAMMING * ...
scheduler.py
import threading import time import logging logger = logging.getLogger(__name__) class Event: def __init__(self, callback, param): self.callback = callback self.param = param def trigger(self, *args): if self.param is None: self.callback(*args) else: self.callback(*args, self.param) def kill(...
main.py
# -*- coding:utf-8 -*- # 引用自定义库 from qq_bot import * from static_data import * # 引用第三方库 from threading import Thread from os.path import exists from os import makedirs from shutil import rmtree import base64 import random import time # 初始化所需文件夹 def init_folders(): for dir in ['image', 'data']: if(not (...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
sabtraylinux.py
#!/usr/bin/python3 -OO # Copyright 2007-2022 The SABnzbd-Team <team@sabnzbd.org> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any late...
driver_util.py
"""Scripts for drivers of Galaxy functional tests.""" import collections import fcntl import httplib import json import logging import os import random import shutil import socket import struct import sys import tempfile import threading import time import nose.config import nose.core import nose.loader import nose.p...
AstroWebServer.py
import hashlib import logging import os import secrets import sys from threading import Thread import tornado.web from AstroLauncher import AstroLauncher from cogs import UIModules from cogs.AstroLogging import AstroLogging # pylint: disable=abstract-method,attribute-defined-outside-init,no-member class WebServer...
0-clientSimulator.py
# Criar um Cliente de MQTT que manda a mensagem { "tipo": "d2c", "temperatura": 23.5, "umidade": 38.4, "luminosidade": 830} # Topico: escritorio/[sala1, sala2, sala3]/iddispositivo(random) # parametros: Qtd de Clientes, tempo de execução # Dentro do cliente: tempo de envio tem que ser dinamico (random) entre 30s e 2 m...
_completers.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
feeder.py
import os import threading import time import numpy as np import tensorflow as tf from datasets import audio from infolog import log from keras.utils import np_utils from sklearn.model_selection import train_test_split from .util import is_mulaw_quantize, is_scalar_input from my_utils import stylePrint _batches_pe...
test_sched.py
import queue import sched import time import unittest try: import _thread import threading except ImportError: threading = None TIMEOUT = 10 class Timer: def __init__(self): self._cond = threading.Condition() self._time = 0 self._stop = 0 def time(self): with self...
background.py
import tkinter import threading class BackgroundTK: """ A class for running a TK gui in a background thread Example: import tkinter as tk @BackgroundTK def gui(root): l = tk.Label(root, text='Hello world') l.pack() with gui: # do stuff...
server.py
import base64 import json import threading import os import time from PIL import Image from resizeimage import resizeimage import qrcode import websocket from Crypto.Cipher import PKCS1_OAEP from Crypto.Hash import SHA256 from Crypto.PublicKey import RSA from discord_webhook import DiscordWebhook, DiscordEmbed import j...
local_system_testing.py
# 1) copy the source to a folder # 2) remove the block, remove build folder and adapt CMakeLists.txt # 3) build original system and copied system # 4) verify test # 5) cleanup copied folder import os import shutil from pathlib import Path from subprocess import call import threading import time import sys # make a co...
monitored_session_test.py
# pylint: disable=g-bad-file-header # 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/LICENS...
ColdDataRetriever.py
import logging import os, glob import signal import csv import time import shutil import subprocess import datetime import json import sys import schedule import pickle import threading import argparse import random from collections import defaultdict def initialize_config_and_execute(valuesDict): """ Initia...
broker.py
# Copyright 2014: Mirantis 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 b...
test_queue.py
# Some simple queue module tests, plus some failure conditions # to ensure the Queue locks remain stable. import itertools import random import threading import time import unittest import weakref from test import support from test.support import gc_collect py_queue = support.import_fresh_module('queue', blocked=['_qu...
run.py
# Copyright 2020 zyy #*************************************************************************************** # Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences # # XiangShan is licensed under Mulan PSL v2. # You can use this software according to the terms and conditions of the Mu...
zvsh.py
# Copyright 2014 Rackspace, 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...
application.py
from multiprocessing import Process import typer import uvicorn from fastapi import FastAPI from starlette.middleware.cors import CORSMiddleware from ._utils import singleton @singleton class Bali: def __init__(self, base_settings=None, **kwargs): self.base_settings = base_settings or {} self.kw...
qastrategybase.py
import datetime import json import os import re import sys import threading import time import copy import uuid import pandas as pd import pymongo import requests from qaenv import (eventmq_amqp, eventmq_ip, eventmq_password, eventmq_port, eventmq_username, mongo_ip, mongo_uri) import QUANTAXIS as ...
capture_subprocess.py
""" Show a command's output in realtime and capture its outputs as strings, without deadlocking or temporary files. This should maybe be a package in its own right, someday. """ from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import os from subproce...
gui.py
#!/usr/bin/env python3 import tkinter as tk import sys import cv2 import mediapipe as mp import numpy as np import random as r import threading import datetime import os import PIL.Image, PIL.ImageTk from tkinter import * from tkinter import ttk from sys import version_info from multiprocessing import P...
pyqttest.py
#thread import mmdbridge from mmdbridge import * import sys import threading use_separate_thread = True __command_queue = [] __command_queue_lock = threading.Lock() __command_queue_event = threading.Event() __pyqt_thread = None def queueCommand(callable, arguments=()): if use_separate_thread == False: callable(*...
asynchronous.py
# -*- coding: utf-8 -*- ######################################################################## # # # python-OBD: A python OBD-II serial module derived from pyobd # # # # C...
views.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.http import HttpResponse, JsonResponse import urllib from django.shortcuts import render, redirect from core.MsfToolbox import * from datetime import datetime from django.core.files.storage import FileSystemStorage import anssi.settings import ...
netmiko-threads.py
#!/usr/bin/env python # Use threads and Netmiko to execute 'show version' on each device in the database. # Calculate the amount of time required to do this. What is the difference in time # between executing 'show version' sequentially versus using threads? from netmiko import ConnectHandler from datetime import d...
__main__.py
# -*- coding: utf-8 -*- from logging import getLogger, ERROR getLogger("scapy.runtime").setLevel(ERROR) import argparse import sys from PyQt5 import QtCore from wifipumpkin3 import PumpkinShell from wifipumpkin3.core.utility.printer import ( banner, setcolor, display_messages, set_nocolors, ) from wifi...
decode.py
#!/usr/bin/env python2.7 # pylint: disable-msg=C0103,E501 import copy import dshell import glob import gzip import logging import optparse import os import output import sys import tempfile import traceback import util import zipfile try: import pcap except ImportError: pcap = None print 'pcap not availab...
base_crash_reporter.py
# Electrum - lightweight Bitcoin client # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, modify, merge, # publish...
translate_selenium.py
from selenium import webdriver import threading from queue import Queue from tqdm import tqdm import warnings import time warnings.filterwarnings('ignore') span = '/html/body/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[3]/div[1]/div[2]/div/span[1]' base_url = 'https://translate.google.com/#' class Translate: ...
run.py
import stackless from datetime import date, timedelta, datetime from General.outsourcingTask import generateSol, stacklessTicker from General.basicServer import CommunicationServer from General.newProcess import StacklessProcess, getLock, getSharedObjects def keepAlive(): while True: stackless.schedule() ...
vkapi.py
# --------------------------- # | vk_advanced_api # | Класс: VKAPI # | Автор: https://vk.com/Ar4ikov # | Создан 07.03.2018 - 9:29 # --------------------------- import os with open(os.path.join(os.path.dirname(__file__), 'version')) as f: __version__ = f.readline().strip() import re import time from t...
capture_cell_coordinates.py
#!/usr/bin/env python #* Team Id : SR#7147 #* Author List : eYantra #* Filename: capture_cell_coordinates.py #* Theme: Survay And Rescue #* Functioning : This script helped us to record the cell coordinates in 2D and store them in .json format as per the cell/block named as "cell_coords.json". # It subscribe to wh...
core.py
# -*- coding: utf-8 -*- """ envoy.core ~~~~~~~~~~ This module provides envoy awesomeness. """ import os import sys import shlex import signal import subprocess import threading import traceback __version__ = '0.0.3' __license__ = 'MIT' __author__ = 'Kenneth Reitz' def _terminate_process(process): ##终止进程 if ...
autoreload.py
import functools import itertools import logging import os import signal import subprocess import sys import threading import time import traceback import weakref from collections import defaultdict from pathlib import Path from types import ModuleType from zipimport import zipimporter import django from django.apps i...
main.py
import pymysql.cursors import yfinance as yf import yaml import inotify.adapters import threading import time import re import dateparser import datetime class Portfolio: def __init__(self): super().__init__() self.portfolio_path = "/app/portfolio.yml" def get_portfolio_path(self): re...
test.py
import json import os.path as p import random import subprocess import threading import logging import time from random import randrange import pika import pytest from google.protobuf.internal.encoder import _VarintBytes from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster fro...
sdk_worker.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...
async_data_reader.py
"""This module contains data processing related logic. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import random import struct import Queue import time import numpy as np from threading import Thread import signal from multiprocessing import Manager,...
main.py
import os import sys import platform import time import threading import random from PyQt5 import QtGui from PyQt5 import QtCore from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QMainWindow from PyQt5.QtWidgets import QDockWidget from PyQt5.QtWidgets import QTextEdit from PyQt5.QtWid...
server.py
import numpy as np import os import io # import for server from flask import Flask, render_template, request, Response, send_file, jsonify from queue import Queue, Empty import threading import time # import for model from transformers import AutoTokenizer, AutoModelWithLMHead, top_k_top_p_filtering from torch.nn imp...
test_cgi.py
#!/usr/bin/python # -- Content-Encoding: UTF-8 -- """ Tests the CGI request handler :license: Apache License 2.0 """ from __future__ import print_function # Standard library import os import random import threading import unittest try: from http.server import HTTPServer, CGIHTTPRequestHandler except ImportError...
CyWebSocket.py
# -*- coding: utf8 -*- # # pywebsocketserver 2018.Jan.29 # ================================ # Written by suxianbaozi # # CyWebSocket.py 2018.Jan.29 # ================================ # Modified by Warren # # Python web server for connecting sockets locally with browsers # as well as a generic TCP server. # imp...
ipgetter2.py
# -*- coding: utf-8 -*- """Main module.""" import re import chardet import requests import unicodedata from threading import Thread from queue import Queue from requests.exceptions import ReadTimeout, ConnectionError from ipaddress import ip_address, IPv4Address, IPv6Address, AddressValueError from typing import List...
mlops_runtime_log.py
import json import logging import multiprocessing import os import threading import time import requests import yaml class MLOpsRuntimeLog: FED_LOG_LINE_NUMS_PER_UPLOADING = 100 _log_sdk_instance = None _instance_lock = threading.Lock() def __new__(cls, *args, **kwargs): if not hasattr(MLOp...
event_engine_base.py
# -*- coding: utf8 -*- _author_ = "gao" from queue import Queue, Empty from threading import Thread, RLock from time import sleep from collections import defaultdict from AmazingQuant.constant import EventType class EventEngineBase(object): """ 变量说明 _queue:私有变量,事件队列 _active:私有变量,事件引擎开关 _thread:...
RemoteTerminal.py
import socket, time, os, threading, sys try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) BIND_IP = s.getsockname()[0] BIND_PORT = 2000 s.close() except: sys.exit() def handle_client(client_socket): while 1: request = client_socket.recv(1024) try: if str(request) == "e...
band.py
#!/usr/bin/python # encoding: utf-8 from __future__ import unicode_literals import os import sys from multiprocessing import Process, Queue from HTMLParser import HTMLParser from workflow import Workflow3, web, ICON_INFO, ICON_WEB, ICON_NOTE, ICON_SYNC from workflow.notify import notify class Result: def __init__...
web_display.py
# A simple web server which displays input/output images over the network. # It should be a simple interface that can be reasonably interpreted when displayed # on a phone in landscape mode. # Initial code taken and modified from https://randomnerdtutorials.com/video-streaming-with-raspberry-pi-camera/ import io from...
final.py
import cv2 import pickle import numpy as np import tensorflow as tf #from cnn_tf import cnn_model_fn import os import sqlite3, pyttsx3 from keras.models import load_model from threading import Thread engine = pyttsx3.init() engine.setProperty('rate', 150) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' model = load_model("cn...
daemon_thread.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import (division, absolute_import, print_function, unicode_literals) import logging import threading import time def thread_function(name): logging.info("Thread %s: starting", name) time.sleep(2) logging.info("Thread %...
test_client_reconnect.py
from concurrent import futures import contextlib import os import threading import sys import grpc import numpy as np import time import random import pytest from typing import Any, Callable, Optional from unittest.mock import patch import ray import ray.core.generated.ray_client_pb2 as ray_client_pb2 import ray.core...
symb.py
import struct import io from PIL import Image __author__ = 'zhengwang' import threading import SocketServer import serial import cv2 import numpy as np import math # distance data measured by ultrasonic sensor sensor_data = " " class NeuralNetwork(object): def __init__(self): self.model = cv2.ANN_MLP(...
bot_base.py
''' @ Harris Christiansen (Harris@HarrisChristiansen.com) January 2016 Generals.io Automated Client - https://github.com/harrischristiansen/generals-bot Generals Bot: Base Bot Class ''' import sys import traceback import logging import os from queue import Queue import random import threading import ti...
EWS_connector.py
#!/usr/bin/env python2.7 from flask import Flask, request, jsonify import json, datetime import sys, os from string import Template import xml.etree.ElementTree as ET import subprocess import requests import sys reload(sys) sys.setdefaultencoding("utf-8") import getpass import csv, codecs import argparse import dateti...
cli.py
# -*- coding: utf-8 -*- import configparser import random import sys import time from pathlib import Path from threading import Thread from urllib.parse import urlparse import click from . import __version__ from .controllers import Cache, CastState, StateFileError, StateMode, get_chromecasts, setup_cast from .error...
test_html.py
from functools import partial from importlib import reload from io import BytesIO, StringIO import os from pathlib import Path import re import threading from urllib.error import URLError import numpy as np import pytest from pandas.compat import is_platform_windows from pandas.errors import ParserError import pandas...
test_io.py
from __future__ import division, absolute_import, print_function import sys import gzip import os import threading from tempfile import mkstemp, NamedTemporaryFile import time import warnings import gc from io import BytesIO from datetime import datetime import numpy as np import numpy.ma as ma from numpy.lib._iotool...
tests.py
from base64 import b64encode import hashlib import unittest from http.server import HTTPServer, BaseHTTPRequestHandler import socketserver import threading from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives import ...
sshd.py
# coding=utf-8 import os import socket import threading import paramiko from paramiko.common import WARNING from webssh.sshd.sftpinterface import SFTPInterface from webssh.sshd.sshinterface import ServerInterface import logging import warnings warnings.filterwarnings("ignore") paramiko.util.log_to_file('./paramiko.log'...
test.py
import json import pytest import random import re import string import threading import time from multiprocessing.dummy import Pool from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster from helpers.test_tools import TSV cluster = ClickHouseCluster(__file__) node1 = cluster.ad...
eternus_dx_iscsi.py
# Copyright (c) 2015 FUJITSU LIMITED # Copyright (c) 2012 EMC Corporation. # Copyright (c) 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 Licen...
webserver.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Athena is Alive!" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()