source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
collection.py | # Copyright 2009-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
main.py | import time
import threading
from helpers.dataintegrityhelper import *
from helpers.sensehathelper import *
#for printing color
from colorama import init
init()
from colorama import Fore, Back, Style
#variables
count = 0
animation_refresh_intervals = 0.1 #smaller is faster
#setup sense hat
hat = SenseHat()
hat.set_r... |
core.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
#... |
build_training_data.py | from cv2 import imwrite
import numpy as np
import os
from PIL import Image, ImageDraw, ImageFont, ImageChops
import string
import pandas as pd
import random
import torchvision
import time
from multiprocessing import Process
class FontChoice():
def __init__(self, font_directory):
self.original_fonts = os.listdir(f... |
tools.py | #create helper classes and functions
import time
import sys
import subprocess
from threading import Thread
#seperator title line
def seperator(title):
print(f'\n{title:-^50}')
#loading text
loading = False
def loading_start():
global loading
loading = True
def load_start():
sys.stdout.write('... |
control.py | '''
The control module
Creates and controls the units of SLM lab: EvolutionGraph, Experiment, Trial, Session
'''
from copy import deepcopy
from importlib import reload
from slm_lab.agent import AgentSpace, Agent
from slm_lab.env import EnvSpace, make_env
from slm_lab.experiment import analysis, search
from slm_lab.expe... |
VideoServers.py | import Queue
import threading
import time
import base64
import threading
import paho.mqtt.client as mqtt
ImagesQueue = Queue.Queue(5)
ClientNum = 0
def on_connect(client,userdata,rc):
#print "Connected with result code" + str(rc)
client.subscribe("Video")
def on_message(client ,userdata, msg):
global Clie... |
Amusebox.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from os import system, name
import itertools
import threading
import time
import sys
import datetime
from base64 import b64decode,b64encode
from datetime import date
expirydate = datetime.date(2022, 21, 12)
#expirydate = datetime.date(2021,20, 30)
today=date.today()
def hero(... |
app.py | # encoding: utf-8
'''
A REST API for Salt
===================
.. versionadded:: 2014.7.0
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
:depends:
- CherryPy Python module. Version 3.2.3 is currently recommended when
SSL is enabled, since this version worked the best with SSL in
internal testing.... |
MainScript.py | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 22 17:53:39 2018
@author: Frostad
"""
#import python modules
from PyQt4 import QtCore, QtGui, uic
from matplotlib.backends.qt_compat import QtWidgets
import cPickle as pkl
from pyueye import ueye
import sys
import cv2
import numpy as np
import copy
import threading
impor... |
client.py | ##########################################################################
# Name: client.py
# Description: Connects to the server to attempt to join a chat room to
# chat with others that join the same chat room.
# Created on: November 10, 2021
# Updated on: November 14, 2021
# Author: Keanu... |
test_webdriver.py | from threading import Thread
import pytest
from assertpy import assert_that
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from sylenium import SyleniumDriver
from sylenium import SyleniumElement
from sylenium.element import ById
from sylenium.sylenium import find
from sylenium.sylenium ... |
scheduler.py | import time
import multiprocessing
from proxypool.processors.server import app
from proxypool.processors.getter import Getter
from proxypool.processors.tester import Tester
from proxypool.setting import APP_PROD_METHOD_GEVENT, APP_PROD_METHOD_MEINHELD, APP_PROD_METHOD_TORNADO, CYCLE_GETTER, CYCLE_TESTER, API_HOST,... |
test_io.py | import sys
import gzip
import os
import threading
import time
import warnings
import io
import re
import pytest
from pathlib import Path
from tempfile import NamedTemporaryFile
from io import BytesIO, StringIO
from datetime import datetime
import locale
import numpy as np
import numpy.ma as ma
from numpy.lib._iotools ... |
SocketControl_MPU6050.py | # SocketControl_MPU6050.py
import time
import socket
import serial
from Calibrate import CarAdmin
from threading import Thread
DEFAULT_SPEED = 15
def recv_all(sock, length):
data = ""
while len(data) < length:
more = sock.recv(length - len(data))
if not more:
raise EOFError('recv_a... |
test-client-via-http-connect-proxy.py | #!/usr/bin/env python3
from common import LOCALHOST, RootCert, STATUS_PORT, SocketPair, TcpClient, TlsServer, print_ok, run_ghostunnel, terminate
import http.server
import threading
import select
# We deliberately use an unresolvable address in this test
# to verify that Ghostunnel accepts unknown targets when
# a co... |
synpro.py | import os
from multiprocessing import Queue, get_context
from pymongo import MongoClient
from synthesis_classifier.model import classifier_version
__all__ = [
'MetaCollectionIteratorByQuery',
'SynProDBWriter'
]
def get_connection():
client = MongoClient('synthesisproject.lbl.gov')
db = client.SynPr... |
test_operator.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... |
webutils.py | """A set of utilities to use for web apps made using web.py.
Licensed under the 3-clause BSD License:
Copyright (c) 2010, Neeraj Kumar (neerajkumar.org)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
... |
literadar.py | # -*- coding: utf-8 -*-
# Copyright 2017 Zachary Marv (马子昂)
#
# 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... |
wss_thread.py | import logging
import threading
import time
import websocket
import time
from collections import deque
import ast
class WssThread(object):
'''docstring for WssThread'''
def __init__(self, url: str, maxlen: int=10):
super(WssThread, self).__init__()
self.queue = deque(maxlen=maxlen)
sel... |
main.py | #!-*-coding:utf-8-*-
# !@Date: 2018/8/12 22:03
# !@Author: Liu Rui
# !@github: bigfoolliu
import os
import tkinter
import tkinter.filedialog
import random
import time
import threading
import pygame
folder = ''
def play():
# folder用来表示存放MP3音乐文件的文件夹
global folder
musics = [folder + '\\' + music for music in os.l... |
thstart.py | import threading
import time
# global www
# @app.route("/test1",methods=["GET"])
# @is_login
class DownThread:
def __init__(self):
self._running = True
def terminate(self):
self._running = False
def run(self, n):
i = 0
while 1:
i = i + 1
print(i)
... |
notify.py | # Copyright (c) 2020 Samsung Electronics
#
# 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 ... |
main.py | import json
import threading
import time
import evdev
import keys_parse
keys = keys_parse.load([
"./keys.yaml",
])
config = keys_parse.load([
"./config.yaml",
"../config/config.yaml",
])
import failures
failures.prehook()
from publisher import Publisher
def capture_events(device, lookup, publish):
... |
example_multiprocess.py | # This program demos how to use milvus python client with multi-process
# See more details and caution in:
# https://milvus.io/docs/v0.6.0/faq/operational_faq.md#Why-does-my-multiprocessing-program-fail
import os
from multiprocessing import Process
from factorys import *
from milvus import Milvus
############### Glo... |
yolo_image.py | """
Image detection example with YOLO
by Takashi MATSUSHITA
"""
import socket
socket.setdefaulttimeout(5) # give-up early for image retrieval
import urllib
import cv2
import numpy as np
import os
import urllib
import threading
import glob
NTHREAD = 4 # number of threads for image downloads
IMG_SIZE = 400 # outp... |
keep_alive.py | from flask import Flask
from threading import Thread
import random
app = Flask('')
@app.route('/')
def home():
return 'Im in!'
def run():
app.run(
host='0.0.0.0',
port=8080
)
def keep_alive():
'''
Creates and starts new thread that runs the function run.
'''
t = Thread(target=run)
t.start() |
translation.py | import random
import sys
import threading
import time
from multiprocessing.dummy import Pool
from queue import Queue
import requests
from cli.mmt.engine import EngineNode, ApiException
from cli.mmt.processing import XMLEncoder
from cli.utils import nvidia_smi
class TranslateError(Exception):
def __init__(self, ... |
mtslep3.py | #coding:utf-8
import threading
from time import sleep, ctime
loops = [4,2]
def loop(nloop, nsec):
print 'start loop', nloop, 'at"', ctime()
sleep(nsec)
print 'loop', nloop, 'done at:', ctime()
def main():
print 'starting at:', ctime()
threads =[]
nloops = range(len(loops))
for i in nloo... |
server.py | #!/usr/bin/env python3
import asyncio
import websockets
import RPi.GPIO as GPIO
import sys
import socket
import json
import time
from piservo import Servo
from time import sleep
from threading import Thread
#host on current LAN address
#s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
#s.connect(("8.8.8.8", 80))
... |
auto_test.py | """Tests for letsencrypt-auto"""
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from contextlib import contextmanager
from functools import partial
from json import dumps
from os import chmod, environ, makedirs
from os.path import abspath, dirname, exists, join
import re
from shutil import copy, rmtree
... |
traceroute.py | #!/usr/bin/env python3
import socket
import struct
import icmplib
import threading
R = '\033[31m' # red
G = '\033[32m' # green
C = '\033[36m' # cyan
W = '\033[0m' # white
Y = '\033[33m' # yellow
def icmp_trace(ip, tr_tout, output, collect):
result = icmplib.traceroute(ip, count=1, interval=0.05, timeout=tr_tout, i... |
manager.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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 b... |
establish-range.py | from threading import Thread
import pygame
from voiceController import q, get_current_note
pygame.init()
screenWidth, screenHeight = 288, 512
screen = pygame.display.set_mode((screenWidth, screenHeight))
clock = pygame.time.Clock()
running = True
titleFont = pygame.font.Font("assets/Bungee-Regular.ttf", 34)
titleT... |
procutil.py | from multiprocessing import Process, Queue
# import traceback
def _wrapper(target, codec, queue, args, kwargs):
exc = None
try:
if args is None:
args = []
if kwargs is None:
kwargs = {}
r = target(*args, **kwargs)
except Exception as e:
# traceback.p... |
thread_queue_test.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# @File : thread_queue_test.py
# @Time : 2019/2/15 1:11
# @Author : MaiXiaochai
# @Site : https://github.com/MaiXiaochai
import time
import threading
from queue import Queue
def get_detail_html(queue):
# 文章详情页
while True:
# get取数据,是一种阻塞的方法,即,若queu... |
test_state.py | # -*- coding: utf-8 -*-
"""
Tests for the state runner
"""
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import errno
import logging
import os
import shutil
import signal
import tempfile
import textwrap
import threading
import time
# Import Salt Libs
import salt.except... |
xtras.py | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/03_xtras.ipynb (unless otherwise specified).
__all__ = ['dict2obj', 'repr_dict', 'is_listy', 'shufflish', 'mapped', 'IterLen', 'ReindexCollection', 'open_file',
'save_pickle', 'load_pickle', 'maybe_open', 'image_size', 'bunzip', 'join_path_file', 'urlquote', '... |
threading_local.py | #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Keeping thread-local values
"""
#end_pymotw_header
import random
import threading
import logging
def show_value(data):
try:
val = data.value
except AttributeError:
logging.debug('No value y... |
shellserver.py | import threading
import socketserver
import kbhit
import sys
import io
import os
SHELL_PATH = r".."
ADDRESS = ("localhost", 9182)
sys.path.append(os.path.abspath(SHELL_PATH))
import operating_environment as oenv
def build_input_function(stream=sys.stdin, prompt_stream=sys.stdout) :
def stream_input(prompt=None, ... |
filemanager.py | import os
import shutil
from halo import Halo
from typing import Dict, Tuple, List
from pathlib import Path
from threading import Thread
import boto3
import PIL
from PIL import Image
from resizeimage import resizeimage
s3Client = boto3.client('s3')
MAX_FILE_SIZE = 576000
DIRECTORY_SOURCE = '/var/www/html/pruebas/aws/... |
go_tool.py | import argparse
import copy
import json
import os
import shutil
import subprocess
import sys
import tempfile
import threading
arc_project_prefix = 'a.yandex-team.ru/'
std_lib_prefix = 'contrib/go/_std/src/'
vendor_prefix = 'vendor/'
def compare_versions(version1, version2):
v1 = tuple(str(int(x)).zfill(8) for x ... |
test.py | #! /usr/bin/env python3
#coding: utf8
#import lirc
import time
import os
import sys
import spidev
import smbus
import config
import threading
from evdev import InputDevice, categorize, ecodes
from threading import Thread
from queue import Queue
# Declare files to save status varialbe
file_mute = config.mute
file_vol ... |
SerialTest.py | # encoding:UTF-8
import serial # 导入串口包
import time # 导入时间包
import threading
class Config:
# 端口号
serialPort = '/dev/ttyUSB1'
# 波特率
baudRate = 9600
class Serialthread:
def __init__(self):
self.port = serial.Serial(Config.serialPort, Config.baudRate,timeout = 0)
self.port.close(... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
CollectionProcessor.py | #!/usr/bin/python3
# system-wide requirements
from sepy.SEPAClient import *
from uuid import uuid4
import threading
import requests
import logging
import json
# debug requirements
import traceback
import pdb
# local requirements
from .QueryUtils import *
class CollectionProcessor:
def __init__(self, conf, stat... |
get_image.py | import math
import os
import random
import threading
import time
from bs4 import BeautifulSoup
from base64 import b64encode
from io import BytesIO
from re import findall
import numpy as np
from PIL import Image, ImageDraw, ImageFont, ImageFilter
from httpx import get
from wordcloud import WordCloud
from .get_data imp... |
communicate.py | # Copyright (c) 2017 Alex Socha
# http://www.alexsocha.com/pynode
import subprocess
import time
import traceback
import sys
import os
import json
import uuid
from threading import Thread
from pynode.src import update
from pynode.src import pynode_core
# The location of the main.py file
APP_DIR = os.p... |
dtkdeploy.py | # MIT License
#
# Copyright (c) 2019
# Miguel Perales - miguelperalesbermejo@gmail.com
# Jose Manuel Caballero - jcaballeromunoz4@gmail.com
# Jose Antonio Martin - ja.martin.esteban@gmail.com
# Miguel Diaz - migueldiazgil92@gmail.com
# Jesus Blanco Garrido - jesusblancogarrido@gmail.com
#
# Permission is hereby gran... |
mult_threading.py | import time
import threading
def calc_square(numbers):
print("calculate square numbers")
for n in numbers:
time.sleep(0.2)
print('square:', n*n)
def calc_cube(numbers):
print("calculating cube of numbers")
for n in numbers:
time.sleep(0.2)
print('cube:', n*n*n)
arr = [... |
attackLib.py | import os
import re
import time
import json
import nmap3
import random
import socket
import threading
import tarfile
import logging
import xmltodict
import multiprocessing
from functools import partial
from colorama import Fore, Style
from socketserver import ThreadingMixIn
from http.server import SimpleHTTPRequestHand... |
test_lightningd.py | from concurrent import futures
from decimal import Decimal
import copy
import json
import logging
import queue
import os
import random
import re
import shutil
import socket
import sqlite3
import stat
import string
import subprocess
import sys
import tempfile
import threading
import time
import unittest
import utils
f... |
piksi.py | #!/usr/bin/env python
#
# Title: piksi.py
# Description: ROS Driver for the Piksi V2 RTK GPS module
# Dependencies: libsbp (https://github.com/swift-nav/libsbp), tested with v1.2.1
# Based on original work of https://bitbucket.org/Daniel-Eckert/piksi_node
#
import rospy
import math
import numpy as np
# Im... |
main2.1.py | #Programme à lancer pour une détection de mouvement et envoie d'un mail avec une image
import cv2
import sys
from mail import sendEmail
from flask import Flask, render_template, Response
from camera import VideoCamera
from flask_basicauth import BasicAuth
import time
import threading
import RPi.GPIO as GPIO
import dat... |
Hover_kb_new.py | #!/usr/bin/env python
import rospy
import tf
from crazyflie_driver.msg import Hover
from std_msgs.msg import Empty
from crazyflie_driver.srv import UpdateParams
from threading import Thread
speed=0.15
class Crazyflie:
def __init__(self, prefix):
self.prefix = prefix
worldFrame = rospy.get_param(... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import qtum_electrum
from qtum_electrum.bitcoin import TYPE_ADDRESS
from qtum_electrum import WalletStorage, Wallet
from qtum_electrum.gui.kivy.i18n import _
from qtum_electrum.paymentrequest import... |
slack.py | from .util import Envoy, is_valid
from concurrent.futures import ThreadPoolExecutor
import multiprocessing
import time
import requests
import threading
class SlackRTMApi(Envoy):
def __init__(self, debug=False, token=None, slack_client_instance=None, base_url='https://api.botanalytics.co/v1/',
cal... |
__main__.py | import logging
import multiprocessing as mp
import threading
from stellarisdashboard import cli, config
from stellarisdashboard.dashboard_app import start_server
logger = logging.getLogger(__name__)
def main():
"""Entry point for the default execution:
1. Start the flask server which hosts the visualizatio... |
dataloader_iter.py | # Copyright (c) 2020 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... |
media_stream_processor.py | '''
* Copyright (C) 2019-2020 Intel Corporation.
*
* SPDX-License-Identifier: MIT License
*
*****
*
* MIT License
*
* Copyright (c) Microsoft Corporation.
*
* 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... |
portable_runner.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... |
twitter.py | from typing import Dict, Union, List
import requests
from requests_oauthlib import OAuth1
import re
import os
import time
import threading
from dotenv import load_dotenv
import logging
from .formatter import generate_tweet
load_dotenv()
USERNAME = os.environ["TWITTER_USERNAME"]
API_KEY = os.environ["TWITTER_API_KEY"... |
processor.py | __all__ = ['IndraDBRestSearchProcessor', 'IndraDBRestHashProcessor']
import logging
from copy import deepcopy
from threading import Thread
from datetime import datetime
from collections import OrderedDict, defaultdict
from indra.statements import stmts_from_json, get_statement_by_name, \
get_all_descendants
from... |
threading_daemon_join_timeout.py |
import threading
import time
import logging
def daemon():
logging.debug('Starting')
time.sleep(0.2)
logging.debug('Exiting')
def non_daemon():
logging.debug('Starting')
logging.debug('Exiting')
logging.basicConfig(
level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',)
d = t... |
_communication.py | from multiprocessing import Pipe
from threading import Thread
from ._sender import Sender
class Communication:
def __init__(self):
self._index = dict()
self._receiver, self._channel = Pipe()
self._sender = Sender(channel=self._channel)
self._worker = None
self._stopped = ... |
controller_input.py | from inputs import get_gamepad # pip install inputs
import threading
def deadzone(normalized_axis):
if abs(normalized_axis) < 0.1: return 0.0
return normalized_axis
class ControllerInput:
def __init__(self):
# self.throttle = 0.0
self._gas_pedal = 0.0
self._brake_pedal = 0.0
... |
Hiwin_RT605_ArmCommand_Socket_20190627161338.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import math
import enum
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback = 1
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
i... |
douban_top250.py | import threading
import time
import requests
from scrapy import Selector
url = "https://movie.douban.com/top250"
lock = threading.Lock()
page_offset = 0
def get_data(url):
"""
获取网页原数据
:param url: 请求地址
:return:
"""
global page_offset
while page_offset <= 225: # 如果页面见底
params = {"... |
eve.py | from typing import Union
import kik_unofficial.datatypes.xmpp.chatting as chatting
from kik_unofficial.client import KikClient
from kik_unofficial.callbacks import KikClientCallback
from kik_unofficial.datatypes.xmpp.errors import SignUpError, LoginError
from kik_unofficial.datatypes.xmpp.roster import PeersInfoRespons... |
solve.py | import struct
import os, sys
import time
import socket
import threading
import re
numLookup = {
0 : " ",
3 : "1",
15: "4",
19: "7",
21: "0",
25: "2",
27: "3",
28: "6",
29: "8",
30: "5",
31: "9"
}
keys = {
'0': 16,
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5'... |
Sclient.py | import os
import socket
import base64
import pickle
import threading
import multiprocessing
import hashlib
import random
import yaml
import datetime
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.primitives.asymmetric impo... |
query_optimizer.py | """
This file composes the functions that are needed to perform query optimization.
Currently, given a query, it does logical changes to forms that are
sufficient conditions.
Using statistics from Filters module, it outputs the optimal plan (converted
query with models needed to be used).
To see the query optimizer pe... |
tcr.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
import time,random,sys,json,codecs,threading,glob,re
cl = LINETCR.LINE()
cl.login(qr=True)
cl.loginResult()
ki = kk = kc = cl
print "login success"
reload(sys)
sys.setdefaultencoding('utf-8')
helpMessage ="... |
test_acse.py | """Unit tests for ACSE"""
from datetime import datetime
import logging
import queue
import select
import socket
from struct import pack, unpack
import sys
import time
import threading
import pytest
from pynetdicom import (
AE, VerificationPresentationContexts, PYNETDICOM_IMPLEMENTATION_UID,
PYNETDICOM_IMPLEM... |
webcamvideostream.py | # import the necessary packages
from threading import Thread
import cv2
class WebcamVideoStream:
def __init__(self, src=0):
# initialize the video camera stream and read the first frame
# from the stream
self.stream = cv2.VideoCapture(src)
(self.grabbed, self.frame) = self.stream.r... |
test_creator.py | from __future__ import absolute_import, unicode_literals
import difflib
import gc
import logging
import os
import stat
import subprocess
import sys
from itertools import product
from threading import Thread
import pytest
from virtualenv.__main__ import run, run_with_catch
from virtualenv.create.creator import DEBUG_... |
__init__.py | """__init__.py
Xule is a rule processor for XBRL (X)brl r(ULE).
This is the package init file.
DOCSKIP
See https://xbrl.us/dqc-license for license information.
See https://xbrl.us/dqc-patent for patent infringement notice.
Copyright (c) 2017 - 2019 XBRL US, Inc.
Licensed under the Apache License, Version 2.0 (th... |
xla_device.py | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
Input_selector.py | from cfg import *
from hardware import adau1701 as DSP
import time
from threading import Thread
class InputSelector:
# Split register in high and low byte
_AUX_DETECT_REG = divmod(AUX_DETECT_REG, 0x100)
_RPI_DETECT_REG = divmod(RPI_DETECT_REG, 0x100)
_SPDIF_DETECT_REG = divmod(SPDIF_DETECT_REG, 0x100)... |
look_ahead_test.py | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
- LICENCE
The MIT License (MIT)
Copyright (c) 2016 Eleftherios Anagnostopoulos for Ericsson AB (EU FP7 CityPulse Project)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software... |
tasks.py | import os
import sys
import fcntl
import datetime
import json
import re
import time
import zipfile
import threading
import hashlib
import shutil
import subprocess
import pprint
import random
from invoke import task
import boto3
import botocore.exceptions
import multiprocessing
import io
import ai2thor.build
import logg... |
main.py | from inspect import getsource # Edit spleeter.separator to consume less VRAM
from math import ceil
from os import path, remove, makedirs
from queue import Queue
from shutil import rmtree # remove temporary files
from subprocess import CalledProcessError, check_output
from sys import stderr, argv, exit as sysexit
... |
model.py |
# Copyright (c) 2020, NVIDIA 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:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions ... |
lock_with.py | # lock_with.py
#
# A simple example of using a mutex lock for critical sections.
# Uses the context manager feature of Python 2.6.
import threading
x = 0 # A shared value
x_lock = threading.Lock() # A lock for synchronizing access to x
COUNT = 1000000
def foo():
global x
for i in xr... |
mysql_test.py | #!/usr/bin/env python
# Lint as: python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import contextlib
import logging
import os
import threading
import unittest
from unittest import mock
import uuid
import warnings... |
bot.py | # coding=utf-8
# Copyright 2008, Sean B. Palmer, inamidst.com
# Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
# Copyright 2012-2015, Elsie Powell, http://embolalia.com
# Copyright 2019, Florian Strzelecki <florian.strzelecki@gmail.com>
#
# Licensed under the Eiffel Forum License 2.
from __future__ import abs... |
msg.py | from utlis.rank import setrank ,isrank ,remrank ,setsudos ,remsudos ,setsudo,IDrank,GPranks
from utlis.send import send_msg, BYusers, sendM,Glang
from handlers.delete import delete
from utlis.tg import Bot, Ckuser
from handlers.ranks import ranks
from handlers.locks import locks
from handlers.gpcmd import gpcmd
... |
audio.py | import socket
import pyaudio
import threading
class AudioClient:
def __init__(self, host, port, audio_format=pyaudio.paInt16, channels=1, rate=44100, frame_chunk=4096):
self.__host = host
self.__port = port
self.__audio_format = audio_format
self.__channels = channels
self.... |
bios_console.py | #!/usr/bin/env python
import os
import pty
import threading
import argparse
import subprocess
import shutil
from litex.tools.litex_term import LiteXTerm
from rowhammer_tester.scripts.utils import RemoteClient, litex_server
def pty2crossover(m, stop):
while not stop.is_set():
r = os.read(m, 1)
w... |
tests.py | # Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import copy
import io
import os
import pickle
import re
import shutil
import tempfile
import threading
import time
import unittest
from unittest import mock
from django.conf import settings
from django.core import manageme... |
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... |
cluster_log_agent.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
#
# Licensed under the GNU General Public License, version 3 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://jxs... |
gazepoint.py | """timeflux.nodes.gazepoint: Gazepoint driver"""
from timeflux.core.node import Node
from timeflux.helpers.clock import now
from threading import Thread, Lock
from time import sleep, perf_counter
import socket
import re
class Gazepoint(Node):
"""Gazepoint eye tracker driver.
Attributes:
o (Port): De... |
execute_sql.py | # -*- coding: UTF-8 -*-
import re
import traceback
import simplejson as json
import time
from threading import Thread
from django.db import connection
from django.utils import timezone
from sql.utils.group import auth_group_users
from common.config import SysConfig
from sql.utils.dao import Dao
from common.utils.co... |
vbox.py | import re
import socket
import sys
from time import sleep, time
from xmlrpclib import ServerProxy
from threading import Thread
from Queue import Full
from util.procs import ProcessManager
from virtdev import VirtualDevice
CMD = r'/usr/bin/VBoxManage'
EXEDIR = r'c:\remote\bin'
USER = 'logger'
KEY = r'c:\remote\keys\v... |
I2TCP_server.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: i2cy(i2cy@outlook.com)
# Filename: I2TCP_server
# Created on: 2021/1/11
import socket
import threading
import time
import sys
import uuid
from hashlib import md5
VERSION = "1.1"
class logger: # Logger
def __init__(self, filename=None, line_end="lf",
... |
netconf.py | from .base import (
Connector as BaseConnector,
Session as BaseSession,
)
from goldstone.lib.errors import Error
import libyang
import logging
import threading
from pathlib import Path
from ncclient import manager
from ncclient.xml_ import *
from lxml import etree
from pyang import repository
from pyang imp... |
utils.py | import collections
import json
import logging
from threading import Thread
import requests
from tensorflow.python.keras.layers import Dense, Concatenate, add
from .activations import *
from .layers import *
from .sequence import *
try:
from packaging.version import parse
except ImportError:
from pip._vendor.... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import threading
import traceback
import asyncore
import weakref
import platform
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.