source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
07_py_thread_dead_lock.py | """ py thread dead lock """
import threading
import time
counter1 = 2
counter2 = 4
counter1_lock = threading.Lock()
counter2_lock = threading.Lock()
def task_one() -> None:
""" task one """
global counter1
global counter2
with counter1_lock:
time.sleep(1)
with counter2_lock:
... |
parrot.py | """The Parrot testing server."""
import gc
import logging
import select
import socket
from socketserver import TCPServer, ThreadingMixIn, BaseRequestHandler
import struct
from struct import pack, unpack
import threading
import time
from pynetdicom.transport import AssociationServer
LOGGER = logging.getLogger("pynet... |
app.py | import json
import logging
import os
from queue import Queue
from threading import Thread
import requests
import tweepy
from textblob import TextBlob
from textblob.sentiments import NaiveBayesAnalyzer
BEARER = os.environ.get('BEARER', None)
API_KEY = os.environ.get('API_KEY', None)
API_SECRET = os.environ.get('API_SE... |
test_106_shutdown.py | #
# mod-h2 test suite
# check HTTP/2 timeout behaviour
#
import time
from threading import Thread
import pytest
from .env import H2Conf, H2TestEnv
from pyhttpd.result import ExecResult
@pytest.mark.skipif(condition=H2TestEnv.is_unsupported, reason="mod_http2 not supported here")
class TestShutdown:
@pytest.fix... |
subfinder_thread.py | # -*- coding: utf8 -*-
""" SubFinder的多线程版本
"""
from .subfinder import SubFinder
from queue import Queue
from threading import Thread, Lock
class Pool(object):
"""线程池"""
def __init__(self, size):
self.size = size
self.queue = Queue(maxsize=size)
self.threads = [Thread(target=self._ru... |
stream.py | # modified from pyimagesearch
import sys
import numpy as np
import cv2
import time
from threading import Thread
if sys.version_info >= (3, 0):
from queue import Queue
else:
from Queue import Queue
class Stream(object):
def __init__(self, video_path, queue_size):
self.video_stream = cv2.VideoCaptu... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
sparse_conditional_accumulator_test.py | # Copyright 2015 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... |
_cli.py | import base64
import json
import logging
import sys
import threading
import time
import typing as tp
import click
import click_log
import nomad
logger = logging.getLogger(__name__)
click_log.basic_config(logger)
def main() -> None:
try:
root(standalone_mode=False)
except click.ClickException as e:
... |
process.py | import subprocess
import datetime
import uuid
from pathlib import Path
from threading import Thread
from typing import Optional, Iterable
from fornax.logger import console_logger, main_logger
from ..command import Command
from .exceptions import ProcessExecException
class Process:
def __init__(self, command: Com... |
DiscordPhone.py | #!/usr/bin/env python3
# -*- coding: latin-1 -*-
import os
import sys
import time
import discord
import asyncio
import logging
import ctypes
import socket
import ctypes.util
from os import environ as env
from dotenv import load_dotenv
from softphone.Softphone import Softphone
from .Audio import AudioCB
from .Asteri... |
twisted_test.py | # Author: Ovidiu Predescu
# Date: July 2011
#
# 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 ... |
test_utils.py | """Utilities shared by tests."""
zaimportuj collections
zaimportuj contextlib
zaimportuj io
zaimportuj logging
zaimportuj os
zaimportuj re
zaimportuj socket
zaimportuj socketserver
zaimportuj sys
zaimportuj tempfile
zaimportuj threading
zaimportuj time
zaimportuj unittest
z unittest zaimportuj mock
z http.server zaim... |
profile_context.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... |
plugin.py | import threading
from binascii import hexlify, unhexlify
from electrum_ltc.util import bfh, bh2u
from electrum_ltc.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT, is_segwit_address)
from electrum_ltc import constants
from electrum_ltc.i18n import ... |
deauth.py | #!/usr/bin/env python3
import logging
import sys
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
import socket
from subprocess import call
from threading import Thread
from time import sleep
# local imports
from src import printings
from src.scan import WifiScan
conf.verb = 0
RED ... |
speedtest_cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2015 Matt Martz
# 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.or... |
text_client.py | # Copyright 2017 Mycroft AI 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 writin... |
util.py | #
# Copyright (C) 2012-2017 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
from collections import deque
import contextlib
import csv
from glob import iglob as std_iglob
import io
import json
import logging
import os
import py_compile
import re
import socket
try:
import ssl... |
http.py | import sys
import os
import re
import traceback
import requests
import socket
import threadutils
import urllib
import mimetypes
import plexobjects
from xml.etree import ElementTree
import asyncadapter
import callback
import util
codes = requests.codes
status_codes = requests.status_codes._codes
DEFAULT_TIMEOUT = ... |
piface_websocket.py | #! /usr/bin/env python3
import time
import asyncio
import threading
from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory
import pifacedigitalio
# initialisiere PiFace
pfd = pifacedigitalio.PiFaceDigital()
# globale Variable zur Speicherung der aktuellen Lauflicht-Geschwindigkeit
a... |
beacon.py | # encoding=utf-8
from flask import Flask,render_template,request,jsonify
from util import util
import threading
import json
app = Flask(__name__)
@app.route('/')
def guide_page():
datas = util.read_guide()
return render_template("index.html",datas = datas,page="blocks/guide.html")
@app.route('/script')
def ... |
__init__.py | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2022, Johannes Köster"
__email__ = "johannes.koester@uni-due.de"
__license__ = "MIT"
from abc import abstractmethod
import os
import sys
import contextlib
import time
import datetime
import json
import textwrap
import stat
import shutil
import shlex
import thre... |
schedulers.py | import logging
import socket
import threading
import json
from datetime import date
from datetime import datetime
from apscheduler.schedulers.background import BackgroundScheduler
import dateutil.parser
logger = logging.getLogger()
DEFAULT_PORT = 1033
DEFAULT_ADDR = "127.0.0.1"
MSG_MAX_LENGTH = 1024
DEBUG = False
de... |
php.py | # -*- coding: utf-8 -*-
"""
:copyright: (C) 2010-2013 by Contrail Consortium.
"""
from threading import Thread
import re
import tarfile
import tempfile
import stat
import os.path
from conpaas.services.webservers.manager.config import CodeVersion, PHPServiceConfiguration
from conpaas.services.webservers.agent imp... |
gpio_addon.py | from gpiozero import DigitalOutputDevice
import time
import threading
import logging
class AddonGPIO:
def __init__(self, pin = 16, active_state = True):
self.is_active = False
self.pin = pin
self.active_state = active_state
self.device = DigitalOutputDevice(pin=pin, active_high=ac... |
networkGossipFanout.py | #!/usr/bin/env python3.7
"""
Router class is part of a dissertation work about WSNs
"""
__author__ = "Bruno Chianca Ferreira"
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Bruno Chianca Ferreira"
__email__ = "brunobcf@gmail.com"
import socket, os, math, struct, sys, json, traceback, zlib, fcntl, threadi... |
listener.py | import socket
import common.constants as c
import common.settings as settings
import json
import threading
import select
from common.game import game
import sys
from client.sender import send_join_request, send_leave_request
from client.game_engine import progress_game
processed_UDP = {} # id: 1
def start_client():... |
runtests.py | #!/usr/bin/env python
from __future__ import print_function
import atexit
import base64
import os
import sys
import re
import gc
import heapq
import locale
import shutil
import time
import unittest
import doctest
import operator
import subprocess
import tempfile
import traceback
import warnings
import zlib
import glo... |
modified_pyhop.py | """
Pyhop, version 1.2.1 -- a simple SHOP-like planner written in Python.
Author: Dana S. Nau, 15 February 2013
Copyright 2013 Dana S. Nau - http://www.cs.umd.edu/~nau
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You ... |
redis.py | import os
import sys
import threading
from typing import Optional
import boto3
import redis
import ujson as json
from asgiref.sync import sync_to_async
from redis.client import Redis
from consoleme.config import config
from consoleme.lib.plugins import get_plugin_by_name
if config.get("redis.use_redislite"):
imp... |
06多线程.py | # 多线程
# 启动一个线程就是把一个函数传入并创建Thread实例,然后调用start()开始执行
import time, threading
# 新线程执行的代码
def loop():
print('thread %s is running ...' % threading.current_thread().name)
n = 0
while n < 5:
n = n + 1
print('thread %s >>> %s' % (threading.current_thread().name, n))
time.sleep(1)
print... |
example3.py | #!/usr/bin/env python3
import threading
import time
def worker():
print('new worker')
time.sleep(0.5)
print('end of worker')
t0 = threading.Thread(target = worker)
t1 = threading.Thread(target = worker)
t0.daemon = t1.daemon = True
print('before')
t0.start()
time.sleep(0.1)
t1.start()
print('after')
t0.join()... |
client_agent.py | #!/usr/bin/env python3
import matplotlib
import socket
import os
import ast
import struct
import random as r
import time
import datetime as dt
import subprocess as sp
import paho.mqtt.client as mqtt
import matplotlib.pyplot as plt
from drawnow import *
import smtplib
import config
import pickle
import algorithms.data_h... |
hash160randomCPU.py | '''
Made by Mizogg Look for HASH160 Compressed and Uncompressed Using iceland2k14 secp256k1 https://github.com/iceland2k14/secp256k1 fastest Python Libary
Good Luck and Happy Hunting HASH160randomCPU.py Version 1 scan randomly in Range with CPU Speed Improvments
https://mizogg.co.uk
'''
import secp256k1 as... |
SentenceTransformer.py | import json
import logging
import os
import shutil
from collections import OrderedDict
from typing import List, Dict, Tuple, Iterable, Type, Union, Callable
from zipfile import ZipFile
import requests
import numpy as np
from numpy import ndarray
import transformers
import torch
from torch import nn, Tensor, device
from... |
network_execution.py | # Copyright 2012 the V8 project authors. 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 conditi... |
test_actions.py | # Copyright (c) 2009-2014, Christian Haintz
# 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 ... |
main.py | # Copyright (c) 2016 Nokia, 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 b... |
xss.py | #!/usr/bin/python3.5
# I don't believe in license.
# You can do whatever you want with this program.
import os
import sys
import re
import time
import copy
import base64
import random
import argparse
import subprocess
import urllib.parse
from functools import partial
from threading import Thread
from queue import Que... |
subproc_vec_env.py | import multiprocessing as mp
import sys
from collections import OrderedDict
from typing import Any, Callable, List, Optional, Sequence, Tuple, Type, Union
import gym
import numpy as np
from stable_baselines3.common.vec_env.base_vec_env import (
CloudpickleWrapper,
VecEnv,
VecEnvIndices,
VecEnvObs,
... |
test.py | import json
import logging
import random
import threading
import os
import pytest
from helpers.cluster import ClickHouseCluster, ClickHouseInstance
import helpers.client
logging.getLogger().setLevel(logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler())
# Creates S3 bucket for tests and allows anon... |
conftest.py | # SPDX-License-Identifier: MIT
import os
import threading
import ioctl.hidraw
import pytest
import uhid
def find_hidraw(device: uhid.UHIDDevice) -> ioctl.hidraw.Hidraw:
visited = set()
while True:
for node in os.listdir('/dev'):
if node in visited: # pragma: no cover
co... |
realtime_power_enf_generator.py | #Using Audacity to collect hourly ENF values
import sounddevice as sd
#import librosa
import time
import threading
import soundfile as sf
from datetime import datetime
#from threading import Timer
duration = 10
fs = 8000
x=datetime.today()
y=x.replace(day=x.day, hour=17, minute=21, second=0, microsec... |
shell.py | import os
import sys
import traceback
import threading
import core.loader
import core.colors
import core.job
import core.tick
''' Cmd is just a bad wrapper around readline with buggy input '''
class Shell(object):
def __init__(self, banner, version):
self.banner = banner
self.version = version
... |
SAC_run_v10.py | #!/usr/bin/env python3
import threading, queue
import time
import os
import shutil
import numpy as np
import math
import rospy
import tensorflow as tf
from sac_v17 import SAC
from env_v24 import Test
from manipulator_h_base_module_msgs.msg import P2PPose
MAX_EPISODES = 100000
MAX_EP_STEPS = 600
MEMORY_CAPACITY = 100... |
core.py | # -*- coding: utf-8 -*-
#
# :copyright: (c) 2020 by Pavlo Dmytrenko.
# :license: MIT, see LICENSE for more details.
"""
yaspin.yaspin
~~~~~~~~~~~~~
A lightweight terminal spinner.
"""
from __future__ import absolute_import
import contextlib
import functools
import itertools
import signal
import sys
import threading... |
test_jobs.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
#... |
export_image_from_video_all.py | import cv2
import os
import argparse
import threading
class item:
def __init__(self):
self.dataset_path = '' # 名称
self.interval = 10
self.flip180 = False
self.resize = True
self.clip = 100
self.width = 1280
self.height = 720
args = item() # 定义结构对象
args.... |
exampleSensor.py | import time
import threading
from SAN.sensorDataEntry import SensorDataEntry
class ExampleSensor(SensorDataEntry):
def __init__(self):
SensorDataEntry.__init__(self)
self._lastReading = 0
threading.Thread(target=self.loop).start()
def loop(self):
while True:
time.s... |
decision1.08.py | #!/usr/bin/env python
#-*- coding:UTF-8 -*-
import math
import pygame
import time
import multiprocessing
# from tools import create_pcd
import rospy
from sensor_msgs.msg import PointCloud2
import sensor_msgs.point_cloud2 as pc2
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
import tf
import threa... |
start.py | import os
import logging
import torch.multiprocessing as mp
import threading
from pathlib import Path
from werkzeug.exceptions import HTTPException
from waitress import serve
from flask import send_from_directory, request, current_app
from flask_compress import Compress
from mindsdb.api.http.namespaces.predictor impo... |
doRunGUI.py | import pdb
import sys
import os
import uuid
import datetime
import argparse
import configparser
import math
import multiprocessing as mp
import signal
import numpy as np
import torch
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State, AL... |
runner.py | from mail import email_sender
from price_scrapper import price_scrapper_v1
from data_saver import data_saver
import matplotlib.pyplot as plt
from threading import Thread
import datetime
import time
import argparse
class runner:
def __init__(self,url,username,password,target):
self.url = url
self.saver... |
BatchQueue.py | import queue
import threading
from time import monotonic as time
from time import sleep
class BatchQueue(queue.Queue):
"""Variant of a queue that can return a batch of objects when there is
a lull in their addition.
:lull_time How long in milliseconds for there to be no activity on the
BatchQueue be... |
chlam_gene_symbols.py | import WD_Utils
from wikidataintegrator import wdi_core, wdi_login
import threading
username = "djow2019"
password = input("Password:\n")
count = 0
sparql = WD_Utils.WDSparqlQueries()
login = wdi_login.WDLogin(user=username, pwd=password)
ref = wdi_core.WDItemID(value="Q22065557", prop_nr='P248', is_reference=True)
... |
midi_reader.py | import fnmatch
import os
import random
import re
import threading
import librosa
import numpy as np
import tensorflow as tf
from .midi_utils import midiread
FILE_PATTERN = r'p([0-9]+)_([0-9]+)\.wav'
def get_category_cardinality(files):
print("WARNING: TODO - update conditional wavenet to support MIDI I/O")
... |
control.py | try:
import os
import sys
import threading
from time import sleep
from git import Repo
from termcolor import colored
import json
import subprocess
from datetime import date
import random
import string
from shutil import copy2
from pathlib import Path
... |
health_manager.py | from template_finder import TemplateFinder
from ui import UiManager
from ui import BeltManager
from pather import Location
import cv2
import time
import keyboard
from utils.custom_mouse import mouse
from utils.misc import cut_roi, color_filter, wait
from logger import Logger
from screen import Screen
import numpy as np... |
export_d3po.py | from __future__ import absolute_import, division, print_function
import os
import json
from glue.core import Subset
DISPATCH = {}
def save_page(page, page_number, label, subset):
""" Convert a tab of a glue session into a D3PO page
:param page: Tuple of data viewers to save
:param label: Tab label
... |
serializable.py | #!/usr/bin/env python
# coding: utf-8
from Queue import Queue as Queue_Queue, Empty as Queue_Empty
from threading import Thread, Lock, current_thread, Timer, local as threading_local
from traceback import format_exc
from common import *
from sqlalchemy import MetaData, create_engine, Table, Integer, String, Column, Fl... |
lisp-core.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com>
#
# 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... |
manager.py | #!/usr/bin/env python3
import os
import time
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import datetime
import textwrap
from typing import Dict, List
from selfdrive.swaglog import cloudlog, add_logentries_handler
from common.basedir import BASEDIR, PARAMS
from common.android im... |
test_sanic.py | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2021
from __future__ import absolute_import
import time
import pytest
import requests
import multiprocessing
from instana.singletons import tracer
from ..helpers import testenv
from ..helpers import get_first_span_by_filter
from ..test_utils import _TraceCon... |
voicemail.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# messenger.py
#
# Copyright 2018 <pi@rhombus1>
#
# 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 ... |
__init__.py | import functools
import io
import logging
import mimetypes
import os
import os.path
import pathlib
import posixpath
import re
import socketserver
import string
import threading
import time
import warnings
import wsgiref.simple_server
import watchdog.events
import watchdog.observers.polling
_SCRIPT_TEMPLATE = """
var ... |
run_with_auto_port.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import cherrypy
class RootServer:
host = None
port = None
url = None
def __init__(self):
cherrypy.engine.subscribe('start', self.on_start)
@cherrypy.expose
def index(self):
return '{}:{} / {}'.format(se... |
test_threading_handler.py | import threading
import unittest
import mock
import pytest
class TestThreadingHandler(unittest.TestCase):
def _makeOne(self, *args):
from kazoo.handlers.threading import SequentialThreadingHandler
return SequentialThreadingHandler(*args)
def _getAsync(self, *args):
from kazoo.handle... |
Building-geo-distributed-apps-and-apis.py | import time
from c8 import C8Client
import pprint
import random
import threading
# Variables
service_url = "gdn1.macrometa.io" # The request will be automatically routed to closest location.
user_mail = "user@example.com"
user_password = "hidden"
collection_name = "employees" + str(random.randint(1, 10000))
stream_na... |
open_views.py | import json
import os
from .errors import ExistingProjectError, NotApprovedError, MiscErrors
import time
from threading import Thread
import psutil
from bson import json_util
from core import service
from core.settings import PostThrottle
from django.http import JsonResponse
from django.shortcuts import redirect
from ... |
__init__.py | import http.server
import json
import webbrowser
from utils import distance
from abstractions import *
def draw_map(centroids, restaurants, ratings):
"""Write a JSON file containing inputs and load a visualization.
Arguments:
centroids -- A sequence of positions
restaurants -- A sequence of restauran... |
async_utils.py | import asyncio
import json
from typing import Dict, Any
from http.server import SimpleHTTPRequestHandler, HTTPServer
from threading import Thread
from unittest import IsolatedAsyncioTestCase
import bugsnag
class AsyncIntegrationTest(IsolatedAsyncioTestCase):
async def asyncSetUp(self):
self.server = Fake... |
util.py | import os
import shutil
import sys
import ctypes
from pathlib import Path
if sys.version_info[0] < 3 or sys.version_info[1] <= 5:
print("\nPlease restart with Python 3.6+\n")
print("Current Python version:", sys.version_info)
exit(-1)
tc_core = None
def in_docker():
if os.environ.get("TI_IN_DOCKER", "") == ... |
Colo.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, 1, 12)
#expirydate = datetime.date(2021, 12, 30)
today=date.today()
def hero... |
accessories.py | #
# Copyright (c) 2021 Project CHIP 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 applica... |
global_handle.py | #!/usr/bin/python
'''
(C) Copyright 2018-2019 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 applic... |
ds18b20Pusher.py | #!/usr/bin/env python
import pika
import sys
from threading import Thread
import threading
import time
import logging
import os
w1Devices = []
rabbitMqHost = os.environ['RABBIT_MQ_HOST']
rabbitMqExchange = os.environ['RABBIT_MQ_EXCHANGE']
connection = pika.BlockingConnection
def checkDevices():
ct = threading.cu... |
callback_executor.py | # -*- coding: utf-8 -*-
import threading
from collections import namedtuple
from futuquant.common.utils import IS_PY2
if IS_PY2:
import Queue as queue
else:
import queue
CallbackItem = namedtuple('CallbackItem', ['ctx', 'proto_id', 'rsp_pb'])
class CallbackExecutor:
def __init__(self):
self._que... |
server.py | #!/usr/bin/env/python
# File name : server.py
# Production : RaspTank
# Website : www.adeept.com
# E-mail : support@adeept.com
# Author : William
# Date : 2018/08/22
import socket
import time
import threading
import move
import Adafruit_PCA9685
pwm = Adafruit_PCA9685.PCA9685()
pwm.set_pwm_freq(... |
run.py | import os
import pandas as pd
import pickle
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'
import tensorflow as tf
assert float(tf.__version__[:3]) >= 2.3
import tensorflow.lite as tflite
gpus = tf.config.experimental.list_physical_devices('GPU')
tf.config.experimental.set_me... |
clicker.py | import logging
import sys
import threading
import time
from pynput import keyboard, mouse
from pynput.mouse import Button, Controller
# TODO: add click package for arg parsing
# If these are changed, be sure to change the help text as well.
ACTIVATE_KEY = u'k'
DEACTIVATE_KEY = u'l'
DELAY = 0.0334
MOUSE_DELAY = 5
# ... |
loader.py | from Tkinter import *
from teamwork import *
from time import sleep
class BaseLoader:
def __init__(self, master):
master.wm_title("Scenario Config")
labels = ["Map Size X", "Map Size Y", "Soldiers", "Enemies", "Bases"] # Display text
fields = [] # Fields for storing entries
for i... |
object_counting_api.py | #----------------------------------------------
#--- Author : Ahmet Ozlu
#--- Mail : ahmetozlu93@gmail.com
#--- Date : 27th January 2018
#----------------------------------------------
import tensorflow as tf
import os
import csv
import cv2
import numpy as np
# from utils import visualizati... |
master.py | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... |
keypad.py | """
`keypad` - Support for scanning keys and key matrices
===========================================================
See `CircuitPython:keypad` in CircuitPython for more details.
* Author(s): Melissa LeBlanc-Williams
"""
import time
import threading
from collections import deque
import digitalio
class Event:
"... |
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 os
import pickle
import random
import re
import subprocess
import sys
import textwrap
import threading
import time
import unitt... |
http.py | from __future__ import print_function
from builtins import str
from builtins import object
import logging
import base64
import sys
import random
import string
import os
import ssl
import time
import copy
import json
import sys
import threading
from pydispatch import dispatcher
from flask import Flask, request, make_res... |
nest_helper.py | import requests
import json
import operator
import glob
import os
import threading
class nest_function:
def __init__(self,host,device_name,tts):
self.device_name = device_name
self.host=host
self.tts=tts
def snap_shot_image(self,name='now'):
response=requests.get('http://localhost:8123/api/camera_proxy/cam... |
schedule.py | import time
from multiprocessing import Process
import asyncio
import aiohttp
try:
from aiohttp.errors import ProxyConnectionError
except:
from aiohttp import ClientProxyConnectionError as ProxyConnectionError
from proxypool.db import RedisClient
from proxypool.error import ResourceDepletionError
from proxypoo... |
conftest.py | import contextlib
import os
import threading
from collections import ChainMap
from http.server import BaseHTTPRequestHandler, HTTPServer
import pytest
requests = pytest.importorskip("requests")
port = 9898
data = b"\n".join([b"some test data"] * 1000)
realfile = "http://localhost:%i/index/realfile" % port
index = b'<... |
ThreadedHTTPServer.py | import sublime
import socketserver
import subprocess
import threading
import os
import codecs
from . import global_vars
class ThreadedHTTPServer(object):
def __init__(self, handler):
self.server = socketserver.TCPServer(('', 0), handler)
self.nodeServer = None
with open(os.path.join(global_vars.PACKAGE... |
email.py | from flask_mail import Message
from app.extensions import mail
from flask import current_app
from threading import Thread
def send_async_email(app,msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body,
attachments=None,sync=False):
msg... |
hello_queue.py | import queue
import threading
import time
q = queue.Queue()
def worker():
while True:
item = q.get()
print(f'Working on {item}')
time.sleep(0.5)
print(f'Finished {item}')
q.task_done()
# turn-on the worker thread
threading.Thread(target=worker, daemon=True).start()
# se... |
__init__.py | # -*- coding: utf-8 -*-
"""
The code for the encrypted websocket connection is a modified version of the
SmartCrypto library that was modified by eclair4151.
I want to thank eclair4151 for writing the code that allows the samsungctl
library to support H and J (2014, 2015) model TV's
https://github.com/eclair4151/Smart... |
callbacks_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... |
EvaluatorWidgets.py | #Evaluation related GUITools
from .TextWidgets import *
from .FileWidgets import *
class TextEvaluator:
###This is simply a wrapper for the Evaluator class which implements the
###process loop. It will take strings and receieve strings.
def __init__(self,parent=None,variables=None,outputFile=None,newThrea... |
kraken.py | from bitfeeds.socket.restful import RESTfulApiSocket
from bitfeeds.exchange import ExchangeGateway
from bitfeeds.market import L2Depth, Trade
from bitfeeds.instrument import Instrument
from bitfeeds.util import Logger
import time
import threading
from functools import partial
from datetime import datetime
class Krake... |
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... |
bot.py | # coding=utf-8
"""
bot.py - Sopel IRC Bot
Copyright 2008, Sean B. Palmer, inamidst.com
Copyright 2012, Edward Powell, http://embolalia.net
Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
Licensed under the Eiffel Forum License 2.
http://sopel.dftba.net/
"""
import time
import imp
import os
import re
import soc... |
penv.py | from multiprocessing import Process, Pipe
import gym
def worker(conn, env):
while True:
cmd, data = conn.recv()
if cmd == "step":
obs, reward, done, info = env.step(data)
if done:
obs = env.reset()
conn.send((obs, reward, done, info))
elif... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.