source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
start_client.py | # coding:utf8
# @author : Guoxi
# @email : splinzer@gmail.com
# @time : 2018 下午7:47
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from socket import *
from time import sleep
from multiprocessing import Process, Queue
from client.websocket_server import SimpleBroadServe... |
tests.py | from __future__ import unicode_literals
import threading
from datetime import datetime, timedelta
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections
from django.db.models.fields import Field
from django.db.models.manager im... |
SiTcp.py | #
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
# A transfer layer for SiTCP Ethernet. More information: http://sitcp.bbtech.co.jp
#
import logging
imp... |
container.py | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
lavavu.py | """
LavaVu python interface: viewer utils & wrapper
This module provides an interface to the LavaVu library allowing
loading of data, rendering of static images, animation and interactive visualisation
To create an instance of the LavaVu rendering engine, use the Viewer() class, e.g.
>>> import lavavu
>>> lv = lavav... |
microtvm_api_server.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
main.py | #!/usr/bin/python
import paho.mqtt.client as paho
import signal
import sys
import time
from random import randint
from threading import Thread
def functionDataActuator(status):
print "Data Actuator Status %s" % status
def functionDataActuatorMqttOnMessage(mosq, obj, msg):
print "Data Sensor Mqtt Subscribe M... |
server.py | import socket
import sys
import threading
import time
from queue import Queue
NUMBER_OF_THREADS = 2
JOB_NUMBER = [1, 2]
queue = Queue()
all_connections = []
all_address = []
# s = socket.socket()
def create_socket():
try:
global host
global port
global s
host = ... |
test_EN_US.py | import unittest
import random
import sys
from multiprocessing import Process
from words2num import words2num, NumberParseException
from num2words import num2words
class TestEN_US(unittest.TestCase):
"""Test inverse text normalization for numbers."""
def test_en_us(self):
"""Test valid en-US input."""... |
transformation.py | """Schedules asynchronous (transformer) jobs"""
from copy import deepcopy
import weakref
import asyncio
import multiprocessing
import sys
import traceback
import functools
import time
import atexit
import json
from multiprocessing import Process, JoinableQueue as Queue
from .execute import execute
from .injector impor... |
app.py | # -- Imports --------------------------------------------------------------------------
from sanic import Sanic, Blueprint
from threading import Thread
from limits.strategies import FixedWindowElasticExpiryRateLimiter
from limits.storage import MemoryStorage, RedisStorage
from copy import copy
from .middlewares import... |
ai4e_service.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from threading import Thread
from os import getenv
from opencensus.trace.tracer import Tracer
from opencensus.ext.azure.trace_exporter import AzureExporter
from flask import Flask, abort, request, current_app, views
from flas... |
instagram.py | # Kali linux
# Desc: Instagram Bruteforce
# python
import os
import time
import urllib
import argparse
import threading
import subprocess
from platform import platform
from Core.tor import TorManager
from Core.Browser import Browser
class Instagram(TorManager,Browser):
def __init__(self,username,wordl... |
ws.py | # coding=utf-8
# requires https://pypi.python.org/pypi/websocket-client/
from excepthook import uncaught_exception, install_thread_excepthook
import sys
sys.excepthook = uncaught_exception
install_thread_excepthook()
# !! Important! Be careful when adding code/imports before this point.
# Our except hook is installed... |
cv_threading.py | #cv_threading class by John Kirchner
import cv2
import time
from threading import Thread
class kronos:
def __init__(self):
self.startvar = None
self.endvar = None
self.elapsed = None
self.frames = 0
def start(self):
self.startvar = time.perf_counter()
retur... |
client.py | import threading
import os
import glob as gb
import facemap as fm
import cv2
import facedb
import time
def cam():
capInput = cv2.VideoCapture(0)
path = r'.\haarcascade_frontalface_alt.xml'
save_path = (r'.\img\20.jpg')
save = (r'.\img\10.jpg')
faceCascade = cv2.CascadeClassifier(path)
i = 0
... |
image_profiling.py | __author__ = 'coriannaj'
###
import os
import subprocess, threading
import pandas as pd
V3D = "/data/mat/xiaoxiaol/work/bin/bin_vaa3d_for_clusters/start_vaa3d.sh"
class Command(object):
def __init__(self, cmd):
self.cmd = cmd
self.process = None
def run(self, timeout):
def target()... |
data_getter.py | from collections import Counter
from concurrent.futures import ThreadPoolExecutor, TimeoutError
from datetime import datetime
from os import mkdir, path
from sys import platform as sys_platform
from threading import Thread
from time import sleep
from typing import Dict, List
import jieba
import jieba.posseg as pseg
fr... |
bucket.py | """
Methods for managing S3 Buckets and making them available as local file systems.
"""
import os
import urllib2
import threading
from cm.util import misc
from cm.services import service_states
from cm.util.misc import _if_not_installed
from cm.util.decorators import TestFlag
import logging
log = logging.getLogger('... |
mtime_file_watcher.py | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
results.py | import os
import subprocess
import uuid
import time
import json
import requests
import threading
import re
import math
import csv
from datetime import datetime
# Cross-platform colored text
from colorama import Fore, Style
class Results:
def __init__(self, benchmarker):
'''
Constructor
''... |
thread_com.py | # -*- encoding: utf-8 -*-
from queue import Queue
from threading import Thread
def producer(out_q, data):
while True:
out_q.put(data)
def consumer(in_q):
while True:
data = in_q.get()
def test_producer_consumer():
q = Queue()
t1 = Thread(target=consumer, args=(q,))
t2 = Thread(... |
detect_face.py | import sys
import dlib
import os
import cv2
import face_alignment
from multiprocessing import Pool, Process, Queue
import time
def run(gpu, files):
os.environ["CUDA_VISIBLE_DEVICES"] = str(gpu)
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False, device='cuda')
print('gpu=... |
discrop.py | import asyncio
import math
import os.path
import sys
import time
import threading
import webbrowser
import obspython as obs
script_path_ = os.path.dirname(__file__) # script_path is part of the OBS script interface.
sys.path.append(os.path.join(script_path_, 'lib', 'site-packages'))
import discord
SLOTS = 10 # Seems... |
driver_2.py | import collections
import logging
import multiprocessing as mp
import time
import quantities as pq
from wsnsims.conductor import sim_inputs
from wsnsims.core import environment
from wsnsims.flower.flower_sim import FLOWER
from wsnsims.minds.minds_sim import MINDS
from wsnsims.tocs.tocs_sim import TOCS
from wsnsims.foc... |
telnet.py | import telnetlib
from threading import Thread
import json
import time
from util.tool import gen_rand_char, res as save_res
from django.conf import settings
from asgiref.sync import async_to_sync
import traceback
import socket
import sys
import os
import re
from util.control import remove_control_chars
from mp_readline ... |
test_callbacks.py | # -*- coding: utf-8 -*-
import time
from threading import Thread
import pytest
import env # NOQA: F401
from pybind11_tests import callbacks as m
def test_callbacks():
from functools import partial
def func1():
return "func1"
def func2(a, b, c, d):
return "func2", a, b, c, d
def f... |
pyelastix.py | # Copyright (c) 2010-2016, Almar Klein
# This code is subject to the MIT license
"""
PyElastix - Python wrapper for the Elastix nonrigid registration toolkit
This Python module wraps the Elastix registration toolkit. For it to
work, the Elastix command line application needs to be installed on
your computer. You can o... |
import_thread.py | from collections import defaultdict
import threading
import traceback
import grpc
import ray
from ray import ray_constants
from ray import cloudpickle as pickle
import ray._private.profiling as profiling
import logging
logger = logging.getLogger(__name__)
class ImportThread:
"""A thread used to import exports ... |
master.py | import re
import uuid
import json
from os import path
import asyncio
import subprocess
from threading import Thread
from tornado.ioloop import IOLoop
from tornado.gen import coroutine
from tornado.websocket import WebSocketHandler
from ..lib import getEnv, getMaster
class Master(WebSocketHandler):
status = Fals... |
mainwindow.py | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Spyder, the Scientific Python Development Environment
=====================================================
Developped and maintained by the Spyder Pro... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
qft-server-py2.py | import sys
import SocketServer
import json
from threading import Thread
import threading
import atexit
import time
thread_list = []
should_connect_list = {}
class TCPHandler(SocketServer.StreamRequestHandler):
def handle(self):
data = self.rfile.readline().strip()
... |
trainer.py | import time
import random
import queue
import threading
import numpy as np
import tensorflow as tf
import pyglet
from glearn.networks.context import num_global_parameters, num_trainable_parameters, NetworkContext
from glearn.policies import load_policy
from glearn.policies.random import RandomPolicy
from glearn.utils.p... |
manager.py | #!/usr/bin/env python
# encoding: utf-8
"""
@author: william
@contact: 1342247033@qq.com
@site: http://www.xiaolewei.com
@file: manager.py
@time: 05/04/2018 23:08
"""
import threading
import json
from kafka import KafkaProducer, KafkaConsumer
from agency.core import config
from agency.core import logger
from agency.c... |
TorzelaUtils.py | #!/usr/bin/env python3
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import dh
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, mode... |
test_content.py | from __future__ import print_function
import re
import sys
import json
import time
import urllib3
import argparse
import requests
import threading
import subprocess
import os
from time import sleep
from datetime import datetime
import demisto_client.demisto_api
from slackclient import SlackClient
from Tests.mock_serv... |
test_daemon.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... |
app.py | # doing necessary imports
import threading
import io
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from logger_class import getLog
from flask import Flask, render_template, request, jsonify, Response, url_for, redirect
from flask_cors import CORS, cros... |
test_fx.py | # Owner(s): ["oncall: fx"]
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 typing
import types
import warnings
import unittest
from math import sqrt
from torch.multiprocessin... |
misc.py | import subprocess
import unittest
from fnmatch import fnmatch
import multiprocessing
from time import sleep, time
import itertools
from pathlib import Path
import numpy as np
import sys
import errno
import os
from vmaf import run_process
from vmaf.tools.scanf import sscanf, IncompleteCaptureError, FormatError
__cop... |
server.py | from CONSTANTS import *
from server_sockets import *
import socket
import threading
'''
The main server file implements the concurrency via multi-threading.
You can only modify the total ports and related server socket initiation here.
If you want to implement the concurrency with other methods,
you c... |
server.py | import numpy as np
import os
import io
# import for server
from flask import Flask, render_template, request, Response, send_file, jsonify
from queue import Queue, Empty
import threading
import time
# import for model
from transformers import AutoTokenizer, AutoModelWithLMHead, top_k_top_p_filtering, AutoModelForMask... |
gear.py | # Copyright 2013-2014 OpenStack Foundation
#
# 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 ... |
hiascdi.py | #!/usr/bin/env python3
""" HIASCDI NGSIV2 Context Broker.
The HIASCDI Context Broker handles contextual data for all HIAS
devices/applications and agents. HIASCDI is based on CEF/FIWARE
NGSI V2 specification.
MIT License
Copyright (c) 2021 Asociación de Investigacion en Inteligencia Artificial
Para la Leucemia Peter... |
test_runner.py | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Copyright (c) 2017 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into ind... |
models.py | from django.db import models
from os import path, system
import subprocess
from django.contrib.auth.models import User
from django.db.models import Q
from random import shuffle
import threading
SOURCE_FILES_DIR = '/root/filya/submits/source/'
EXEC_FILES_DIR = '/root/filya/submits/bin/'
SANDBOX_DIR = '/root/filya/subm... |
test_memory.py | import ctypes
import sys
import threading
import unittest
import cupy.cuda
from cupy.cuda import device
from cupy.cuda import memory
from cupy.cuda import stream as stream_module
from cupy import testing
class MockMemory(memory.Memory):
cur_ptr = 1
def __init__(self, size):
self.ptr = MockMemory.cur... |
baseline_racer.py | from argparse import ArgumentParser
import airsimneurips as airsim
import cv2
import threading
import time
import utils
import numpy as np
import math
# drone_name should match the name in ~/Document/AirSim/settings.json
class BaselineRacer(object):
def __init__(self, drone_name = "drone_1", viz_traj=True, viz_tra... |
buzzer_board.py | import RPi.GPIO as io
from socketIO_client import SocketIO, BaseNamespace
import threading
import time
players = {
1: {'player_name': 'Euclid', 'player_id': 1, 'pin_id': 26},
2: {'player_name': 'Euclid', 'player_id': 1, 'pin_id': 19}
}
def on_connect(*args):
print('connected', args)
def buzzer_callback... |
main.py | import sys
import os
import pipe_utils
import subprocess
import threading
import time
def thread_function(name):
# Process function
while(1):
print("hello")
time.sleep(3)
#process the array
array = pipe.output_array
print(array)
print(len(array))
if __name__... |
mainwindow.py | """The Qt MainWindow for the QtConsole
This is a tabbed pseudo-terminal of IPython sessions, with a menu bar for
common actions.
Authors:
* Evan Patterson
* Min RK
* Erik Tollerud
* Fernando Perez
* Bussonnier Matthias
* Thomas Kluyver
* Paul Ivanov
"""
#------------------------------------------------------------... |
server.py | """
A high-speed, production ready, thread pooled, generic HTTP server.
For those of you wanting to understand internals of this module, here's the
basic call flow. The server's listening thread runs a very tight loop,
sticking incoming connections onto a Queue::
server = HTTPServer(...)
server.start()
->... |
guitools.py | # -*- coding: utf-8 -*-
# script.module.python.koding.aio
# Python Koding AIO (c) by TOTALREVOLUTION LTD (support@trmc.freshdesk.com)
# Python Koding AIO is licensed under a
# Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
# You should have received a copy of the license along w... |
mock_web_api_server.py | import asyncio
import json
import logging
import re
import sys
import threading
import time
from http import HTTPStatus
from http.server import HTTPServer, SimpleHTTPRequestHandler
from multiprocessing.context import Process
from typing import Type
from unittest import TestCase
from urllib.parse import urlparse, parse_... |
tasks.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
from collections import OrderedDict, namedtuple, deque
import errno
import functools
import importlib
import json
import logging
import os
from io import StringIO
from contextlib import redirect_stdout
import shutil
import stat... |
coinv1.py |
from os import _exit,system
import time
import sys
from amino.lib.util import exceptions
try:
import amino
except:
print("not have internet")
_exit
import random,string,hashlib,base64,importlib,threading
def deviceaoss():
return str('01' + (hardwareInfo := hashlib.sha1(''.join(random.choi... |
test_functools.py | import abc
import builtins
import collections
import copy
from itertools import permutations
import pickle
from random import choice
import sys
from test import support
import time
import unittest
import unittest.mock
from weakref import proxy
import contextlib
try:
import threading
except ImportError:
threadin... |
crawler.py | # -*- coding: utf-8 -*-
"""
Contains the crawling logic.
"""
from __future__ import unicode_literals, absolute_import
import base64
from collections import defaultdict
import logging
import sys
import time
from bs4 import BeautifulSoup, UnicodeDammit
import lib.pylinkvalidator.compat as compat
from lib.pylinkvalidat... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
import logging
import getpass
import multiprocessing
import fnmatch
import copy
import os
import hashlib
import re
import types
import threading
import time
import traceback
import sys
import signal
from random import randint
# Import th... |
speedTest.py | #!/usr/bin/env python
# source: https://github.com/sanderjo/fast.com
'''
Python CLI-tool (without need for a GUI) to measure Internet speed with fast.com
'''
import os,sys
import json,time
import urllib,urllib2
import xbmc,xbmcgui
#import jsbeautifier
#import threading
from threading import Thread
def... |
test_comms.py | import asyncio
import os
import sys
import threading
import types
import warnings
from functools import partial
import pkg_resources
import pytest
from tornado import ioloop
from tornado.concurrent import Future
import dask
import distributed
from distributed.comm import (
CommClosedError,
connect,
get_a... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import importlib.machinery
import importlib.util
import os
import pickle
import random
import re
import subprocess
import sys
import t... |
tornado-http-bench.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import tornado
import tornado.iostream
import tornado.httpclient
import signal
import multiprocessing
import os
import sys
import struct
import functools
try:
import cPickle as pickle
except ImportError:
import pickle
import time
import argparse
now_exit = False
... |
multi2.py | "multiprocessing pipes"
"""
Use multiprocess anonymous pipes to communicate. Returns 2 connection
object representing ends of the pipe: objects are sent on one end and
received on the other, though pipes are bidirectional by default
"""
import os
from multiprocessing import Process, Pipe
def sender(pipe):
"""
... |
fiware2gopigo_impl.py | # -*- coding: utf-8 -*-
import os
import re
import ssl
import threading
from math import pi
import paho.mqtt.client as mqtt
import rospy
from geometry_msgs.msg import Twist
from fiware_ros_gopigo.params import get_params, find_item
from fiware_ros_gopigo.logging import get_logger
logger = get_logger(__name__)
cla... |
acceptor.py | # -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... |
main.py | import threading
from src.Platform import pt
from src.Wy_Finance import Wy
from src.Ths_Finance import Ths
from src.Jrj_Finance import Jrj
from src.Fh_Finance import Fh
from src.East_Finance import Ew
from src.CCTV_News import CCTV
from src.Sina_Finance import Sina
from src.Xhs_Finance import Xhs
from src.Sg_... |
tests.py | # -*- coding: utf-8 -*-
import os
import shutil
import sys
import tempfile
import time
import unittest
from cStringIO import StringIO
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.core.files.base import ContentFile
from django.core.files.images import get_image_dime... |
java.py | import os
import atexit
import shutil
import tempfile
from contextlib import contextmanager
import threading
import onir
logger = onir.log.easy()
class _JavaInterface:
def __init__(self):
self._autoclass = None
self._defs = {}
self._cache = {}
self._jars = []
self._log_lis... |
services.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
kaisa_gateway.py | """
"""
import base64
import json
import threading
import sys
import requests
import math
import pytz
from Crypto.Cipher import AES
from datetime import datetime
from typing import Dict, Any, List
from urllib import parse
from vnpy.api.rest import RestClient, Request
from vnpy.api.websocket import WebsocketClient
from... |
namespaces.py | import contextlib
import ctypes
import errno
import os
import pyroute2
import pytest
import signal
import multiprocessing
# All allowed namespace types
NAMESPACE_FLAGS = dict(mnt=0x00020000,
uts=0x04000000,
ipc=0x08000000,
user=0x10000000,
... |
test_utils.py | """Module for testing the natcap.invest.utils module.."""
import codecs
import unittest
import os
import tempfile
import shutil
import logging
import logging.handlers
import threading
import warnings
import re
import glob
import textwrap
import queue
import numpy
from osgeo import gdal
from osgeo import ogr
from osgeo... |
run_json_proxy.py | #!/usr/bin/env python
# GPX from google maps route: http://www.gpsvisualizer.com/convert_input
### stdlib packages
import os
import socket
import argparse
import sys
import select
import time
import threading
import thread
import urllib
import json
###
INDEX = "/whereami/setloc.html"
UPDATE_INTERVAL = 0.3
# curr_la... |
views.py | import json
import shutil
import threading
from collections import defaultdict
import cv2
import face_recognition
import numpy as np
from flask import Response, render_template, request, url_for, redirect, session
from flask_dropzone import Dropzone
from flask_uploads import UploadSet, configure_uploads, IMAGES, patch... |
atari.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: atari.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import numpy as np
import time, os
import cv2
from collections import deque
import threading
import six
from six.moves import range
from tensorpack.utils import (get_rng, logger, get_dataset_path, execute_only_once)... |
run_vs_pass.py | # -*- coding: utf-8 -*-
"""
Example startup script to perform full quantization of a two qubit, one cavity Josephson circuit.
The results are saved, printed, and nicely plotted.
@author: Zlatko
"""
from pyEPR import ProjectInfo, DistributedAnalysis, QuantumAnalysis
# 1. Project and design. Open link to HFSS control... |
bkit_oauth.py | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
test_zeromq.py | # -*- coding: utf-8 -*-
"""
:codeauthor: Thomas Jackson <jacksontj.89@gmail.com>
"""
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import ctypes
import multiprocessing
import os
import threading
import time
from concurrent.futures.thread import ThreadPoolExecutor
#... |
tensorflow.py | # -*- coding: utf-8 -*-
try:
import tensorflow as tf
from object_detection.utils import label_map_util as lm_util
except ImportError as error:
raise ImportError(
"Usage of the TensorFlow detectors requires that TensorFlow and the research module of "
"the TensorFlow Model Garden are install... |
demo.py | import matplotlib
matplotlib.use('Agg')
import os, sys
import yaml
from argparse import ArgumentParser
from tqdm import tqdm
import cv2
import imageio
import numpy as np
from skimage.transform import resize
from skimage import img_as_ubyte
import torch
from sync_batchnorm import DataParallelWithCallback
from modules.... |
test_streams.py | """Tests for streams.py."""
import gc
import os
import queue
import pickle
import socket
import sys
import threading
import unittest
from unittest import mock
from test.support import socket_helper
try:
import ssl
except ImportError:
ssl = None
import asyncio
from test.test_asyncio import utils as test_utils
... |
preprocessing.py | #!/usr/bin/env python3
# coding: utf8
"""
TODO: Write Documentation
"""
import glob
from queue import Queue
import os
import threading
import multiprocessing
import time
import scipy.io as sio
import numpy as np
from PIL import Image
from tqdm import tqdm, trange
class Preprocesser(object):
"""
Preprocesso... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from utils.general import xyxy2xywh, xywh2xyxy, torch_di... |
routes_server.py | import json
import os
import re
import requests
import shlex
import socket
import subprocess
import sys
import traceback
from flask import current_app, make_response, request, redirect, send_file
from pathlib import Path
from threading import Thread
from time import sleep
from os import path
from . import main
from .c... |
tornado.py | import asyncio
import fnmatch
import json
import logging
import os
import threading
import time
import webbrowser
from functools import partial
from typing import Dict
from urllib.parse import urlparse
import tornado
import tornado.httpserver
import tornado.ioloop
from tornado.web import StaticFileHandler
from tornado... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return "Running"
def run():
app.run(host="0.0.0.0", port=8000)
def keep_alive():
server = Thread(target=run)
server.start()
|
hypothesis_test.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import copy
from functools import partial, reduce
from hypothesis import assume, given, settings
import hypothesis.strategies as st
import unittest
from caffe2.python import core, workspace,... |
session.py | #
# Copyright (c) 2016-2021 Deephaven Data Labs and Patent Pending
#
import os
import threading
from typing import List
import pyarrow
from bitstring import BitArray
import grpc
from pydeephaven._arrow_flight_service import ArrowFlightService
from pydeephaven._console_service import ConsoleService
from pydeephaven... |
lock_counter.py | import threading
import time
def worker():
global counter
# lock the critical section:
lock.acquire()
tmp = counter
print("Before:",counter)
counter = tmp + 1
print("After:",counter)
lock.release()
counter = 0
# create a lock
lock = threading.Lock()
# create some treads to count together:
thread_... |
serialctrl.py | import threading
from time import sleep
from contextlib import contextmanager
import seriallib
from .constants import ByteSize, Parity, StopBits, fDtrControl, BaudRate
from .exceptions import (
SerialPortNotConnected, CommandMustBytesType, OutOfRange,
SerialCtrlError, SerialPortConnectError,
)
class RWLock:
... |
concurrent_clients.py | #! /usr/bin/env python
#
# ===============================================================
# Description: Lots of clients doing concurrent requests
# Warning: may require raising ulimit -n
#
# Author: Ayush Dubey, dubey@cs.cornell.edu
#
# Copyright (C) 2015, Cornell University, see the... |
test_athenad.py | #!/usr/bin/env python3
import json
import os
import requests
import shutil
import tempfile
import time
import threading
import queue
import unittest
from datetime import datetime, timedelta
from multiprocessing import Process
from pathlib import Path
from unittest import mock
from websocket import ABNF
from websocket.... |
worker.py | try:
from queue import Queue # Replace 'queue' with 'Queue' for Python 2.
except ImportError:
from Queue import Queue
import threading
def worker(jobs_queue, results_queue):
while True:
job = jobs_queue.get()
result = job()
results_queue.put(result)
jobs_queue, results_queue = Q... |
test_restful.py | #!/usr/bin/python3
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
NOTE:
This unittest is being used as a procedural test.
The tests must be run in-order and CANNOT be parallelized!
Tests all but two RESTful interfaces:
* agent's POST /v2/keys/vkey
- Done by C... |
doom_gym.py | import copy
import os
import random
import re
import time
from os.path import join
from threading import Thread
import cv2
import gym
import numpy as np
from filelock import FileLock, Timeout
from gym.utils import seeding
from vizdoom.vizdoom import ScreenResolution, DoomGame, Mode, AutomapMode
from multi_sample_fact... |
driver_station_sim.py | #!/usr/bin/env python
import os
import argparse
import rospy
import rospkg
import threading
from qt_gui.plugin import Plugin
from python_qt_binding import loadUi
from python_qt_binding.QtWidgets import QWidget
from ros_control_boilerplate.msg import AutoMode
from frc_msgs.msg import MatchSpecificData
class Driver... |
demo_image_repo.py | """
demo_image_repo.py
Demonstration code handling an Image Repository.
Use:
import demo.demo_image_repo as di
di.clean_slate()
See README.md for more details.
<Demo Interface Provided Via XMLRPC>
XMLRPC interface presented TO THE DEMO WEBSITE:
add_target_to_image_repo(target_filepath, filepat... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.