source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
detect_cap_multi.py |
import cv2
import numpy as np
from timeit import default_timer as timer
import time
import multiprocessing as mp
import threading
import queue
def frame_put(frame_q,cap_path):
cap = cv2.VideoCapture(cap_path)
while cap.isOpened():
return_value, frame = cap.read()
if not return_value:
... |
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... |
tracing_backend.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cStringIO
import json
import logging
import socket
import threading
import weakref
from telemetry.core import trace_result
from telemetry.core.backen... |
GUI.py | try: from .Legacy import run as cxgen
except: from Legacy import run as cxgen
try: from .utils import *
except: from utils import *
from tkinter import *
from tkinter.filedialog import askdirectory, askopenfilename, askopenfile, askopenfilenames, askopenfiles, asksaveasfile, asksaveasfilename
from tkinter.message... |
installwizard.py |
from functools import partial
import threading
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform
from kivy... |
ros_wrapper.py | #!/usr/bin/env python
# coding: utf-8
import os
import sys
import pybullet
from qibullet.camera import Camera
from qibullet.pepper_virtual import PepperVirtual
from qibullet.base_controller import PepperBaseController
from threading import Thread
try:
import rospy
import roslib
import roslaunch
import... |
ScoreThread.py | # -*- coding:utf-8 -*-
"""
-------------------------------------------------
File Name: ScoreThread
Description: 使用多线程处理
Author: Miller
date: 2017/9/5 0005
-------------------------------------------------
"""
__author__ = 'Miller'
import threading
mutex = threading.Lock()
class Scor... |
ssocr.py | import PySimpleGUI as sg
import os
from PIL import ImageGrab
from time import sleep
from ctypes import windll
from easyocr import Reader
from queue import Queue
from threading import Thread
import psutil as ps
def checkProcessRunning(proc_name:str):
for proc in ps.process_iter():
if proc_name.lower() in pr... |
kafka_commands.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
"License")... |
compose.py | # -*- coding: utf-8 -*-
# pylint: disable=import-error, no-name-in-module
import contextlib
import json
import multiprocessing
import signal
import subprocess
import time
import traceback
import warnings
import flask
from const import DOCKER_COMPOSE, INTERVAL, KILL_SIGNAL
# running flag
UP_FLAG = multiprocessing.Va... |
example_test.py | # This example code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
# -*- coding: utf-8 -*-
from __future__ import pri... |
pool.py | import redis
from threading import Thread
import inspect
import ctypes
def stop_thread(thread):
try:
exctype = SystemExit
tid = ctypes.c_long(thread.ident)
if not inspect.isclass(exctype):
exctype = type(exctype)
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctyp... |
Active_Directory_Query_test.py | import demistomock as demisto
from Active_Directory_Query import main, group_dn
import socket
import ssl
from threading import Thread
import time
import os
import pytest
import json
from IAMApiModule import *
from unittest.mock import patch
BASE_TEST_PARAMS = {
'server_ip': '127.0.0.1',
'secure_connection': '... |
server_test.py | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
train.py | #!/usr/bin/env python
"""Train models."""
import os
import signal
import torch
import onmt.opts as opts
import onmt.utils.distributed
from onmt.utils.misc import set_random_seed
from onmt.utils.logging import init_logger, logger
from onmt.train_single import main as single_main
from onmt.utils.parse import ArgumentPa... |
test_pdb.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import bdb
import inspect
import io
import os
import os.path
import re
import subprocess
import sys
import textwrap
import traceback
from io import BytesIO
import py
import pytest
import pdbpp
from pdbpp import DefaultConfig, Pdb, StringIO
try:
from ... |
cluster_coordinator_test.py | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
multi-threading.py | import time, threading
def loop():
print('thread %s is runing...' % threading.current_thread().name)
n = 0
while n < 5:
n = n + 1
print('thread %s >>> %s' % (threading.current_thread().name, n))
time.sleep(1)
print('thread %s ended.' % threading.current_thread().name)
print('thread %s is running..... |
decorator.py | # -*-coding:utf-8 -*-
from functools import wraps
from traceback import format_tb
from db.basic_db import db_session
from logger.log import parser, crawler, storage
from utils.util_cls import Timeout, KThread
# 用于超时设置
def timeout_decorator(func):
@wraps(func)
def time_limit(*args, **kargs):
try:
... |
main.py | import re
import threading
from tkinter.filedialog import *
from tkinter import ttk
from pytube import YouTube, request
filesize = 0
# dark mode :
def darkmode():
global btnState
if btnState:
btn.config(image=offImg, bg="#CECCBE", activebackground="#CECCBE")
root.config(bg="#CEC... |
cpac_group_runner.py | import nipype.pipeline.engine as pe
import nipype.interfaces.utility as util
import nipype.interfaces.io as nio
from time import strftime
from multiprocessing import Process
import re
import os
import sys
import glob
import time
import csv
from nipype import logging
from CPAC.utils import Configuration
def split_f... |
params.py | #!/usr/bin/env python3
"""ROS has a parameter server, we have files.
The parameter store is a persistent key value store, implemented as a directory with a writer lock.
On Android, we store params under params_dir = /data/params. The writer lock is a file
"<params_dir>/.lock" taken using flock(), and data is stored in... |
decorators.py | from threading import Thread
def async(f):
def wrapper(*args, **kwargs):
thr = Thread(target = f, args = args, kwargs= kwargs)
thr.start()
return wrapper |
imagetools.py | # -*- coding=UTF-8 -*-
# pyright: strict
"""tools for image processing. """
import hashlib
import threading
from pathlib import Path
from typing import Any, Callable, Literal, Optional, Text, Tuple, Union
import cast_unknown as cast
import cv2
import cv2.img_hash
import numpy as np
from PIL.Image import BICUBIC, Ima... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
async_utils.py | import asyncio
from collections import deque
from functools import partial, wraps
from threading import Condition, Lock, Thread
from typing import (Any, AsyncIterator, Callable, Coroutine, Deque, Dict,
Generic, Iterable, Iterator, Optional, Tuple, TypeVar)
T = TypeVar("T")
class SyncIteratorWrapp... |
igstore.py | '''
Dreamworld
#My question about store development
https://community.backtrader.com/topic/459/store-development/2
#Example for adding a data feed. Can use online sources
https://www.backtrader.com/docu/datafeed-develop-general/datafeed-develop-general.html
I need to implement
2) IG Broker - Look at bt/brokers/oan... |
main_diagram.py | from threading import Thread
from state_machine_py.multiple_state_machine import MultipleStateMachine
from tests.rock_paper_scissors.context import Context
from tests.rock_paper_scissors.data.state_gen_conf import state_gen
from tests.rock_paper_scissors.auto_gen.data.const import INIT, MACHINE_A
class MainDiagram:
... |
simulate_traffic.py | #!/usr/bin/env python3
"""This script runs a bunch of builds against BuildBuddy in a loop."""
import argparse
import multiprocessing
import os
import random
import subprocess
import sys
import time
def sh(cmd):
return subprocess.run(cmd, shell=True)
def sh_get_list(cmd):
stdout = subprocess.run(cmd, shell=... |
test_main.py | import os
import tempfile
import code # noqa: F401
import mock
import platform
from snimpy.main import interact
from multiprocessing import Process
import agent
import unittest
class TestMain(unittest.TestCase):
"""Test the main shell"""
@classmethod
def setUpClass(cls):
cls.agent = agent.TestA... |
wsdump.py | #!c:\users\danilo\appdata\local\programs\python\python36\python.exe
import argparse
import code
import sys
import threading
import time
import ssl
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
encoding = getatt... |
pseudo-server-ar-mt.py | #!/usr/bin/python
'''
This is a pseudo-server that sends predefined pattern to any connected client.
It is used to test transport behaviour and throughput.
If you want to use it with a sketch, connect your PC and Blynk-enabled device
into the same network and configure Blynk to connect to this pseudo-server:
I... |
demo.py | import time
import os
import numpy as np
import torch
import torchvision
import cv2
import dlib
from torch.autograd import Variable
from collections import OrderedDict
from PIL import Image
from multiprocessing import Process, Queue
from torch.multiprocessing import Process as torchProcess
from torch.multiprocessing im... |
player.py | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
xmlstream.py | """
sleekxmpp.xmlstream.xmlstream
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module provides the module for creating and
interacting with generic XML streams, along with
the necessary eventing infrastructure.
Part of SleekXMPP: The Sleek XMPP Library
:copyright: (c) 2011 Nathanael C. Fritz
:... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
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
PANDA_OUTPUT_VOLTAGE = 5.28
CAR_VOLTAGE_LOW_PASS_K =... |
main.py | import cgi
import json
import logging
import os
import random
import threading
import uuid
import smtplib
import ssl
from ssl import SSLError
import threading, queue
import requests
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.util... |
firmware.py | #####################################################
#
# firmware.py
#
# Copyright 2009 Hewlett-Packard Development Company, L.P.
#
# Hewlett-Packard and the Hewlett-Packard logo are trademarks of
# Hewlett-Packard Development Company, L.P. in the U.S. and/or other countries.
#
# Confidential computer software. Valid ... |
web.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights t... |
spirograph.py | # spirograph
import math
import random
import threading
from PyQt5 import QtWidgets,QtGui,QtCore
from easygraphics import *
from easygraphics.graphwin import GraphWin
import easygraphics.dialog
Outer_Color = Color.LIGHT_BLUE
Inner_Color = Color.LIGHT_CYAN
Drawing_Point_Color = Color.LIGHT_RED
class MyWindow(QtWidget... |
Facepager.py | #!/usr/bin/env python
"""Facepager was made for fetching public available data from Facebook, Twitter and other JSON-based API. All data is stored in a SQLite database and may be exported to csv. """
# MIT License
# Copyright (c) 2019 Jakob Jünger and Till Keyling
# Permission is hereby granted, free of charge, to ... |
Logger.py | import signal
from datetime import datetime
from multiprocessing import Queue, Process
from time import sleep
class Logger:
logThread = None
shouldThreadJoin = False
buffer = Queue()
logToConsole = True
logToFile = False
filepath = ""
@classmethod
def setLogToConsole(cls... |
host_callback_test.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
newloader.py | import copy
import datetime
import functools
import importlib
import io
import json
import os
import shutil
import sys
import tempfile
import types
from threading import Thread
import requests
import yaml
from bs4 import BeautifulSoup
from httprunner import logger
from httprunner.api import HttpRunner
from requests.co... |
workerResultLog.py | # -*- coding: utf-8 -*-
from polylogyx.application import create_app
from polylogyx.settings import CurrentConfig
from polylogyx.tasks import pull_and_match_with_rules
import threading
app = create_app(config=CurrentConfig)
thread_count = 1
for i in range(thread_count):
t = threading.Thread(target=pull_and_match... |
__init__.py | import queue
import requests
import threading
from typing import List, Optional, Union
from platypush.plugins import action
from platypush.plugins.switch import SwitchPlugin
from platypush.schemas.switchbot import DeviceSchema, DeviceStatusSchema, SceneSchema
class SwitchbotPlugin(SwitchPlugin):
"""
Plugin t... |
test_selenium.py | # -*- coding: utf-8 -*-
import re
import threading
import time
import unittest
from selenium import webdriver
from webapp import create_app
from webapp.models import db, User, Role, Post, Tag, Comment
from webapp.extensions import admin, rest_api
# @unittest.skip('cannot pass')
class SeleniumTestCase(unittest.TestCas... |
cronjobs.py | #!/usr/bin/env python
"""Cron management classes."""
import logging
import random
import threading
import time
from grr import config
from grr.lib import rdfvalue
from grr.lib import registry
from grr.lib import stats
from grr.lib import utils
from grr.lib.rdfvalues import cronjobs as rdf_cronjobs
from grr.lib.rdfval... |
keylogger.py | from threading import Timer
from threading import Thread
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
import subprocess, socket, base64, time, datetime, os, sys, urllib2, platform
import pythoncom, pyHook, Image, ImageGrab, win32api, win32gui... |
test_threads.py | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
"""
Tests the h5py.File object.
"""
import thre... |
twitch_bot.py | import datetime
import logging
import os
from abc import ABC
from threading import Thread
from typing import AnyStr, Tuple, Union
from twitchio import Message, User, Channel
from twitchio.ext import commands
from bots.irc_bot import IrcBot
from helpers.beatmap_link_parser import parse_beatmap_link
from helpers.databa... |
monitor.py | # Copyright 2018 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
test_data_node_scale.py | import threading
import time
import pytest
from base.collection_wrapper import ApiCollectionWrapper
from common.common_type import CaseLabel
from common import common_func as cf
from customize.milvus_operator import MilvusOperator
from scale import constants
from pymilvus import connections
from utils.util_log import... |
biqugeSpider.py | import requests
from lxml import etree
import threading
lock = threading.Lock()
page_list = list(range(1, 389))
book_set = set()
def get_books():
pool = []
for i in range(10):
p = threading.Thread(target=parser_page, args=(lock,))
pool.append(p)
p.start()
for p in pool:
p... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
import sock... |
test_server.py | import asyncio
import threading
from fastapi import FastAPI
from api_server.__main__ import ServerManager
class TestServer:
def __init__(self):
self.server_manager = ServerManager()
self._ready = threading.Semaphore(0)
for srv in self.server_manager.servers:
# uvloop does no... |
__init__.py | #!/usr/bin/env python3
import json
import threading
import requests
import zipfile
import io
import yaml
import tempfile
import shutil
import os
from requests_toolbelt.multipart.encoder import MultipartEncoder
from napalm import get_network_driver
class ConfigOptions(object):
def __init__(self, access_token, bas... |
day10_T.py | # (1) 통계 기반 데이터 분석 (부제: 영상 처리를 통한 데이터 분석 및 통계 처리)
#
# (2) 텍스트마이닝 기반 데이터 분석 (부제: 텍스트 기반 데이터 분석 및 처리)
#
# (3) 빅데이터 분석 결과 시각화 (부제 : 데이터베이스 기반 데이터 분석 및 GUI 시각화)
#
#
# 복습퀴즈1. 선택한 폴더의 모든 엑셀 파일을 SQLite의 테이블로 입력되는
#
# 코드를 작성하세요. (별도의 소스코드에 작성)
#
#
# 복습퀴즈2. SQLite의 모든 테이블이 선택한 폴더의 엑셀 파일로 저장되는
#
# 코드를... |
gen_protos.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 us... |
config_reader.py | import copy
import multiprocessing as mp
def process_configs(target, arg_parser):
args, _ = arg_parser.parse_known_args()
# 多进程
ctx = mp.get_context('spawn')
for run_args, _run_config, _run_repeat in _yield_configs(arg_parser, args):
p = ctx.Process(target=target, args=(run_args,))
p.... |
human_agent.py | #!/usr/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides a human agent to control the ego vehicle via keyboard
"""
import time
from threading import Thread
import cv2
import numpy as np
try:
import pygame
... |
test_event.py | """
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
tests.integration.modules.event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import queue
import threading
import time
import pytest
import salt.utils.event as event
from tests.support.case import ModuleCase
@pytest.mark.windows_whitelisted
@pytest.mark.usefi... |
wsdump.py | #!C:\Users\redfa\Desktop\Neurohack\Neurohacking\venv\Scripts\python.exe
import argparse
import code
import six
import sys
import threading
import time
import websocket
try:
import readline
except:
pass
def get_encoding():
encoding = getattr(sys.stdin, "encoding", "")
if not encoding:
return "... |
term_success_0.py | # Controlled thread could be inserted before first line
# of PrinterFactory.printer(). That method is going to
# run only once and ran as a thread of a controller
# thread. Without a controller thread, the controlled
# thread wouldn't terminate. Just try it by reversing
# the commented out blocks with the backwards com... |
Serial2Ethernet.py | import socket
import serial
import sys
import threading
def recv_msg():
while True:
recv_msg = conn.recv(1024)
if not recv_msg:
sys.exit(0)
# recv_msg = recv_msg.decode()
# print(recv_msg)
s.write(recv_msg)
def send_msg():
while True:
send_msg = s.... |
dataPreparation.py | import sys
import os
import pandas as pd
import numpy as np
import sys
import random
from trackml.dataset import load_event
from trackml.dataset import load_dataset
from trackml.randomize import shuffle_hits
from trackml.score import score_event
import multiprocessing
from multiprocessing import Process, Value, Lock... |
main.py | import cv2
import numpy
import os
import threading
class MotionDetection:
def __init__(self,**opts):
self.opts={"cam_id":0,"image_scale_factor":1,"max_color_diff":[10,10,10]}
self.opts.update(opts)
self.cap=cv2.VideoCapture(self.opts["cam_id"])
self.last_img=None
self.d_img=[]
self.motion=False
def ... |
server.py | #!/usr/bin/python
import socket
import os
import threading
import hashlib
from Crypto import Random
import Crypto.Cipher.AES as AES
from Crypto.PublicKey import RSA
import signal
from lazyme.string import color_print
def RemovePadding(s):
return s.replace('`','')
def Padding(s):
return s + ((16 - len(s) % ... |
emails.py | # -*- coding: utf-8 -*-
"""
:author: Grey Li (李辉)
:url: http://greyli.com
:copyright: © 2018 Grey Li <withlihui@gmail.com>
:license: MIT, see LICENSE for more details.
"""
from threading import Thread
from flask import url_for, current_app
from flask_mail import Message
from bluelog.extensions import ... |
trainer.py | import argparse
import os
import shutil
import torch.multiprocessing as mp
from checkpoint import checkpoint
from collector import collector
from dataset import Dataset
from optimiser import optimiser
from solvers.mctsnet import MCTSnet
if __name__ == '__main__':
mp.set_start_method('spawn', True)
shutil.rm... |
sdk_worker_main.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 us... |
processes.py | import os
import logging
import multiprocessing
def init():
print('\nmodule multiprocessing:')
print(dir(multiprocessing))
print('\nclass multiprocessing.Process:')
print(dir(multiprocessing.Process))
print('\nclass multiprocessing.Queue:')
print(dir(multiprocessing.Queue))
multiprocessing.log_to_stderr()
lo... |
web.py | import collections
import io
import logging
import multiprocessing
import os
import queue
import re
import selectors
import signal
import socket
import ssl
import sys
import time
# export everything
__all__ = ['server_version', 'http_version', 'http_encoding', 'default_encoding', 'start_method', 'max_line_size', 'max... |
task.py | import atexit
import json
import os
import shutil
import signal
import sys
import threading
import time
from argparse import ArgumentParser
from tempfile import mkstemp, mkdtemp
from zipfile import ZipFile, ZIP_DEFLATED
try:
# noinspection PyCompatibility
from collections.abc import Sequence as CollectionsSequ... |
experiment_gpuMod.py | from multiprocessing import Process
from DLplatform.coordinator import Coordinator, InitializationHandler
from DLplatform.worker import Worker
from DLplatform.communicating import Communicator, RabbitMQComm
from DLplatform.dataprovisioning import IntervalDataScheduler
from DLplatform.learningLogger import LearningLogge... |
test_dist_graph_store.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
import dgl
import sys
import numpy as np
import time
import socket
from scipy import sparse as spsp
from numpy.testing import assert_array_equal
from multiprocessing import Process, Manager, Condition, Value
import multiprocessing as mp
from dgl.graph_index import create_gr... |
experiment_generator.py | from pyflamegpu import *
import os
import random
import itertools
import sys
import threading
import queue
import datetime
import numpy as np
import copy
import ctypes
from deap import base
from deap import creator
from deap import tools
class Experiment(object):
r"""This class provides an interface to a reproduci... |
reconnectingwebsocket.py | # # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA... |
superresolution.py | import argparse
from PIL import Image
from io import BytesIO
import numpy as np
import os
import sys
import torch
import json
from multiprocessing import Process
import base64
import time
from superresolution.utils import load_model
from superresolution.common import tensor2img
sys.path.insert(0, o... |
base_socketsM.py |
import tornado.websocket
import json
import definitions
from multiprocessing import Process
SERVER = definitions.SERVER
class SuperBaseSocket(tornado.websocket.WebSocketHandler):
def open(self, id_sessions, Session):
_id = self.get_argument("id", None, True)
if not _id:
... |
kaldi_io.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014-2016 Brno University of Technology (author: Karel Vesely)
# Licensed under the Apache License, Version 2.0 (the "License")
import numpy as np
import sys, os, re, gzip, struct
#################################################
# Adding kaldi tools to shel... |
rl_data.py | from __future__ import print_function
import mxnet as mx
import numpy as np
import gym
import cv2
import math
import Queue
from threading import Thread
import time
import multiprocessing
import multiprocessing.pool
from flask import Flask, render_template, Response
import signal
def make_web(queue):
app = Flask(__... |
camera_worker.py | import time
import datetime
import json
import redis
import threading
import sys
import os
import RPi.GPIO as GPIO
from picamera import PiCamera
sys.path.append('..')
import variables
#r = redis.Redis(host='127.0.0.1', port=6379)
GPIO.setmode(GPIO.BCM)
class CameraWorker():
def __init__(self, config, main_thread_ru... |
ftl_navigation_node.py | #################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"). ... |
app.py | from node import Node
from time import sleep
import threading
import pika
class NodeMain(Node):
def on_message(self, ch, method, properties, body):
self.data_queue.append(body)
def __init__(self, config: dict, parent=None):
super().__init__(config)
self.data_queue = []
self.queue = config["queue... |
serial_port.py | import serial
from serial.tools import list_ports
import time
import logging
import threading
class SerialPort():
def __init__(self, port, on_received=None,
on_connect=lambda:None,
on_disconnect=lambda:None,
keep_active=True, **kwargs):
self.ser... |
test_sys.py | import unittest, test.support
from test.support.script_helper import assert_python_ok, assert_python_failure
import sys, io, os
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
import gc
import sysconfig
import locale
import threading
# count the number of test runs, used t... |
pipeline.py | """Pipeline building support for connecting sources and checks."""
import traceback
from collections import defaultdict, deque
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import Pool, Process, SimpleQueue
from pkgcore.package.errors import MetadataException
from pkgcore.restrictions import ... |
main.py | # -*- coding: utf-8 -*-
import threading
from PyQt5 import QtWidgets
from PyQt5.QtGui import QImage, QPixmap, QCursor, QIcon
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from mainWindow import Ui_mainWindow
from Test import Ui_Test
import dlib # 人脸识别的库dlib
import cv2 # 图像处理的库OpenCv
from scipy.sp... |
server.py | import argparse
import json
import os
import urlparse
import multiprocessing
import glob
import warnings
import logging
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from rasa_nlu.train import do_train
from rasa_nlu.config import RasaNLUConfig
class RasaNLUServer(object):
def __init__(self, config... |
TestController.py | import collections
import os
import threading
import collections
import tempfile
import time
import traceback
import unittest
from qtpy import QtCore as QC
from qtpy import QtWidgets as QW
from qtpy import QtGui as QG
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core im... |
runner.py | import asyncio
import concurrent.futures
import contextlib
import threading
import types
from typing import TYPE_CHECKING, Any, Optional, Tuple, Type, cast
import click.testing
from typing_extensions import Literal
from kopf import cli
from kopf._cogs.configs import configuration
from kopf._core.intents import regist... |
center_controller.py | r"""
加载配置文件,快速运行,方便复现
"""
import sys
sys.path.append('..')
import os
import multiprocessing as mp
import argparse
import importlib
from codes.nlper.utils import (
read_data,
Dict2Obj,
seed_everything,
ProcessStatus
)
from text_clf_handler import TextCLFHandler
if __name__ == '__main__':
parser = a... |
main.py | import numpy as np, os, time, random, torch, sys
from core.neuroevolution import SSNE
from core.models import Actor
from core import mod_utils as utils
from core.mod_utils import str2bool
from core.ucb import ucb
from core.runner import rollout_worker
from core.portfolio import initialize_portfolio
from torch.multiproc... |
test_sockets.py | import os, multiprocessing, subprocess
from runner import BrowserCore, path_from_root
from tools.shared import *
def clean_pids(pids):
import signal, errno
def pid_exists(pid):
try:
# NOTE: may just kill the process in Windows
os.kill(pid, 0)
except OSError, e:
return e.errno == errno.EPE... |
main.py | # This Python file uses the following encoding: utf-8
import logging
import os
import sys
import threading
import traceback
from pathlib import Path
from urllib.parse import urlparse
from urllib.request import url2pathname, urljoin
import cv2
from PySide2.QtCore import QObject, Slot, QUrl
from PySide2.QtWidgets import... |
openvino_inference_ssd300.py | import numpy as np
import time
import cv2
from threading import Thread
from datetime import datetime
import random
import argparse
from openvino.inference_engine import IENetwork, IEPlugin
#exemple:
#python3 openvino_inference_ssd300.py --mode=tf_gpu --model_name=../ssd_keras_files/plate_inference_graph_retrained/fro... |
cluster.py | import configparser
import datetime
import enum
import hashlib
import json
import os
import re
import socket
import subprocess
import sys
import tempfile
import threading
import time
import uuid
from pathlib import Path
import bech32
import docker
import durations
import jsonmerge
import tomlkit
import yaml
from dateu... |
breaksolver.py | ##
# Copyright: Copyright (c) MOSEK ApS, Denmark. All rights reserved.
#
# File: breaksolver.py
#
# Purpose: Show how to break a long-running task.
##
import sys
from mosek.fusion import *
import random
import threading
import time
def main():
timeout = 5
n = 200 # number of binary variables
m... |
async_event_loop.py | # ----------------------------------------------------------------------------
# - Open3D: www.open3d.org -
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.