source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
mq.py | import pika
import json
import multiprocessing as mp
class MqBase(object):
def __init__(self, host, port, user, password):
self.connection = pika.BlockingConnection(pika.ConnectionParameters(host=host, port=port, credentials=pika.PlainCredentials(user, password)))
self.channel = self.connection.cha... |
monitor_slave.py | import os
import socket
import threading
import pickle
import hpbandster.core.nameserver as hpns
from importlib.machinery import SourceFileLoader
from hpbandster.optimizers import BOHB as BOHB
import multiprocessing
class Slave(object):
def __init__(self, nic_name, port, monitor, monitor_port, share_dir):
... |
snowboydecoder_arecord.py | #!/usr/bin/env python
import collections
import snowboydetect
import time
import wave
import os
import logging
import subprocess
import threading
logging.basicConfig()
logger = logging.getLogger("snowboy")
logger.setLevel(logging.INFO)
TOP_DIR = os.path.dirname(os.path.abspath(__file__))
RESOURCE_FILE = os.path.join... |
a2c_example.py | import os
import gym
from botbowl import BotBowlEnv
from torch.autograd import Variable
import torch.optim as optim
from multiprocessing import Process, Pipe
from botbowl.ai.layers import *
import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import sys
from a2c_agent impor... |
test_ssl.py | # Copyright (c) 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... |
base_camera.py | import threading
import time
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
class CameraEvent(object):
"""An Event-like class that signals all active clients when a new frame is
... |
posix.py | from __future__ import unicode_literals
import datetime
import fcntl
import os
import random
import signal
import threading
from prompt_toolkit.terminal.vt100_input import InputStream
from prompt_toolkit.utils import DummyContext, in_main_thread
from prompt_toolkit.input import Input
from .base import EventLoop, INPUT... |
postgresql.py | # Copyright (c) 2018 David Preece, All rights reserved.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTI... |
host.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... |
26_multithreading.py | import time
import threading
from threading import Thread
def sleepMe(i):
print("Thread %i will sleep." % i)
time.sleep(5)
print("Thread %i is awake" % i)
for i in range(10):
th = Thread(target=sleepMe, args=(i, ))
th.start()
print("Current Threads: %i." % threading.active_count())
|
spinner.py | import itertools
import sys
import time
import threading
class Spinner(object):
spinner_cycle = itertools.cycle(['-', '/', '|', '\\'])
def __init__(self, frequency=0.20):
self.frequency = frequency
self.stop_running = threading.Event()
self.spin_thread = threading.Thread(target=self.i... |
skyspy.py | import os
import re
import subprocess
import sys
import threading
from datetime import datetime, timedelta
from shapely.geometry import Point, Polygon
from skyutils.aircraft import Aircraft
from skyutils.logger import Logger
from skyutils.metar import Metar
from skyutils.config import get_geo_fence, get_h... |
fractal_timer.py | #!/usr/bin/env python3
"""
A tkinter gui for timing gw2 fractal runs and marathons.
Date: March 4, 2018
Author: Sean Lydon
License: BSD
Setup: Install tkinter if you don't already have it installed. If you
want progress graphing, then also install matplotlib.
Usage:
./fractal_timer.py [--state <STATE>] ... |
audio_handler.py | # Copyright (c) 2022 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... |
afhmm_sac.py | from collections import Counter, OrderedDict
import math
import pandas as pd
import numpy as np
from nilmtk.disaggregate import Disaggregator
import cvxpy as cvx
from hmmlearn import hmm
from multiprocessing import Process, Manager
class AFHMM_SAC(Disaggregator):
"""1 dimensional baseline Mean algorithm."""
d... |
msg.py | from utlis.rank import setrank ,isrank ,remrank ,setsudos ,remsudos ,setsudo,IDrank,GPranks
from utlis.send import send_msg, BYusers, sendM,Glang,GetLink
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... |
prompt.py | import sys
import threading
import time
import queue
def add_input(input_queue):
while True:
input_queue.put(sys.stdin.readline())
def foobar():
input_queue = queue.Queue()
input_thread = threading.Thread(target=add_input, args=(input_queue,))
input_thread.daemon = True
inpu... |
gdaltest_python3.py | # -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Python Library supporting GDAL/OGR Test Suite
# Author: Even Rouault, <even dot rouault at mines dash paris dot org>
#
##########################################... |
console.py | #!/usr/bin/env python3
# coding=utf-8
#
# Copyright (c) 2020 Huawei Device Co., Ltd.
# 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
#
# Unle... |
test_utilities.py | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Tests the utility module
:author: Thomas Calmant
"""
# Same version as the tested bundle
__version_info__ = (1, 0, 1)
__version__ = ".".join(str(x) for x in __version_info__)
# Documentation strings format
__docformat__ = "restructuredtext en"
# ------------... |
test_command.py | # -*- coding: utf-8 -*-
"""
Testing command specific API
Command is a type of ConnectionObserver.
Testing ConnectionObserver API conformance of Command is done
inside test_connection_observer.py (as parametrized tests).
- call as function (synchronous)
- call as future (asynchronous)
"""
__author__ = 'Grzegorz Latu... |
scope_download_threaded.py | import requests
import warnings
import json
from threading import Thread
from Queue import Queue
requests.adapters.DEFAULT_RETRIES = 10
warnings.filterwarnings("ignore")
token = raw_input("Please enter your Synack Auth Header (Command from web console: sessionStorage.getItem('shared-session-com.synack.accessToken')): ... |
port scanner.py | import socket
import threading
from queue import Queue
target= "127.0.0.1" #Write the ip address of target you want to scan
queue=Queue()
open_ports=[]
def portscan(port):
try:
sock =socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((target, port))
return True
except:... |
novel_360dxs.py | import html
import re
import threading
from novel import AbstractNovel
class Dxs(AbstractNovel):
"""
360dxs.com class, deal with url such as:
http://qitawenku.360dxs.com/book_3037.html
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.chapter_links =... |
tess.py | #-*- encoding: utf-8 -*-
'''
Created on Apr 5, 2015
This is the OCR Engine file
@author: jiang
'''
import os
import locale
import ctypes
import threading
from PyQt4 import QtCore
from libs import tesstool
class TessMgr(QtCore.QObject):
def __init__(self,parent = None):
QtCore.QObject.__init__(self)
... |
pacman.py | import logging
import os
import re
from threading import Thread
from typing import List, Set, Tuple, Dict, Iterable, Optional
from colorama import Fore
from bauh.commons import system
from bauh.commons.system import run_cmd, new_subprocess, new_root_subprocess, SystemProcess, SimpleProcess
from bauh.commons.util impo... |
cropping.py | import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import scipy
from sklearn.cluster import KMeans, DBSCAN
from sklearn import metrics
import pandas as pd
import random
import matplotlib.image as mpimg
import os
from multiprocessing import Process
import multiprocessing as mp
import concurrent.fut... |
queue_push.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2022/3/8 5:21 下午
# @File : queue_push.py
# @author : Akaya
# @Software: PyCharm
# queue_push :
import queue
import threading
import cv2 as cv
import subprocess as sp
class Live(object):
def __init__(self):
self.frame_queue = queue.Queue()
... |
video_dumper.py | import cv2
import time
#import h5py
import os
import errno
import re
import numpy as np
import shutil
from threading import Thread
from Queue import Queue
import rospy
SAVE_DIR = "/home/nvidia/match_recordings/"
SET_NAME = "depth_feed"
class VideoDumper:
'''
The VideoDumper is a vision processor class that
... |
tab3_engine.py | import wx
import shell_util as exec_cmd
import multiprocessing
import time
import os
import subprocess
from subprocess import call
import images as img
import time
from wx.lib.pubsub import setuparg1
from wx.lib.pubsub import pub as Publisher
import threading
from threading import Thread
import signal
import ctypes
""... |
test_api.py | import mock
import re
import socket
import threading
import time
import warnings
from unittest import TestCase
import pytest
from tests.test_tracer import get_dummy_tracer
from ddtrace.api import API, Response
from ddtrace.compat import iteritems, httplib, PY3
from ddtrace.vendor.six.moves import BaseHTTPServer, soc... |
main.pyw | import time
from playsound import playsound
import tkinter
import tkinter.ttk
import threading
import tkinter.messagebox
'''
#Colors
224, 232, 235 blue light / solitude
#e0e8eb
6, 161, 146 blue like green / persian green
#06a192
225, 161, 159 beige like / Shilo
#e1a19f
31, 42, 51 dark blue / Black pearl
#1f2a33
'''... |
graph.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. 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... |
pytest_plugin.py | import os
import threading
import pytest
from .snmp_server import SNMPServer
@pytest.fixture
def snmpserver():
host = os.environ.get("PYTEST_SNMPSERVER_HOST")
port = os.environ.get("PYTEST_SNMPSERVER_PORT")
if port:
port = int(port)
if not host:
host = SNMPServer.DEFAULT_LISTEN_HOST
... |
http.py | import socket
from threading import Thread
status = {
200: "200 OK",
404: "404 NOT FOUND",
401: "401 Unauthorized"
}
def mkHeader(header):
return f"\n\r{header}\n\r"
class HTTPServer(object):
def __init__(self,callback, ip="0.0.0.0", port=8088):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... |
b_bot.py | import reposter
import botmemory
import simplevk
import getpass
import threading
import requests
app_id = botmemory.app_id
my_id = botmemory.my_id
access_token = botmemory.access_token
v = botmemory.api_version
#chatting = botmemory.chatting
reposting = botmemory.reposting
vk = simplevk.vk()
vk.a... |
load_aggregate_stats.py | import src.constants
import numpy as np
from datetime import timedelta, date, datetime
import src.mongoDBI
import src.utils
import src.aggregate_buffer as aggregate_buffer
from multiprocessing import Process
import src.week_util as week_util
import math
import src.constants as constants
import src.mongoDBI as mongoDBI... |
scone_enclave_manager.py | #!/usr/bin/env python3
# Copyright 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... |
flask_camera.py | import logging
import platform
import sys
import threading
import time
import os
import cv2
import numpy as np
from flask import Flask, render_template, Response
SW_VERSION = 'ver-1.0.1'
IP_ADDRESS = os.environ['DEVICE_IP']
PORT_NUMBER = os.environ.get('PORT_NUMBER', '1234')
TOPIC_INFERENCE = "aws/inference"
MSG_ERRO... |
find_missing_archivelogs.py | #!/usr/bin/env python
# Corey Brune - March 2017
# Description:
# Adapted from Tad Martin's bash script
#
# Requirements
# pip install docopt delphixpy
# The below doc follows the POSIX compliant standards and allows us to use
# this doc to also define our arguments for the script.
"""Description
Usage:
find_missing... |
autoreload.py | # -*- coding: utf-8 -*-
#
# Copyright (C)2006-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consis... |
client.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... |
containers.py | ##############################################################################
# Copyright (c) 2017 Huawei Technologies Co.,Ltd.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is avai... |
a3c_train.py | # -*- coding: utf-8 -*-
import pdb
import tensorflow as tf
import threading
import numpy as np
import random
import os
import time
from networks.qa_planner_network import QAPlannerNetwork
from networks.free_space_network import FreeSpaceNetwork
from networks.end_to_end_baseline_network import EndToEndBaselineNetwork
... |
visualizer.py | import sys
from PyQt5.QtWidgets import QApplication, QLabel, QMainWindow, QHBoxLayout, QVBoxLayout, QSizePolicy, QWidget
from PyQt5.QtCore import QThread, pyqtSignal, Qt, pyqtSlot, QSize, QRect
from PyQt5.QtGui import QImage, QPixmap
import cv2
import threading
import numpy
# Subclass QMainWindow to customise your app... |
rabbit.py | # -*- coding: utf-8 -*-
"""
Created on 21 August 2017
@author: dgrossman
"""
import logging
import threading
import time
from functools import partial
import pika
class Rabbit(object):
'''
Base Class for RabbitMQ
'''
def __init__(self):
self.logger = logging.getLogger('rabbit')
def make... |
train.py | #!/usr/bin/env python3
# Copyright 2019-2020 Mobvoi AI Lab, Beijing, China (author: Fangjun Kuang)
# Apache 2.0
import logging
import os
import sys
import warnings
from multiprocessing import Process
# disable warnings when loading tensorboard
warnings.simplefilter(action='ignore', category=FutureWarning)
import num... |
Zeeshan.py | #!/usr/bin/python
# coding=utf-8
# (ZeDD) RedDemons
# Source : Python2 Gerak"
# DARK-FB version1.7
#Import module
import os,sys,time,datetime,random,hashlib,re,threading,json,getpass,urllib,cookielib
from multiprocessing.pool import ThreadPool
try:
import mechanize
except ImportError:
os.system("pip2 install mechani... |
service_streamer.py | # coding=utf-8
# Created by Meteorix at 2019/7/13
import logging
import multiprocessing
import os
import threading
import time
import uuid
import weakref
import pickle
from queue import Queue, Empty
from typing import List
from redis import Redis
from .managed_model import ManagedModel
TIMEOUT = 1
TIME_SLEEP = 0.001... |
manager.py | import logging
import threading
import traceback
from collections import OrderedDict
from django.core.mail import mail_admins
from orchestra.utils import db
from orchestra.utils.python import import_class, OrderedSet
from . import settings, Operation
from .backends import ServiceBackend
from .helpers import send_rep... |
executors.py | import threading
import queue
from abc import abstractmethod
from nets import *
class TGExecutor:
def __init__(self, base, max_workers):
self.base = base
self.q = queue.SimpleQueue()
self.threads = [threading.Thread(target=self._work) for _ in range(max_workers)]
def start(self):
... |
datasets.py | # Dataset utils and dataloaders
import glob
import logging
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
import torch.nn.functional ... |
__init__.py | #!/usr/bin/python3
# @todo logging
# @todo extra options for url like , verify=False etc.
# @todo enable https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl as option?
# @todo option for interval day/6 hour/etc
# @todo on change detected, config for calling some API
# @todo fetch title into json
# https://di... |
executor.py | """
Driver of the test execution framework.
"""
from __future__ import absolute_import
import threading
from . import fixtures
from . import hooks as _hooks
from . import job as _job
from . import report as _report
from . import testcases
from .. import config as _config
from .. import errors
from .. import logging
... |
ebay-watcher.py | import requests
from bs4 import BeautifulSoup as soup
import random
import datetime
from threading import Thread
from log import log as log
def read_from_txt(path):
'''
(str) -> list of str
Loads up all sites from the sitelist.txt file in the root directory.
Returns the sites as a list
... |
socket_handler.py | import asyncio
import json
import threading
import websocket
from client import ClientObject
class SocketHandler:
def __init__(self, client: ClientObject, socket_url, socket_trace=False):
"""
Build the websocket connection.
client: client that owns the websocket connection.
"""
... |
rclient.py | import socket
import threading
import time
import errno
import sys
DEBUG = False
simhook=[None]
class SocketRobot:
def __init__(self,host):
self.done = False
self.address = (host, 9080)
self.receive_thread = threading.Thread(target=self.receive_loop)
self.receive_thread.start()
... |
decorator.py | # Copyright (c) 2016 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 applic... |
FlappyBird - Windows [3.0.5].py | '''
FlappyBird Version 2.9.3 on Windows
Game for python3.5 [Windows]
A similar game to FlappyBird on Windows
For kick the bird you can use 'spacebar' or 'left mouse button'
By using 'p' you pause and resume the game and by using
'F3' you activate and deactivate development mode (you can not
die and there are rectangul... |
store.py | import json
from threading import Thread
import uuid
from collections import defaultdict
from typing import Callable
from copy import deepcopy
from inspect import signature
from pathlib import Path
from threading import Lock
from typing import Union
from dictdiffer import diff
from tzlocal import get_localzone
from n... |
multiprocessing_simulations.py | from multiprocessing import Process
from sirepo_bluesky import SirepoBluesky
import hashlib
import time
# use the "Youngs Double Slit Experiment" example simulation
sim_id = '87XJ4oEb'
sb = SirepoBluesky('http://10.10.10.10:8000')
sb.auth('srw', sim_id)
def run(sim):
print('running sim {}'.format(sim.sim_id))
... |
test_state.py | import logging
import os
import textwrap
import threading
import time
import pytest
import salt.loader
import salt.utils.atomicfile
import salt.utils.files
import salt.utils.path
import salt.utils.platform
import salt.utils.stringutils
log = logging.getLogger(__name__)
pytestmark = [
pytest.mark.windows_whiteli... |
search_forking_manual_pool.py | import multiprocessing
import time
from autofocus import AFSample
def search_hash(hash):
print("Searching for {}".format(hash))
query = {
"operator": "all",
"children": [
{
"field": "sample.sha256",
"operator": "is",
"value": None ... |
tuner.py | import os
import shutil
import subprocess
import sys
# import tempfile
# import importlib
import random
import string
import json
from functools import partial
from multiprocessing import Pipe, Pool, Process
from pathlib import Path
from tqdm import tqdm
import numpy as np
def read_file(filename):
""" return ... |
NeteaseDownloader.py | import json
import os
import requests
from tkinter import *
from tkinter.filedialog import askdirectory
from tkinter import messagebox
import webbrowser
from base_logger import getLogger
from lrc_module import Lrc
import threading
import time
import psutil
from urllib import parse
import multiprocessing
import platform... |
OSC.py | #!/usr/bin/python
"""
This module contains an OpenSoundControl implementation (in Pure Python), based (somewhat) on the
good old 'SimpleOSC' implementation by Daniel Holth & Clinton McChesney.
This implementation is intended to still be 'Simple' to the user, but much more complete
(with OSCServer & OSCClient classes)... |
multiprocess_example.py | '''
Requires paramiko >=1.8.0 (paramiko had an issue with multiprocessing prior
to this)
Example code showing how to use netmiko for multiprocessing. Create a
separate process for each ssh connection. Each subprocess executes a
'show version' command on the remote device. Use a multiprocessing.queue to
pass data fr... |
multi_cam.py | #---------------------------------
# @time : 2018-11-03
# @Author : Wison
# @Description : Package the multi cams as one file
# @last_modification: 2018-11-03
#---------------------------------
import runcam1, runcam2, runcam3, runcam4
import rospy
import threading
def main():
rospy.ini... |
test_server.py | try:
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
except:
from http.server import BaseHTTPRequestHandler, HTTPServer
import os
import sys
import threading
CONTENT_TYPES = {
'.htm': 'text/html',
'.html': 'text/html',
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.js': 'application/javas... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
from threading import Thread
import time
import traceback
import csv
from decimal import Decimal
from electrum_twist.twist import COIN
from electrum_twist.plugins import BasePlugin, hook
from electrum_twist.i18n import _
from electrum_twist.util i... |
fetcher.py | from __future__ import division
import logging
from time import time, sleep
from datetime import datetime, timedelta
from threading import Thread
from multiprocessing import Process
import os
# @modified 20191115 - Branch #3262: py3
# from os import kill, getpid
from os import kill
import traceback
import re
from sys i... |
test_forward.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... |
ctfd.py | #!/usr/bin/env python2
from halo import Halo
from cloudscraper import create_scraper
from threading import Thread, Lock
from requests import session
from argparse import Namespace, ArgumentParser
from bs4 import BeautifulSoup
from shutil import make_archive
import logging as log
import requests, json
import sys, os
imp... |
grpc_comm_manager.py | import logging
import os
import pickle
import threading
from concurrent import futures
from typing import List
import grpc
from ..gRPC import grpc_comm_manager_pb2_grpc, grpc_comm_manager_pb2
lock = threading.Lock()
from ...communication.base_com_manager import BaseCommunicationManager
from ...communication.message... |
test_ratelimiter.py | # Copyright 2013 Arnaud Porterie
#
# 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 writing... |
batcher.py | #Most of this file is copied form https://github.com/abisee/pointer-generator/blob/master/batcher.py
import Queue
import time
from random import shuffle
from threading import Thread
import numpy as np
import tensorflow as tf
import config
import data
import random
random.seed(1234)
class Example(object):
def _... |
Start.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import ctypes
import hashlib
import multiprocessing
import os
import random
import signal
import socket
import stat
import sys
import threading
import time
import tkinter as tk
from datetime import datetime, timedelta, date
from winreg import O... |
video_recording.py | # script for video recording
from pypylon import pylon
from imageio import get_writer
from datetime import datetime
from threading import Thread
import os, platform, cv2
class multi_video_recording_start:
def __init__(self, cams, video_format = "FFMPEG", video_codec="h264",
writing_mode="... |
accurate_landing.py | from oled import TrackerOled
from color_tracker import ColorTracker
import cv2
from threading import Thread
tracker_oled = TrackerOled()
color_tracker = ColorTracker()
def write_fps():
tracker_oled.writeTextCenter("FPS: {:.2f}".format(color_tracker.fps.fps()))
tracker_oled.writeTextCenter("READY")
while True:
... |
multi_threading.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
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('t... |
lisp-itr.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... |
framework.py | #!/usr/bin/env python
from __future__ import print_function
import gc
import sys
import os
import select
import unittest
import tempfile
import time
import faulthandler
import random
import copy
import psutil
import platform
from collections import deque
from threading import Thread, Event
from inspect import getdoc, ... |
send_mail.py | import csv
import smtplib
import threading
import time
from kivy.app import App
from .prepare_message import PrepMessage
from queue import Queue
from smtplib import SMTPRecipientsRefused
from mailer.mailing_exceptions import FromError, SubjectError, ToError
class Mailer:
def __init__(self):
self.queue_siz... |
ft5406.py | import glob
import io
import os
import errno
import struct
from collections import namedtuple
import threading
import time
import select
import queue
TOUCH_X = 0
TOUCH_Y = 1
TouchEvent = namedtuple('TouchEvent', ('timestamp', 'type', 'code', 'value'))
EV_SYN = 0
EV_ABS = 3
ABS_X = 0
ABS_Y = 1
ABS_MT_SLOT = 0x2f # ... |
1_0_threading_lock.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Time : 2021-4-6
@Author : EvilRecluse
@Contact : https://github.com/RecluseXU
@Desc :
原始锁是一个在锁定时不属于特定线程的同步基元组件。
在Python中,它是能用的最低级的同步基元组件,由 _thread 扩展模块直接实现。
原始锁处于 "锁定" 或者 "非锁定" 两种状态之一。它被创建时为非锁定状态。
它有两个基本方法, acquire()请求锁 和 release()释放锁,方法执行都是原子性的
cla... |
test_dag_serialization.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... |
supervisor.py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
chrome_test_server_spawner.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A "Test Server Spawner" that handles killing/stopping per-test test servers.
It's used to accept requests from the device to spawn and kill instances of ... |
__main__.py | import ast
import curio
import code
import inspect
import sys
import types
import warnings
import threading
import signal
import os
assert (sys.version_info.major >= 3 and sys.version_info.minor >= 8), "console requires Python 3.8+"
class CurioIOInteractiveConsole(code.InteractiveConsole):
def __init__(self, loc... |
train.py | import sys
import os
import threading
import torch
from torch.autograd import Variable
import torch.utils.data
from lr_scheduler import *
import numpy
from AverageMeter import *
from loss_function import *
import datasets
import balancedsampler
import networks
from my_args import args
def train():
torch.manua... |
soft_robot.py | #!/usr/bin/env python
# coding=utf-8
# The exlaination is here:
# http://docs.ros.org/kinetic/api/moveit_tutorials/html/doc/move_group_python_interface/move_group_python_interface_tutorial.html
import sys
import copy
import rospy
import logging
import geometry_msgs.msg
from std_msgs.msg import String
im... |
3-github-repo-info.py | import time
import multiprocessing
import requests
from github import REPOS, ACCESS_TOKEN
def grab_data_from_queue():
while not q.empty():
repo_url = q.get()
response = requests.get(repo_url, params={'access_token': ACCESS_TOKEN}).json()
repo_info = {
'name': response['name'],
... |
__main__.py | import ast
import curio
import curio.monitor
import code
import inspect
import sys
import types
import warnings
import threading
import signal
import os
assert (sys.version_info.major >= 3 and sys.version_info.minor >= 8), "console requires Python 3.8+"
class CurioIOInteractiveConsole(code.InteractiveConsole):
d... |
model_ensemble.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import threading
import random
import tensorflow as tf
import torch
import torchvision as tv
import numpy as np
import skeleton
from architectures.resnet import ResNet9, ResNet18
# add ensemble test class
from skeleton.projects import LogicModel... |
ircthread.py | #!/usr/bin/env python
# Copyright(C) 2011-2016 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, m... |
command.py | #!/usr/bin/env python3
import logging
import os
import re
import subprocess
import threading
import datetime
from optparse import OptionParser
ignore_patterns = {
'consul': lambda v: re.search(r'-(alpha|beta|rc|)|\+ent', v),
'flutter': lambda v: re.search(r'-dev|pre', v),
'golang': lambda v: re.search(r'... |
test_thread.py | """
Copyright (c) 2008-2017, 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... |
queuetest-gui-class.py | # GUI that displays data produced and queued by worker threads (class-based)
import threading, queue, time
from tkinter.scrolledtext import ScrolledText # or PP4E.Gui.Tour.scrolledtext
class ThreadGui(ScrolledText):
threadsPerClick = 4
def __init__(self, parent=None):
ScrolledText.__init__(self... |
multi_process_runner.py | # Lint as: python3
# Copyright 2019 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 ... |
categorize.py | import time
import requests
import urllib
import os
import sys
import mysql.connector
from mysql.connector import errorcode
from bs4 import BeautifulSoup
from bs4 import element
from threading import Thread
# The following 4 lines are necessary until our modules are public
import inspect
currentdir = os.path.dirname(o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.