source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
custom_loop.py | import asyncio
import logging
# Logging setup
import threading
import time
from concurrent.futures import ThreadPoolExecutor
class AsyncioLoggingFilter(logging.Filter):
def filter(self, record):
task = asyncio.Task.current_task()
record.task = f'[task {id(task)}]' if task else '[NOLOOP ... |
test_client.py | import http.client
import pytest
import responses
import ssl
import sys
import threading
import time
import urllib.error
import urllib.parse
import urllib.request
from contextlib import contextmanager
from requests.models import Response
from unittest import mock
from cumulusci.core.exceptions import SalesforceCreden... |
table.py | import threading
import Queue
from gamblers.simple_bettor import simple_bettor
from gamblers.double_bettor import double_bettor
from gamblers.dAlembert import dAlembert
def table(args):
'''
Simple table for gamblers
'''
pool = []
queue = Queue.Queue()
player_results = []
players_at_table ... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
mysql_test.py | #!/usr/bin/env python
from __future__ import unicode_literals
import logging
import os
import random
import string
import threading
import unittest
from builtins import range # pylint: disable=redefined-builtin
import MySQLdb # TODO(hanuszczak): This should be imported conditionally.
import unittest
from grr_respo... |
houndify.py | ##############################################################################
# Copyright 2017 SoundHound, Incorporated. All rights reserved.
##############################################################################
import base64
import hashlib
import hmac
import http.client
import json
import threading
import t... |
scheduler_job.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
#... |
create_cell_mask.py | import pickle
import tempfile
import time
from multiprocessing import Process, Queue
from queue import Empty
from typing import Sequence
import blosc
import cv2
import fire
import hpacellseg.cellsegmentator as cellsegmentator
import numpy as np
import skimage
import torch
import torch.nn.functional as F
from hpacellse... |
mixer.py | import threading
import traceback
import subprocess
import socket
import time
from . import base
import math
class Mixer(base.Object):
def __init__(self, name, gain=1.0):
self.name = name
self.gain = self.calc_gain(gain)
self.in_ports = []
self.in_ports.append("%s:in_left" % self.n... |
main.py | import curses
import random
import argparse
import time
import threading
import sys
# ---------------------------------------
# Initialize Variables and Strings
# ---------------------------------------
# Dropping Speed
SPEED = [1, 0.8 ,0.6 ,0.4, 0.2, 0.1, 0.07, 0.05, 0.03, 0.01]
def init():
global obstacles... |
gui.py | from tkinter import *
from timeit import default_timer as timer
from tkinter import messagebox
import threading
import copy
from sudokucsp import SudokuCSP
# if you want to verify that my csp.py does a better job just change
# from csp import ... to from original import ... , original is the csp.py file from ... |
lease.py | """
Sync lease util
"""
import sys
import threading
import time
from ..errors import ErrLeaseNotFound
from ..utils import log
from ..utils import retry
class Lease(object):
def __init__(self, client, ttl, ID=0, new=True):
"""
:type client: BaseClient
:param client: client instance of etcd... |
collect_data_files.py | #!/usr/bin/env python
import getopt
import sys
import os
import time
from threading import Thread
from datetime import datetime
sys.path.extend(('.', 'lib'))
from lib.remote.remote_util import RemoteMachineShellConnection
from lib.membase.api.rest_client import RestConnection
import TestInput
def usage(error=None):
... |
data_flow.py | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
import threading
try:
# Python 2
import Queue as queue
except Exception:
# Python 3
import queue
from . import utils
class DataFlow(object):
""" Data Flow.
Base class for using real t... |
use_deep_guidance_arm.py | """
This script loads in a trained policy neural network and uses it for inference.
Typically this script will be executed on the Nvidia Jetson TX2 board during an
experiment in the Spacecraft Robotics and Control Laboratory at Carleton
University.
Script created: June 12, 2019
@author: Kirk (khovell@gmail.com)
"""
... |
AlarmCheck.py | import threading
import time
import AlarmStorage
# import LedController
class AlarmCheck(object):
""" Threading example class
The run() method will be started and it will run in the background
until the application exits.
"""
def __init__(self, interval=30):
""" Constructor
:type ... |
puppyplaydate.py | # This performs the under-the-hood logic for puppyplaydate using btpeer
from btpeer import *
import json
# PuppyPlaydate message types
GETPEERS="GPER"
GETREPL="GREP"
ADDFRIEND = "ADDF"
MEET = "MEET"
MEETREPLY = "MREP"
QUERY = "QUER"
QRESP = "QRES"
# Underlying required message types
INFO = "INFO"
LISTPEERS = "LIST"
... |
AudioReaderVS.py | import fnmatch
import os
import random
import re
import threading
import librosa
import numpy as np
import tensorflow as tf
import soundfile as sf
FILE_PATTERN = r'p([0-9]+)_([0-9]+)\.wav'
def get_category_cardinality(files):
id_reg_expression = re.compile(FILE_PATTERN)
min_id = None
max_id = None
fo... |
player.py | """
The MIT License (MIT)
Copyright (c) 2021 xXSergeyXx
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, modify, merge, p... |
fpms.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python3
"""
FPMS
~~~~
Front Panel Menu System
"""
import getopt
import os
import os.path
import random
import signal
import socket
import subprocess
import sys
import termios
import threading
import time
import tty
from gpiozero import Button as GPIO_Button
from gpiozero impor... |
Task.py | #
# Task.py -- Basic command pattern and thread pool implementation.
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from __future__ import absolute_import, print_function
from . import six
from .six.moves import map, zip
import sys
import time
import os
... |
Update_xl_thread.py | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 7 15:53:26 2018
@author: Vadim Shkaberda
"""
from db_connect_sql import DBConnect
from log_error import writelog
from os import path
from pyodbc import Error as SQLError
from send_mail import send_mail
from xl import copy_file, update_file
import sharepoint
import sys
i... |
exec_cmd.py | # coding=utf-8
import logging
import os
import subprocess
import threading
logger = logging.getLogger(__name__)
def run(call_args, call_back, call_back_args):
(cwd, ignored) = os.path.split(call_args[0])
try:
logger.info("Running %r in %s." % (call_args, cwd))
subprocess.check_call(call_args, cwd=cwd)... |
dnsdumpster.py | import re
import threading
import requests
import hashlib
import urllib
class DNSDUMPSTER:
COOKIES = {'csrftoken' : ''}
DATA = {'csrfmiddlewaretoken' : '', 'targettip': ''}
SERVICE = "DNSDumpster"
LOCK = threading.Semaphore(value=1)
URL = "https://dnsdumpster.com"
REGEXP = "([a-z0-9]+[.])+%s"
TIMEOUT = 10
RES... |
memory.py | import os
import sys
import time
import psutil
import resource
import threading
import platform
from dpark.utils.log import get_logger
logger = get_logger(__name__)
ERROR_TASK_OOM = 3
class MemoryChecker(object):
""" value in MBytes
only used in mesos task
start early
"""
def __init__(... |
test_multiprocessing.py | # Owner(s): ["module: multiprocessing"]
import contextlib
import gc
import os
import sys
import time
import unittest
import copy
from sys import platform
import torch
import torch.cuda
import torch.multiprocessing as mp
import torch.utils.hooks
from torch.nn import Parameter
from torch.testing._internal.common_utils ... |
test_request.py | import threading
import asyncio
import aiohttp_jinja2
from urllib import request
from aiohttp.test_utils import unittest_run_loop
from ddtrace.pin import Pin
from ddtrace.contrib.aiohttp.patch import patch, unpatch
from ddtrace.contrib.aiohttp.middlewares import trace_app
from .utils import TraceTestCase
from ... im... |
sippingmethods.py | #!/usr/bin/env python
from glob import glob
from subprocess import call
from threading import Thread
from Bio.Sequencing.Applications import *
from accessoryfunctions.accessoryFunctions import *
from accessoryfunctions.metadataprinter import *
from .bowtie import *
from io import StringIO
__author__ = 'adamkoziol'
cl... |
th_main.py | """ Это реализация парсинга, в которой загрузка в базу данных делается отдельным тредом.
Выигрыш во времени на удаленной БД - примерно 40%
Пробовал и параллелить сам парсинг с помощью тред пула - выигрыша во времени нет
"""
import logging
import threading
from main import upload_batch, get_filenames, startdir, XlsIter... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum.bitcoin import TYPE_ADDRESS
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.paymentrequest import InvoiceStore
from electr... |
__init__.py | # Copyright 2018 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... |
server.py | # Adafruit BNO055 WebGL Example
#
# Requires the flask web framework to be installed. See http://flask.pocoo.org/
# for installation instructions, however on a Linux machine like the Raspberry
# Pi or BeagleBone black you can likely install it by running:
# sudo apt-get update
# sudo apt-get install python3-fl... |
hello.py | from flask import Flask, render_template, session, redirect, url_for, flash
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager, Shell
from flask_moment import Moment
from flask_mail import Mail, Message
from fl... |
transport.py | import websocket
import json
import time
import threading
import logging
logger = logging.getLogger(__name__)
class TimeoutException(Exception):
pass
class Timeout(object):
def __init__(self, seconds=1, error_message='Timeout'):
self.seconds = seconds
self.error_message = error_message
... |
day12_04.py | ##히스토그램
#엠보싱 샤프닝등의 처리기법
from statistics import median
from tkinter import *
import os.path ;import math
from tkinter.filedialog import *
from tkinter.simpledialog import *
import matplotlib.pyplot as plt
## 함수 선언부
def loadImage(fname) :
global window, canvas, paper, filename, inImage, outImage, inW, inH,... |
base.py | import base64
import hashlib
import io
import json
import os
import threading
import traceback
import socket
import sys
from abc import ABCMeta, abstractmethod
from six import text_type
from six.moves.http_client import HTTPConnection
from six.moves.urllib.parse import urljoin, urlsplit, urlunsplit
from ..testrunner i... |
common.py | import inspect
import json
import os
import random
import subprocess
import ssl
import time
import requests
import ast
import paramiko
import rancher
import pytest
from urllib.parse import urlparse
from rancher import ApiError
from lib.aws import AmazonWebServices
from copy import deepcopy
from threading import Lock
fr... |
read.py | #!/usr/bin/python3
# coding: utf-8
import os, sys, stat
import random
import threading
import multiprocessing
import subprocess
import streams.transcribe
import queue
import select
import time,datetime
from fcntl import fcntl, F_GETFL, F_SETFL, ioctl
import cv2
import numpy as np
import re
import select
import setp... |
server.py | from config import *
if multiple_process:
from gevent import monkey
monkey.patch_all()
import re
import os
import cv2
import time
import json
import base64
import shutil
import datetime
import threading
import numpy as np
from bottle import route, run, static_file, request, BaseRequest, resp... |
test-zip.py | #!/usr/bin/env python3
import sys
from multiprocessing import Process, Queue
from pathlib import Path
from zipfile import ZipFile
def test_proc(dir_path, queue):
while True:
zip_path = queue.get()
if zip_path is None:
queue.put(None)
break
rel_path = zip_path.rel... |
sensor.py | #!/usr/bin/env python2
"""
Copyright (c) 2014-2019 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function # Requires: Python >= 2.6
import sys
sys.dont_write_bytecode = True
import core.versioncheck
import inspect
import... |
main.py | from __future__ import print_function
import argparse
import os
import torch
import torch.multiprocessing as mp
import my_optim
from envs import create_atari_env
from model import ActorCritic
from test import test
from train import train
# Based on
# https://github.com/pytorch/examples/tree/master/mnist_hogwild
# T... |
manager.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2020 Fetch.AI Limited
#
# 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 ... |
tempmon.py | #!/usr/bin/env python3
import influxdb
import math
import os
import queue
import re
import sys
import threading
import time
import traceback
import settings
class Writer:
def __init__(self):
self.client = influxdb.InfluxDBClient(**settings.INFLUXDB_CONNECT, timeout=30, retries=1)
self.queue = qu... |
__color_picker.py | import random
import subprocess
import threading
from tkinter import END, Entry, Label, Tk
# list of possible colour.
colours = [
"Red",
"Blue",
"Green",
"Pink",
"Black",
"Yellow",
"Orange",
"White",
"Purple",
"Brown",
]
score = 0
# To take in account the time left: initially ... |
netmiko_threading_queuing.py | #!/usr/bin/python3
# This method will spin up threads and process IP addresses in a queue
# Importing Netmiko modules
from netmiko import Netmiko
from netmiko.ssh_exception import NetMikoAuthenticationException, NetMikoTimeoutException
# Additional modules imported for getting password, pretty print
from getpass imp... |
plotting.py | """Pyvista plotting module."""
import collections
import logging
import os
import time
from threading import Thread
import imageio
import numpy as np
import scooby
import vtk
from vtk.util import numpy_support as VN
from vtk.util.numpy_support import numpy_to_vtk, vtk_to_numpy
import warnings
import pyvista
from pyv... |
uwsgidecorators.py | from functools import partial
import sys
from threading import Thread
try:
import cPickle as pickle
except:
import pickle
import uwsgi
if uwsgi.masterpid() == 0:
raise Exception(
"you have to enable the uWSGI master process to use this module")
spooler_functions = {}
mule_functions = {}
postfork... |
camera.py | """
camera.py
Camera.py é resposável por fazer a ativação da câmera através de threads. Através dela, outras classes e métodos conseguem
instanciá-la quando necessário para captura de imagens ou até mesmo fazer capturas ininterruptas até que a thread seja finalizada.
"""
from threading import Thread
import cv2
class... |
webserver.py | #!/usr/bin/python
""" webserver.py - Flask based web server to handle all legal requests.
Copyright (C) 2019 Basler AG
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import http
def set_led(red... |
TFTPListener.py | import logging
import os
import sys
import threading
import SocketServer
import socket
import struct
import urllib
from . import *
EXT_FILE_RESPONSE = {
'.html': 'FakeNet.html',
'.png' : 'FakeNet.png',
'.ico' : 'FakeNet.ico',
'.jpeg': 'FakeNet.jpg',
'.exe' : 'FakeNetMini.exe',
'.pdf' : 'Fak... |
scylla_node.py | # ccm node
from __future__ import with_statement
from datetime import datetime
import errno
import os
import signal
import shutil
import socket
import stat
import subprocess
import time
import threading
from distutils.version import LooseVersion
import psutil
import yaml
import glob
import re
from ccmlib.common impo... |
environment.py | # Copyright 2018 Tensorforce Team. 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 la... |
process.py | """System process utilities module."""
import time
import psutil
import warnings
import subprocess
import platform
import threading
import functools
from .timing import get_sleeper, exponential_interval
from testplan.common.utils.logger import TESTPLAN_LOGGER
def _log_proc(msg, warn=False, output=None):
if out... |
decorators.py | from threading import Thread
def async(f):
def wrapper(*args, **kwargs):
thr = Thread(target=f, args=args, kwargs=kwargs)
thr.start()
return wrapper |
app.py | #
# This file is:
# Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com>
#
# MIT License
#
import os
from electroncash_gui.ios_native.monkeypatches import MonkeyPatches
from electroncash.util import set_verbosity
from electroncash_gui.ios_native import ElectrumGui
from electroncash_gui.ios_native.utils import... |
websocket.py | from pdb import set_trace as T
import numpy as np
from signal import signal, SIGINT
import sys, os, json, pickle, time
import threading
from twisted.internet import reactor
from twisted.internet.task import LoopingCall
from twisted.python import log
from twisted.web.server import Site
from twisted.web.static import F... |
runner.py | from __future__ import print_function
__true_print = print
import argparse
import datetime
import docker
import json
import multiprocessing.pool
import numpy
import os
import psutil
import requests
import sys
import threading
import time
def print(*args, **kwargs):
__true_print(*args, **kwargs)
sys.stdout.flu... |
nbzz_run.py | import inspect
import yaml
from pathlib import Path
import threading
import os
try:
from tqdm import tqdm
except:
try:
os.system('pip3 install tqdm')
except:
print("tqdm install error ")
exit(1)
from tqdm import tqdm
# store builtin print
old_print = print
def new_print(*a... |
backend.py | import atexit
import time
import sys
from threading import Thread
from abc import abstractmethod
from collections import deque
from typing import Union
from tmtccmd.config.definitions import CoreServiceList, CoreModeList
from tmtccmd.tm.definitions import TmTypes
from tmtccmd.tm.handler import TmHandler
from tmtccmd.u... |
views.py | import datetime
import logging
import re
import threading
from typing import Optional, List
import pytz
import simplejson as json
from django.contrib.auth.decorators import login_required
from laboratory.decorators import group_required
from django.core.exceptions import ValidationError
from django.db import transacti... |
streamlabs.py | import logging
import threading
import socketio
from pajbot.managers.handler import HandlerManager
from pajbot.managers.db import DBManager
from pajbot.models.user import User
from currency_converter import CurrencyConverter
log = logging.getLogger(__name__)
class StreamLabsNameSpace(socketio.ClientNamespace):
... |
verifier.py | from csv import DictWriter
import os
import datetime
import sys
import time
import threading
import traceback
from rdflib.compare import isomorphic
from rdflib import Graph
from bagit import Bag
from .constants import EXT_BINARY_EXTERNAL
from .iterators import FcrepoWalker, LocalWalker
from .resources import FedoraRes... |
test_util.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... |
utilities.py | from src.sources import *
from scrapy.crawler import CrawlerRunner
from multiprocessing import Process
from twisted.internet import reactor
def run_spider(spider,source_information):
def f():
runner = CrawlerRunner()
deferred = runner.crawl(spider,source_information = source_information)
... |
PublisherManager.py | from RabbitPublisher import RabbitPublisher
from printer import console_out
import threading
class PublisherManager:
def __init__(self, broker_manager, test_number, actor, publisher_count, in_flight_max, print_mod):
self.broker_manager = broker_manager
self.test_number = test_number
self.pu... |
session.py | import os
import platform
import queue
import threading
import time
from datetime import datetime
from dataclasses import dataclass
from enum import Enum, auto
from typing import Callable
from typing import Optional, Dict
import warnings
import ray
from ray.train.constants import (
DETAILED_AUTOFILLED_KEYS, TIME_T... |
lasthopold.py | import os
import json
import math
import urllib.request, urllib.error, urllib.parse
import requests
import multiprocessing
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from shared.set_username import SetUsername
from shared.config import Config
def go():
LastHop.run()
... |
clonesrv2.py | """
Clone server Model Two
Author: Min RK <benjaminrk@gmail.com>
"""
import random
import threading
import time
import zmq
from kvsimple import KVMsg
from zhelpers import zpipe
def main():
# Prepare our context and publisher socket
ctx = zmq.Context()
publisher = ctx.socket(zmq.PUB)
publisher.bind("... |
python3-54.py | #Communicating with processes
#Real time communications with processes
#Even on other machines
#Imports
import logging
import time
import multiprocessing
from multiprocessing import process
from multiprocessing.context import Process
from multiprocessing.connection import Listener, Client
logging.basicConfig(format='... |
tftp.py | # import click
from socket import AF_INET, SOCK_DGRAM, socket
from struct import unpack, pack
from threading import Thread
from zipfile import ZipFile
import io
import os
from piman import logger
"""
This code is modified following Prof. Reed suggestion
"""
"""
The TFTPServer class encapsulates the methods required... |
test_describe_collection.py | import pytest
import logging
import time
from utils import *
from constants import *
uid = "describe_collection"
class TestDescribeCollection:
@pytest.fixture(
scope="function",
params=gen_single_filter_fields()
)
def get_filter_field(self, request):
yield request.param
@pyt... |
test_full_system.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import time
import uuid
import os
from unittest import mock
from parlai.mturk.core.socket_manager import... |
proxier.py | import atexit
from concurrent import futures
from dataclasses import dataclass
import grpc
import logging
from itertools import chain
import json
import psutil
import socket
import sys
from threading import Lock, Thread, RLock
import time
import traceback
from typing import Any, Callable, Dict, List, Optional, Tuple
i... |
client.py | #!/usr/bin/python2
import argparse
from Crypto.Cipher import AES
import fcntl
import os
import pty
import sctp
import socket
import ssl
import sys
fro... |
rest_conn.py | # Copyright 2020 Richard Koshak
#
# 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... |
SafeProcess_test.py | #!/usr/bin/env python
"""
SafeProcess_test.py
Alexander Hiam
An example to demonstrate the use of the SafeProcess library
for PyBBIO.
This example program is in the public domain.
"""
from bbio import *
from bbio.libraries.SafeProcess import *
def foo():
while(True):
print "foo"
delay(1000)
def set... |
echotext.py | # echotext Version 1.1 by Neil Flodin
#
# A simply widget that uses predictive text analysis to provide
# user customized predictive text input, similar to that seen now
# on many smartphones.
#
# The text of the MIT license is below.
#
#
# Copyright (c) 2015 Neil Flodin <neil@neilflodin.com>
#
# Permission is h... |
getsniffer.py | import socket
import os
import threading
import binascii
from lib.udp_sender.udp_sender import udp_sender
outputfilename = ""
probemaster = []
pack = []
output_tuple = []
output = []
probehelplist = []
helpdata=[]
def getsniffer(host, args):
if args.noise != None:
noise = args.noise
if args.output:
... |
server.py | from __future__ import absolute_import
from prometheus_client import start_http_server, Gauge, Counter, Histogram, Summary
import redis
import json
import logging
import sys
if sys.version_info < (3, 0):
from subprocess32 import call
else:
from subprocess import call
import psutil
from .schema import validate_s... |
lab3.py |
import time, os
from threading import Thread, current_thread
from multiprocessing import Process, current_process, Pool
import sys
COUNT = 200000000
SLEEP = 10
def io_bound(sec):
pid = os.getpid()
threadName = current_thread().name
processName = current_process().name
#print(f"{pid} *... |
_UIAHandler.py | #_UIAHandler.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2011-2018 NV Access Limited, Joseph Lee, Babbage B.V.
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
from ctypes import *
from ctypes.wintypes import *
import comtypes.client
from comtyp... |
webhook.py | # coding=utf8
"""
webhook.py - Sopel GitHub Module
Copyright 2015 Max Gurela
_______ __ __ __ __
| __|__| |_| |--.--.--.| |--.
| | | | _| | | || _ |
|_______|__|____|__|__|_____||_____|
________ __ __ __
| | | |.-----.| |--.| |--.-----.-----.| |--.-... |
shell_objects.py | #!/usr/bin/env python
# Copyright (c) 2006-2007 Open Source Applications Foundation
# Copyright (c) 2008-2009 Mikeal Rogers <mikeal.rogers@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 a copy o... |
build_image_data.py | #!/usr/bin/python
# 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 requ... |
lauetoolsneuralnetwork.py | # -*- coding: utf-8 -*-
"""
Created on June 18 06:54:04 2021
GUI routine for Laue neural network training and prediction
@author: Ravi raj purohit PURUSHOTTAM RAJ PUROHIT (purushot@esrf.fr)
@guide: jean-Sebastien MICHA (micha@esrf.fr)
Credits:
Lattice and symmetry routines are extracted and adapted from the ... |
parallel_sampler.py | """Author: Brandon Trabucco, Copyright 2019"""
import threading
import numpy as np
from mineral.core.samplers.sampler import Sampler
from mineral.core.samplers.path_sampler import PathSampler
class ParallelSampler(Sampler):
def __init__(
self,
*args,
num_threads=4,
... |
__init__.py | '''
sphinx is an example of a package plug-in to both GUI menu and command line/web service
that compiles a Sphinx Rules file into an XBRL Formula Linkbase either to be saved or to
be directly executed by Arelle XBRL Formula processing.
This plug-in is a python package, and can be loaded by referencing the containing
... |
test_browser.py | # coding=utf-8
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import argparse
import json
import multiprocessing
imp... |
tasks.py | #!/usr/bin/env python
"""
Copyright 2016-Present Couchbase, Inc.
Use of this software is governed by the Business Source License included in
the file licenses/BSL-Couchbase.txt. As of the Change Date specified in that
file, in accordance with the Business Source License, use of this software will
be governed by the ... |
sql_isolation_testcase.py | """
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... |
run-tests.py | #!/usr/bin/env python
#
# 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 "Li... |
test_streaming.py | import asyncio
import copy
import multiprocessing
import os
import time
from datetime import datetime
from functools import partial
from typing import Dict
import pytest
from jina import Document, DocumentArray
from jina.clients import Client
from jina.helper import random_port
from jina.parsers import set_gateway_pa... |
twarc_videos.py | import os
import sys
import json
import time
import click
import logging
import youtube_dl
import multiprocessing as mp
from urllib.parse import urlparse
from twarc import ensure_flattened
from datetime import datetime, timedelta
from youtube_dl.utils import match_filter_func
@click.command()
@click.option('--max-dow... |
libra.py | #Main file, defining Libra, socket select server to accept requests
#It must be optimized, this is naive
import select, queue, math
import socket, sys, random, client
import threading, reques
import time
counter = 1
weight = 0
class Libra:
def __init__(self):
self._redirects = []
self.outputs = []
self.... |
cpu_indicator.pyw | import time
from threading import Thread
import pystray
from PIL import Image, ImageDraw, ImageFont
from psutil import cpu_percent
class Indicator:
# changeable variables
REFRESH_INTERVAL = 0.5
FONT_SIZE = 200
ICON_RES = 250, 250
FONT = ImageFont.truetype('arial.ttf', FONT_SIZE)
BLUE_BG = Im... |
task.py | from core.function import *
from core.sa import *
from core.tools import *
import threading
import time
def AsynListAll(worker=1):
"""ListAll 获取指定文件夹下的所有子文件夹以及相关文件
Args:
service ([type]): 服务账号信息
"""
assert worker > 0, "工作线程必须大于0"
status_with_exit = [False] * worker
lock = threading.Lo... |
shell.py | # Copyright 2019 Barefoot Networks, 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... |
MultiTaskchat.py | # -*- coding:utf-8 -*-
# 多任务版udp聊天器(一)
"""
说明:
1. 编写一个有2个线程的程序
2. 线程1用来接收数据然后显示.
3. 线程2用来检测键盘数据然后通过udp发送数据.
要求:
- 总结多任务程序的特点.
改进思路:
1. 单独开子线程用于接收消息,以达到收发消息可以同时进行.
2. 接收消息要能够连续接收多次,而不是一次.
3. 设置子线程守护主线程(解决无法正常退出问题)
"""
# 开辟子线程,实现发送消息的同时接收消息.
import socket
import time
import threading
def send_msg(udpsocket):
"... |
edit.py |
from utlis.rank import setrank ,isrank ,remrank ,setsudos ,remsudos ,setsudo
from handlers.delete import delete
from utlis.tg import Bot
from config import *
import threading, requests, time, random
def edit(client, message,redis):
userID = message.from_user.id
chatID = message.chat.id
rank = isrank(redi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.