source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
cache-rtsp.py | import multiprocessing
import time
import av
import cv2
import threading
import numpy as np
import os
from fractions import Fraction # Fraction(分子,分母)
class Cache_frame(object):
"""
设定地址于self.address\n
可选择"pyav"或"opencv"解码在self.encoding_tool
"""
def __init__(self):
self.... |
test_mongo_core.py | """Testing the MongoDB core of cachier."""
from __future__ import print_function
import sys
import datetime
from datetime import timedelta
from random import random
from time import sleep
import threading
try:
import queue
except ImportError: # python 2
import Queue as queue
import pytest
import pymongo
impo... |
driver_util.py | """Scripts for drivers of Galaxy functional tests."""
import fcntl
import logging
import os
import random
import shutil
import signal
import socket
import string
import struct
import subprocess
import sys
import tempfile
import threading
import time
import nose.config
import nose.core
import nose.loader
import nose.p... |
Audio.py |
import threading
import traceback
import pyaudio
import sys
import numpy
import Globals
class Audio:
def __init__(self,device_index=-1,samplerate=44100,gain=1,channels=1,samples=2**10):
self.pya = pyaudio.PyAudio()
self.device_index = device_index
self.samplerate = samplerate
self... |
train.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
from pytorch_pretrained_bert import BertConfig
import distributed
from models import data_loader, model_builder
from models.data_loader i... |
4_content_attributes2.py | import nltk
nltk.download('stopwords')
from nltk.corpus import stopwords
from multiprocessing import Process
from empath import Empath
import pandas as pd
import numpy as np
import textblob
import spacy
import time
import csv
import re
stopWords = set(stopwords.words('english'))
nlp = spacy.load('en_core_web_lg')
pro... |
test_functional.py | import errno
import logging
import multiprocessing
import os
import signal
import socket
import string
import subprocess
import sys
import time
import unittest
from waitress import server
from waitress.compat import httplib, tobytes
from waitress.utilities import cleanup_unix_socket
dn = os.path.dirname
here = dn(__fi... |
aqualogic_mqtt_old.py | """
This is the main program for the Aqualogic inteface. It is meant to run as a
systemd daemon. It can also be used stand-alone from the command line.
An example systemd.service file is included and can be used to start and stop
the service.
This program starts the following multiprocessing threads:
- PoolCntl T... |
destroy.py | from core.config import Settings
from core.providers.aws import BaseAction
from core.terraform import PyTerraform
from core import constants as K
from time import sleep
from threading import Thread
from datetime import datetime
import importlib
import sys
class Destroy(BaseAction):
"""
AWS provider for destro... |
MegaMind_engine_anonymous.py | import threading
import struct
import json
#from Session import Session
#from Session import Extension
from bcolors import bcolors
#from Sandbox import Sandbox
#from Sandbox import Sandbox_pool
from time import sleep
import os
from mypipe import MyPipe
#port_start_speech = consts.PortNumber_start_speech_2
#port_end_sp... |
Tag_Unused.py | import requests
import xml.etree.ElementTree as ET
import sys
import csv
import threading
import datetime
import re
import getpass
from apigen import get_key
requests.packages.urllib3.disable_warnings()
def create_new_tag(fw, key, tag):
#Create new tag
r = requests.post(f"https://{fw}/api/?type=config&action=... |
lenovo_fix.py | #!/usr/bin/env python3
import configparser
import dbus
import glob
import os
import psutil
import struct
import subprocess
import sys
from collections import defaultdict
from dbus.mainloop.glib import DBusGMainLoop
from errno import EACCES, EPERM
from mmio import MMIO, MMIOError
from multiprocessing import cpu_count
... |
test_failure_2.py | import logging
import os
import signal
import sys
import threading
import time
import numpy as np
import pytest
import ray
from ray.experimental.internal_kv import _internal_kv_get
from ray.ray_constants import DEBUG_AUTOSCALING_ERROR
import ray._private.utils
from ray.util.placement_group import placement_group
impo... |
ex2_nolock.py | import multiprocessing
# python -m timeit -s "import ex2_nolock" "ex2_nolock.run_workers()"
# 12ms
def work(value, max_count):
for n in range(max_count):
value.value += 1
def run_workers():
NBR_PROCESSES = 4
MAX_COUNT_PER_PROCESS = 1000
total_expected_count = NBR_PROCESSES * MAX_COUNT_PER_PR... |
apctrl.py | #!/usr/bin/env python2
"""
This module was made to wrap the hostapd
"""
import os
import threading
import ctypes
from roguehostapd.config.hostapdconfig import HostapdConfig
import roguehostapd.config.hostapdconfig as hostapdconfig
class KarmaData(ctypes.Structure):
"""
Handle the hostapd return mac/ssid data... |
stego-maker-gui.py | from Tkinter import *
import ttk
import pvd.pvd
import tkMessageBox
import tkFileDialog as tfd
from PIL import ImageTk, Image
import matplotlib.pyplot as plt
import pvd.bit_planes.bit_planes as pvd_bits
import numpy as np
import threading
"""
AUTHOR: Himanshu Sharma
"""
class Page(Frame):
# Page class is a ... |
receive_test.py | """FPS_receive_test.py -- receive (text, image) pairs & print FPS stats
A test program to provide FPS statistics as different imagenode algorithms are
being tested. This program receives images OR images that have been jpg
compressed, depending on the setting of the JPG option.
It computes and prints FPS statistics. ... |
test_base.py | import asyncio
import fcntl
import logging
import os
import sys
import threading
import time
import uvloop
import unittest
import weakref
from unittest import mock
from uvloop._testbase import UVTestCase, AIOTestCase
class _TestBase:
def test_close(self):
self.assertFalse(self.loop._closed)
self... |
test_smtpserver.py | # Copyright The IETF Trust 2014-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import smtpd
import threading
import asyncore
import six
import debug # pyflakes:ignore
class AsyncCoreLoopThread(object):
def w... |
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... |
views.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import torch
CUDA_LAUNCH_BLOCKING = "1"
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0,1,2,3"
import multiprocessing
import random
from threading import Thread
import botocore
from django.contrib impor... |
led.py | #!/usr/bin/env python3
import led, sys, threading
def run(use_curses=False):
player = led.Player.Player()
t1 = threading.Thread(target=player.run_and_exit)
target = None if use_curses else led.Keyboard.keyboard
t2 = threading.Thread(target=target, args=(player.keyboard,))
t1.start()
t2.start()... |
ChatClient.py | #!/usr/bin/python3
import socket
import threading
import tkinter
BUFSIZ=1024
host='127.0.0.1'
port=19787
def recv_message(sock):
while True:
try:
message=sock.recv(BUFSIZ).decode()
message_box.insert(tkinter.END, message)
#for auto-scroll
message_box.select_... |
suspend_resume.py | # Copyright 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Suspend and resume device with given cycles.
Description
-----------
Suspends and resumes the device an adjustable number of times for
adjustable ran... |
channel.py | #
# Copyright (C) 2019-2020 Intel Corporation. All Rights Reserved.
#
#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, co... |
pre_commit_linter.py | # coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
test_timer.py | import concurrent.futures
import json
import multiprocessing
import os
from pathlib import Path
import tempfile
import threading
import time
from typing import List, Tuple
import unittest
from waterfalls import Timer
class TestTimer(unittest.TestCase):
"""
Tests the `waterfalls.Timer` module.
"""
de... |
EWSO365.py | import random
import string
from typing import Dict
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import sys
import traceback
import json
import os
import hashlib
from datetime import timedelta
from io import StringIO
import logging
import warnings
import email
fr... |
test_lock.py | """
Copyright (c) 2008-2020, Jesus Cea Avion <jcea@jcea.es>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of... |
test_thread.py | from __future__ import print_function
import datetime
import threading
import time
import caffi.ca as ca
def setup_module(module):
# create explicitly a preemptive enabled context
# so that it can attached in other threads
status = ca.create_context(True)
assert status == ca.ECA.NORMAL
global ctx
... |
instance.py | import abc
import asyncio
import asyncio.subprocess
import functools
import logging
import math
import os
import random
import re
import select
import shutil
import socket
import string
import subprocess
import time
from typing import Optional
import yaml
from threading import Thread
__all__ = (
'TarantoolInstan... |
protocol.py | """
The RPyC protocol
"""
import sys
import weakref
import itertools
import socket
import time
import gc
from threading import Lock, RLock, Event, Thread
from rpyc.lib.compat import pickle, next, is_py3k, maxint, select_error
from rpyc.lib.colls import WeakValueDict, RefCountingColl
from rpyc.core import consts, brine... |
plugin.py | # Copyright (c) 2015 SONATA-NFV, 2017 5GTANGO
# 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 ... |
grid.py | import pygame
import math, random, scipy, numpy, Queue, threading, logging, os
from numpy import linalg
from objects import map
from decimal import *
from Queue import Queue
from threading import Thread
module_logger = logging.getLogger('App.Grid')
#Return grid with tiles
class Grid(object):
def __init__(self,sur... |
compare_num_layer_haar_multiprocessing_sgd.py | import qiskit
import numpy as np
import sys
import multiprocessing
sys.path.insert(1, '../')
import qtm.base, qtm.constant, qtm.ansatz, qtm.fubini_study, qtm.encoding
def run_haar(num_layers, num_qubits):
psi = 2*np.random.rand(2**num_qubits)-1
# Haar
thetas = np.ones(num_qubits*num_layers*5)
psi =... |
papersearch.py | # imports - core
import os, sys
import logging
import ast
import cPickle as pickle
from random import random as rand
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
import time
from numpy import array as mat, pi, cos, sin, \
arctan2 as atan2, linspace, meshgrid as mesh
from ... |
task_bulter.py | #!/usr/bin/env python
#coding:utf-8
"""
Author: --<v1ll4n>
Purpose: Manage Task
Created: 2016/12/13
"""
import time
from time import sleep
import unittest
from multiprocessing import Pipe
from threading import Thread
from pprint import pprint
from inspect import getmembers
from . import except... |
GUI.py | #Author:Huangliang
#Time:2018/5/25
import tkinter as tk
from tkinter.filedialog import *
import tkinter.messagebox
import Final_Fantasy_Driver as FFD
import demo_training as DT
import threading
window = tk.Tk()
window.title('Pedestrians Detector')
window.geometry('300x210')
def tick():
import winsound
wins... |
domino_puzzle.py | import math
import re
import typing
from operator import itemgetter
from collections import defaultdict, deque
from concurrent.futures import Future
from concurrent.futures.process import ProcessPoolExecutor
from dataclasses import dataclass
from datetime import datetime, timedelta
from functools import partial
from it... |
port_forward.py | import socket
import select
import sys
from threading import Thread
import paramiko
def handler(chan, host, port):
sock = socket.socket()
try:
sock.connect((host, port))
except Exception as e:
print("Forwarding request to %s:%d failed: %r" % (host, port, e))
return
print(
... |
web_sockets.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/server/web_sockets.py
#
# 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
# notic... |
twisterlib.py | #!/usr/bin/env python3
# vim: set syntax=python ts=4 :
#
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import contextlib
import string
import mmap
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import threading
import concurrent.fut... |
utils.py | # coding: utf-8
# This file is a part of VK4XMPP transport
# © simpleApps, 2014.
"""
Contains useful functions which used across the modules
"""
import threading
import xmpp
import urllib
from socket import error
from writer import *
isNumber = lambda obj: (not execute(int, (obj,), False) is None)
def execute(hand... |
multiprocessing_test.py | # import os
# #fork只能用于linux/unix中
# pid = os.fork()
# print("bobby")
# if pid == 0:
# print('子进程 {} ,父进程是: {}.' .format(os.getpid(), os.getppid()))
# else:
# print('我是父进程:{}.'.format(pid))
import multiprocessing
#多进程编程
import time
def get_html(n):
time.sleep(n)
print("sub_progress success")
return ... |
prefetch_iterator.py | # Copyright 2021 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
test_threaded_import.py | # This jest a variant of the very old (early 90's) file
# Demo/threads/bug.py. It simply provokes a number of threads into
# trying to zaimportuj the same module "at the same time".
# There are no pleasant failure modes -- most likely jest that Python
# complains several times about module random having no attribute
#... |
updater.py | from googaccount.helpers import get_channel
from oauth2client.contrib.django_orm import Storage
from googaccount.models import CredentialsModel
from django.utils import timezone
from datetime import datetime, timedelta
import httplib2, json
from meta.models import Meta
import time
import threading
from main.models impo... |
server.py | import traceback
import urllib.parse
from http.server import HTTPServer, BaseHTTPRequestHandler
from threading import Thread
from telegram import Bot, Message
from . import bot
class CustomHandler(BaseHTTPRequestHandler):
# noinspection PyPep8Naming
def do_GET(self):
try:
path = urllib.p... |
TGeventServer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
test_threading.py | import threading
import time
from test.fake_time_util import fake_time
import pytest
from pyinstrument import Profiler
from .util import do_nothing
def test_profiler_access_from_multiple_threads():
profiler = Profiler()
profiler.start()
thread_exception = None
def helper():
while profile... |
webserver.py | import flask
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Running!"
def run():
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
|
executorservodriver.py | import json
import os
import socket
import threading
import time
import traceback
from .base import (Protocol,
BaseProtocolPart,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
strip_server)
from ..testrunner im... |
WalletServer.py | from APNS import APNS
from Wallet import Sign
import json
import calendar
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from OpenSSL import Signing
from hashlib import md5
from flask import Flask, request, Response
import threading
#Setup Server and Database
app = Flask(__name__)
app.config[... |
routers.py | import json
import os
import sys
import time
from datetime import datetime
from multiprocessing import Process
from random import randint, choice
from flask import session, jsonify
import firebase_admin
import fitz
import pytz
from firebase_admin import credentials
from firebase_admin import firestore
from flask import... |
simple.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import os.path
from threading import Thread
import traceback
from urllib.request import urlretrieve
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLineEdit, QFormLayout
def download_file(url: str, file_name: str):
try:
... |
test_ipc.py | #!/usr/bin/env python3
# -*- mode: python -*-
# -*- 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... |
down.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@File : down.py
@Time : 2019-07-29 21:29
@Author : Empty Chan
@Contact : chen19941018@gmail.com
@Description:
@License : (C) Copyright 2016-2017, iFuture Corporation Limited.
"""
# -*- coding:utf-8 -*-
import os
import re
import sys
import t... |
inference_images.py | """
Inference images: Extract matting on images.
Example:
python inference_images.py \
--model-type mattingrefine \
--model-backbone resnet50 \
--model-backbone-scale 0.25 \
--model-refine-mode sampling \
--model-refine-sample-pixels 80000 \
--model-checkpoint "PATH... |
scheduler.py | #!/usr/bin/env python
import os
import pickle
import sys
import time
import socket
import random
from optparse import OptionParser
import threading
import subprocess
from operator import itemgetter
import logging
import signal
import getpass
import zmq
ctx = zmq.Context()
import dpark.pymesos as mesos
import dpark.py... |
basic_gpu_test.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
a3c.py | #!/usr/bin/env python
from skimage.transform import resize
from skimage.color import rgb2gray
import threading
import tensorflow as tf
import sys
import random
import numpy as np
import time
import gym
from keras import backend as K
from keras.layers import Convolution2D, Flatten, Dense
from collections import deque
fr... |
regrtest.py | #! /usr/bin/env python
"""
Usage:
python -m test.regrtest [options] [test_name1 [test_name2 ...]]
python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
If no arguments or options are provided, finds all files matching
the pattern "test_*" in the Lib/test subdirectory and runs
them in alphabeti... |
test.py | import asyncio
from pyppeteer import launch
class engine():
def __init__(self):
pass
async def start(self):
self.browser = await launch({'headless': True})
self.page = await self.browser.newPage()
async def goto(self,url):
await self.page.goto(url)
return await self.page.content()
async... |
tests.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import errno
import os
import shutil
import sys
import tempfile
import threading
import time
import unittest
from datetime import datetime, timedelta
from django.core.cache import cache
from django.core.exceptions import SuspiciousFileOperation, Suspicio... |
server.py | import sched
import threading
import time
import requests
from requests.compat import urljoin
from flask import Flask, request, abort, Response, jsonify
from flask_cors import CORS
from models import DownloadSpec, DownloadRequest
from sources_manager import SourcesManager
REQUEST_KEEPING_TIMEOUT_SEC = 60 * 60 * 12 #... |
Camera.py | #!/usr/bin/env python3
"""
Programmer: Chris Blanks
Last Edited: March 2019
Project: Automated Self-Serving System
Purpose: This script defines the Camera class. It inherits the basic attributes
of the peripheral device class, so that it can have a standard interface that
a MainApp instance can use. Also it uses Utili... |
threads.py | """Threads:
When you use time.sleep() your program cannot do anything else,
unless you use threads.
A single-thread program is like placing one finger on a line of code,
then moving to the next.
A multi-threaded program has multiple "fingers"
"""
import threading, time
def pause():
time.sleep(5)
print('Wake up... |
thumbnail_maker.py | # thumbnail_maker.py
import time
import os
import logging
from urllib.parse import urlparse
from urllib.request import urlretrieve
from queue import Queue
from threading import Thread
import PIL
from PIL import Image
FORMAT = "[%(threadName)s, %(asctime)s, %(levelname)s] %(message)s"
logging.basicConfig(filename='lo... |
mixins.py | # GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
# Copyright (c) 2018-2019 Ben Nuttall <ben@bennuttall.com>
# Copyright (c) 2016-2019 Dave Jones <dave@waveform.org.uk>
# Copyright (c) 2016 Andrew Scheller <github@loowis.durge.org>
#
# Redistribution and use in source and binary forms, with or without... |
demo.py | #!/usr/bin/python
''' Demo for depth display - for Siggraph E-Tech submission
David Dunn
Feb 2017 - created
www.qenops.com
'''
__author__ = ('David Dunn')
__version__ = '1.0'
import dDisplay as dd
import dDisplay.varifocal as vf
import dGraph as dg
import dGraph.test.test2 as test
import dGraph.ui as ui
import mult... |
qactabase.py | import copy
import datetime
import json
import os
import re
import sys
import threading
import time
import uuid
import pandas as pd
import pymongo
import requests
from qaenv import (eventmq_amqp, eventmq_ip, eventmq_password, eventmq_port,
eventmq_username, mongo_ip, mongo_uri)
from QAPUBSUB.consume... |
websockets.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 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... |
worker.py | # -*- coding:utf-8 -*-
from Queue import Queue, Empty
from threading import Thread
from os import path, makedirs
from logging import getLogger
from threading import Lock
logger = getLogger(__name__)
fail_logger = getLogger('migrate_tool.fail_file')
class Worker(object):
def __init__(self, work_dir, file_filter, ... |
test_runserver_main.py | import asyncio
import json
import os
import signal
import time
from multiprocessing import Process
from unittest import mock
import aiohttp
import pytest
from aiohttp.web import Application
from pytest_toolbox import mktree
from aiohttp_devtools.runserver import run_app, runserver
from aiohttp_devtools.runserver.conf... |
main.py | #!/usr/bin/python3
from threading import Thread
import datetime as dt
import math
import time
# functions
def thread_function(time):
btime = dt.datetime.now()
while dt.datetime.now() < btime + dt.timedelta(seconds=time):
value = math.sin(dt.datetime.now().second)
return
# main
print('Start thread fun... |
preproc_train2.py | import load_brats
import numpy as np
import pickle
import random
import itertools
import multiprocessing as mp
from argparse import ArgumentParser
from directories import *
def create_input(data, start_idx, end_idx):
z3 = start_idx[0]
x3 = start_idx[1]
y3 = start_idx[2]
z4 = data.shape[1] - end_idx... |
self.py | # -*- coding: utf-8 -*-
import PEPEN
from PEPEN.lib.curve.ttypes import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile
from bs4 import BeautifulSoup
from urllib import urlopen
import... |
helper.py | import os
import time
from collections import OrderedDict, defaultdict
from contextlib import contextmanager
from functools import wraps
from itertools import chain, combinations
from re import ASCII, MULTILINE, findall, match
from threading import Thread
from typing import (
Any,
Callable,
DefaultDict,
... |
threading_lock.py | import logging
import threading
import time
logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-10s) %(message)s')
logger = logging.getLogger(__name__)
def some_func(delay, repeat, lock):
logger.debug('started')
lock.acquire()
logger.debug('lock acquired')
for _ in range(repeat):
... |
network_scanner_without_mac.py | #-*-coding:utf8;-*-
#qpy:3
#qpy:console
import threading
import os
import socket
from datetime import datetime
import sys
import subprocess as sub
from subprocess import PIPE, run
from subprocess import check_output
class bcolors:
GREEN_IP = '\033[92m'
ENDC = '\033[0m'
WARNING_PORT = '\033[33m'
END = ... |
data_loader.py | """ Manages downloading and storing the MNIST dataset. """
# This forks processes, so we want to import it as soon as possible, when there
# is as little memory as possible being used.
from common.data_manager import cache, image_getter, imagenet
import cPickle as pickle
import gzip
import json
import logging
import... |
test_pyerrors.py | import pytest
import sys
import StringIO
from pypy.module.cpyext.state import State
from pypy.module.cpyext.pyobject import make_ref
from pypy.module.cpyext.test.test_api import BaseApiTest
from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
from rpython.rtyper.lltypesystem import rffi
class T... |
program.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
alarmcontroller.py | #!/usr/bin/python3
""" DIYHA Alarm Controller:
Manage a simple digital high or low GPIO pin.
"""
# The MIT License (MIT)
#
# Copyright (c) 2020 parttimehacker@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Soft... |
util.py | import ConfigParser
import datetime
import inspect
import os
import sys
import traceback
__all__ = []
def _write_message(kind, message):
# Get the file/line where this message was generated.
f = inspect.currentframe()
# Step out of _write_message, and then out of wrapper.
f = f.f_back.f_back
file,... |
monitored_session_test.py | # pylint: disable=g-bad-file-header
# Copyright 2016 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/LICENS... |
arrow_tests.py | # Copyright (c) 2019 Michael Vilim
#
# This file is part of the bamboo library. It is currently hosted at
# https://github.com/mvilim/bamboo
#
# 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
... |
client.py | import json
import logging
import socket
import threading
from cli_validator import port_validation, ip_validation
DEFAULT_PORT = 9090
DEFAULT_IP = "127.0.0.1"
END_MESSAGE_FLAG = "CRLF"
# Настройки логирования
logging.basicConfig(
format="%(asctime)-15s [%(levelname)s] %(funcName)s: %(message)s",
handlers=[l... |
Test_setLeds.py | ### If you dont have an led strip then use this(Test_setLeds.py) instead of setLeds.py
import threading
import socket
import select
PORT = 4444
bindsocket = socket.socket()
bindsocket.bind(('', PORT))
bindsocket.listen(5)
print("listening...")
def clientInputLoop(sock, fromaddr):
while True:
... |
test_sanity_sample.py | """
Copyright (c) 2019-2020 Intel 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 w... |
threadLifecycle.py | import threading
import time
# A very simple method for our thread to execute
def threadWorker():
# it is only at the point where the thread starts executing
# that it's state goes from 'Runnable' to a 'Running'
# state
print("My Thread has entered the 'Running' State")
# If we call the time.sleep() method ... |
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, ... |
test_cache.py | # This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... |
protocols.py | import asyncio
import collections
import dataclasses
import logging
import queue
import socketserver
import threading
import time
from typing import Any, Callable, Dict, NamedTuple, Optional, Set, Tuple, Union
from .captures import Capture, CaptureEntry
from .messages import OscBundle, OscMessage
osc_in_logger = logg... |
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 sample_factory.al... |
pranjan77contigfilter4Server.py | #!/usr/bin/env python
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, ServerError, InvalidRequestE... |
cycle_control_old.py | # -*- coding: utf-8 -*-
#----------Metadata--------------------------------
#This script is responsible for the auto cycle modus.
#
#----------Imports--------------------------------
import serial
import time
import Tools
import flap_control as flap
import threading
import temperature_limits as TempLimits
import sys,o... |
DrowinessDetection.py | import imutils
import face_recognition
import cv2
from scipy.spatial import distance as dist
import playsound
from threading import Thread
import numpy as np
import os
MIN_AER =0.30
EYE_AR_CONSEC_FRAMES =10
COUNTER = 0
ALARM_ON = False
def playAlarm(soundfile):
playsound.playsound(soundfile)
def eye_aspect_ratio(e... |
netwolf.py | import threading
import time
from udp import UDP
from cluster_manager import ClusterManager
from transfer_manager import TransferManager
ENCODING = 'utf-8'
class NetWolf:
def __init__(self, udp_listener_port, files_directory, cluster_list_address,
discovery_period, max_clients, free_ride_delay,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.