source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
demo_message.py | # -*- coding: utf-8 -*-
# ======================================================
# @Time : 21-1-16 下午1:30
# @Author : huang ha
# @Email : 1286304229@qq.com
# @File : demo_message.py
# @Comment:
# ======================================================
from multiprocessing import Process,Pipe,Queue
import mult... |
server.py | # Copyright 2020 Unity Technologies
#
# 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... |
serve.py | # Most of this code is:
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# The server command includes the additional header:
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/C... |
sendalerts.py | import time
from threading import Thread
from django.core.management.base import BaseCommand
from django.utils import timezone
from hc.api.models import Check, Flip
def notify(flip_id, stdout):
flip = Flip.objects.get(id=flip_id)
check = flip.owner
# Set the historic status here but *don't save it*.
... |
cli.py | # Copyright (c) 2017 Sony Corporation. 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 applicabl... |
core.py | """Voice Assistant core components."""
import threading
from typing import Any, Callable, Dict, List
import diskcache as dc
from voiceassistant.const import CACHE_DIR
VassJob = Callable[[], None]
class VoiceAssistant:
"""Voice Assistant root class."""
def __init__(self) -> None:
"""Initialize Voi... |
misc.py | # -*- coding: utf-8 -*-
"""Some miscellaneous utility functions."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD-3-Clause
from contextlib import contextmanager
import fnmatch
import gc
import inspect
from math import log
import os
from queue import Queue, Empty
from string import Format... |
manager.py | #!/usr/bin/env python2.7
import os
import sys
import fcntl
import errno
import signal
import subprocess
from common.basedir import BASEDIR
sys.path.append(os.path.join(BASEDIR, "pyextra"))
os.environ['BASEDIR'] = BASEDIR
def unblock_stdout():
# get a non-blocking stdout
child_pid, child_pty = os.forkpty()
if ch... |
app.py | from flask_sqlalchemy import SQLAlchemy
from flask import Flask,render_template
from flask import Flask,render_template,redirect, url_for,flash,request,jsonify,abort
import threading
from sqlalchemy import extract,func,desc
import datetime
import random
import markdown
import re
import time
import requests
import flask... |
market_app.py | # !-*-coding:utf-8 -*-
# @TIME : 2018/6/11/0011 15:32
# @Author : Nogo
import math
import time
import talib
import numpy as np
import logging
from collections import defaultdict
from threading import Thread
from fcoin import Fcoin
from WSS.fcoin_client import fcoin_client
from balance import balance
import config... |
doms_runner.py | from subprocess import Popen, PIPE, TimeoutExpired
import threading
import sys
import time
import atexit
import logging
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler
import datetime
import psutil
import os
SUBPROCESS_COMMAND = 'python runner.py'
SUBPROCESS_CWD = os.path.realpa... |
v0.2.1.py | #!/usr/bin/env python
#version: 0.2
import threading
import random
import logging
import socket
import socks
import time
import sys
import ssl
logging.basicConfig(
format="[%(asctime)s] %(message)s",
datefmt="%H:%m:%S"
)
logger = logging.getLogger(__name__)
if "debug" in sys.argv or "d" in sys.argv:
logger.setLe... |
kb_functional_enrichment_1Server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
batching_queue_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# 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... |
DockerHardeningCheck.py | import demistomock as demisto
from CommonServerPython import *
from multiprocessing import Process
import resource
import re
import time
def big_string(size):
s = 'a' * 1024
while len(s) < size:
s = s * 2
return len(s)
def mem_size_to_bytes(mem: str) -> int:
res = re.match(r'(\d+)\s*([gm])?... |
dai.py | import atexit
import logging
import os.path
import platform
import re
import signal
import sys
import time
from threading import Thread, Event
from uuid import UUID
from iottalkpy.color import DAIColor
from iottalkpy.dan import DeviceFeature, RegistrationError, NoData
from iottalkpy.dan import register, push, deregis... |
search.py | import time
import threading
import xbmcgui
import kodigui
import opener
import windowutils
from lib import util
from lib.kodijsonrpc import rpc
from plexnet import plexapp
class SearchDialog(kodigui.BaseDialog, windowutils.UtilMixin):
xmlFile = 'script-plex-search.xml'
path = util.ADDON.getAddonInfo('path... |
pace_util.py | #!python3
import sys, os, time, logging, importlib
from threading import Thread
this_file_dir = os.path.dirname(__file__)
methods_dir = os.path.abspath(os.path.join(this_file_dir, '..', '..', '..'))
dropbox_dir = os.path.dirname(methods_dir)
user_dir = os.path.dirname(dropbox_dir)
global_log_dir = os.path.join(dropbo... |
exports.py | # Copyright 2004-2019 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... |
test_app.py | from tixte_foss import app
from multiprocessing import Process
import pytest
def test_run():
server = Process(target=app.run)
server.start()
server.terminate()
|
daemon_processes_cant_fork.py | #!/usr/bin/env python
# Daemon processes can't fork child processes in Python, because...
# Well, they just can't. We want to use daemons though to avoid hanging
# processes if, for some reason, communication of termination conditions
# fails.
#
# Patchy McPatchface to the rescue (no, I am not kidding): we remove
# t... |
_mtapithreader.py | import threading, time, datetime, logging
logger = logging.getLogger(__name__)
class _MtapiThreader(object):
LOCK_TIMEOUT = 300
update_lock = threading.Lock()
update_lock_time = datetime.datetime.now()
def __init__(self, mtapi, expires_seconds=60):
self.mtapi = mtapi
self.EXPIRES_SE... |
__init__.py | from datetime import datetime, timedelta
from dateutil import parser
from queue import Queue
from time import time, sleep
from threading import Thread
import json
# globals
json_log = []
class LoadTester:
def __init__(self,
duration_time,
request_time,
worker,
... |
bio_thread_io_manager.py |
import socket
from bio_client import *
from socket_channel import *
import time
import threading
class BioThreadIoManager:
def __init__(self, s: socket, client):
self.client = client
self.socketChannel = SocketChannel(s)
self.running = False
def send(self, msg):
self.socketChannel.writeAndFlush... |
gamepad.py | """Gamepad support.
Defines a single class Gamepad that provide support for game controller interfaces. When run as a
program the integrated x- and y- values are printed to the console.
"""
from datetime import datetime
import os
import signal
import threading
import time
from typing import List
import selectors
impo... |
Simplicity.py | import os, sys
import pickle
import threading, time
import requests
import tkinter as tk
import exchange
from exchange import exchangeInfo
import gridBot
from gridBot import gridBotStart
from os import path
from datetime import datetime
from tkinter import *
from tkinter import messagebox
from PIL import Image, ImageT... |
function.py | import time
from lib.core.evaluate import ConfusionMatrix,SegmentationMetric
from lib.core.general import non_max_suppression,check_img_size,scale_coords,xyxy2xywh,xywh2xyxy,box_iou,coco80_to_coco91_class,plot_images,ap_per_class,output_to_target
from lib.utils.utils import time_synchronized
from lib.utils import plot_... |
test_logging.py | # Copyright 2001-2017 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this perm... |
new_user.py | from time import sleep
from threading import Thread
from mongolia.errors import DatabaseConflictError
from conf.settings import BYPASS_START_WORDS
from constants.exceptions import BadPhoneNumberError
from backend.outgoing.dispatcher import (send_welcome, send_waitlist,
send_bad_access_code, send_pending)
from cons... |
sql_reporter.py | # Copyright 2009 Yelp
#
# 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, software
... |
utils.py | from __future__ import print_function, division, absolute_import
import atexit
from collections import deque
from contextlib import contextmanager
from datetime import timedelta
import functools
from hashlib import md5
import inspect
import json
import logging
import multiprocessing
from numbers import Number
import o... |
async_checkpoint.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... |
rss_feed.py |
import feedparser
import os
import os
import re
import requests
import subprocess
import sys
import time
from multiprocessing import Queue, Process
from multiprocessing.queues import Empty
from requests import head, get
from copy import deepcopy
from pprint import pformat
from logger import log
from downloader import... |
task.py | """ Backend task management support """
import itertools
import json
import logging
import os
import re
import sys
import warnings
from copy import copy
from datetime import datetime
from enum import Enum
from multiprocessing import RLock
from operator import itemgetter
from tempfile import gettempdir
from threading im... |
RPCS3 Game Update Downloader.py | ## This code is trash and will make your eyes bleed. You have been warned.
## This program requires you to install PyYAML and aiohttp (python -m pip pyyaml aiohttp[speedups])
## This program also requires Python 3.8 or higher due to using the walrus operator
import yaml
import asyncio
import aiohttp
import threading
i... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
test_beeline.py | import threading
import unittest
from mock import Mock, patch, call
import beeline
import libhoney
assert libhoney
class TestBeeline(unittest.TestCase):
def setUp(self):
self.addCleanup(patch.stopall)
self.m_gbl = patch('beeline._GBL').start()
def test_send_event(self):
''' test corre... |
eterbase_utils.py | import logging
from typing import Dict, Any, Optional, Tuple, List
import hummingbot.connector.exchange.eterbase.eterbase_constants as constants
from hummingbot.connector.exchange.eterbase.eterbase_auth import EterbaseAuth
import aiohttp
import asyncio
import json
from threading import Thread
_eu_logger = logging.get... |
manager.py | import argparse # noqa
import atexit # noqa
import codecs # noqa
import copy # noqa
import errno # noqa
import fnmatch # noqa
import hashlib # noqa
import io # noqa
import os # noqa
import shutil # noqa
import signal # noqa
import sys # noqa
import threading # noqa
import traceback # noqa
from contextlib ... |
test_106_shutdown.py | #
# mod-h2 test suite
# check HTTP/2 timeout behaviour
#
import time
from threading import Thread
import pytest
from .env import H2Conf
from pyhttpd.result import ExecResult
class TestShutdown:
@pytest.fixture(autouse=True, scope='class')
def _class_scope(self, env):
conf = H2Conf(env)
conf... |
script_api.py | # Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
import sys, os, shutil, importlib, datetime, tempfile, psutil, setproctitle, signal, errno
from os.path import join as jp
import multiprocessing
import urllib.parse
from .api_base i... |
Hiwin_RT605_ArmCommand_Socket_20190627185330.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
live_tool_udp.py | #!/usr/bin/env python
import rospy
import rospkg
import os
from std_msgs.msg import String
from geometry_msgs.msg import PoseWithCovarianceStamped, Twist, Pose2D
from humanoid_league_msgs.msg import BallRelative, ObstaclesRelative, GoalRelative, GameState, Strategy, RobotControlState
from trajectory_msgs.msg import Jo... |
streaming_tflite_conformer.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... |
__init__.py | #
# Copyright (C) 2016 UAVCAN Development Team <uavcan.org>
#
# This software is distributed under the terms of the MIT License.
#
# Author: Pavel Kirienko <pavel.kirienko@zubax.com>
#
import os
import sys
import queue
import uavcan
import logging
import multiprocessing
from PyQt5.QtWidgets import QApplication
from ... |
quantize_yolov2-tiny-my2.py | #!/usr/bin/env python
# --------------------------------------------------------
# Quantize Fast R-CNN based Network
# Written by Chia-Chi Tsai
# --------------------------------------------------------
"""Quantize a Fast R-CNN network on an image database."""
import os
os.environ['GLOG_minloglevel'] = '2'
import _... |
test_state.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import shutil
import tempfile
import textwrap
import threading
import time
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.unit import skipIf
from tes... |
tcpServer.py | #!/usr/bin/python
import socket
import threading
bind_ip = "0.0.0.0"
bind_port = 9999
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip,bind_port))
server.listen(5)
print("[*] Listening on %s:%d" % (bind_ip,bind_port))
#this is out client-handling thread
def handle_client(client_sock... |
test_passive_server_debugger.py | import socket
import threading
import time
import unittest
import sys
from io import StringIO
from egtsdebugger.passive_server_debugger import PassiveEgtsServerDebugger
from egtsdebugger.egts import *
auth_packet = b"\x01\x00\x00\x0b\x00\x0f\x00\x01\x00\x01\x06\x08\x00\x01\x00\x38\x01\x01\x05\x05\x00\x00\xef" \
... |
etcd_cache.py | """
Local Cache for ETCd values
"""
import etcd
from threading import Event, Thread
from time import sleep
from typing import Callable, List, Tuple, Union
from .general import isFunction
from .ext_dicts import FrozenDict, QueryDict
# Type Hinting
Callback = Callable[[FrozenDict], None]
Callbacks = Union[
List[Ca... |
clock_engine.py | # coding: utf-8
import datetime
from collections import deque
from threading import Thread
import pandas as pd
import arrow
from dateutil import tz
import time
from ..easydealutils import time as etime
from ..event_engine import Event
class Clock:
def __init__(self, trading_time, clock_event):
self.trad... |
main.py | """
This is the main file that runs the OpenEEW code package
"""
# import modules
import time
from threading import Thread
import os
from params import params
from src import data_holders, receive_traces, aws
__author__ = "Vaclav Kuna"
__copyright__ = ""
__license__ = ""
__version__ = "1.0"
__maintainer__ = "Vaclav ... |
50_po_history.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
from xmlrpc import client as xmlrpclib
import multiprocessing as mp
from scriptconfig import URL, DB, UID, PSW, WORKERS
# ==================================== Purchase ORDER ====================================
def update_purchase_order(pid, data_pool, error... |
worker.py | # worker.py - master-slave parallelism support
#
# Copyright 2013 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
import errno
import os
import signal
import sys
import thread... |
uexpect.py | # Copyright (c) 2019 Vitaliy Zakaznikov
#
# 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 i... |
ssl_loop_ac.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
loop thread to run ssl
"""
from scipy import stats
import numpy as np
from pyaudio import PyAudio, paInt16
from SoundSourceLocalization.ssl_setup import *
from SoundSourceLocalization.ssl_gcc_generator import GccGenerator
# from SoundSourceLocalization.ssl_actor_... |
nullinux.py | #!/usr/bin/env python3
# Author: @m8r0wn
# License: GPL-3.0
# Python2/3 compatibility for print('', end='')
from __future__ import print_function
import sys
import argparse
import datetime
from time import sleep
from ipparser import ipparser
from threading import Thread, activeCount
if sys.version_info[0] < 3:
f... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum_zeny as electrum
from electrum_zeny.bitcoin import TYPE_ADDRESS
from electrum_zeny import WalletStorage, Wallet
from electrum_zeny_gui.kivy.i18n import _
from electrum_zeny.paymentre... |
test_executor_resources.py | import os
from concurrent.futures import as_completed
from multiprocessing import Process
import platform
from unittest import mock
import filelock
from vsi.tools.dir_util import is_dir_empty
from terra.tests.utils import (
TestSettingsConfigureCase, TestCase, TestThreadPoolExecutorCase
)
from terra.executor.proce... |
scheduler.py | """
This module is the main part of the library. It houses the Scheduler class
and related exceptions.
"""
from threading import Thread, Event, Lock
from datetime import datetime, timedelta
from logging import getLogger
import os
import sys
from apscheduler.util import *
from apscheduler.triggers import SimpleTrigger... |
whatsapp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys;
sys.dont_write_bytecode = True;
import os;
import signal;
import base64;
from threading import Thread, Timer
import math;
import time;
import datetime;
import json;
import io;
from time import sleep;
from threading import Thread;
from Crypto.Cipher import AES;... |
dataset.py | import numpy as np
import cv2
import os
import time
from collections import defaultdict, namedtuple
from threading import Thread, Lock
from multiprocessing import Process, Queue
class ImageReader(object):
def __init__(self, ids, timestamps, cam=None):
self.ids = ids
self.timestamps = timestamps... |
run_nvmf.py | #!/usr/bin/env python3
import os
import re
import sys
import json
import paramiko
import zipfile
import threading
import subprocess
import itertools
import time
import uuid
import rpc
import rpc.client
from common import *
class Server:
def __init__(self, name, username, password, mode, nic_ips, transport):
... |
wallet_multiwallet.py | #!/usr/bin/env python3
# Copyright (c) 2017-2020 The C1pzo Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiwallet.
Verify that a c1pzod node can load multiple wallet files
"""
from decimal import Decim... |
darknet_video.py | from ctypes import *
import random
import os
import cv2
import time
import darknet
import argparse
from threading import Thread, enumerate
from queue import Queue
def parser():
parser = argparse.ArgumentParser(description="YOLO Object Detection")
parser.add_argument("--input", type=str, default=0,
... |
artifact_service.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 use ... |
adding_server.py | import socket
import multiprocessing as mp
import threading as thread
import sys
def message_handler(conn, address):
import sys
import lib.protocol_utils as protocol_utils
import time
import datetime
print("New connection from", address)
actual_time = datetime.datetime.utcnow()
log_file =... |
queue_example.py | import threading
import queue
tasks_queue = queue.Queue()
def process_tasks_from_queue():
while True:
task_data: str = tasks_queue.get()
do_some_work(task_data)
tasks_queue.task_done()
def do_some_work(task_data: str):
print(f'Doing task_data: {task_data}...')
for _ in range(3):
... |
test_pebble.py | #!/usr/bin/python3
# Copyright 2021 Canonical 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 agre... |
server.py | #!python3
'''
##############################
### Receive Video stream #####
### from Android client #######
### Use yolo to do detect ####
## (return a message to the mobile device) ##
##############################
'''
from ctypes import *
import math
import random
import os
import socket
import time
import cv2
impor... |
Detection_Models.py | """Specified Models for object detection with tensorflow and distance calculation."""
__version__ = "1.0.0"
__author__ = "Tim Rosenkranz"
__email__ = "tim.rosenkranz:stud.uni-frankfurt.de"
__credits__ = "Special thanks to The Anh Vuong who came up with the original idea." \
"This code is also based off o... |
initserver.py | import settings
settings.generateConfigFile()
import reddit
import socketserverhandler
import socketservervideogenerator
from time import sleep
import database
import datetime
from threading import Thread
import atexit
def getScripts():
global lastUpdate
print("Grabbing more scripts...")
in... |
clone_one_eval_mini_srcgame_add_map_bn.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
USED_DEVICES = "4,5"
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES
import sys
import threading
import time
import tensorflow as tf
from absl import... |
proxy_session.py | import time
import json
import threading
import struct
import urlparse
from xlog import getLogger
xlog = getLogger("x_tunnel")
from simple_http_client import HTTP_client
import utils
import base_container
import encrypt
import global_var as g
def encrypt_data(data):
if g.config.encrypt_data:
return encr... |
rml_send.py | #
# rml_send_gui
# graphical interface for sending jobs to the Roland Modela
#
# Brian Mayton <bmayton@media.mit.edu>
# MIT 2011-2014
#
# (c) Massachusetts Institute of Technology 2011-2014
# Permission granted for experimental and personal use;
# license for commercial sale available from MIT.
# imports
from __futu... |
xml_reader.py | import xml.sax
import threading
from Queue import Queue
from disco.core import Job, result_iterator
from disco.worker.classic.func import chain_reader
"""
For using this example, you should obtain an sml corpus and do the following:
1. Add the current directory to the python path
$ export PYTHONPATH=$PYTHONPATH:.... |
96_ipc_asyncio-dev.py | # https://docs.python.org/zh-cn/3/library/asyncio-dev.html
# Debug 模式
"""
有几种方法可以启用异步调试模式:
1. 将 PYTHONASYNCIODEBUG 环境变量设置为 1 。
2. 使用 -X dev Python 命令行选项。
3. 将 debug=True 传递给 asyncio.run() 。
4. 调用 loop.set_debug() 。
除了启用调试模式外,还要考虑:
1. 将 asyncio logger 的日志级别设置为 logging.DEBUG,例如,下面的代码片段可以在应用程序启动时运行:
logging.basicConfig(l... |
Solver.py | import numpy as np
import hashlib
import copy
import datetime
import threading
# Notation: [ROW][COL]
# Note: Add Forbidden Cells to improve the efficiency
# Check duplicate state in the search tree, keep DEPTH info
# Add Progress Monitoring
# ?Store Search Nodes for next batch
# ?Add Heuristic... |
botai2.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile
from bs4 import BeautifulSoup
from urllib import urlopen
fr... |
conftest.py | from .server import create_server
import pytest
from multiprocessing import Process
from threading import Thread
@pytest.fixture(scope='session', autouse=True)
def server_setup():
instance = create_server()
process = Process(target=instance.serve_forever)
yield process.start()
process.terminate()
# f... |
mumbleBot.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import threading
import time
import sys
import math
import signal
import configparser
import audioop
import subprocess as sp
import argparse
import os
import os.path
import pymumble_py3 as pymumble
import pymumble_py3.constants
import variables as var
import logging
impor... |
email.py | from flask_mail import Message
from threading import Thread
from flask import render_template, current_app
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
msg = Message(app.co... |
defiance_launcher.py | import os, subprocess, shutil
import parser5
from tkinter import *
import tkinter.messagebox
from tkinter import simpledialog
import requests, zipfile, io, tldextract, json
import pygame, threading, re
class myWindow(Frame):
def __init__(self,parent=None):
Frame.__init__(self,parent)
self.parent =... |
async_file_reader.py | import os, sys, threading
from queue import Queue
from collections import deque
from time import sleep, time
if sys.platform.startswith('linux'):
def set_nonblocking(fd):
import fcntl
flag = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, flag | os.O_NONBLOCK)
else:
def set... |
net.py | import tensorflow as tf
import numpy as np
import cv2
from threading import Thread
#import ipdb
#-------------------------------------------------------------------------------
def smooth_l1_loss(x):
square_loss = 0.5*x**2
absolute_loss = tf.abs(x)
return tf.where(tf.less(absolute_loss, 1.), square_loss... |
wifi_link_layer.py | #from gossip_layer import Gossip
import socket
import time
import os
import threading
import binascii
import select
class Wifi_Link_Layer:
def __init__(self, receive_msg_cb):
print("Initializing Link Layer...")
self.receive_msg_cb = receive_msg_cb
self.msg_buffer_list = []
... |
gold_mentions.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
import math
import json
import threading
import numpy as np
import tensorflow as tf
import os
import util
import coref_ops
import conll
import metrics
import optimization
from bert import tokeniz... |
compare_Wchain_sgd_1layers.py | import qiskit
import numpy as np
import sys
sys.path.insert(1, '../')
import qtm.base, qtm.constant, qtm.ansatz, qtm.fubini_study, qtm.encoding
import importlib
import multiprocessing
importlib.reload(qtm.base)
importlib.reload(qtm.constant)
importlib.reload(qtm.ansatz)
importlib.reload(qtm.fubini_study)
def run_wcha... |
dicom_file_classifier.py | import os
import os.path
import pydicom
import shutil
from multiprocessing import Process
import time
# set initial values
src_path = "dicom file directory"
des_path = "destination directory"
process_count = 10 # number of process you use
def sd_form(str): # Series Description
str = str.replace(' ', '_')
... |
example_bot.py | # Importing local packages
from browser import Browser
from harvester_manager import HarvesterManger
from harvester import Harvester
# Importing external packages
from selenium.webdriver.common.by import By
from selenium.common.exceptions import WebDriverException
# Importing standard packages
import time
import dateti... |
server_based.py | #!/usr/bin/env python
import argparse
import sys
import socket
import random
import struct
import threading
import time
import thread
import json
from scapy.all import sendp, send, get_if_list, get_if_hwaddr
from scapy.all import Packet
from scapy.all import Ether, IP, UDP, TCP
from proposalHeader import GvtProtocol
... |
modbus_poll.py | #!/usr/bin/env python
import argparse
import json
import logging
import threading
import sys
import signal
from time import sleep, time
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
def poll_range(num, den):
ret = [den] * (num / den)
if num % den > 0:
ret.append(num % den)
ret... |
client.py | #!/usr/bin/env python3
'''
Server script for simple client/server example
Copyright (C) Simon D. Levy 2021
MIT License
'''
from threading import Thread
from time import sleep
import socket
from struct import unpack
from header import ADDR, PORT
def comms(data):
'''
Communications thread
'''
# Conn... |
server.py | import os
import logging
import boto3
import signal
import socket
import json
from http.server import HTTPServer
from http.server import BaseHTTPRequestHandler
from botocore.config import Config as BotoCoreConfig
from threading import Semaphore, Thread, Event
from multiprocessing import Pool
from .worker import init_wo... |
check_oracle.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import string
import time
import datetime
from subprocess import Popen, PIPE
import MySQLdb
import cx_Oracle
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("check_oracle")
path='./include'
sys.pat... |
test_cassandra.py | # stdlib
import threading
import time
from types import ListType
import unittest
# 3p
from nose.plugins.attrib import attr
# project
from aggregator import MetricsAggregator
from dogstatsd import Server
from jmxfetch import JMXFetch
from tests.checks.common import Fixtures
STATSD_PORT = 8121
class DummyReporter(th... |
conftest.py | import asyncio
import os
import threading
import time
import typing
import pytest
import trustme
from cryptography.hazmat.primitives.serialization import (
BestAvailableEncryption,
Encoding,
PrivateFormat,
)
from uvicorn.config import Config
from uvicorn.main import Server
from httpx import URL, AsyncioBa... |
test_lockutils.py | # Copyright 2011 Justin Santa Barbara
#
# 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... |
conftest.py | # Copyright The PyTorch Lightning team.
#
# 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 i... |
pgbackrest-rest.py | #!/usr/bin/python3
"""
The purpose of this script/program is to be able to trigger backups using an api.
The reason to not have the CronJob execute the backup but only to trigger the backup
is as follows:
- a Kubernetes Cronjob is running in its own pod (different from the database)
- the backup process requires dire... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.