source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
job_engine.py | # -*- coding: utf-8 -*-
"""
Accepts and handles requests for tasks.
Each of the following runs in its own Thread/Process.
BASICALLY DO A CLIENT/SERVER TO SPAWN PROCESSES
AND THEN A PUBLISH SUBSCRIBE TO RETURN DATA
Accepter:
Receives tasks and requests
Delegates tasks and responds to requests
Tasks are de... |
dx_operations.py | #!/usr/bin/env python
# Corey Brune - Oct 2016
# This script starts or stops a VDB
# 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.
"""List all VDBs or Start, stop, enable, disable a VDB
Usag... |
example2.py | #!/usr/bin/env python3
import threading
import time
def worker():
print('new worker')
time.sleep(0.5)
print('end of worker')
t0 = threading.Thread(target = worker)
t1 = threading.Thread()
t0.daemon = t1.daemon = True
t1.run = worker
print('before')
t0.start()
time.sleep(0.1)
t1.start()
print('after')
|
app.js.py | import threading
import myExtractor
queries= ['Donald Trump', 'Justin Trudeau']
threads = []
for i in queries:
t = threading.Thread(target=myExtractor.extract, args=(i,))
threads.append(t)
t.start()
|
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... |
wait_rabbitmq.py | import sys
import json
import time
import pika
import queue
import pickle
import logging
from threading import Thread
from tblib import pickling_support
from concurrent.futures import ThreadPoolExecutor, wait
from lithops.storage.utils import create_job_key
pickling_support.install()
logger = logging.getLogger(__name... |
tests_pool.py | import heapq
import psycopg2 # Trigger import error if not installed.
import threading
import time
from unittest import TestCase
from peewee import *
from playhouse.pool import *
class FakeDatabase(SqliteDatabase):
def __init__(self, *args, **kwargs):
self.counter = 0
self.closed_counter = 0
... |
turtlewidget.py | from easygraphics.image import Image
from easygraphics.turtle import TurtleWorld, Turtle
import time
import threading
from PyQt5 import QtCore, QtWidgets, QtGui
__all__ = ['TurtleWidget']
class TurtleWidget(QtWidgets.QWidget):
def __init__(self, parent=None, width=600, height=400):
super().__init__(paren... |
build_utils.py | """Building Utils"""
__all__ = ["pass_argv", "get_include_file", "wildcard",
"change_ext", "change_exts", "mkdir", "rmdir", "add_path",
"file_changed", "file_is_latest",
"run_command", "run_command_parallel", "command_exists",
"config", "Flags", "INC_PATHS", "ENV_PATH",
... |
dataclient.py | """This file implements a threaded stream controller to abstract a data stream
back to the ray clientserver.
"""
import logging
import queue
import threading
import grpc
from typing import Any
from typing import Dict
import ray.core.generated.ray_client_pb2 as ray_client_pb2
import ray.core.generated.ray_client_pb2_g... |
SocksProxy.py | import socket
import asyncio
import binascii
import http.client
import json
import os
import re
import ssl
import threading
from Controller import Config, Log
from threading import Thread
clients = {}
class SocksProxyServer:
def __init__(self, host, port):
self.host = host
self.port = port
... |
test_query_node_scale.py | import threading
import time
import pytest
from base.collection_wrapper import ApiCollectionWrapper
from common.common_type import CaseLabel
from customize.milvus_operator import MilvusOperator
from common import common_func as cf
from common import common_type as ct
from scale import constants
from pymilvus import I... |
order_id_queue.py | """An event queue for managing order ID requests."""
from threading import Event, Thread
from time import sleep
from enum import Enum
from typing import List, Callable, TYPE_CHECKING
from .._internal.threading import LoggingLock
from .._internal.trace import trace_all_threads_str
# Type hints on IbTwsClient cause a ... |
tcp_proxy.py | import hashlib
import sys
import threading
import socket
import time
import select
import errno
from typing import Union
class TcpProxy(object):
__header = 'PROXY#'
__close_header = 'CLOSE#'
__uid_length = 64
__socket_test_timeout = 3
__max_sockets = 100
__wait_timeout = 300 # make sure we do... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
process.py | import importlib
import os
import signal
import struct
import time
import subprocess
from typing import Optional, List, ValuesView
from abc import ABC, abstractmethod
from multiprocessing import Process
from setproctitle import setproctitle # pylint: disable=no-name-in-module
import cereal.messaging as messaging
imp... |
storage.py | # -*- coding: utf-8 -*-
"""
Object for saving data.
"""
import threading
from collections import UserDict
from threading import local as threadlocal
class Storage(dict):
"""A Storage object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`.
"""
def __geta... |
server.py | import socket
from threading import Thread, Lock
def start_server():
connected_client_sockets = []
client_manager_lock = Lock()
server_socket = create_server_socket()
while True:
client_socket, address = server_socket.accept()
client_socket.settimeout(20) # ping client eve... |
client.py | import logging
import json
import microgear
from microgear import cache
import time
import re
import paho.mqtt.client as mqtt
import threading
import os
import sys
import requests
import certifi
def do_nothing(arg1=None, arg2=None):
pass
subscribe_list = []
current_subscribe_list = []
current_id... |
cli.py | #===============================================================================
# Imports
#===============================================================================
from __future__ import print_function
import os
import re
import sys
import optparse
import textwrap
import importlib
from collections import (
... |
pool_cmds.py | import paramiko
import threading
import queue
import sys
from PyInquirer import prompt
def pool_list(provs):
pools = []
for provider in provs:
pools.extend(provider.get_pools())
for pool in pools:
print(pool.name, pool.systems)
def pool_create(provs):
prov_name = prompt(
[
... |
flickr_thread.py | """
Fall 2017 CSc 690
File: flickr_thread.py
Author: Steve Pedersen & Andrew Lesondak
System: OS X
Date: 12/13/2017
Usage: python3 spotify_infosuite.py
Dependencies: flickr, threading, pyqt5
Description: Requester class. A thread used to search the Flickr API asynchronously.
"""
from flickr import flickr
import thre... |
plot_map.py |
import pandas as pd
import numpy as np
import math
import urllib
import io
from PIL import Image
def deg2num(lat_deg, lon_deg, zoom):
lat_rad = math.radians(lat_deg)
n = 2.0 ** zoom
xtile = int((lon_deg + 180.0) / 360.0 * n)
ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos... |
DNS_Server.py | import json
import socket
import threading
#Reading From JSON File and Converting to Dictionary------------------------------------------------------------------
def read():
database=open("DNS_Database.json", "r+")
dns_data=database.read()
database.close()
dns_dict = json.loads(dns_data)
DNS_Data =... |
gpio_simulator.py | from Tkinter import Button, Checkbutton, DISABLED, Tk
from threading import Thread
class GpioSimulator():
def __init__(self, frontend):
self.frontend = frontend
self.playing_led = None
thread = Thread(target=self.initial_simulator)
thread.start()
def initial_simulator(self):
... |
callbacks.py | # -*- coding: utf8 -*-
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2014, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must... |
threadingutils.py | # -*- coding: utf-8 -*-
from threading import Thread, current_thread
import logging
def start_thread(target, name, exception_event, *args, **kwargs):
thread = Thread(target=thread_wrapper, name=name, args=(target, exception_event) + args, kwargs=kwargs)
thread.start()
return thread
def thread_wrapper(ta... |
doc.py | #
# Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of cond... |
test.py | import cv2
import requests,json
import threading,time
import queue
class ThreadingVideoCapture:
def __init__(self,src,max_queue_size=256):
print("クラス初期化...")
self.video = cv2.VideoCapture(src)
self.video.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('H', '2', '6', '4'));
self.vid... |
FastprotoBenchmark.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
test_cached_storage.py | import shutil
import tempfile
import unittest
from queue import Queue
from threading import Thread, Event
import numpy as np
from cltl.backend.api.storage import AudioParameters
from cltl.backend.impl.cached_storage import CachedAudioStorage
def wait(lock: Event):
passed = lock.wait(1)
if isinstance(passed,... |
peons.py | # Mrs
# Copyright 2008-2012 Brigham Young University
#
# 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 o... |
tpu_estimator.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
DSA.py | """
Created by mbenlioglu & mertkosan on 12/13/2017
"""
from __future__ import absolute_import, print_function, division
from random import randint
from pyprimes import is_prime, nprimes
from multiprocessing import Process, Queue
import hashlib
import sys
import os
import warnings
if sys.version_info < (3, 6):
... |
client.py | import os
import subprocess
import sys
import random
import socket
import threading
from datetime import date
from pyDes import *
import time
import rsa
import string
def secret_chat_listener():
print("Начинаю обмен ключами")
(pubkey, privkey) = rsa.newkeys(2048) #генерация пары ключей ... |
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... |
test_decorator_item.py | # -*- coding: utf-8 -*-
import unittest
from lutino.caching import create_cache_key
from lutino.caching.tests.base import CachingTestCase
from datetime import datetime
import threading
__author__ = 'vahid'
def th():
return threading.current_thread().name
class TestCacheDecoratorItem(CachingTestCase):
@clas... |
test_multi_thread_producer_consumer_sql_twitter.py | #!/usr/bin/env python
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
from multi_thread_producer_consumer_sql_twitter import ProducerConsumerThreadSqlTwitter
from os import path
import threading
import argparse
APP_ROOT = path.dirname(path.abspath( __file__ ))
"""
This script for ... |
httpd.py | #!/usr/bin/env python
"""
Copyright (c) 2014-2016 Miroslav Stampar (@stamparm)
See the file 'LICENSE' for copying permission
"""
import BaseHTTPServer
import cStringIO
import datetime
import httplib
import glob
import gzip
import hashlib
import io
import json
import mimetypes
import os
import re
import socket
import ... |
process_monitor.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
scheduler.py | import time
from multiprocessing import Process
from proxypool.api import app
from proxypool.getter import Getter
from proxypool.tester import Tester
from proxypool.db import RedisClient
from proxypool.setting import *
class Scheduler():
def schedule_tester(self, cycle=TESTER_CYCLE):
"""
定时测试代理
... |
utils.py | try:
from Crypto import Random
from Crypto.Cipher import AES
except:
from Cryptodome import Random
from Cryptodome.Cipher import AES
from colorama import init, Fore, Back, Style
from datetime import datetime
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.common.desired_capa... |
key.py | import threading
import tty
import termios
import fcntl
import os
import sys
import logging
from time import sleep, time
from select import select
from typing import List, Dict, Tuple, Union
LOG = logging.getLogger(__name__)
class Timer:
timestamp: float
return_zero = False
@classmethod
def stamp(c... |
_Root.py | #-----------------------------------------------------------------------------
# Title : PyRogue base module - Root Class
#-----------------------------------------------------------------------------
# This file is part of the rogue software platform. It is subject to
# the license terms in the LICENSE.txt file f... |
ibstore.py | #!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015-2020 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... |
datamunging.py | import logging
import time
import threading
class DataMunging:
mongo = None
def __init__(self, mongo, replicator_queue):
self.mongo = mongo
self.logger = logging.getLogger(__name__)
self.replicator_queue = replicator_queue
self.lock = threading.Lock()
self.last_seqnum ... |
client.py | import socket
from _thread import *
import threading
import os
import time
import sys
HOST = 'localhost' # github : lubnc4261
PORT = 33000
BUFFER_SIZE = 1024
ADDR = (HOST, PORT)
CONNECTED = True
CLIENT = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def clear():
if os.nam... |
parallel_to_sound.py | import os
from multiprocessing import Process, Queue
import lib.video as video
class Pool:
"""
A pool of video downloaders.
"""
def __init__(self, classes, source_directory, target_directory, num_workers, failed_save_file, no_sound_save_file):
self.classes = classes
self.source_directory = source_dir... |
safaribooks.py | #!/usr/bin/env python3
# coding: utf-8
import re
import os
import sys
import json
import shutil
import pathlib
import getpass
import logging
import argparse
import requests
import traceback
from html import escape
from random import random
from lxml import html, etree
from multiprocessing import Process, Queue, Value
f... |
ss.py | import sys
import wifi
import base64
import csv
import json
import threading
from datetime import datetime
import subprocess
import socket
import urllib
import os
import configparser
import subprocess as sp
os.system('sudo systemctl start bluetooth')
import pygatt
from binascii import hexlify
import time
import binasci... |
config.py | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@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... |
env_wrappers.py | """
Modified from OpenAI Baselines code to work with multi-agent envs
"""
import numpy as np
from multiprocessing import Process, Pipe
from baselines.common.vec_env import VecEnv, CloudpickleWrapper
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while Tru... |
run.py | # 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, software
# distrib... |
test_streams.py | """Tests for streams.py."""
import gc
import os
import queue
import pickle
import socket
import sys
import threading
import unittest
from unittest import mock
from test.support import socket_helper
try:
import ssl
except ImportError:
ssl = None
import asyncio
from test.test_asyncio import utils as test_utils
... |
model.py | """
Classes for tracking pipelines and the runs within each pipeline in separate
monitor threads that synchronize state.
Note that there is state tracked in these classes which is not available just
by looking at the return code. In particular, a run my be killed for several
different reasons: external signal, run tim... |
codesearcher.py | import os
import sys
import random
import traceback
import numpy as np
import math
from math import log
import argparse
from datashape.coretypes import real
random.seed(42)
import threading
import codecs
from tqdm import tqdm
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, fo... |
scheduler.py | import time
from multiprocessing import Process
from proxypool.api import app
from proxypool.getter import Getter
from proxypool.tester import Tester
from proxypool.db import RedisClient
from proxypool.setting import *
class Scheduler():
def schedule_tester(self, cycle=TESTER_CYCLE):
"""
定时测试代理
... |
timer.py | import threading
from typing import Callable
class Timer:
def __init__(self, interval: float, action: Callable):
"""
:param interval: The time interval in seconds after which the action will be called
:param action: The event that happens after the time interval
"""
self._i... |
time.py | import os
import time
from contextlib import suppress
from datetime import timezone as tz
from astropy import units as u
from astropy.time import Time
from panoptes.utils import error
from panoptes.utils.logging import logger
def current_time(flatten=False, datetime=False, pretty=False):
""" Convenience method t... |
utils.py | # -*- coding: utf-8 -*-
from __future__ import division
import errno
import os
import sys
import socket
import signal
import functools
import atexit
import tempfile
from subprocess import Popen, PIPE, STDOUT
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Q... |
common.py | """Test the helper method for writing tests."""
import asyncio
import functools as ft
import json
import logging
import os
import uuid
import sys
import threading
from collections import OrderedDict
from contextlib import contextmanager
from datetime import timedelta
from io import StringIO
from unittest.mock import M... |
test_tracer.py | import time
import mock
import opentracing
from opentracing import Format
from opentracing import InvalidCarrierException
from opentracing import SpanContextCorruptedException
from opentracing import UnsupportedFormatException
from opentracing import child_of
import pytest
import ddtrace
from ddtrace.ext.priority imp... |
indicator.py | # -*- coding: utf-8 -*-
# indicator.py
# based on python 3.6+
"""\
This module is a simple status indicator which liked systemd initialization style
We provide four styles of status include OK/FAILED/PASS/WARN/InProgress and also
support black&white style mode for some old console like Windows 7‘s cmd you can
watch the... |
engine.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import multiprocessing
import time
import random
import os
import string
from flask import Flask
from flask import jsonify
from flask import request as flask_request
from flask import render_template
from flask import abort
from flask import Response
from flask import make... |
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 ... |
ssh_tasks.py | # coding: utf-8
#
# ssh_tasks.py
#
# Copyright (C) 2020 IMTEK Simulation
# Author: Johannes Hoermann, johannes.hoermann@imtek.uni-freiburg.de
#
# 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... |
multiprocessing_write.py | import multiprocessing
from BTrees.OOBTree import OOBTree
import sheraf
class PerfConcurrentDB:
NUM_PROCESS = 55
DATABASE_URI = "zeo://localhost:9999"
PROVOKE_CONFLICTS = True
@classmethod
def concurrent_creation(cls):
class Model(sheraf.Model):
table = "Model"
s... |
__main__.py | """This module contains code for GUI of the converter."""
import os.path
import sys
from threading import Thread
from PIL import Image
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import QApplication, QFileDialog, QMainWindow
from converter import window
from converter.utils import convert, get_file_n... |
photoboothapp.py | # import the necessary packages
from __future__ import print_function
from PIL import Image
from PIL import ImageTk
import Tkinter as tki
import threading
import datetime
import imutils
import cv2
import os
class PhotoBoothApp:
def __init__(self, vs):
# store the video stream object and output path, then initialize... |
Problem#10.py | """
Implement a job scheduler which takes in a function f and an integer n, and calls f after n milliseconds.
"""
# Simple solution
import time
def job_scheduler(func, delay):
time.sleep(delay / 1000) # miliseconds
func()
def print_hello():
print(f"Hello World!")
print(time.time())
job_... |
flake_id_generator_test.py | import threading
import time
import random
from tests.base import SingleMemberTestCase, HazelcastTestCase
from tests.hzrc.ttypes import Lang
from hazelcast.client import HazelcastClient
from hazelcast.errors import HazelcastError
FLAKE_ID_STEP = 1 << 16
SHORT_TERM_BATCH_SIZE = 3
SHORT_TERM_VALIDITY_SECONDS = 3
NUM_TH... |
load.py | """
This is the "load and transform" part of our ELT.
There are three options for accomplishing this:
(1) a "load" command will start building the data warehouse from scratch, usually, after backing up.
(2) an "upgrade" command will try to load new data and changed relations (without any back up).
(3) an "update" com... |
KeyClipWriter.py | # This class handles clipping of recordings
# The original comes from here
# https://www.pyimagesearch.com/2016/02/29/saving-key-event-video-clips-with-opencv/
# Further modifications by Matias Andina
# import the necessary packages
from collections import deque
from threading import Thread
from queue import Queue
imp... |
feeder.py | import os,sys
import threading
import time
import traceback
import numpy as np
import tensorflow as tf
from infolog import log
from sklearn.model_selection import train_test_split
from tacotron.utils.text import text_to_sequence
_batches_per_group = 32
class Feeder:
"""
Feeds batches of data into queue on a backg... |
pg_lib.py | import io
import psycopg2
from psycopg2 import sql
from psycopg2.extras import RealDictCursor
import sys
import json
import datetime
import decimal
import time
import os
import binascii
from distutils.sysconfig import get_python_lib
import multiprocessing as mp
class pg_encoder(json.JSONEncoder):
def default(self, ob... |
views.py | import json
import re
from datetime import timedelta
from os import path
from threading import Thread
import shortuuid
from django.conf import settings
from django.contrib import messages
from django.core.cache import cache
from django.core.exceptions import PermissionDenied
from django.db import IntegrityError, trans... |
test_serializable_fails_if_updating_different_rows.py | ##############
# Setup Django
import django
django.setup()
#############
# Test proper
import threading
import time
import pytest
from django.db import DatabaseError, connection, transaction
from django.db.models import F, Subquery
from app.models import Sock
@pytest.mark.django_db
def test_serializable_fails_if_... |
utils.py |
from typing import Union, Any, Mapping, Callable
import multiprocessing as mp
import pickle
from pathlib import Path
import os
import warnings
from tqdm import trange
from .fileio import FileWriter
def dump(
dataset: Mapping[int, Any],
fname: Union[str, os.PathLike],
nfiles: int,
ser... |
policy_server_input.py | import logging
import queue
import threading
import traceback
from http.server import SimpleHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
import ray.cloudpickle as pickle
from ray.rllib.offline.input_reader import InputReader
from ray.rllib.env.policy_client import PolicyClient, \
_create... |
pyto_ui.py | """
UI for scripts
The ``pyto_ui`` module contains classes for building and presenting a native UI, in app or in the Today Widget.
This library's API is very similar to UIKit.
.. warning::
This library requires iOS / iPadOS 13.
This library may have a lot of similarities with ``UIKit``, but subclassing isn't supp... |
common.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
from datetime import timedelta
import json
import yaml
import logging
import os
import subprocess
import re
import stat
import subprocess
import urllib.parse
import threading
import contextlib
import tempfile
import psutil
from functools import reduce,... |
event.py | from .transaction import SimpleTransaction
import logging
from lightweightpush import LightweightPush
from lightweightpush import ErrorCodes as LPErrorCodes
import threading
class Event(object):
"""
Abstract object for events that can be triggered by an unknown transaction.
"""
def __init__(self, id:... |
test_s3boto3.py | import gzip
import pickle
import threading
from datetime import datetime
from textwrap import dedent
from unittest import mock, skipIf
from urllib.parse import urlparse
from botocore.exceptions import ClientError
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.... |
CommandLine.py | import threading
import cv2
import Queue as queue
import datetime
import time
import open3d
from libs import *
import rospy
def worker(invoker,stop):
x=""
while True:
x= raw_input("Enter command")
commands = x.split()
if len(commands)>0:
invoker.execute(com... |
map_test.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
wsdump.py | #!C:\Users\karli\PycharmProjects\IASEexamen\venv\Scripts\python.exe
import argparse
import code
import sys
import threading
import time
import ssl
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
encoding = getatt... |
3_content_attributes1.py | from multiprocessing import Process
import pandas as pd
import numpy as np
import time
import csv
import re
hashtags = re.compile("#(\w+)")
regex_mentions = re.compile("@(\w+)")
urls = re.compile("http(s)?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+")
regex_bad_words = re.compile("(" + "|".jo... |
locust.py | import gevent.monkey; gevent.monkey.patch_all()
import sys
import multiprocessing
import socket
import gevent
from locust import runners
from locust import events, web
from locust.main import version, load_locustfile
from locust.stats import print_percentile_stats, print_error_report, print_stats
from stormer.base impo... |
blast_32cores.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from threading import Thread, Event
import time
# import threading
import psutil
import datetime
import os
import subprocess
from subprocess import PIPE,Popen
# sizes = [0.015625, 0.03125, 0.0625, 0.125, 0.25, 0.5]
size = 0.015625
n_cores = 32
# command = "blastn -db nt ... |
test_windows.py | """
This is part of the MSS Python's module.
Source: https://github.com/BoboTiG/python-mss
"""
import platform
import threading
import mss
import pytest
from mss.exception import ScreenShotError
if platform.system().lower() != "windows":
pytestmark = pytest.mark.skip
def test_implementation(monkeypatch):
... |
train.py | import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from data import Vocab, DataLoader, STR, END, CLS, SEL, TL, rCLS
from generator import Generator
from extract import LexicalMap
from adam import AdamWeightDecayOptimizer
from utils import move_to_cuda
from work import validate
import argp... |
utils.py | import os
import sys
import logging
import time
import datetime
import tempfile as _tempfile
import contextlib
import subprocess
import hashlib
import re
import multiprocessing
import json
import atexit
import collections
import base64
from functools import wraps
from werkzeug import import_string
... |
funcs.py | import time
import logging
import warnings
import psutil
from signal import signal, SIGINT
from py3nvml.py3nvml import *
from typing import Dict, Optional
from kge import Config, Dataset
from kge.distributed.parameter_server import init_torch_server, init_lapse_scheduler
from kge.distributed.worker_process import Work... |
1.thread3_daemon.py | import time
from threading import Thread, active_count
def test1():
print("test1")
time.sleep(1)
print("test1 ok")
def test2():
print("test2")
time.sleep(2)
print("test2 ok")
def main():
t1 = Thread(target=test1)
t2 = Thread(target=test2, daemon=True)
t1.start()
t2.start()
... |
test_index.py | """
For testing index operations, including `create_index`, `describe_index` and `drop_index` interfaces
"""
import logging
import pytest
import time
import pdb
import threading
from multiprocessing import Pool, Process
import numpy
import sklearn.preprocessing
from milvus import IndexType, MetricType
from utils imp... |
artifacts.py | import hashlib
import json
import mimetypes
import os
import pickle
from six.moves.urllib.parse import quote
from copy import deepcopy
from datetime import datetime
from multiprocessing import RLock, Event
from multiprocessing.pool import ThreadPool
from tempfile import mkdtemp, mkstemp
from threading import Thread
fro... |
test_cpu_usage.py | #!/usr/bin/env python3
import time
import threading
import _thread
import signal
import sys
import cereal.messaging as messaging
import selfdrive.manager as manager
def cputime_total(ct):
return ct.cpuUser + ct.cpuSystem + ct.cpuChildrenUser + ct.cpuChildrenSystem
def print_cpu_usage(first_proc, last_proc):
pr... |
Term.py | import pygame
import pygame.freetype
import pygame.fastevent
import threading
import struct
import time
class Term(object):
CSI = '\x1b[' #ESC[
colortable = {
'guess' : [
[ #normal intensity
(0, 0, 0), #black
(160, 0, 0), #red
(0, 160, 0), #gre... |
fuzzer.py | """Simple fuzzer for MantaTail. See https://en.wikipedia.org/wiki/Fuzzing
To fuzz:
1. Make sure you don't have any unnecessary prints in mantatail. They will
cause the fuzzer to think that mantatail crashed; it doesn't try to
distinguish prints from error messages.
2. Make sure that Mantatail isn't running... |
test_interactive_credential.py | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import functools
import random
import socket
import threading
import time
from azure.core.exceptions import ClientAuthenticationError
from azure.core.pipeline.policies ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.