source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_cache.py | #!/usr/bin/env python2
import os
import shutil
import tempfile
import time
import unittest
from Queue import Queue
from threading import Event, Thread
import genbankfs
from genbankfs import GenbankCache
def get_download_mock(download_trigger):
class DownloadMock(object):
def __init__(self, *args, **kwargs):
... |
server.py | from __future__ import absolute_import
import errno
import socket
import threading
from pwnlib.context import context
from pwnlib.log import getLogger
from pwnlib.tubes.sock import sock
from pwnlib.tubes.remote import remote
log = getLogger(__name__)
class server(sock):
r"""Creates an TCP or UDP-server to liste... |
__main__.py | import argparse
import asyncio
import logging
import logging.config
import os
import sys
import threading
from logging.handlers import RotatingFileHandler
from pathlib import Path
from typing import TYPE_CHECKING, Any, List, Optional, cast
__file__ = os.path.abspath(__file__)
if __file__.endswith((".pyc", ".pyo")):
... |
test_operator_gpu.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... |
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... |
automaton.py | import os.path
import sys
import enum
import json
import time
import random
import getpass
import logging
import threading
logging.basicConfig(format='[%(asctime)s] %(name)s: %(levelname)s: %(message)s', level=logging.INFO)
try:
import requests
except ImportError:
logging.error("Package `requests` is required.")
... |
server.py | import asyncio
import websockets
import os
import inspect
from threading import Thread
from djwebsockets.websocket import WebSocket
import djwebsockets as settings
BASE_DIR = os.path.dirname(__file__)
class WebSocketServer:
NameSpaces = {}
server_running = False
loop = None
server = None
host = N... |
server.py | # Copyright (c) 2014-2015, Heliosphere Research LLC
# 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 c... |
threadingpool.py | #!/usr/bin/env python
# encoding: utf-8
'''
@author: LoRexxar
@contact: lorexxar@gmail.com
@file: threadingpool.py
@time: 2020/4/7 14:30
@desc:
'''
import time
import threading
import traceback
from LSpider.settings import THREADPOOL_MAX_THREAD_NUM
from utils.log import logger
class ThreadPool:
"""
造一个线程池轮... |
lisp-rtr.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... |
api.py | import json
import logging
import os
import time
from threading import Thread
from typing import Callable, Dict, Optional, Union
from oauthlib.oauth2 import TokenExpiredError
from requests import Response
from requests_oauthlib import OAuth2Session
from .sseclient import SSEClient
URL_API = "https://api.home-connect... |
test_base_events.py | """Tests for base_events.py"""
import errno
import logging
import math
import os
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from asyncio import test_utils
try:
from test import support... |
serve.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import abc
import argparse
import importlib
import json
import logging
import multiprocessing
import os
import platform
import signal
import socket
import subprocess
import sys
import threading
import time
import traceback
import urllib
import uuid
from co... |
knot_identification.py | from collections import defaultdict
import multiprocessing
import numpy as np
from lfd.rapprentice import math_utils, LOG
def intersect_segs(ps_n2, q_22):
"""Takes a list of 2d nodes (ps_n2) of a piecewise linear curve and two points representing a single segment (q_22)
and returns indices into ps_n2 of in... |
listener.py | from time import sleep
from queue import Queue
from threading import Thread
from migration.migration import Migration, MigrationState
from persistence.migration import MigrationPickler
class Listener:
def __init__(self):
self.migration_pickler = MigrationPickler()
def run(self, q: Queue):
w... |
server.py | import asyncio
import os
import traceback
import warnings
from functools import partial
from inspect import isawaitable
from multiprocessing import Process
from signal import (
SIGTERM, SIGINT,
signal as signal_func,
Signals
)
from socket import (
socket,
SOL_SOCKET,
SO_REUSEADDR,
)
from time im... |
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... |
event_processor.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
MTBatchGenerator.py | import multiprocessing as mp
import logging
import pandas as pd
import numpy as np
import pysam
import pyBigWig
import random
from threading import Thread
from queue import Queue
from scipy.ndimage import gaussian_filter1d
from basepairmodels.cli.batchgenutils import *
class MTBatchGenerator:
""" MultiTask batc... |
main.py | import wx
import sys
from documents.text import TextDocument
from . import goto, preferences
from repeating_timer import RepeatingTimer
from documents.pdf import PdfDocument
from documents.word import DocxDocument
from documents.epub import EpubDocument
from documents.markdown import MarkdownDocument
from documents.htm... |
gunicorn.py | from gunicorn.app.base import BaseApplication
import multiprocessing
from lump.keypress import InteractiveTerminalHandler
from multiprocessing import Process
import psutil
import logging
import os
from lump.humanreadable import format_metric
logger = logging.getLogger(__name__)
class GunicornApplication(BaseApplicat... |
piotroski.py | #!/usr/bin/env python3
# Para a análise, são utilizados princípios do Joseph D. Piotroski
# Estipulados no livro: "Value Investing: The Use of Historical Financial Statement Information to Separate Winners from Losers"
# No estudo original de Piotroski, ao longo de 20 anos (1976–1996), uma estratégia de investimento b... |
main.py | #!/usr/bin/python3
from mcpi import minecraft
import os,sys,queue,json,time,threading
from importlib import import_module
from multiprocessing import Value
def main(mc,state):
root=os.path.dirname(os.path.abspath(__file__))+"/"
sys.path.insert(1,root)
rituals={}
altar={}
files=[os.path.splitext(i)[0] for i in... |
java_list_test.py | '''
Created on Dec 17, 2009
@author: barthelemy
'''
from __future__ import unicode_literals, absolute_import
from multiprocessing import Process
import subprocess
import time
import unittest
from py4j.compat import unicode
from py4j.java_gateway import JavaGateway
from py4j.protocol import Py4JJavaError, Py4JError
f... |
test_sys.py | import builtins
import codecs
import gc
import locale
import operator
import os
import struct
import subprocess
import sys
import sysconfig
import test.support
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, assert_python_failure
from te... |
trex_subscriber.py | #!/router/bin/python
import json
import threading
import time
import datetime
import zmq
import re
import random
import os
import signal
import traceback
import sys
from .trex_types import RC_OK, RC_ERR
#from .trex_stats import *
from ..utils.text_opts import format_num
from ..utils.zipmsg import ZippedMsg
# basic... |
test_command_signal.py | import sys
import time
import signal
import multiprocessing
import tornado
from circus.tests.support import TestCircus, EasyTestSuite, TimeoutException
from circus.tests.support import skipIf, IS_WINDOWS
from circus.client import AsyncCircusClient
from circus.stream import QueueStream, Empty
from circus.util import to... |
ptf_runner.py | #!/usr/bin/env python2
# Copyright 2013-present Barefoot Networks, Inc.
# Copyright 2018-present Open Networking Foundation
#
# 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.a... |
GUI_server.py | import threading
import socket
import time
from Tkinter import *
server = socket.socket()
server.bind(('localhost' , 63453)) # 63453
server.listen(2)
con , addr = server.accept()
root = Tk()
def send():
data_send = edit_Text.get()
con.send(data_send)
label = Label(root , text=data_send , bg="red" , fg="white"... |
login.py | import re
import time
import base64
import sys
import threading
import Api_360Yzm
from rk import *
# from multiprocessing import Pool
from selenium import webdriver
from selenium.webdriver import ActionChains
class Register:
def __init__(self):
self.rc = RClient('若快账号', '若快密码', '94468', '0a5cda0581544112... |
pod.py | """
Pod related functionalities and context info
Each pod in the openshift cluster will have a corresponding pod object
"""
import logging
import os
import re
import yaml
import tempfile
import time
import calendar
from threading import Thread
import base64
from semantic_version import Version
from ocs_ci.ocs.bucket_... |
test_subprocess.py | import unittest
from unittest import mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import warnings_helper
import subprocess
import sys
import signal
import io
import itertools
import os
import errno
import tempfile
import time
import traceback
... |
test_xmlrpc.py | import base64
import datetime
import sys
import time
import unittest
import xmlrpc.client as xmlrpclib
import xmlrpc.server
import threading
import http.client
import socket
import os
import re
from test import support
alist = [{'astring': 'foo@bar.baz.spam',
'afloat': 7283.43,
'anint': 2**20,
... |
unibot_v2.py | from uniswap import Uniswap
from binance.client import Client
import time
import logger
import sys
import threading
import pandas as pd
pub = ''
pvt = ''
ETH_ADDRESS = "0x0000000000000000000000000000000000000000"
ampl = "0xD46bA6D942050d489DBd938a2C909A5d5039A161"
weth_address = "0xc02aaa39b223fe8d0a0e5c4f27ead9083... |
test_signals.py | import os
import signal
import threading
import queue as stdlib_queue
import pytest
from .. import _core
from .._util import signal_raise
from .._signals import catch_signals, _signal_handler
from .._sync import Event
async def test_catch_signals():
print = lambda *args: None
orig = signal.getsignal(signal.S... |
benchmark.py | import random
import uuid
import timeit
import argparse
import contextlib
import threading
import statistics
from functools import partial
from pymongo import MongoClient
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from redis import Redis
from vakt import (
MemoryS... |
test_pdb.py | # A test suite for pdb; not very comprehensive at the moment.
import doctest
import os
import pdb
import sys
import types
import codecs
import unittest
import subprocess
import textwrap
import linecache
from contextlib import ExitStack
from io import StringIO
from test.support import os_helper
# This little helper cl... |
cam.py | import copy
import logging
from threading import Semaphore, Thread
import circum.endpoint
import click
logger = logging.getLogger(__name__)
tracking_semaphore = None
tracking_info = {"objects": []}
vector_info = []
updated = False
def _get_targets():
raise NotImplementedError()
return []
def _update_thr... |
locality_bdys_lambda.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# import arguments
import boto3
import gzip
import json
# import sys
import multiprocessing
import locality_bdys_display
# from botocore.config import Config
from datetime import datetime
from flask import Flask
from flask import Response
from flask_compress import Comp... |
WebBrowserMessengerPy3.py | from __future__ import absolute_import, division, print_function
import traceback
from libtbx.utils import Sorry, to_str
import threading, sys
import os.path, time
#import pathlib
#import ssl
import asyncio
import websockets
from typing import Optional
from websockets.exceptions import (
ConnectionClosed,
Connecti... |
__init__.py | # -*- coding: utf-8 -*-
'''
Set up the Salt integration test suite
'''
# Import Python libs
from __future__ import absolute_import, print_function
import os
import re
import sys
import copy
import json
import time
import stat
import errno
import signal
import shutil
import pprint
import atexit
import socket
import lo... |
eslogger.py | import logging
import threading
import uuid
from datetime import datetime
import jsonpickle as jsonpickle
from elasticsearch import Elasticsearch
class Elastic:
def __init__(self, component: str, host: str = 'localhost', port: int = 9200):
self.es = Elasticsearch(hosts=host, port=port)
self.compo... |
apt_tdc_surface_consept.py | """
This is the main script for controlling the experiment.
It contains the main control loop of experiment.
"""
import time
import datetime
import multiprocessing
from multiprocessing.queues import Queue
import threading
import numpy as np
# Serial ports and NI
import serial.tools.list_ports
import pyvisa as visa
im... |
test_bigquery_proxy.py | import unittest
import os
import json
from unittest.mock import patch
import threading
from test.support import EnvironmentVarGuard
from urllib.parse import urlparse
from http.server import BaseHTTPRequestHandler, HTTPServer
from google.cloud import bigquery
from google.auth.exceptions import DefaultCredentialsError
... |
machine_classification.py | #!/usr/bin/env pybricks-micropython
import time
from threading import Thread
import ujson
import urequests
from pybricks.ev3devices import Motor, ColorSensor, UltrasonicSensor
from pybricks.parameters import Port, Stop, Direction
from pybricks.tools import wait
# Initialize the motors
belt_motor = Motor(Port.D, Direc... |
qa_difi_blocks_cpp.py |
# pylint: disable=missing-function-docstring, no-self-use, too-many-public-methods
# pylint: disable=missing-class-docstring, no-name-in-module, no-member, too-many-lines, too-many-locals
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) Microsoft Corporation.
# Licensed under the GNU General Public Lice... |
presence_adapter.py | """Presence Detection adapter for Mozilla WebThings Gateway."""
from datetime import datetime, timedelta
from gateway_addon import Adapter, Database
import json
import os
import re
import threading
import ipaddress
from .presence_device import PresenceDevice
from .util import valid_ip, valid_mac, clamp, get_ip, ping... |
auto_trader_universal.py | """
This bot does not implement an API to actually trade (buy/sell) shares in any stock. One could utilize Alpaca API to do this.
This program assumes you have a budget of $1000 daily to invest in 5 different stocks, with $200 being allocated to each of the 5 stocks.
The bot will only purchase a stock (out of the to... |
instrument.py | """
Class that abstracts interaction with the VISA instrument.
"""
import datetime as dt
import pathlib
import threading
import time
import numpy as np
import pyvisa
from pyvisa.util import from_ascii_block
class VISAInstrument():
"""
Abstract instrument class that communicates with the VISA instrument.
... |
service_handler.py | """
Deals with the webserver and the service modules
"""
import importlib
import BaseHTTPServer
import SimpleHTTPServer
from SocketServer import ThreadingMixIn
import threading
from time import sleep
from utils import *
import json
import MySQLdb
import warnings
import base_service
import atexit
#Web server
Protocol =... |
test_gpulockmanager.py | import multiprocessing as mp
import os
import time
from pathlib import Path
import pytest
from hypertrainer.utils import GpuLockManager, PidFile
def try_acquire(q):
p = PidFile(Path('/tmp/test.lock'))
q.put(p.try_acquire())
time.sleep(0.5)
p.release()
def test_pid():
q = mp.Queue()
p1 = mp... |
email.py | from flask_mail import Message
from app import app, mail
from flask import render_template
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):
msg = Message(subject, sender=sender, reci... |
mocking.py | """mock utilities for testing
Functions
---------
- mock_authenticate
- mock_check_account
- mock_open_session
Spawners
--------
- MockSpawner: based on LocalProcessSpawner
- SlowSpawner:
- NeverSpawner:
- BadSpawner:
- SlowBadSpawner
- FormSpawner
Other components
----------------
- MockPAMAuthenticator
- MockHub
-... |
test_basic_3.py | # coding: utf-8
import gc
import logging
import os
import sys
import time
import subprocess
import numpy as np
import pytest
import ray.cluster_utils
from ray._private.test_utils import (
dicts_equal,
wait_for_pid_to_exit,
wait_for_condition,
)
from ray.autoscaler._private.constants import RAY_PROCESSES
f... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
rdd.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... |
ModuleView.py |
from .Object import Object
from .MainWindow import MainWindow
from .Module import Module
from .moduletype import ModuleType
from enum import Enum
from . import direction
from q3.ui.engine import qtw,qtc,qtg
from .DetailWindow import DetailWindow
import threading
class ModuleView(Object):
def __init__(self... |
test_worker.py | # -*- encoding: 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 ... |
test_multiplexer.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2021-2022 Valory AG
# Copyright 2018-2019 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.... |
main.py | from BeeAlgorithm import BeeAlgorithm
import INI
from matplotlib import pyplot as plt
import time
from BeeAlgorithm import SelectPatch
from BeeAlgorithm import FitnessFunction
import numpy as np
from multiprocessing import Process
from BeeAlgorithm import AlgorithmType
from matplotlib.legend import Legend
available_c... |
server_flask_opencv.py | from flask import Flask, Response
import cv2 as cv
app = Flask(__name__)
@app.route("/")
def helloworld():
str = "helloworld"
return str
global video_frame
def encodeframe():
global video_frame
while True:
ret, encoded_image = cv.imencode('.jpg', video_frame)
yield(b'--frame\r\n... |
queues.py | # -*- coding: utf-8 -*-
"""
logbook.queues
~~~~~~~~~~~~~~
This module implements queue backends.
:copyright: (c) 2010 by Armin Ronacher, Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
import json
import threading
from threading import Thread, Lock
import platform
from logbook.base ... |
conftest.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import print_function, with_statement, absolute_import
import inspect
import os
import platform
import pytest
import threading
import types
import sy... |
0004.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile
from bs4 import BeautifulSoup
from urllib import urlopen
fr... |
test_kill_tree.py | import unittest
from chalmers.utils.kill_tree import kill_tree
from multiprocessing import Process
import time
import os
def child_process():
p = Process(target=time.sleep, args=(100,))
p.start()
p.join()
class Test(unittest.TestCase):
def test_kills_process(self):
p = Process(ta... |
03_parallel_orig.py | #!/usr/bin/env python3
import gym
import ptan
import argparse
import torch
import torch.optim as optim
import torch.multiprocessing as mp
from tensorboardX import SummaryWriter
from lib import dqn_model, common
PLAY_STEPS = 4
def play_func(params, net, cuda, exp_queue):
env = gym.make(params.env_name)
env... |
bot.py | import praw
import re
import random
import os
import threading
#TODO find blacklisted sites, test, change 'crypto_cust_service' to submission.author and comment.author.name, test
def comment_loop():
for comment in subreddit.stream.comments():
for blink in blacklist:
normalized_comment = commen... |
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... |
email.py | """Script that calls SMTP server and sends emails"""
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
def send_async_email(app, msg):
"""
Sends email asyncronously so as not to slow down app
Args:
app: needs app instance... |
dirfucker.py | import requests
import argparse
import threading
import os
import sys
import signal
import time
from termcolor import colored
def signal_handler(sig, frame):
print(colored('Exiting please wait while im fucking up those threads bye...', "blue"))
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
def max_... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from utils.utils import xyxy2xywh, xywh2xyxy
help_url =... |
kernel_tick.py | #!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# 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 ... |
test_autograd.py | # Owner(s): ["module: autograd"]
import contextlib
import gc
import io
import math
import os
import random
import sys
import tempfile
import threading
import time
import unittest
import uuid
import warnings
import operator
import subprocess
from copy import deepcopy
from collections import OrderedDict
from itertools i... |
server.py | # -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
microservice.py | import argparse
import importlib
import json
import logging
import multiprocessing as mp
import os
import sys
import time
from distutils.util import strtobool
from functools import partial
from typing import Callable, Dict
from seldon_core import __version__
from seldon_core import wrapper as seldon_microservice
from ... |
multi-threading-1.py | import threading
import time
from time import gmtime, strftime
start = time.perf_counter()
def take_action():
print(f'Sleeping for 1 second...and now it is {strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())}/')
time.sleep(1)
print(f'Wake up after sleeping...and now it is {strftime("%a, %d %b %Y %... |
nt.py | """NT implementation of platform-specific services."""
import nagiosplugin
import threading
import msvcrt
def with_timeout(t, func, *args, **kwargs):
"""Call `func` but terminate after `t` seconds.
We use a thread here since NT systems don't have POSIX signals.
"""
func_thread = threading.Thread(ta... |
scheduler_job.py | # pylint: disable=no-name-in-module
#
# 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, Versio... |
util.py | from __future__ import absolute_import
import atexit
import binascii
import collections
import struct
from threading import Thread, Event
import weakref
from kafka.vendor import six
from kafka.errors import BufferUnderflowError
if six.PY3:
MAX_INT = 2 ** 31
TO_SIGNED = 2 ** 32
def crc32(data):
... |
parallel.py | from multiprocessing import Process, Queue
# Input arguments: tasks = [(func, args)].
def parallel_work(tasks, num_workers):
task_queue = Queue()
done_queue = Queue()
num_workers = min(num_workers, len(tasks))
for func, args in tasks:
task_queue.put((func, args))
def worker(input, output):
... |
app.py | """
This application is for getting wifi password which is present on your system
"""
from tkinter import *
from tkinter.ttk import Combobox, Treeview
import tkinter.messagebox
import subprocess
import threading
# creating instance
class WifiPassword:
def __init__(self, root):
self.root=root
... |
scenario_runner.py | #!/usr/bin/env python
# Copyright (c) 2018-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Welcome to CARLA scenario_runner
This is the main script to be executed when running a scenario.
It loads the scenario configura... |
test_gauge.py | """Unit tests for gauge"""
from collections import namedtuple
import random
import re
import shutil
import tempfile
import threading
import time
import os
import unittest
from unittest import mock
from http.server import HTTPServer, BaseHTTPRequestHandler
import yaml
import requests
from requests.exceptions import ... |
rpc_producer.py | #!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# 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 ... |
indie10.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile
from bs4 import BeautifulSoup
from urllib import urlopen
im... |
test_interrupt.py | import os
import time
from threading import Thread
from dagster import (
DagsterEventType,
DagsterSubprocessError,
ExecutionTargetHandle,
Field,
String,
execute_pipeline_iterator,
pipeline,
seven,
solid,
)
from dagster.core.instance import DagsterInstance
from dagster.utils import s... |
_testing.py | import bz2
from collections import Counter
from contextlib import contextmanager
from datetime import datetime
from functools import wraps
import gzip
import operator
import os
import re
from shutil import rmtree
import string
import tempfile
from typing import Any, Callable, ContextManager, List, Optional, Type, Union... |
test_mlt_dcl_ms.py | # -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import os
import sys
import tensorflow as tf
import cv2
import numpy as np
import math
from tqdm import tqdm
import argparse
from multiprocessing import Queue, Process
sys.path.append(".... |
collective_ops_test.py | # Copyright 2020 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 applicab... |
main.py | import json
from ttkbootstrap import Style
from tkinter.ttk import Progressbar
from tkinter.messagebox import askquestion, showinfo
from tkinter import Label, Canvas, PhotoImage
import tkinter as tk
import sys
import os
import time
from threading import Thread
from tkvideo import tkvideo
import platform
import psutil
i... |
notifications.py | from asyncio import new_event_loop, set_event_loop
from threading import Thread
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.types import ParseMode
from aiogram.utils import executor
from requests import post, get
from app.models import Account
from config import TG_TOKEN, CAL... |
drive_resource_client.py | # Copyright 2014 National Research Foundation (South African Radio Astronomy Observatory)
# BSD license - see LICENSE for details
from __future__ import absolute_import, division, print_function
import logging
import signal
import threading
import time
import IPython
import tornado
from katcp import inspecting_clie... |
lrs_frame_queue_manager.py | # License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.
# This library is part of validation testing wrapper
import collections
import csv
import logging
import os
import threading
import time
from queue import Queue, Full
from datetime import datetime
im... |
recordtest.py | #!/usr/bin/env python
## recordtest.py
##
## This is an example of a simple sound capture script.
##
## The script opens an ALSA pcm forsound capture. Set
## various attributes of the capture, and reads in a loop,
## writing the data to standard out.
##
## To test it out do the following:
## python recordtest.py out.r... |
tello.py | """Library for interacting with DJI Ryze Tello drones.
"""
# coding=utf-8
import logging
import socket
import time
from threading import Thread
from typing import Optional, Union, Type, Dict
from .enforce_types import enforce_types
import av
import numpy as np
threads_initialized = False
drones: Optional[dict] = {... |
multi_proxy_server.py | import socket
from multiprocessing import Process
HOST = ""
PORT = 8001
BUFFER_SIZE = 1024
def handle_multi(addr, conn, proxy_end):
send_full_data = conn.recv(BUFFER_SIZE)
print(f"Sending recieved data {send_full_data} to google")
proxy_end.sendall(send_full_data)
data = proxy_end.recv(BUFFER_SIZE)
... |
notifications.py | """A collection of ZeroMQ servers
test_notification_service - send out notifications of test status changes
- Registers a PULL socket that model.py sends notifications of tests to.
- Registers a PUB socket that broadcasts notifications to cluster_api websocket subscribers.
console_monitor_service - monitor the cons... |
server.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
import threading
from _shaded_thriftpy.protocol import TBinaryProtocolFactory
from _shaded_thriftpy.transport import (
TBufferedTransportFactory,
TTransportException
)
logger = logging.getLogger(__name__)
class TServer(object):... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
master_sup_sec.py | import threading, sys
import random, string
import socket
#p=21 q=109 n=2289 e=7 d=1543
def encrypt(data):
e,n=7,2289
#print("encrypting : "+data)
intdata = [x for x in map(ord, data)]
crypteddata = [((x ** e) % n) for x in intdata]
return ",".join(map(str, crypteddata))
def decrypt(da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.