source
stringlengths
3
86
python
stringlengths
75
1.04M
email.py
from flask_mail import Message from app import mail, app from flask import render_template from threading import Thread def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body): msg = Message(subject, sender=sender, reci...
test_local_task_job.py
# -*- coding: utf-8 -*- # # 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 #...
tests.py
from pytest import fixture, raises from threading import Thread from tinydb import where, TinyDB from tinydb.storages import MemoryStorage from tinyrecord import transaction, abort @fixture def db(): return TinyDB(storage=MemoryStorage).table('table') def test_insert_multiple(db): with transaction(db) as tr...
test_termination.py
#!/usr/bin/env python from contextlib import contextmanager import platform import signal import threading import time import pytest import requests from constants import protocols from util import start_cloudflared, wait_tunnel_ready, check_tunnel_not_connected def supported_signals(): if platform.system() == ...
manticore.py
import os import sys import time import types import functools import cProfile import pstats import itertools from multiprocessing import Process from contextlib import contextmanager from threading import Timer # FIXME: remove this three import elftools from elftools.elf.elffile import ELFFile from elftools.elf.sect...
job_helper.py
# coding=utf-8 # Copyright (c) 2017 Dell Inc. or its subsidiaries. # 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/L...
TProcessPoolServer.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...
vaults.py
import logging import re import threading import time from typing import List from brownie import ZERO_ADDRESS, Contract, chain from eth_utils import encode_hex, event_abi_to_log_topic from joblib import Parallel, delayed from semantic_version.base import Version from yearn import apy from yearn.apy.common import ApyS...
feed.py
import sys import cv2 import time import threading import queue import numpy as np import tensorflow as tf import configparser from PIL import Image from utils.utils import load_coco_names, draw_boxes, \ get_boxes_and_inputs_pb, non_max_suppression, \ load_graph, letter_box_image # ------------------- # FUNCTI...
test_pocs.py
import os import threading import time import pytest import requests from astropy import units as u from panoptes.pocs import hardware from panoptes.pocs.core import POCS from panoptes.pocs.observatory import Observatory from panoptes.utils.config.client import set_config from panoptes.utils.serializers import to_j...
context.py
#!/usr/bin/env python3 from http import HTTPStatus from socketserver import ThreadingMixIn from urllib.parse import urlparse from ruamel.yaml.comments import CommentedMap as OrderedDict # to avoid '!!omap' in yaml import threading import http.server import json import queue import socket import subprocess import time ...
webcam-follower.py
import cv2 import sys import time import math from threading import Thread import nxt.locator from nxt.motor import * cascPath = "haarcascade_frontalface_default.xml" faceCascade = cv2.CascadeClassifier(cascPath) video_capture = cv2.VideoCapture(0) centerx = 320 centery = 240 currentx = 0 currenty = 0 def movex(b, c...
test_lostfilmtracker_parse_all_series.py
import pytest from unittest import TestCase from monitorrent.plugins.trackers.lostfilm import LostFilmTVTracker from monitorrent.utils.soup import get_soup import requests from threading import Thread, Lock from queue import Queue, Empty class TestParseAllSeriesTest(TestCase): def test_parse_all_series(self): ...
NseSupport.py
import requests import json import threading import queue from bs4 import BeautifulSoup from datetime import datetime import csv import SupportUrls class Nse: def __init__(self): self.queue = queue.Queue() self.threads = list() self.number_of_threads = 5 self.stock...
drEngine.py
# encoding: UTF-8 ''' 本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。 使用DR_setting.json来配置需要收集的合约,以及主力合约代码。 ''' import json import csv import os import copy from collections import OrderedDict from datetime import datetime, timedelta from Queue import Queue, Empty from threading import Thread from redtorch.event import Even...
local_file_inclusion_v1.py
#!/usr/bin/python # -*- coding: UTF-8 -*- import mechanize import requests import random import sys from urlparse import urlparse from urlparse import parse_qs from urlparse import urlunsplit import timeit import argparse import os import multiprocessing as mp import time from pymongo import MongoClient connection =...
carplay.py
#!/usr/bin/python3 # "Autobox" dongle driver for HTML 'streaming' - test application # Created by Colin Munro, December 2019 # See README.md for more information """Implementation of electric-monk's pycarplay for use with head-units""" import asyncio import decoder import audiodecoder import link import protocol from...
eventEngine.py
# encoding: UTF-8 # 系统模块 from queue import Queue, Empty from threading import Thread from time import sleep from collections import defaultdict # 第三方模块 from qtpy.QtCore import QTimer # 自己开发的模块 from cyvn.trader.vtEvent import * ######################################################################## class EventEngin...
applemusicrp.py
import sys import os import platform import time import subprocess import threading from sys import exit import logging from pypresence import Presence import pypresence.exceptions import dialite from pystray import Icon as icon from pystray import Menu as menu from pystray import MenuItem as item from PIL import Image...
matrixMul.py
import multiprocessing # Program to multiply two matrices using nested loops def multiplyMatrix(AList, BList,CList): #print ("---- A --------") #print AList #print ("---- B --------") #print BList #print ("---- C --------") #print CList # iterate through rows of X for i in range(len(AList)): # print ("---...
conftest.py
import pytest import torch from multiprocessing import Process import syft from syft import TorchHook @pytest.fixture() def start_proc(): # pragma: no cover """ helper function for spinning up a websocket participant """ def _start_proc(participant, kwargs): def target(): server = parti...
dokku-installer.py
#!/usr/bin/env python2.7 import cgi import json import os import re import SimpleHTTPServer import SocketServer import subprocess import sys import threading VERSION = 'v0.18.2' hostname = '' try: command = "bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || wget -q -O - icanhazip.com'" hostname = s...
display.py
#!/usr/bin/env python # builtin from __future__ import absolute_import, division, print_function import glob import logging import numbers import os import socket import socketserver import subprocess import sys import tarfile import threading import time # external import xdg.BaseDirectory # internal from wallpapermgr...
mnist_to_mr.py
# Copyright 2019 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...
test_interrupt.py
import os import signal import tempfile import time from threading import Thread import pytest from dagster import ( DagsterEventType, Field, ModeDefinition, String, execute_pipeline_iterator, pipeline, reconstructable, resource, seven, solid, ) from dagster.core.errors import D...
writing.py
import multiprocessing import io import os import queue import shutil import sys import threading from typing import Optional import torch def open_wrapper(func): def wrapper(self, file_path, mode='rb', buffering=-1, encoding=None, errors=None, newline=None, closef...
collect.py
# Andrei, 2018 """ Collect data. """ from argparse import ArgumentParser import os import time import yaml from utils import dict_to_namespace from copy import deepcopy import torch.multiprocessing as mp import subprocess import signal from subprocess import PIPE from argparse import Namespace import shutil from ...
run.py
# encoding: UTF-8 """ 无人值守运行服务 """ from __future__ import print_function from time import sleep from datetime import datetime, time from multiprocessing import Process import webbrowser from webServer import run as runWebServer from tradingServer import main as runTradingServer from cyvn.trader.vtEngine import LogE...
java_gateway.py
# -*- coding: UTF-8 -*- """Module to interact with objects in a Java Virtual Machine from a Python Virtual Machine. Variables that might clash with the JVM start with an underscore (Java Naming Convention do not recommend to start with an underscore so clashes become unlikely). Created on Dec 3, 2009 :author: Barthe...
server.py
import socket import time import threading import logging import os import sys sys.path.append('C://code') sys.path.append('C://code/wave') from radar.radar_signal_processing import radar_activate from Echo import Echo NUM_RF_DATA = 5 ROOT_DATA = '//Desktop-3i7mg3m/data' class Server: def __init__(self, host, po...
threaded-atari-v2.py
from collections import defaultdict, namedtuple from threading import Thread from time import sleep import numpy as np import cv2 import gym def cellfn(frame): cell = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY) cell = cv2.resize(cell, (11, 8), interpolation = cv2.INTER_AREA) cell = cell // 32 return cell ...
go_tool.py
from __future__ import absolute_import import argparse import copy import json import os import re import shutil import subprocess import sys import tempfile import threading import six from functools import reduce import process_command_files as pcf arc_project_prefix = 'a.yandex-team.ru/' std_lib_prefix = 'contrib/...
remote_access.py
""" * Implementation of remote access Use localhost.run ssh remote port forwarding service by running a ssh subprocess in PyWebIO application. The stdout of ssh process is the connection info. * Strategy Wait at most one minute to get stdout, if it gets a normal out, the connection is successfully established. Othe...
foo_api.py
#!/usr/bin/env python2.7 from __future__ import print_function """ This module is an API module for ThreeSpace devices. The ThreeSpace API module is a collection of classes, functions, structures, and static variables use exclusivly for ThreeSpace devices. This module can be used with a system running...
util.py
# # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket try: import ssl ...
BilibiliLiveSimple.py
import datetime import json import os import random import time from subprocess import call import threading import requests def delayRandom(downTime, upTime, power): DelayTime = random.randint(downTime, upTime) time.sleep(DelayTime * power) def downloadFile(url): headers = {'User-Agent': 'Mozil...
websocketconnection.py
import threading import websocket import gzip import ssl import logging from urllib import parse import urllib.parse from binance_d.base.printtime import PrintDate from binance_d.impl.utils.timeservice import get_current_timestamp from binance_d.impl.utils.urlparamsbuilder import UrlParamsBuilder from binan...
ydlhandler.py
import importlib import io import os import subprocess import sys from collections import ChainMap from queue import Queue from threading import Thread from time import sleep import youtube_dlc from ydl_server import jobshandler from ydl_server.config import app_defaults from ydl_server.logdb import JobsDB, Job, Acti...
PyShell.py
#! /usr/bin/env python3 import getopt import os import os.path import re import socket import subprocess import sys import threading import time import tokenize import traceback import types import io import linecache from code import InteractiveInterpreter from platform import python_version, system try: from t...
main.py
''' @author: Yuto Watanabe @version: 1.0.0 Copyright (c) 2020 Earthquake alert ''' import multiprocessing import os import time try: from acquisition import AcquisitionJMA # pyright: reportMissingImports=false from convert_areas import convert, convert_report # pyright: reportMissingImports=false from c...
server.py
""" Web Server """ import socket import threading from todo.config import HOST, PORT, BUFFER_SIZE from todo.utils import Request, Response from todo.controllers import routes def process_connection(client): """处理客户端请求""" # 接收请求报文数据 # 解决客户端发送数据长度等于 recv 接收的长度倍数时阻塞问题 # https://docs.python.org/zh-cn/3.7...
_channel.py
# Copyright 2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
test_signal.py
import errno import os import random import signal import socket import statistics import subprocess import sys import time import unittest from test import support from test.support.script_helper import assert_python_ok, spawn_python try: import _testcapi except ImportError: _testcapi = None class GenericTes...
Hut.py
# -*- coding: utf-8 -*- """ Created on Sun Sep 13 07:10:14 2020 @author: tobias """ import requests import time import datetime import threading from concurrent.futures import Future try: from .GPSConverter import GPSConverter #from .HutDescription import HutDescription except ImportError: # for local testing...
updating_server.py
#!/usr/bin/env python3 """ Pymodbus Server With Updating Thread -------------------------------------------------------------------------- This is an example of having a background thread updating the context while the server is operating. This can also be done with a python thread:: from threading import Thread ...
httpserver.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...
t3dium-DOS.py
#Hey there, you're either looking at the source code because you think im a nsa agent looking to honeypot your data (lmao), or a curious coder. #Well if ur option 1: fear not ;), the codes really simple so you can see for yourself. #imports import threading import socket #functions def begin(): while True: ...
dlrm_main.py
"""Training script for DLRM model.""" import functools import queue import threading import REDACTED from absl import app as absl_app from absl import flags import numpy as np import tensorflow.compat.v1 as tf from REDACTED.tensorflow.python.tpu import device_assignment from REDACTED.tensorflow.python.tpu import tpu...
debugger_frontend.py
from json_serializer import JsonClient from multiprocessing import Queue import os import time import sys import threading import sys print(sys.path) import qdb from qdb import Frontend from .breakpoint import LineBreakpoint class LoggingPipeWrapper: def __init__(self, pipe): self.__pipe = pipe ...
module_speechrecognition.py
# -*- coding: utf-8 -*- ########################################################### # Retrieve robot audio buffer and do google speech recognition # # Syntax: # python scriptname --pip <ip> --pport <port> # # --pip <ip>: specify the ip of your robot (without specification it will use the NAO_IP defined below) # ...
mqttCore.py
# /* # * Copyright 2010-2016 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://aws.amazon.com/apache2.0 # * # * or i...
Test.py
import threading import IPLeak import os from halo import Halo CGREY = '\33[90m' CRED2 = '\33[91m' CGREEN2 = '\33[92m' CYELLOW2 = '\33[93m' CEND = '\33[0m' CBLUE2 = '\33[94m' ipv4 = [] ipv6 = [] dns = [] torrent_ips = [] def check_for_small_leak(): os.system('clear') spinner = Halo(text='Gathe...
tf_utils.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import rospy import tf2_ros import tf import os import threading import sys from multiprocessing import Process from tmc_sanyo_battery.msg import SanyoBatteryInfo from std_msgs.msg import Header from geometry_msgs.msg import TransformStamped STATIC_TF...
test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import Queue import time import sys import os import gc import signal import array import socket import random import logging import errno import weakref import test.script_helper from test import support from StringIO import StringIO _multiprocessing = ...
tasks.py
#!/usr/bin/env python # -*- coding: utf8 -*- # Author:RedTeam@Wing import nmap import re from celery import Celery from app.core.database.db_mongo import mongo from app.core.database.database_wing import DBSubdomain, TaskDB, PocscanTask, PocsuiteDB, PocsuiteVuln, VulnScanDB, \ LinksDB from app.common.utils.logger ...
multiprocessing_utils.py
#!/usr/bin/python3 import math import multiprocessing import pdb from tqdm import tqdm from typing import Any, Callable, List def send_list_to_workers(num_processes: int, list_to_split: List[Any], worker_func_ptr: Callable, **kwargs) -> None: """Given a list of work, and a desired number of n workers, launch n ...
test_signal.py
import errno import os import random import signal import socket import statistics import subprocess import sys import threading import time import unittest from test import support from test.support.script_helper import assert_python_ok, spawn_python try: import _testcapi except ImportError: _testcapi = None ...
classify_real_time.py
import argparse import os.path import re import sys import tarfile import cv2 from time import sleep import numpy as np from six.moves import urllib import tensorflow as tf import time from gtts import gTTS import pygame import os from threading import Thread import cv2 model_dir = '/tmp/imagenet' DATA_URL = 'http://d...
18-multiple-crash.py
#!/usr/bin/env python """Multiple processes with wandb service crash. Create a scenario where: - 4 runs are created in parallel - all runs attempt to log data - one run gets a fault injected - all 4 runs try to execute run.finish() The result is: - 4 runs created - indeterminate history logged for all 4 runs - indete...
magma_disk_full.py
''' Created on 16-Feb-2021 @author: riteshagarwal ''' import copy import os import threading import time from Cb_constants.CBServer import CbServer from cb_tools.cbstats import Cbstats from magma_base import MagmaBaseTest from memcached.helper.data_helper import MemcachedClientHelper from remote.remote_util import Re...
host_callback_test.py
# Copyright 2020 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
terminal.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import re import sys import time import shlex import codecs import curses import logging import threading import webbrowser import subprocess import curses.ascii from curses import textpad from multiprocessing import Process from contextlib impo...
DecodeRTSP_wo_ffmpeg.py
# import os # import sys # if os.name == 'nt': # # Add CUDA_PATH env variable # cuda_path = os.environ["CUDA_PATH"] # if cuda_path: # os.add_dll_directory(cuda_path) # else: # print("CUDA_PATH environment variable is not set.", file = sys.stderr) # print("Can't set CUDA DLLs sear...
arglauncher.py
"""Wraps launcher_util to make launching experiments one step easier - Ashvin - Names experiments based on the running filename - Adds some modes like --1 to run only one variant of a set for testing - Control the GPU used and other experiment attributes through command line args """ from railrl.launchers import launc...
text.py
# -*- coding: utf-8 -*- # @Time    : 2019/12/22 12:17 # @Author  : 高冷 # @FileName : 线程.py import threading import time star = time.time() def doo(n): time.sleep(3) print(n) def bar(n): time.sleep(2) print(n) t1 = threading.Thread(target=doo, args=(1,)) t2 = threading.Thread(target=bar, args=(2,)) ...
iis_shortname_Scan.py
# encoding=gbk # An IIS short_name scanner my[at]lijiejie.com http://www.lijiejie.com import sys import httplib import urlparse import string import threading import Queue import time import string class Scanner(): def __init__(self, target): self.target = target self.schem...
ipcontrollerapp.py
#!/usr/bin/env python # encoding: utf-8 """ The IPython controller application. Authors: * Brian Granger * MinRK """ #----------------------------------------------------------------------------- # Copyright (C) 2008 The IPython Development Team # # Distributed under the terms of the BSD License. The full licen...
tournament.py
from collections import defaultdict import csv import logging from multiprocessing import Process, Queue, cpu_count from tempfile import NamedTemporaryFile import warnings import tqdm from axelrod import on_windows from .game import Game from .match import Match from .match_generator import RoundRobinMatches, ProbEnd...
load_bpf.py
from threading import Thread from socket import socket import ctypes #import numpy as np #import os from time import sleep #from tree import * #from pprint import pprint #from bcc import BPF import subprocess #import create_bpf shutdown_time = -1 output_path = '/home/be4r/bin/bpf/remote/logs/' trace = {} flag = True b...
webapp.py
from flask import Flask, render_template, request, redirect, url_for, flash, session from datetime import datetime, timedelta from db_connector.db_connector import connect_to_database, execute_query from flask_login import LoginManager, login_user, login_required, current_user, logout_user, UserMixin from werkzeug.secu...
test_client.py
# coding=utf-8 # Copyright 2018-2020 EVA # # 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 ...
installwizard.py
import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electrum import Wallet, WalletStorage from electrum.util import UserCancelled, InvalidPassword from electrum.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALLET from elec...
ExportIndicators.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import json from flask import Flask, Response, request from gevent.pywsgi import WSGIServer from tempfile import NamedTemporaryFile from typing import Callable, List, Any, cast, Dict from base64 import b64decode from ssl...
tabuada.py
import sys import os from multiprocessing import Process, Value, Array ar2 = [] argm = int(sys.argv[1]) def func_tab(argm): global ar2 global ar for i in range(11): sm = argm * i ar2.append(sm) ar = Array("i", ar2) newT = Process(target=func_tab(argm)) newT.start() newT.join()...
test_sched.py
import queue import sched import threading import time import unittest from test import support TIMEOUT = 10 class Timer: def __init__(self): self._cond = threading.Condition() self._time = 0 self._stop = 0 def time(self): with self._cond: return self._time ...
metricd.py
# Copyright (c) 2013 Mirantis Inc. # Copyright (c) 2015-2017 Red Hat # # 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 a...
util.py
import atexit import os import shutil import sys import ctypes if sys.version_info[0] < 3 or sys.version_info[1] < 5: print("\nPlease restart with python3. \n(Taichi supports Python 3.5+)\n") print("Current version:", sys.version_info) exit(-1) tc_core = None def in_docker(): if os.environ.get("TI_IN_DOCKE...
__init__.py
import multiprocessing import queue from .network import Server from .game import Game def run(ip: str, port: int = None) -> (multiprocessing.Process, multiprocessing.Queue, multiprocessing.Queue): if port is None: port = 10000 receive, send = multiprocessing.Queue(), multiprocessing.Queue() net...
pytorch.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import atexit import logging import time from dataclasses import dataclass import os from pathlib import Path import socket from subprocess import Popen from threading import Thread import time from typing import Any, List, Optional, Union impor...
main.py
from __future__ import annotations # typehint only from typing import Optional, Pattern, Tuple, List, Dict, Union from asyncio.events import AbstractEventLoop from asyncio.futures import Future from asyncio.tasks import Task from http.cookiejar import Cookie from aiohttp.client_ws import ClientWebSocketRespons...
dhcp_starvation_2.py
from scapy.all import * from time import sleep from threading import Thread from scapy.layers.dhcp import DHCP, BOOTP from scapy.layers.inet import IP, UDP from scapy.layers.l2 import Ether class DHCPStarvation(object): def __init__(self): # Generated MAC stored to avoid same MAC requesting for differen...
utils.py
import os import time import contextlib import werkzeug.serving import threading import klaus TEST_SITE_NAME = "Some site" HTDIGEST_FILE = "tests/credentials.htdigest" TEST_REPO = os.path.abspath("tests/repos/build/test_repo") TEST_REPO_ROOT = os.path.abspath("tests/repos/build") TEST_REPO_URL = "test_repo/" UNAUTH_...
zero_agent.py
# 참고한 코드: https://github.com/maxpumperla/deep_learning_and_the_game_of_go/blob/master/code/dlgo/zero/agent.py from typing import Dict, Iterable, Optional, Tuple, TypeVar import numpy as np import heapq import threading import torch import torch.nn as nn import torch.nn.functional as F from torch import optim from torch...
robot.py
from django.conf import settings from robot import models from wxpy import Bot from wxpy.api.messages import MessageConfig from .security import create_signature from .action import SimpleAction from . import serializers from robot import get_message_helper from utils.etc import show_spend_time from threading import...
vg_to_imdb_vrr.py
# coding=utf8 import argparse, os, json, string from Queue import Queue from threading import Thread, Lock import h5py import numpy as np from scipy.misc import imread, imresize def build_filename_dict(data): # First make sure all basenames are unique basenames_list = [os.path.basename(img['image_path']) for...
xunfei_asr_handle.py
# -*- coding: utf-8 -*- # @Time : 2021/5/25 17:36 # @Author : lovemefan # @Email : lovemefan@outlook.com # @File : xunfei_asr.py import asyncio import hashlib import hmac import base64 import json, time, threading import traceback import aiohttp import aioredis import websockets from urllib.parse import quote import ...
collective_ops_test.py
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
hires.py
import picamera, httplib, requests, io, time from multiprocessing import Process, Pipe def postImage(): camera = picamera.PiCamera() s = requests.Session() camera.capture('images/file.jpg') camera.close() files = {'file': ('file.jpg', open('images/file.jpg', 'rb'), 'image/jpeg')} r = s.post...
error_handling.py
# Copyright 2018 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...
util.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2011 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights t...
Daemon_Thread.py
# Daemon Thread from threading import Thread, current_thread from time import sleep # def disp(): # print("Disp Function") # t2 = Thread(target=show) # print("T2 : ", t2.isDaemon()) # t2.start() # def show(): # print("Show Function") # # mt = current_thread() # print(mt.getName()) # print("MT : "...
models.py
# -*- coding: utf-8 -*- import time from threading import Thread import base64 import redis import redisco import unittest from datetime import date from redisco import models from redisco.models.base import Mutex class Person(models.Model): first_name = models.CharField() last_name = models.CharField() d...
sub-finder.py
import requests import sys import resolver import threading import time print(r""" _____ _ ______ _ _ / ____| | | | ____| (_) | | | (___ _ _ | |__ ______ | |__ _ _ __ ...
player.py
import threading import time import cv2 import numpy as np class VideoPlayer: def __init__(self, source, size=None, flip=False, fps=None, skip_first_frames=0): self.__cap = cv2.VideoCapture(source) if not self.__cap.isOpened(): print(f"Cannot open {'camera' if isinstance(source, int)...
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...
video.py
# Copyright 2020 Lorna Authors. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
stylizations.py
from flask_restplus import Namespace, Resource, reqparse from flask_login import login_required, current_user from werkzeug.datastructures import FileStorage from flask import send_file from multiprocessing import Process import threading from config import Config from PIL import Image import time import datetime from ...
sensing_interface.py
#!/usr/bin/env python3 import rospy import rospkg import re import threading import numpy as np from threading import Lock import imp from rosplan_knowledge_msgs.srv import KnowledgeUpdateServiceArray, KnowledgeUpdateServiceArrayRequest from rosplan_knowledge_msgs.srv import GetDomainPredicateDetailsService, GetDomain...
scraps.py
# coding: utf-8 import scapy.all as scapy import capture import strategy import logging import re import socket import subprocess import net import threading import time logger = logging.getLogger(__name__) class Strategy(strategy.Strategy): """ This strategy solves the scraps challenge by immediatly assuming...
slycat-pbs-agent.py
#!/bin/env python # Copyright (c) 2013, 2018 National Technology and Engineering Solutions of Sandia, LLC . Under the terms of Contract # DE-NA0003525 with National Technology and Engineering Solutions of Sandia, LLC, the U.S. Government # retains certain rights in this software. # External dependencies import PIL.Im...