source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
cnc.py | from lib import network, database, console, tools
import threading, socket, random, time
from pyngrok import ngrok
class Master(threading.Thread):
def __init__(self, console: console.Console, color: console.Color, database: database.Database, socket_session: socket.socket, ip: str, port: int):
threading.Th... |
test_fx.py | import builtins
import contextlib
import copy
import functools
import inspect
import math
import numbers
import operator
import os
import pickle
import sys
import torch
import traceback
import warnings
import unittest
from math import sqrt
from pathlib import Path
from torch.multiprocessing import Process
from torch.te... |
__init__.py | # Copyright 2019, OpenTelemetry Authors
#
# 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... |
running.py | # -*- coding: utf-8 -*-
"""Code for maintaining the background process and for running
user programs
Commands get executed via shell, this way the command line in the
shell becomes kind of title for the execution.
"""
import collections
import logging
import os.path
import shlex
import shutil
import signal
import... |
test_client_reconnect.py | from concurrent import futures
import asyncio
import contextlib
import os
import threading
import sys
import grpc
import numpy as np
import time
import random
import pytest
from typing import Any, Callable, Optional
from unittest.mock import patch
import ray
import ray.core.generated.ray_client_pb2 as ray_client_pb2
... |
check_projects.py | #!/usr/bin/env python
# Copyright 2016 The Kubernetes Authors.
#
# 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 appli... |
test_config.py | import asyncio
import copy
import pytest
import random
import yaml
from staidelta.util.config import create_default_staidelta_config, initial_config_file, load_config, save_config
from staidelta.util.path import mkdir
from multiprocessing import Pool
from pathlib import Path
from threading import Thread
from time impo... |
cifar10_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... |
S14.py | # -*- coding: utf-8 -*-
import KRIS
from KRIS.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
import r... |
mock_server.py | """
The :class:`MockAsynctionSocketIO` server is essentially
an :class:`AsynctionSocketIO` server that:
* Periodically emits events containing payloads of fake data,
through tasks running on the background.
* Listens for all events defined in the given AsyncAPI specification,
returning fake acknowledgmentds where ... |
get_traffic.py | # coding=utf-8
from __future__ import unicode_literals, print_function
import os
import datetime
import threading
import requests
from django.conf import settings
from .fritz_browser import FritzBrowser
from ..models import DummyLogger, Capture
def get_traffic(num_seconds=10, browser=None, log=None):
if log i... |
webssh_connection.py | import json
import socket
from threading import Thread
import paramiko
class SSH:
def __init__(self, websocket, message):
self.websocket = websocket
self.message = message
self.channel = None
def connect(self, host, user, password=None, port=22, timeout=30, term='xterm... |
conftest.py | """
Pytest configuration that spins up a single localstack instance that is shared across test modules.
See: https://docs.pytest.org/en/6.2.x/fixture.html#conftest-py-sharing-fixtures-across-multiple-files
It is thread/process safe to run with pytest-parallel, however not for pytest-xdist.
"""
import logging
import mu... |
nanoscp.py | #! python
import os, sys, glob, time
import threading, queue
import tarfile
import paramiko, socket
import re
import wx
import wx.lib
from wx.lib import intctrl
from watchdog.observers import Observer
from watchdog.events import RegexMatchingEventHandler
from watchdog.events import FileMovedEvent
# Handle file system... |
detect.py | import cv2
import numpy as np
import subprocess
import threading
import time
import image
import motor
sides=6
def match_img(flann, scene, needle):
matches = flann.knnMatch(needle.descriptors,scene.descriptors,k=2)
good = []
for m,n in matches:
if m.distance < 0.7*n.distance:
good.appe... |
common_utils.py | r"""Importing this file must **not** initialize CUDA context. test_distributed
relies on this assumption to properly run. This means that when this is imported
no CUDA calls shall be made, including torch.cuda.device_count(), etc.
torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported.... |
CoveringarrayServer.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... |
run_system_test.py | """
Copyright (c) 2016 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Apache License, Version 2.0 (the "License").
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
The code, technical concepts, and all information contained herein, are the ... |
workflow.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import json
import logging
import os
import sys
import threading
import time
from contextlib import contextmanager
from copy import deepcopy
from datetime import datetime, timedelta
from operator import itemgetter
from random import random
from traceback impo... |
simplequeue.py | import json
import threading
import time
from anchore_engine.clients.services import http
from anchore_engine.subsys import logger
from anchore_engine.utils import get_threadbased_id
from anchore_engine.clients.services.internal import InternalServiceClient
import retrying
class LeaseUnavailableError(Exception):
... |
acecore.py | # -*- coding: utf-8 -*-
""" Plexus (c) 2015 enen92
This file contains the acestream console of the addon. Initial versions were coded by Nouismons and so, this file is based on his work.
Classes:
Logger() -> Log class
_TSPlayer(xbmc.Player) -> Inheritance of the xbmc.Player class for acestr... |
__init__.py | import io
import json
import logging
import os
import random
import socket
import time
import threading
import tornado
import tornado.ioloop
import tornado.web
import tornado.gen
import numpy as np
import PIL.Image
from .. import base
logger = logging.getLogger(__name__ )
def get_ip_addres... |
_testing.py | import bz2
from collections import Counter
from contextlib import contextmanager
from datetime import datetime
from functools import wraps
import gzip
import os
from shutil import rmtree
import string
import tempfile
from typing import Any, List, Optional, Union, cast
import warnings
import zipfile
import numpy as np
... |
conftest_disabled.py | import multiprocessing
from pyramid import authorization
from pyramid.testing import testConfig
import pytest
from h.script import Application, assets
def run(start, settings):
def prepare(worker):
assets(settings)
start.release()
start.acquire()
start.notify()
app = Application('d... |
bmv2stf.py | #!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, 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... |
threads.py | from abots.helpers import eprint, cast
from abots.events import Every
from queue import Queue, Empty, Full
from threading import Thread, Event, Lock, RLock, BoundedSemaphore
from contextlib import contextmanager
"""
TODO:
"""
@contextmanager
def acquire_timeout(lock, timeout=-1):
if timeout is None:
time... |
vicc-vpcdHost.py | """
Example Virtual Smart Card Reader aka Virtual Proximity Coupling Device (vpcd) application to run the WebSocketServerVICC example.
It waits for a socket connecting virtual smart card aka Virtual Integrated Circuit Card (vicc) and sends a GET_CHALLENGE(1) CAPDU (command application protocol data unit).
Example... |
main_example.py | import signal
from threading import Thread
from PyQt6.QtWidgets import QMainWindow
import pglive.examples_pyqt6 as examples
from pglive.examples_pyqt6.designer_example.win_template import Ui_MainWindow
from pglive.sources.data_connector import DataConnector
from pglive.sources.live_plot import LiveLinePlot
class Ma... |
_client_application.py | # Copyright 2017 gRPC authors.
#
# 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... |
main.py | from tkinter import *
from threading import Thread
from record import record_to_file
from features import mfcc
from anntester_single import *
import scipy.io.wavfile as wav
class Application(Frame):
def createWidgets(self):
self.button_image = PhotoImage(file="button.gif")
self.RECORD = Button(sel... |
AnimatedQuintris.py | # "Fancier" animated interactive version of quintris. v0.2
# D. Crandall, Sept 2021
#
# DON'T MODIFY THIS FILE! Or else we might not be able to grade your submission properly.
#
from QuintrisGame import *
class AnimatedQuintris(QuintrisGame):
def __init__(self):
QuintrisGame.__init__(self)
# This thread j... |
Misc.py | ## @file
# Common routines used by all tools
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the lic... |
daqmx.py | r"""
NI IO Trace can be used to troubleshoot & debug the setup. It should be installed
when the NI-DAQmx driver is installed.
PyDAQmx parses the NIDAQmx.h header to build ctypes wrappers for all function,
constants, etc. It also wraps the functions which return errors codes to raise
exceptions (and warnings) based on ... |
agent.py | import shutil
import socket
import subprocess
import threading
import json
import pickle
import tempfile
import time
import box
import threading
import os
import base64
import getpass
import urllib
import requests
import zipfile
import sys
import pprint
import platform
DEBUG = True
BPH_TEMPLATE_... |
duce.py | import json
import os
import random
import re
import threading
import time
import traceback
from decimal import Decimal
from urllib.parse import parse_qs, unquote, urlsplit
import cloudscraper
import requests
from bs4 import BeautifulSoup as bs
from tqdm import tqdm
from colors import *
# DUCE-CLI
# Scraper
def dis... |
test__triangle_intersection.py | # 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, software
# distributed under t... |
test_etcd3.py | """
Tests for `etcd3` module.
----------------------------------
"""
import base64
import json
import os
import subprocess
import tempfile
import threading
import time
import grpc
from hypothesis import given, settings
from hypothesis.strategies import characters
import mock
import pytest
import six
from six.mov... |
ur5_reacher_6D.py | #!/usr/bin/env python
# Copyright (c) 2018, The SenseAct Authors.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import copy
import time
from multiprocessing import Process, Value, Manager
import... |
debug.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : debug.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 08/26/2019
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import sys
import functools
import threading
import contextlib
__all__ = ['hook_exception_ipd... |
test_pynative_hccl.py | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
test_cuda.py | # Owner(s): ["module: cuda"]
from itertools import repeat, chain, product
from typing import NamedTuple
import collections
import contextlib
import ctypes
import gc
import io
import pickle
import queue
import sys
import tempfile
import threading
import unittest
import torch
import torch.cuda
import torch.cuda.comm as... |
network.py | # Electrum - Lightweight Bitcoin Client
# Copyright (c) 2011-2016 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 rig... |
multi-threads-DLVideo.py | # Python program to illustrate the concept
# of threading
# importing the threading module
import threading
import youtube_dl
import sys
import os
def task(string):
#print("download: {}".format(string))
print("downloading file {}: {}".format(count, string.strip()))
stringCommand = "videoYoutubeDL.py htt... |
installwizard.py | # -*- mode: python3 -*-
import os
import sys
import threading
import traceback
import weakref
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from electroncash import Wallet, WalletStorage
from electroncash.util import UserCancelled, InvalidPassword, finalization_print_error
from el... |
CntlrWinMain.py | '''
Created on Oct 3, 2010
This module is Arelle's controller in windowing interactive UI mode
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from arelle import PythonUtil # define 2.x or 3.x string types
import os, sys, subprocess, pickle, time, locale, re, os.pat... |
train.py | import argparse
import logging
import math
import os
import random
import time
from copy import deepcopy
from pathlib import Path
from threading import Thread
import numpy as np
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.optim.lr_sche... |
record_demonstration.py | #! /usr/bin/python
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
import cv2
import sys
import os
from os.path import expanduser
import signal
import threading
from multiprocessing import Pool
import time
from random import randint
from std_msgs.msg impo... |
tcp_server.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 22 16:55:20 2020
@author: edoardottt
"""
import socket
import threading
bind_ip = "127.0.0.1"
bind_port = 9999
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip, bind_port))
server.listen(5)
print("[*] Listening o... |
Wikipedia.py | import wikipedia
import itertools
import threading
import time
import sys
#print(wikipedia.search('Egypt', results=15))
#print(wikipedia.geosearch(40.775114, -73.968802,title=None, results=10, radius=1000))
TitlesList = []
Results = []
print("")
topic = input('Please Enter The Topic : ')
n = int(inp... |
paygen.py | #!/usr/bin/env python3
import encrypt_code
import os
import argparse
import subprocess
import shutil
import banners
import platform
from essential_generators import DocumentGenerator
from colorama import init
from colorama import Fore, Back, Style
init()
if platform.system() == 'Windows':
PYTHON_PYIN... |
sbwib1.py | # -*- coding: utf-8 -*-
import WIB
from WIB.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
import req... |
simulation_server.py | #!/usr/bin/env python3
# Copyright 1996-2020 Cyberbotics 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 applic... |
EvaClient.py | # Copyright (c) 2016 Gabriel Oliveri (<gabrieloandco@gmail.com>)
#
# 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,... |
visualizer.py | import math
import numpy as np
import threading
import open3d as o3d
from open3d.visualization import gui
from open3d.visualization import rendering
from collections import deque
from .boundingbox import *
from .colormap import *
from .labellut import *
import time
class Model:
"""The class that helps build visu... |
component_driver.py |
# Copyright 2010 Alon Zakai ('kripken'). All rights reserved.
# This file is part of Syntensity/the Intensity Engine, an open source project. See COPYING.txt for licensing.
import os, signal, threading, time
from multiprocessing import Process, Queue
from intensity.base import *
from intensity.logging import *
from ... |
google_calendar.py | import datetime
import threading
import httplib2
import oauth2client
import pytz
from apiclient import discovery
from dateutil import parser
from googleapiclient.errors import HttpError
from i3pystatus import IntervalModule, logger
from i3pystatus.core.color import ColorRangeModule
from i3pystatus.core.util import us... |
android_helper.py | import os
import re
import sys
import time
import codecs
import lyrebird
import threading
import subprocess
from pathlib import Path
from . import config
from lyrebird.log import get_logger
"""
Android Debug Bridge command helper
Basic ADB command for device_service and API
"""
logger = get_logger()
ignore_devices_... |
main.py | import sys, os
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.uic import loadUi
import random
import numpy as np
from mplwidget import MplWidget
import websocket
import threading
import json
import pprint
import urllib3
import csv
import matplotlib.dates as mdates
import matplotlib.ticker as mticker
from mpl_fin... |
test_refleaks.py | """Tests for refleaks."""
from cherrypy.test import test
test.prefer_parent_path()
import gc
import httplib
import threading
import cherrypy
from cherrypy import _cprequest
data = object()
def get_instances(cls):
return [x for x in gc.get_objects() if isinstance(x, cls)]
def setup_server():
class Ro... |
common.py | import json
import threading
import logging
from qupy.comm import common
from qupy.interface import AbstractInterface
from qupy.framing import AbstractFraming
from qupy.framing.errors import FramingDecodeError
log = logging.getLogger(__name__)
_DATA_FORMAT_CONVERTERS = {
'binary': {
'decoder': lambda rx... |
TelloCommand.py | import time
import socket
from threading import Thread
"""
Class Description:
TelloCommand is a utility class to send commands to the Tello drone.
Public Attributes: None
Public Methods:
- start # start the drone communication
- stop # stop the drone communication
- send # send a command to the drone
... |
orphan_process_monitor.py | from builtins import object
import os
import threading
import time
import traceback
from ..splunktalib.common import log
class OrphanProcessChecker(object):
def __init__(self, callback=None):
"""
Only work for Linux platform. On Windows platform, is_orphan is always
False
"""
... |
val_submit.py | import cv2
import numpy as np
import pandas as pd
import threading
import Queue
import tensorflow as tf
from tensorflow.python.client import device_lib
from tqdm import tqdm
import params
import os
input_size = params.input_size
batch_size = params.test_batch_size
orig_width = params.orig_width
orig_height = params.o... |
test_proxy.py | # -*- coding: utf8 -*-
# Copyright (c) 2019 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, mo... |
threads-demoAll-frm.py | """
FAILS! -- tkinter doesn't support parallel GUI updates in threads
"""
import _thread, threading
from tkinter import *
from quitter import Quitter
demoModules = ['demoDlg', 'demoCheck', 'demoRadio', 'demoScale']
parts = []
def addComponents(root):
for demo in demoModules:
module = __import__(demo)
... |
manager.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import multiprocessing
import time
#只要设定要传递的事件,就打印d
def watch(d,evt):
while True:
evt.wait()
print d
evt.clear()
if __name__ == '__main__':
m = multiprocessing.Manager()
d = m.dict()
evt = m.Event()
#启动监视字典的进程
p = multiproc... |
chauffeur.py | #!/usr/bin/env python3
## Copyright 2017 Timothy A. Handy
##
## 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, ... |
convert_state.py | import argparse
import os
os.environ["D4RL_SUPPRESS_IMPORT_ERROR"] = "1"
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
os.environ["OMP_NUM_THREADS"] = "1"
import os.path as osp
from multiprocessing import Process
import h5py
from mani_skil... |
2_multi_threads_ans.py | import time
import datetime
from threading import Thread
# a factorial method similar to exercise 1, but return the result via a result placeholder
def factorial(n: int, result: [int]):
_result = 1
print("Started calculation for n=" + str(n))
for i in range(1, n+1):
# sleep for a second - release ... |
serve.py | import socketserver
import socket
import threading
import time
import random
import queue
switchboard = {}
class ChatroomQueue:
def __init__(self, name):
self.a_queue = queue.Queue()
self.b_queue = queue.Queue()
self.user_set = 0
def get_queue(self, index):
l = [self.a_... |
parallel_unittest.py | # -*- coding: utf-8 -*-
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for parallel library."""
from __future__ import print_function
import contextlib
import cPickle
import mock
imp... |
main.py | from Tkinter import *
import tkFileDialog
import tkMessageBox
import threading
from glyphcollector.collection_handler import CollectionHandler
from tools import AverageCalculator, count_images, listFolderPaths
class App:
def __init__( self, parent ):
self.stateVar = "Ready"
self.collectionHandl... |
app.py | import threading
from PIL import Image
import os
import io
import json
import logging
import linecache
import sys
import datetime
import asyncio
from argparse import ArgumentParser
import cv2
import numpy as np
from openvino.inference_engine import IECore
from flask import Flask, request, jsonify, Response
from file... |
conftest.py | """
Pytest configuration that spins up a single localstack instance that is shared across test modules.
See: https://docs.pytest.org/en/6.2.x/fixture.html#conftest-py-sharing-fixtures-across-multiple-files
It is thread/process safe to run with pytest-parallel, however not for pytest-xdist.
"""
import logging
import mu... |
host.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... |
SWHear.py | """
this is a stripped down version of the SWHear class.
It's designed to hold only a single audio sample in memory.
check my githib for a more complete version:
http://github.com/swharden
"""
import pyaudio
import time
import numpy as np
import threading
import sys
def getFFT(data,rate):
"""Giv... |
drainratetests.py | import datetime
import time
import unittest
from threading import Thread
import logger
from TestInput import TestInputSingleton
from membase.api.rest_client import RestConnection, RestHelper
from membase.helper.bucket_helper import BucketOperationHelper
from membase.helper.rebalance_helper import RebalanceHelper
from ... |
test_sockets.py | # Import third-party packages
# --------------------------------------------------------------
import numpy as np
import sys, os
import pytest
import threading
import socket
import pickle
from datetime import datetime
import subprocess
# Import neighboring packages
# ---------------------------------------------------... |
Updater.py | '''
Created on May 30, 2010
@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
'''
import tkinter.messagebox, webbrowser, os, threading
def checkForUpdates(cntlr):
if not cntlr.webCache.workOffline:
# check for updates in background
import threading
... |
mupen64plus_env.py | import sys
PY3_OR_LATER = sys.version_info[0] >= 3
if PY3_OR_LATER:
# Python 3 specific definitions
from http.server import BaseHTTPRequestHandler, HTTPServer
else:
# Python 2 specific definitions
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import abc
import array
from contextlib im... |
threadingUtil.py | """
.. Hint::
线程操作有线程池
.. literalinclude:: ../../../pyefun/threadingUtil_test.py
:language: python
:caption: 代码示例
:linenos:
"""
from .public import *
import threading
from concurrent.futures import ThreadPoolExecutor
from threading import current_thread
@异常处理返回类型逻辑型
def 启动线程(函数名, 参数=(), 跟随主线程结束=... |
Bluetooth.py | from comlocal.util import Properties
import Radio
import json
import bluetooth
import bluetooth._bluetooth as _bt
import struct
import socket
import errno
import threading
import subprocess
import os
from ctypes import (CDLL, get_errno)
from ctypes.util import find_library
from socket import (
timeout,
socket,
... |
detectordatascoringworker.py | import argparse
import logging
import math
import time
from itertools import cycle, islice
from tempfile import TemporaryDirectory
from threading import Thread
from typing import NoReturn
import msgpack
import torch
import zmq
from dpu_utils.utils import run_and_debug
from tqdm import tqdm
from buglab.controllers.hel... |
trainer.py | # -*- coding: utf-8 -*-
# @Time : 2020-01-31 22:18
# @Author : Enjoy Zhao
# @Describe :本文件是定义了一个训练器方法类,在训练器中定义了训练函数,包括单实例和多实例训练,强化学习的训练是在训练模拟器中完成的。
import multiprocessing as mp
from collections import namedtuple
import tensorflow as tf
import cloudpickle
from general.core import GrEexception
from general.memory imp... |
main.py | # coding=UTF-8
import time
from Src.Core import OutputCustomer,Reader,Base
from multiprocessing import Process
from threading import Thread
from webServer.start import start_web
import multiprocessing,os,click
def runReader(log_files_conf,config_name):
r = Reader(log_file_conf=log_files_conf ,config_name=conf... |
points_to_heatmaps.py | import json
import numpy as np
from skimage.draw import line
from pathlib import Path
import pdb
import cv2
import math
import matplotlib.pyplot as plt
import os
import shutil
from time import sleep
import multiprocessing
import time
import pdb
from .helper import get_labels, replace_values
from fastprogress.fastprogre... |
test_threading.py | import gc
from threading import Thread
import pytest
from sentry_sdk import configure_scope, capture_message
from sentry_sdk.integrations.threading import ThreadingIntegration
@pytest.mark.parametrize("integrations", [[ThreadingIntegration()], []])
def test_handles_exceptions(sentry_init, capture_events, integrati... |
app.py | #!flask/bin/python
import os
import datetime
import logging
import json
from threading import Thread
from typing import Dict
import requests
from dotenv import load_dotenv
from flask import Flask, request, abort, jsonify
from querry_sender import try_send_querry_data
from email_sender import send_mail
from database im... |
ipsec_perf_tool.py | #!/usr/bin/env python3
"""
**********************************************************************
Copyright(c) 2021, Intel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redis... |
notification.py | # -*- coding: utf-8 -*-
"""
Slack notifications.
"""
import threading
import logging
from law.config import Config
logger = logging.getLogger(__name__)
def notify_slack(title, content, attachment_color="#4bb543", attachment_fallback=None,
short_threshold=40, token=None, channel=None, **kwargs):
# te... |
_channel.py | # Copyright 2016 gRPC authors.
#
# 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... |
twisterlib.py | #!/usr/bin/env python3
# vim: set syntax=python ts=4 :
#
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import contextlib
import string
import mmap
import math
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import hashlib
import thre... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from typing import Optional
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
from selfdrive.statsd imp... |
test_tokenizer.py | # Copyright (c) 2021 PaddlePaddle 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 appli... |
util.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 "L... |
main.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
visualizer.py | #!/usr/bin/env python
# pacman -S tk
from threading import Thread # listener thread
from math import sin,cos,pi # gui positioning
import hashlib # calculating uid
import time # ttl and refresh
import tkinter # gui library
import sys # arguments and exit
... |
iostream.py | # coding: utf-8
"""Wrappers for forwarding stdout/stderr over zmq"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import atexit
from binascii import b2a_hex
import os
import sys
import threading
import warnings
from io impor... |
MicrosoftTeams.py | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import requests
from distutils.util import strtobool
from flask import Flask, request, Response
from gevent.pywsgi import WSGIServer
import jwt
import time
from threading import Thread
from typing import... |
benchmarker.py | from setup.linux.installer import Installer
from benchmark import framework_test
import os
import json
import subprocess
import time
import textwrap
import pprint
import csv
import sys
import logging
import socket
import glob
from multiprocessing import Process
from datetime import datetime
class Benchmarker:
####... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.