source
stringlengths
3
86
python
stringlengths
75
1.04M
go_tool.py
import argparse import copy import json import os import re import shutil import subprocess import sys import tempfile import threading arc_project_prefix = 'a.yandex-team.ru/' std_lib_prefix = 'contrib/go/_std/src/' vendor_prefix = 'vendor/' vet_info_ext = '.vet.out' vet_report_ext = '.vet.txt' FIXED_CGO1_SUFFIX='.f...
client_server_test.py
# -*- coding: UTF-8 -*- from contextlib import contextmanager import gc from multiprocessing import Process import subprocess import threading import unittest from py4j.clientserver import ( ClientServer, JavaParameters, PythonParameters) from py4j.java_gateway import GatewayConnectionGuard, is_instance_of, \ ...
tests.py
from unittest import TestCase import os import tempfile import pickle import itertools import numpy as np from scipy import sparse import neoml import threading class MultithreadedTestCase(TestCase): def _thread_function(self, target, kwargs): print(f"python thread {threading.get_ident()} started") ...
server.py
''' Assignment 2 Server for image classification Author: fanconic ''' import base64 from threading import Thread from queue import Queue from PIL import Image import socket, json from keras.preprocessing import image from keras.applications.resnet50 import ResNet50, preprocess_input, decode_predictions from io import ...
Event_test.py
# coding: utf-8 ######################################################################### # 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> # # author yeeku.H.lee kongyeeku@163.com # # # # version...
submithost.py
""" This file is part of PUQ Copyright (c) 2013 PUQ Authors See LICENSE file for terms. """ from __future__ import absolute_import, division, print_function import os, time, sys from .monitor import TextMonitor from subprocess import Popen, PIPE import numpy as np from logging import debug from .hosts import Host from...
amsg_cli.py
#!env/bin/python3 import sys import socket import threading import time import signal import argparse import sqlite3 import parser import rsa import socks class client: def __init__(self,ip='localhost',port='9999',mode='0'): #just to support srv variable self.clients = 1 self.srv_info = [(...
__init__.py
import multiprocessing from pkg_resources import get_distribution, DistributionNotFound try: __version__ = get_distribution(__name__).version except DistributionNotFound: # package is not installed pass class Actor: __close_message__ = '_*CLOSE*_' """ Wraps a pickleable class as an actor...
Admin.py
from tkinter import * from tkinter import ttk from tkinter import tix from tkinter import filedialog from tkscrolledframe import ScrolledFrame from ttkwidgets import CheckboxTreeview from math import * from platform import * from tkinter import messagebox from datetime import * import mysql.connector import threading i...
serialwriter.py
# -*- coding: utf-8 -*- # vim: ts=2 sw=2 et ai ############################################################################### # Copyright (c) 2012,2021 Andreas Vogel andreas@wellenvogel.net # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentatio...
stockRefreshModule.py
import time import yfinance as yf import threading from dotenv import load_dotenv import src.app.domain.collections.stocks.stocksQueries as stockQueries from random import randrange from src.app.domain.collections.stocks.stocksDatabaseAccess import refreshRegularPriceForStock from src.app.domain.collecti...
test_deconfuser.py
import numpy as np import multiprocessing import itertools import argparse import os import deconfuser.sample_planets as sample_planets import deconfuser.orbit_fitting as orbit_fitting import deconfuser.orbit_grouping as orbit_grouping import deconfuser.partition_ranking as partition_ranking mu_sun = 4*np.pi**2 #Sun'...
tftp.py
import logging import os import random import signal import tempfile import threading from pyats.utils.sig_handlers import enable_double_ctrl_c from tftpy import TftpClient, TftpServer from ..server import FileServer as BaseFileServer from ..server import ALPHA DEFAULT_PORT = 0 class FileServer(BaseFileServer): ...
mainwindow.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Spyder, the Scientific PYthon Development EnviRonment ===================================================== Developped and maintained by the Spyder Pro...
picker.py
import threading from pynput import keyboard from pynput import mouse """ monitor the mouse: x, y paint the x, y, w, h box with red color monitor the ctrl-keyboard generate the position index value """ def on_move(x, y): # print('Pointer moved to {0}'.format( # (x, y))) pass def on_activat...
test.py
import json import os.path as p import random import socket import threading import time import logging import io import string import ast import math import avro.schema import avro.io import avro.datafile from confluent_kafka.avro.cached_schema_registry_client import CachedSchemaRegistryClient from confluent_kafka.av...
injector_test.py
# encoding: utf-8 # # Copyright (C) 2010 Alec Thomas <alec@swapoff.org> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # # Author: Alec Thomas <alec@swapoff.org> """Functional tests for the "Injector" dependency inje...
_localhost_open_browser.py
import os import time import urllib import warnings import threading import webbrowser from .._is_reload_process import is_reload_process from .._user_preferences import get_user_preference from . import terminal_colors class LocalhostOpenBrowser: # pylint: disable=too-few-public-methods def __init__(self, ...
Tree Height.py
>> import sys, threading sys.setrecursionlimit(10**7) # max depth of recursion threading.stack_size(2**27) # new thread will get stack of such size class TreeHeight: def read(self): self.n = int(sys.stdin.readline()) self.parent = list(map(int, sys.stdin.readline().split()))...
test_decorators.py
import threading from pytest import fixture, raises import zmq from zmq.decorators import context, socket from zmq.tests import BaseZMQTestCase, term_context ############################################## # Test cases for @context ############################################## @fixture(autouse=True) def term_cont...
training.py
from __future__ import print_function from __future__ import absolute_import import warnings import copy import time import numpy as np import multiprocessing import threading try: import queue except ImportError: import Queue as queue from .topology import Container from .. import backend as K from .. import...
InternalMain.py
''' @desc:内网穿透(映射)客户端 部署在内网 @author: Martin Huang @time: created on 2019/6/14 20:43 @修改记录: 2019/07/12 => 增加DEBUG选项 默认False 改为True可显示更多信息 ''' import select import socket import time from threading import Thread from Utils.ConversionUtils import ConversionUtils #pycharm #from src.main.Utils.IOUtils import * #调试参数 DEBUG =...
buttonthread.py
# -*- coding: utf-8 -*- # Copyright (c) 2018 Steven P. Goldsmith # See LICENSE.md for details. """ Use a thread to monitor edge events in background ------------- Should work on any board with a button built in. Just change chip and line value as needed. """ import sys, time, threading, gpiod from argparse import * ...
genericpot.py
#!/usr/bin/env python3 import os import signal import threading from . import generic import core.potloader as potloader import core.utils as utils from .dblogger import DBThread class GenericPot(potloader.PotLoader): """ Implementation of generic honeypot that listens on an arbitrary UDP port and respo...
MergeSort.py
from Algorithims import Algorithms import time import threading class MergeSort(Algorithms): def __init__(self, data, delay): Algorithms.__init__(self) self.data = data self.delay = delay sorting_thread = threading.Thread(target=self.sort, args=(self.data, self.drawData, self.del...
__init__.py
#!/usr/bin/python3 # @todo logging # @todo extra options for url like , verify=False etc. # @todo enable https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl as option? # @todo option for interval day/6 hour/etc # @todo on change detected, config for calling some API # @todo make tables responsive! # @todo fe...
rpc.py
import threading import pickle import sys import logging import msgpackrpc import tblib import uuid import functools logger = logging.getLogger(__name__) class Base(object): def __init__(self): self._server = msgpackrpc.Server(self) self._blocking_thread = None self._id = str(uuid.uuid1()...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
label_sync.py
# ElectrumSV - lightweight Bitcoin client # Copyright (C) 2014 Thomas Voegtlin # Copyright (C) 2019-2020 The ElectrumSV Developers # # 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 re...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
intersection_scenario_generate.py
""" Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University. All rights reserved. Description : generate two vehicle at a specefic intersection Author:Team Li """ import sys, os, glob, random, threading, time, pickle, datetime from enum import Enum from situation_assessment import _assess_o...
test_auto_scheduler_search_policy.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
qweNet.py
import sys import time import networkx as nx import numpy as np import torch import torch.nn.functional as F from scipy.stats import kendalltau as kd from tensorboardX import SummaryWriter from torch import nn from torch_geometric.data import DataLoader from torch_geometric.nn import GCNConv from torch_geometric.utils...
syslog.py
from socketserver import BaseRequestHandler, UDPServer from threading import Thread from eNMS.database import db class SyslogServer: def __init__(self, ip_address, port): self.ip_address = ip_address self.port = port self.start() def start(self): UDPServer.allow_reuse_address...
watchlogs.py
"""A simple log file watcher to provide `tail -F` style functionality across multilple logfiles. The syntax is simply: `watchlogs --log_files log1.txt,log2.txt,....` """ import sys import math import time import argparse import threading from typing import Callable, Union, List from pathlib import Path import tailf ...
serialization.py
# Copyright 2020 Huawei Technologies Co., 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 agreed to...
inference.py
## 기본 라이브러리 Import import sys import numpy as np import torch import os import argparse ## WaveGlow 프로젝트 위치 설정 sys.path.append('waveglow/') ## Tacontron2 프로젝트 위치 설정 sys.path.append('tacotron2/') ## 프로젝트 라이브러리 Import from hparams import defaults from model import Tacotron2 from layers import TacotronSTFT, STFT from au...
utils.py
# -*- coding: utf-8 -*- import os import time import signal import platform import multiprocessing from contextlib import closing import sqlite3 import pytest from usql.main import special DATABASE = os.getenv("PYTEST_DATABASE", "test.sqlite3") def db_connection(dbname=":memory:"): conn = sqlite3.connect(data...
wiki.py
#!/usr/bin/python #coding=utf-8 import os,sys,warnings,requests,time,urllib,threading,csv import wikipedia as wiki from PIL import Image from io import BytesIO from locale import getdefaultlocale warnings.filterwarnings('ignore') try: langue=getdefaultlocale() langue=langue[0] langue=langue.split("_") ...
EMG_DPNN.py
# -*- coding: utf-8 -*- """ Created on Fri Aug 24 09:40:28 2018 @author: Paulo Augusto """ import numpy as np #from numpy import fft import matplotlib.pyplot as plt #import scipy.signal as sig import os import random import emgReaderClass_v2 as erc import threading import multiprocessing #import data...
integration_test_support.py
""" This module provides a IntegrationTestServerFixture which runs a IntegrationTestServer on "http://127.0.0.1:5000/". """ import atexit import os import shutil import subprocess import tempfile import time from multiprocessing import Process from time import sleep import pymongo import redis import requests...
watcher.py
#!/usr/bin/python3 from threading import Thread, Event from owtapi import OWTAPI from configuration import env import time inactive_time=float(env["INACTIVE_TIME"]) class RoomWatcher(object): def __init__(self, inactive=inactive_time, stop=Event()): super(RoomWatcher, self).__init__() self._stop=...
rpdb2.py
#! /usr/bin/env python """ rpdb2.py - version 2.4.8 A remote Python debugger for CPython Copyright (C) 2005-2009 Nir Aides 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;...
pluginmanager.py
#!/usr/bin/env python import functools def notify_stdout(msg, key=None, **kwargs): print msg libnotify_ids = {} def notify_libnotify(msg, key=None, timeout=1000, **kwargs): import dbus, wmiidbus try: session_bus = wmiidbus.get_session_bus(start_thread=False) except: return ...
views.py
#!/usr/bin/env python #!-*- coding:utf-8 -*- import json import threading import multiprocessing import requests from flask import Flask,render_template,request,session,jsonify,redirect from libs.action import SqlMapAction,Spider_Handle,Save_Success_Target from libs.func import Tools from libs.models import MySQLHand...
vnokex.py
# encoding: UTF-8 import hashlib import zlib import json from time import sleep from threading import Thread import websocket # OKEX网站 OKEX_USD_SPOT = 'wss://real.okex.com:10441/websocket' # OKEX 现货地址 #OKEX_USD_SPOT = 'wss://47.90.109.236:10441/websocket' # OKEX 现货地址 #OKEX_USD_SPOT = ...
test_threading.py
# Very rudimentary test of threading module import test.test_support from test.test_support import verbose, cpython_only from test.script_helper import assert_python_ok import random import re import sys thread = test.test_support.import_module('thread') threading = test.test_support.import_module('threading') import...
custom_datablock.py
#!/usr/bin/env python3 """ Pymodbus Server With Custom Datablock Side Effect -------------------------------------------------------------------------- This is an example of performing custom logic after a value has been written to the datastore. """ # ------------------------------------------------------------------...
materialized_views_test.py
import collections import re import sys import time import traceback import pytest import threading import logging from flaky import flaky from enum import Enum from queue import Empty from functools import partial from multiprocessing import Process, Queue from cassandra import ConsistencyLevel, InvalidRequest, Writ...
Dataset_Collect.py
import base64 import copy import datetime as dt import io import os import random import socket import sys import threading import time from collections import deque from net_builder import Data_dim_reduce as build_model import numpy as np import skimage import torch from torch.autograd import Variable from PIL import...
McRange.py
import random import socket import threading import discord from discord.ext import commands import os import threading import asyncio import requests client= commands.Bot(command_prefix = '.') print(""" SSSSSSSSSSSSSSS KKKKKKKKK KKKKKKKII...
pfsystem.py
# !/usr/bin/env python3 # -*- coding:utf-8 -*- __author__ = 'Zhiquan Wang' __date__ = '2018/7/20 22:28' import threading from networkservice import * from pfgame import * from pfmessage import * class PixelFightSystem(object): def __init__(self, *, ip=None, port=None): self.__networkSev = NetworkService(...
gui.py
""" The GUI file, reserved for all interactions GUI-wise and some others that fit within the category or are critical / necessary for the GUI to run. """ from os import listdir from random import randint from threading import Thread from time import sleep, time from PyQt5 import QtGui from PyQt5.QtCore import QEvent, ...
example.py
# -*- coding: utf-8 -*- import json import random from ironsource.atom.ironsource_atom import IronSourceAtom from ironsource.atom.ironsource_atom_tracker import IronSourceAtomTracker import time from threading import Thread from threading import Lock if __name__ == "__main__": stream = "YOUR_TARGET.public.atom_d...
test_dxlclient.py
# -*- coding: utf-8 -*- ################################################################################ # Copyright (c) 2018 McAfee LLC - All Rights Reserved. ################################################################################ """ Test cases for the DxlClient class """ # Run with python -m unittest dxlc...
test_worksheet.py
# Copyright (c) 2010 Resolver Systems Ltd, PythonAnywhere LLP # See LICENSE.md # from __future__ import with_statement try: import unittest2 as unittest except ImportError: import unittest import codecs import json import simplejson as json from StringIO import StringIO from mock import Mock, patch from thre...
run-spec-test.py
#!/usr/bin/env python3 # Author: Volodymyr Shymanskyy # Usage: # ./run-spec-test.py # ./run-spec-test.py ./core/i32.json # ./run-spec-test.py ./core/float_exprs.json --line 2070 # ./run-spec-test.py ./proposals/tail-call/*.json # ./run-spec-test.py --exec "../build-custom/wasm3 --repl" # # Running WASI veris...
test_web_status.py
# -*- coding: utf-8 -*- """ .. invisible: _ _ _____ _ _____ _____ | | | | ___| | | ___/ ___| | | | | |__ | | | |__ \ `--. | | | | __|| | | __| `--. \ \ \_/ / |___| |___| |___/\__/ / \___/\____/\_____|____/\____/ Created on Feb 11, 2014 ███████████████████████████████████████...
FolderCamera.py
import time import threading try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident from .FolderWatcher import FolderWatcher class CameraEvent(object): """An Event-like class that signal...
client.py
# import hmac import json import base64 from hashlib import sha1 import requests import threading import time from uuid import UUID from os import urandom from time import timezone, sleep from typing import BinaryIO from binascii import hexlify from time import time as timestamp from locale import getdefau...
window.py
import os import sys import sqlite3 import logging from PyQt5 import QtCore from PyQt5 import QtWidgets from PyQt5.QtCore import Qt from PyQt5.QtGui import QPalette from multiprocessing import Process, Queue sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from utility.setting import * from ...
trainer.py
import os import sys import settings from sources import ARTDQNAgent, TensorBoard, STOP, ACTIONS, ACTIONS_NAMES from collections import deque import time import random import numpy as np import pickle import json from dataclasses import dataclass from threading import Thread # Try to mute and then load Tensorflow # Mu...
test_creator.py
from __future__ import absolute_import, unicode_literals import ast import difflib import gc import json import logging import os import shutil import site import stat import subprocess import sys import zipfile from collections import OrderedDict from itertools import product from stat import S_IREAD, S_IRGRP, S_IROT...
pykms_Misc.py
#!/usr/bin/env python3 import sys import logging import os import argparse from logging.handlers import RotatingFileHandler from pykms_Format import ColorExtraMap, ShellMessage, pretty_printer #---------------------------------------------------------------------------------------------------------------------------...
core.py
""" Core voice2json command support. """ import asyncio import io import logging import os import queue import shlex import ssl import sys import threading import typing import wave from pathlib import Path import pydash _LOGGER = logging.getLogger("voice2json.core") # -----------------------------------------------...
Misc.py
import csv import Stats from Params import misc_params, stats_params, trees, analyze_params import pysam import multiprocessing as mp import argparse import os acceptable_bases = {'A','C','G','T'} def filter_by_trees(sites): filtered_sites = list() for site in sites: genotype_dict = {tree:{'HET':0, 'H...
Scheduler.py
import asyncio import datetime import os import sys import threading import time # import _thread as thread from functools import wraps TIME_ACCURACY = 1 # 时间精度,时间精度不是越小越好!你的Task每次循环超过了这个值,将影响准确度 start_time = int(time.time()) sql_clean_time = 45 def time_to_str(times=time.time()): if times == 0: ...
arbiter.py
import logging import os import subprocess import threading from enum import Enum from os.path import expanduser from psutil import Popen from smart_getenv import getenv from virtualenvapi.manage import VirtualEnvironment logger = logging.getLogger(__name__) logging.basicConfig(level=logging.DEBUG) class ProcessSt...
test_tg_vcmts_pktgen.py
# Copyright (c) 2019 Viosoft Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
pgd.py
import os import time import csv import numpy as np import argparse from multiprocessing import Process, Pipe, cpu_count parser = argparse.ArgumentParser(description='') parser.add_argument('--model', type=str, required=True, help='Path to model') parser.add_argument('--epsilon', type=float, required=True, help='Epsilo...
linear_anstaz_w_multithread.py
import qiskit import numpy as np import sys import qtm.base import qtm.constant import qtm.ansatz import qtm.fubini_study import qtm.encoding import multiprocessing def runw(num_layers, num_qubits): thetas = np.ones((num_qubits*num_layers*5)) qc = qiskit.QuantumCircuit(num_qubits, num_qubits) loss_values ...
videoreader.py
from threading import Thread import sys import time import numpy as np import ffmpeg width = 1280 height = 720 class VideoReader: def __init__(self, path, fps): self.stopped = False self.frame = None self.path = path self.fps = fps self.process = None self.frames =...
async_save.py
import torch from torch.multiprocessing import Process import numpy as np import logging from collections import OrderedDict from typing import Any, Dict logger = logging.getLogger(__name__) def copy_cpu_state_dict(states: Any) -> Dict[str, Any]: # need a new dict result_states = OrderedDict() if isinst...
damarisd.py
import tables as T import numpy as N import subprocess import threading import SimpleXMLRPCServer import SocketServer import time,xmlrpclib,httplib import cPickle as pickle import ConfigParser import sys, os import imp # xmlrpc mit timeout def Server(url, *args, **kwargs): t = TimeoutTransport() t.timeout = kw...
modbus_thread.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # modbus_thread # start a thread for polling a set of registers, display result on console # exit with ctrl+c import time from threading import Thread, Lock from pyModbusTCP.client import ModbusClient SERVER_HOST = "localhost" SERVER_PORT = 502 # set global regs = [] #...
fit.py
#!/usr/bin/env python3 import itertools import json import random from threading import Thread from tqdm import tqdm, tnrange from sword import morphology_map, where_da_sword def iou(a, b, epsilon=1e-5): # COORDINATES OF THE INTERSECTION BOX x1 = max(a[0], b[0]) y1 = max(a[1], b[1]) x2 = min(a[2], b...
test_concurrent_transaction.py
from nose.plugins.attrib import attr from test.integration.base import DBTIntegrationTest import threading class BaseTestConcurrentTransaction(DBTIntegrationTest): def reset(self): self.query_state = { 'view_model': 'wait', 'model_1': 'wait', } @property def schema...
presto.py
import re from collections import OrderedDict import prestodb from query_designer.models import Query import time from threading import Thread import sys from django.db import connections, ProgrammingError from django.conf import settings from aggregator.models import Variable, Dimension from .utils import GRANULA...
api_tts.py
import os, hashlib, asyncio, threading, time, aiohttp, json, urllib, mutagen from mutagen.mp3 import MP3 from homeassistant.helpers.network import get_url from homeassistant.helpers import template from homeassistant.const import (STATE_PLAYING) # 百度TTS IS_PY3 = True from urllib.request import urlopen from urllib.requ...
util.py
# Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. # See the LICENSE file in the project root for more information. from __future__ import annotations # Allow subscripting Popen from dataclasses import dataclass, replace from datetime...
test_socket.py
import unittest from test import support import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import platform import array import contextlib from weakref import proxy import signal import math import pickle import struct impo...
sync.py
# Copyright (C) 2008 The Android Open Source Project # # 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 ...
serverapp.py
# coding: utf-8 """A tornado based Jupyter server.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import binascii import datetime import errno import gettext import hashlib import hmac import inspect import io import ipaddress import json import logging import mi...
main.py
import socketIO_client import time import threading import os import pty import subprocess io = socketIO_client.SocketIO('witcoin.ru', 4000) io.emit('auth', 'test3') master, slave = pty.openpty() if not os.path.exists('tmp'): os.mkdir('tmp') videoPipeName = 'tmp/video.avi' if not os.path.exists(vide...
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 import pandas.util._test_decorators as...
email.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from api.app import mail def send_async_email(app, to, subject, template, **kwargs): with app.app_context(): # pragma: no cover msg = Message(subject, recipients=[to]) msg.body = render_te...
spotify.py
#!/usr/bin/env python from app import lego from app import webhook from flask import Blueprint, request, render_template, \ flash, g, session, redirect, url_for, \ current_app from urllib.request import urlopen import io import logging import os import sqlite3 import tekore as tk im...
server.py
################################################################################ # # 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 ...
start.py
#!/usr/bin/env python3 from concurrent.futures import ThreadPoolExecutor, as_completed from contextlib import suppress from itertools import cycle from json import load from logging import basicConfig, getLogger, shutdown from math import log2, trunc from multiprocessing import RawValue from os import urandom...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import unittest.mock import queue as pyqueue 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 subprocess import struct import operator import p...
subproc.py
#! env python # should work with Python 2.7 and 3.x # subproc.py from __future__ import print_function import logging import os import shlex import signal import subprocess import sys import threading from collections import namedtuple from multiprocessing import TimeoutError try: from itertools import izip excep...
wireless_chat.py
""" Send text to other devices running this script remotely. """ import multipeer from console import clear from time import sleep from threading import Thread from PIL import Image done = False def loop(): while not done: data = multipeer.get_data() if data is not None: clear() ...
utils.py
import glob import hashlib import logging import os import shutil import subprocess from functools import wraps from tempfile import gettempdir from threading import Thread import requests from timeout_decorator import timeout from utils.constants import Constant from utils.format import Format logger = logging.getL...
mark.py
from .set_mark.namu import namu from .set_mark.markdown import markdown import re import html import sqlite3 import urllib.parse import threading import multiprocessing def load_conn2(data): global conn global curs conn = data curs = conn.cursor() def send_parser(data): if not re.search('^<br>$'...
pyNet.py
#! ~/git/Code/scripts/ # Author : Garrett Lender # Date : 2017 May 15 # Purpose : This script allows for the processing of comands on an external machine, listening on a port on a host machine for incoming connections, # execution of a certain file once connection to a host machine is made, and can initia...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import electrum from electrum.bitcoin import TYPE_ADDRESS from electrum import WalletStorage, Wallet from electrum_gui.kivy.i18n import _ from electrum.paymentrequest import InvoiceStore from electr...
video.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ## Import the relevant files from sys import exit as Die try: import sys import time import cv2 import time import imutils import numpy as np from threading import Thread from colordetection import ColorDetector import os import pi...
startup_flair.pyw
import time, os, threading as thread, pathlib from tkinter import * from PIL import Image, ImageTk PATH = str(pathlib.Path(__file__).parent.absolute()) scalar = 0.6 def doAnimation(): root = Tk() root.configure(bg='black') root.frame = Frame(root, borderwidth=2, relief=RAISED) root.wm_attri...
python_test04.py
#!env python # -*- coding: utf-8 -*- """ Python test 04: Run user-selected command on many servers (user provided as param) with ssh in parallel, collect output from all nodes. Script should print collected output from all nodes on stdout, w/o using temp files """ # This is free and unencumbered software released int...
__init__.py
# Copyright 2017 Mycroft AI 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 writin...