source
stringlengths
3
86
python
stringlengths
75
1.04M
_base.py
# Builtins import datetime as dt import time from pathlib import Path import yaml import traceback import threading from typing import List, Dict, Any # External libraries import pandas as pd # Submodule imports from harvest.utils import * class API: """ The API class communicates with various API endpoints...
tool.py
#! /usr/bin/env python # 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 # "L...
dialogs_list.py
from threading import Thread, RLock import xbmc,os import xbmcaddon import xbmcgui from resources.lib.modules import control import time rt_timeout = 500 def select_ext(title, scraped_items): addonPath = xbmcaddon.Addon().getAddonInfo('path').decode('utf-8') dlg = SelectorDialog("DialogSelectList.xml", addo...
diffmap_widget.py
# coding: utf-8 # # Project: Azimuthal integration # https://github.com/silx-kit/pyFAI # # Copyright (C) 2015-2022 European Synchrotron Radiation Facility, Grenoble, France # # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu) # # Permission is hereby granted, free of charge, to any p...
socket_server.py
import socket import threading import time # 服务端 def deal_client(sock,addr): print('Accept new connection from {}'.format(addr)) # send() 的参数为二进制数据,字节数据 sock.send(b'Hello, I am a server.') while True: # recv()接收到的是字节数据 data=sock.recv(1024) time.sleep(1) if not data or d...
conftest.py
from __future__ import print_function import pytest import time import datetime import requests import os import sys import threading import logging import shutil from contextlib import contextmanager from tests import utils from six.moves import queue from wandb import wandb_sdk # from multiprocessing import Process...
btcproxy.py
""" A bitcoind proxy that allows instrumentation and canned responses """ from flask import Flask, request from bitcoin.rpc import JSONRPCError from bitcoin.rpc import RawProxy as BitcoinProxy from cheroot.wsgi import Server from cheroot.wsgi import PathInfoDispatcher import decimal import flask import json import log...
demo03.py
from threading import Condition, Thread import time class PeriodicTimer: def __init__(self, interval): self.interval = interval self._cv = Condition() self._flag = 0 def run(self): while True: time.sleep(self.interval) with self._cv: se...
Server.py
import sys import logging import thread import threading from BaseHTTPServer import HTTPServer as HTTPServer from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from RequestHandler import RequestHandler from HttpMiddleware import HttpMiddleware, ApiMiddleware logging.basicConfig(format='%(asctime)s %(l...
run_qtgui_with_spectogram.py
import numpy as np import torch import sys from collections import Counter from sklearn.preprocessing import LabelEncoder from librosa.core import load from librosa.feature import melspectrogram from librosa import power_to_db from librosa import amplitude_to_db from model import genreNet from config import MODELPATH...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def main(): return "Its alive!" def run(): app.run(host="0.0.0.0", port=8080) def keep_alive(): server = Thread(target=run) server.start()
stockmarket.py
from __future__ import print_function import random import threading import time import Pyro4 class StockMarket(object): def __init__(self, marketname, symbols): self.name = marketname self.symbolmeans = {} for symbol in symbols: self.symbolmeans[symbol] = random....
dynamic_recorder.py
#!/usr/bin/python3 #****************************************************************************** # #"Distribution A: Approved for public release; distribution unlimited. OPSEC #4046" # #PROJECT: DDR # # PACKAGE : # ORIGINAL AUTHOR : # MODIFIED DATE : # MODIFIED BY : # REVISION : # # Copyright (...
osc_server.py
"""OSC Servers that receive UDP packets and invoke handlers accordingly. Use like this: dispatcher = dispatcher.Dispatcher() # This will print all parameters to stdout. dispatcher.map("/bpm", print) server = ForkingOSCUDPServer((ip, port), dispatcher) server.serve_forever() or run the server on its own thread: serve...
__init__.py
import atexit import json import logging import socket import time import traceback from threading import Thread import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry instances = [] # For keeping track of running class instances DEFAULT_QUEUE_SIZE = 5000 #...
sonmari.py
import sys from os import system from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5 import uic import cv2 import argparse import sonmari_video as sv import darknet from threading import Thread, enumerate from queue import Queue def parser(): parser = argparse.ArgumentPa...
nkMergeSim.py
#!/usr/bin/env python #author Nikhil Kanamarla import matplotlib.pyplot as plt import matplotlib.animation as animation import math from matplotlib import style from Points import BuildPath from std_msgs.msg import String import rospy import tf import time import datetime ## import numpy as np from numpy.linalg import ...
installGUI.py
#!/usr/bin/env python3 """GUI class for the installSynApps module This GUI solution allows for much easier use of the installSynApps module to clone, update, and build the EPICS and synApps software stack. """ # Tkinter imports import tkinter as tk from tkinter import * from tkinter import messagebox from tkinter i...
socket.py
import time import json import websocket import threading import contextlib from sys import _getframe as getframe from .lib.util import objects class SocketHandler: def __init__(self, client, socket_trace = False, debug = False): # websocket.enableTrace(True) self.socket_url = "wss://ws1.narvii....
main.py
import socket import multiprocessing import atexit import os import datetime from urllib.parse import unquote clist = [] addrlist = [] plist = [] response_codes = { "200": "HTTP/1.0 200 OK\nServer:kral4 http server\nConnection: close\nContent-Type: text/html\n\n", "400": "HTTP/1.0 400 Bad request\nCach...
experiment_gui_module.py
import os import rospy import rospkg import collections import time import sys import subprocess import numpy as np from qt_gui.plugin import Plugin from python_qt_binding import loadUi from python_qt_binding.QtWidgets import QWidget, QDialog from python_qt_binding.QtCore import QMutex, QMutexLocker,QSemaphore, QThread...
widgets.py
# # widgets.py # Classes for widgets and windows # from PySide2 import QtWidgets, QtCore, QtGui, QtMultimedia import lib import os from playlist import PlaylistModel, PlaylistView import mutagen from typing import List import threading import time is_admin = lib.getAdminStatus() if is_admin: import keyboard ...
file_io_cli.py
# Copyright (c) 2018 Niklas Rosenstein # # 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, d...
__init__.py
# Copyright 2021 RTBHOUSE. All rights reserved. # Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. import http.server import json import logging import pathlib import ssl import threading from dataclasses import dataclass from functools import partial from urllib.parse ...
test_sized_dict.py
import multiprocessing import sys import numpy as np import pytest import torch.multiprocessing from espnet2.utils.sized_dict import get_size from espnet2.utils.sized_dict import SizedDict def test_get_size(): d = {} x = np.random.randn(10) d["a"] = x size1 = sys.getsizeof(d) assert size1 + get_...
TCP_Control.py
#-*- coding:utf-8 -*- import RPi.GPIO as GPIO import socket import time import string import threading #按键值定义 run_car = '1' #按键前 back_car = '2' #按键后 left_car = '3' #按键左 right_car = '4' #按键右 stop_car = '0' #按键停 #舵机按键值定义 front_left_servo = '1' #前舵机向左 front_right_servo = '2' #前舵机向右 up_servo = '3' #摄像头舵机向上...
tlsmagic.py
__author__ = 'Shirish Pal' import os import subprocess import sys import argparse import json import jinja2 import time from threading import Thread import pdb supported_ciphers = [ {'cipher_name' : 'AES128-SHA', 'cipher' : '{AES128-SHA}', 'sslv3' : '{sslv3}', 'tls1' : '{tls1}', 't...
service.py
# Copyright 2017 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
tracker.py
import logging import threading import time from typing import Union import numpy as np from tracker.filters.robot_kalman_filter import RobotFilter from tracker.multiballservice import MultiBallService from tracker.vision.vision_receiver import VisionReceiver from tracker.constants import TrackerConst from tracker.tr...
ex_workers.py
# # Simple example which uses a pool of workers to carry out some tasks. # # Notice that the results will probably not come out of the output # queue in the same in the same order as the corresponding tasks were # put on the input queue. If it is important to get the results back # in the original order then con...
sshslot.py
from utility import * import subprocess import sys import os import threading import time ssh_privkey_file = os.getenv("SSH_PRIVKEY_FILE", "daala.pem") binaries = { 'daala':['examples/encoder_example','examples/dump_video'], 'x264': ['x264'], 'x264-rt': ['x264'], 'x265': ['build/linux/x265'], 'x26...
ffmpegmux.py
import os import random import threading import subprocess import sys from streamlink import StreamError from streamlink.stream import Stream from streamlink.stream.stream import StreamIO from streamlink.utils import NamedPipe from streamlink.compat import devnull, which import logging log = logging.getLogger(__nam...
repl.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function import os import signal import string import threading def main(): import codecs import hashlib import json import os import platform import re import sys try: from urllib.request import build_open...
ip.py
""" ip.py: Module containing a comm-layer adapter for the Tcp/UDP/IP stack. This pairs with the F prime component "SocketIpDriver" in order to read data being sent via Tcp or Udp. This is the default adapter used by the system to handle data sent across a Tcp and/or UDP network interface. @author lestarch """ import ...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
tab_base_classes.py
##################################################################### # # # /tab_base_classes.py # # # # Copyright 2013, Monash University ...
socket.py
# ============================================================================ # FILE: socket.py # AUTHOR: Rafael Bodill <justRafi at gmail.com> # License: MIT license # ============================================================================ import socket from threading import Thread from queue import Queue from ...
tasks.py
import threading from django.db import transaction from .models import CrawlTask, TaskStatus from .PttSpider.ptt_spider import PttArticleListSpider, PttArticleSpider from .PttSpider.ptt_spider import Push, ArticleInfo from .PttSpider.ptt_spider import PttUrl, PttUrlType from .taskpool import TaskPool TASK_POOL_SIZE...
InfoFlow_Array_VIS_For_TK.py
import show_state_array from InfoFlow import * import tkinter as tk from tkinter import font from tkinter import N, S, W, E from typing import List import random import time from threading import Thread def rgb2hex(r, g, b): return "#%02x%02x%02x" % (r, g, b) class Style: color_background = "#373737" co...
login.py
import os, sys, time, re, io import threading import json, xml.dom.minidom import copy, pickle, random import traceback, logging try: from httplib import BadStatusLine except ImportError: from http.client import BadStatusLine import requests from pyqrcode import QRCode from .. import config, utils from ..retu...
main.py
#!/usr/bin/env python3.7 # -*- coding: utf-8 -*- import hashlib import json import math import os import re import requests import shlex import signal import struct import sys import threading import time import types from PIL import Image from io import BytesIO from bilibili import Bilibili #from picture import Encod...
x8_mmw.py
# # Copyright (c) 2020, Manfred Constapel # This file is licensed under the terms of the MIT license. # # # TI IWR6843 ES2.0 @ mmWave SDK demo of SDK 3.4.0.3 # TI IWR1843 ES1.0 @ mmWave SDK demo of SDK 3.4.0.3 # import sys import json import serial import threading from lib.shell import * from lib.helper import * fr...
test_subprocess.py
import unittest from test import test_support import subprocess import sys import signal import os import errno import tempfile import time import re import sysconfig try: import resource except ImportError: resource = None try: import threading except ImportError: threading = None mswindows = (sys.pl...
viewer.py
#Create Layout for GUI from roshandlers.rosconnector import ROSConnector from kivy.uix.gridlayout import GridLayout from kivy.uix.boxlayout import BoxLayout from kivy.clock import Clock from kivy.properties import ObjectProperty from kivy.uix.scrollview import ScrollView from kivy.uix.checkbox import CheckBox from kivy...
vfs_test.py
#!/usr/bin/env python # Lint as: python3 # -*- encoding: utf-8 -*- """Tests for API client and VFS-related API calls.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import io import os import threading import time import zipfile from absl import app ...
shobaleader.py
from multiprocessing import Process from lib.panel import Panel class Shobaleader: """Orchestrator of the whole thing.""" def __init__(self): """Construct.""" self.panel = Panel() self.performer_class = None self.args = None self.process = None def render(self): ...
test_win32file.py
import unittest from pywin32_testutil import str2bytes, TestSkipped, testmain import win32api, win32file, win32pipe, pywintypes, winerror, win32event import win32con, ntsecuritycon import sys import os import tempfile import threading import time import shutil import socket import datetime import random import win32tim...
tpm_feed.py
#!/usr/bin/env python3 import tpmdata import multiprocessing import pprint import numpy as np import matplotlib.pyplot as plt from matplotlib import dates from astropy.time import Time from argparse import ArgumentParser from matplotlib import animation import astropy.units as u __version__ = '3.0.1' tpmdata.tinit()...
round.py
import random import string import socket import threading import dns.resolver as resolver class ROUNDER: PTHREADS = 0 PORTS = """21-23,25-26,53,81,110-111,113,135,139,143,179,199,445,465,514-515,548,554,587,646,993,995,1025-1027, 1433,1720,1723,2000-2001,3306,3389,5060,5666,5900,6001,8000,8008,8080,8443,8888,10...
main.py
import os import json import random import threading from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.action_chains import ActionChains from selenium.webdr...
test_server.py
# Test Server / Client Communication import pytest, time, threading, socket import socketio from socketio.client import Client from socketio.server import Server import server, client from server import Client as cs_client ##### Variables and global Server object ##### HOST = '127.0.0.1' PORT = 5000 # Server object ...
lib.py
import subprocess import threading import os import random import zipfile import sys import importlib import queue import shutil import logging import contextlib import json import signal import time from .server import Server from ..vendor.Qt import QtWidgets from ..tools import workfiles self = sys.modules[__name__...
duoxiancheng01.py
# 进程: 执行单位,每一个进程至少有一个线程 # 线程: 资源单位 from threading import Thread def func(name): for i in range(1000): print('func', name) def sum(): for i in range(1000): print('sum', i) #第二种 class MyThead(Thread): def run(self): #固定的方法 for i in range(1000): print('子线程', i) if _...
lmp.py
""" Functions for manipulating LAMMPS files. """ import math import os from subprocess import Popen, PIPE # call, from time import strftime from .hublib import check_nanohub LAMMPS_EXEC = os.environ.get("LAMMPS_EXEC") if LAMMPS_EXEC is None: LOADEDMODULES = os.environ.get("LOADEDMODULES") if LOADEDMODULES a...
import_logs.py
#!/usr/bin/python # vim: et sw=4 ts=4: # -*- coding: utf-8 -*- # # Matomo - free/libre analytics platform # # @link https://matomo.org # @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later # @version $Id$ # # For more info see: https://matomo.org/log-analytics/ and https://matomo.org/docs/log-analytics-t...
vh-gui.py
#!/usr/bin/python import Tkinter from Tkinter import * import urllib import json import ConfigParser import os import subprocess from threading import Thread from Queue import Queue, Empty def iter_except(function, exception): try: while True: yield function() except exception: ret...
optimize_logp.py
""" Optimize the logP of a molecule Starting point: methane (C) - actions: add a bond or an atom - state: molecule state - reward: 0, unless a terminal state is reached, then the penalized logp estimate of the molecule """ import argparse import logging import math import multiprocessing import os import sys imp...
emails.py
#!usr/bin/env python # -*- coding:utf-8 -*- """ @author:Administrator @file: emails.py @time: 2019/06/05 @software: PyCharm @detail: 邮件 """ from threading import Thread from flask import current_app, render_template from flask_mail import Message from albumy.extensions import mail def _send_async_mail(app, message...
makebot.py
#!/usr/bin/env python3 # -*- coding: utf8 -*- # Made by Make http://github.com/mak3e # # Imports from telegram.ext import Updater, CommandHandler, MessageHandler # python-telegram-bot from threading import Thread from datetime import datetime import threading import sqlite3 import animals import subprocess import tim...
test_wrapper.py
"""Unit tests for module `ibpy_native._internal._wrapper`.""" # pylint: disable=protected-access import asyncio import datetime import threading import unittest from ibapi import contract from ibapi import wrapper from ibpy_native import error from ibpy_native import models from ibpy_native import manager from ibpy_n...
server.py
#!/usr/bin/env python import socket from threading import Thread HOST = 'localhost' PORT = 12345 BUFSIZE = 2014 def client_handle(client_socket): client_info = str(client_socket.getpeername()) print "Got connection from %s" % client_info while True: data = client_socket.recv(BUFSIZE) i...
test_SexpVector.py
import unittest import sys import rpy3.rinterface as ri ri.initr() def evalr(string): rstring = ri.StrSexpVector((string, )) res = ri.baseenv["parse"](text = rstring) res = ri.baseenv["eval"](res) return res def floatEqual(x, y, epsilon = 0.00000001): return abs(x - y) < epsilon class WrapperSex...
migrate.py
# # Migrate the current beacon to a different process # import os import json import base64 import argparse import threading from lib import buildtools __description__ = "Migrate a beacon to a different process" __author__ = "@_batsec_" __type__ = "process" # identify the task as shellcode execute DLLINJECT_EXEC_ID...
hello-world-web-server-2.py
import threading from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer class HelloHTTPRequestHandler(BaseHTTPRequestHandler): message = 'Hello World! 今日は' def do_GET(self): self.send_response(200) self.send_header('Content-type', 'text/html; charset=UTF-8') self.end_headers() self...
train.py
#!/usr/bin/env python # -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Originally written by Rob Girshick. Adapted by Dennis Dam to # use scenarios. # ---------------------------------------------------...
commandlinesolution.py
import sys import threading from queue import Queue import threading import os import time import cv2 def task(filename,inp,out): check = cv2.imread(f'./{inp}/{filename}') gray = cv2.cvtColor(check,cv2.COLOR_BGR2GRAY) cv2.imwrite(f'./{out}/{filename}',gray) # Function to send task to threads def do_st...
display.py
from pepper.framework import AbstractComponent from pepper.framework.component import FaceRecognitionComponent, ObjectDetectionComponent from .server import DisplayServer from threading import Thread, Lock from PIL import Image from io import BytesIO import base64 import json class DisplayComponent(AbstractComponen...
process.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: leeyoshinari import time import json import threading import influxdb from logger import logger, cfg, handle_exception from request import Request class Process(object): def __init__(self): self.request = Request() self._agents...
builtin.py
import bisect import copy import datetime import functools from queue import Empty as EmptyQueueException from multiprocessing import Queue, Process from typing import Optional, Callable, Dict, Tuple def callback(queue, **kwargs): kwargs['callback_timestamp'] = str(datetime.datetime.utcnow()) queue.put(kwargs...
test_jutil.py
'''test_jutil.py - test the high-level interface python-javabridge is licensed under the BSD license. See the accompanying file LICENSE for details. Copyright (c) 2003-2009 Massachusetts Institute of Technology Copyright (c) 2009-2013 Broad Institute All rights reserved. ''' import gc import os import numpy as np ...
AmqpAdapter.py
import pika import threading class AmqpAdapter: def __init__(self, name, controller): self.sub_connection = None self.sub_channel = None self.pub_connection = None self.pub_channel = None self.name = name self.controller = controller self.properties = {} ...
snippet.py
#!/usr/bin/env python """ If you use landslide to create slideshows using markdown, you may have found yourself repeating endlessly: + save source document + switch to the terminal to run landslide + reload the generated html in your browser This QT (using webkit) based "application" monitor changes to the source fil...
threading-demo.py
import queue import threading import time def putting_thread(q): while True: print('started thread') time.sleep(10) q.put(5) print('put something') q = queue.Queue() t = threading.Thread(target=putting_thread, args=(q,), daemon=True) t.start() q.put(5) print(q.get()) print...
main.py
#============== Moudles ===============# import requests from licensing.models import * from licensing.methods import Key, Helpers from colorama import Fore, Style, Back from multiprocessing.dummy import Pool import multiprocessing, time, datetime, ctypes import re import sys import random import time import os import ...
async_thread.py
"""Tools for working with async tasks """ import asyncio import logging import threading from . import EOS_MARKER log = logging.getLogger(__name__) class AsyncThread(object): @staticmethod def _worker(loop): asyncio.set_event_loop(loop) loop.run_forever() loop.close() def __ini...
httpd.py
import hashlib import os import threading from RangeHTTPServer import RangeRequestHandler from dvc.utils.compat import HTTPServer class TestRequestHandler(RangeRequestHandler): checksum_header = None def end_headers(self): # RangeRequestHandler only sends Accept-Ranges header if Range header ...
session.py
import os import platform import queue import threading import time from datetime import datetime from enum import Enum, auto from typing import Callable from typing import Optional, Dict import warnings import ray from ray.train.constants import ( DETAILED_AUTOFILLED_KEYS, TIME_THIS_ITER_S, PID, TIMESTAMP, TIME_T...
atm.py
import colorama from colorama import Fore,Back import mysql.connector as sql import time import sys from os import system import random import threading import itertools '''For Connecting to your DATABASE Change below credentials and run SQL QUERIES which are at end of this code ''' while(1): try: LH=str(...
echo_server.py
import threading import time from signal import SIGINT, SIGTERM, signal import zmq from agents import Agent class EchoServer(Agent): def setup(self, name=None, address=None): self.connection = self.bind_socket(zmq.REP, {}, address) self.connection.observable.subscribe(self.echo) def echo(se...
backend.py
import os import re import time import threading import subprocess import lib.eviltwin from lib import settings from lib.resp import Resp from lib.accesspoints.backend import APs from lib.handshake.deauth import Deauthenticate class Target: def __init__(self, bssid, essid, chann, is_captured=False): self....
amber.py
from __future__ import absolute_import import os import time import pytraj as pt import threading from .base import BaseMD class AmberMD(BaseMD): # TODO: doc ''' Unstable API Examples -------- >>> from nglview.sandbox.amber import AmberMD >>> amber_view = AmberMD(top='./peptide.top', res...
worker.py
import threading import queue import time from typing import Callable, Optional, Any, Tuple, Dict class Worker: _instances = dict() VERBOSE = False @classmethod def instance(cls, id: str) -> "Worker": if id not in cls._instances: worker = Worker(id) worker.start() ...
worker.py
# Copyright 2021 Supun Nakandala. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
customer.py
import web3 import time import eth_account.messages import web3.contract import sys import socket from threading import Thread, Lock from lib import * from Simple import * from SimpleValidator import * import json from lib import w3 import traceback HOST = '127.0.0.1' # Standard loopback interface address (localhost)...
shell.py
"""Command execution in bash shells""" import time import threading from mara_pipelines import config from mara_pipelines.logging import logger from .logging import SingerTapReadLogThread def singer_run_shell_command(command: str, log_command: bool = True): """ Runs a command in a bash shell and logs the ou...
main.py
import os import subprocess import sys import threading from time import sleep import tkinter as tk from tkinter import filedialog root = tk.Tk() root.title('视频库清理助手 V0.1.2') many = int(0) quit1 = 0 wait1 = 0 continueY = 0 potONorOFF = 0 file_name = '0' now_dir = '0' now_name = 0 work_dir = tk.StringVar() pot_dir = tk...
example_test.py
import re import os import socket import BaseHTTPServer import SimpleHTTPServer from threading import Thread import ssl from tiny_test_fw import DUT import ttfw_idf import random server_cert = "-----BEGIN CERTIFICATE-----\n" \ "MIIDXTCCAkWgAwIBAgIJAP4LF7E72HakMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n"\ ...
local_t_est.py
import threading from time import sleep from pyffmpeg import FFmpeg ff = FFmpeg() ff.loglevel = 'info' def tt(): t_th = threading.Thread(target=ov) t_th.daemon = True t_th.start() qq() def qq(): sleep(3) print(ff._ffmpeg_instances) ff.quit('convert') def ov(): out = ff.convert('H...
test_generate_filter.py
# Copyright 2015 Cisco Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
videoio.py
from pathlib import Path from enum import Enum from collections import deque from urllib.parse import urlparse import subprocess import threading import logging import cv2 LOGGER = logging.getLogger(__name__) WITH_GSTREAMER = True class Protocol(Enum): IMAGE = 0 VIDEO = 1 CSI = 2 V4L2 = 3 RTS...
taskmanager.py
# -*- coding:utf-8 -*- #################分布式爬虫demo,manager########################### from spider import wpd import threading import random, time, Queue,logging import dill from multiprocessing.managers import BaseManager # 定义一个Handler打印INFO及以上级别的日志到sys.stderr console = logging.StreamHandler() # 设置日志打印格式 f...
smtio.py
# # yosys -- Yosys Open SYnthesis Suite # # Copyright (C) 2012 Clifford Wolf <clifford@clifford.at> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. #...
test_weakref.py
import gc import sys import unittest import collections import weakref import operator import contextlib import copy import threading import time import random from test import support from test.support import script_helper, ALWAYS_EQ # Used in ReferencesTestCase.test_ref_created_during_del() . ref_from_del = None #...
scratchpad.py
""" Display number of scratchpad windows and urgency hints. Configuration parameters: cache_timeout: refresh interval for i3-msg or swaymsg (default 5) format: display format for this module (default "\u232b [\\?color=scratchpad {scratchpad}]") thresholds: specify color thresholds to use (d...
threaded_download.py
#sequential download import urllib.request def downloadImage(imagePath, fileName): print("downloading image from ", imagePath) urllib.request.urlretrieve(imagePath, fileName) print("Completed Download") def main_sequential(): t0 = time.time() for i in range(10): imageName = "temp/image-" ...
pre_commit_linter.py
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
flask_send_mail.py
# -*- coding:utf-8 -*- from flask import Flask, render_template from flask_mail import Mail, Message from threading import Thread # 线程 import sys reload(sys) sys.setdefaultencoding('utf-8') app = Flask(__name__) # 配置邮件:服务器/端口/安全套接字层/邮箱名/授权码 app.config['MAIL_SERVER'] = "smtp.163.com" app.config['MAIL_PORT'] = 465 ap...
wallet.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights t...
object.py
""" :class:`~pyobs.object.Object` is the base for almost all classes in *pyobs*. It adds some convenience methods and helper methods for creating other Objects. :func:`~pyobs.object.get_object` is a convenience function for creating objects from dictionaries. """ from __future__ import annotations import datetime imp...
train_multi_gpu_using_spawn.py
import os import math import tempfile import argparse import torch import torch.multiprocessing as mp from torch.multiprocessing import Process import torch.optim as optim import torch.optim.lr_scheduler as lr_scheduler from torch.utils.tensorboard import SummaryWriter from torchvision import transforms from model im...