source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
benchmark_utils.py | # This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
# Copyright 2020 The HuggingFace Team and the AllenNLP 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 o... |
test_sanity_sample.py | """
Copyright (c) 2019-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... |
tcp_chat_client.py | # -*- coding:utf8 -*-
# python3
from socket import *
import threading
import time
HOST = '127.0.0.1'
PORT = 5000
ADDR = (HOST, PORT)
BUFSIZ = 1024
tcp_client = socket(AF_INET, SOCK_STREAM)
tcp_client.connect(ADDR)
def send_message():
while True:
input_data = input(">>> ")
if ... |
permission.py | import os
import time
import threading
import uuid
import PySimpleGUI as sg
prompt_open = False
user_response = ""
permission_tokens = []
TOKEN_TIMEOUT_S = 60
def is_device_allowed(current_setting, device_id, device_name, token):
if current_setting == 1: # allow all
return 1
if current_setting == 2... |
imagenet_ofrecord.py | """
Copyright 2020 The OneFlow 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 applicable law or agr... |
_test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import unittest.mock
import queue as pyqueue
import time
import io
import itertools
import sys
import os
import gc
import errno
import signal
import array
import socket
import random
import logging
import struct
import operator
import weakref
import warn... |
04-daemon.py | import time
import threading
def myfunc(name):
print(f"myfunc started with {name}")
time.sleep(10)
print("myfunc ended")
if __name__ == '__main__':
print('main started')
#myfunc('realpython')
t=threading.Thread(target=myfunc, args=['realpython'],daemon=True)
t.start()
print('main ende... |
capture_sensor_data.py | #!/usr/bin/env python3
import serial
from threading import Thread
from time import sleep, time
import argparse, logging, subprocess
import arduino_mode
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--device', default='/dev/serial0', help="Device to use for serial connection")
parser.add_argument('-l',... |
papiezowa.py | import getpass
import logging
import os
import sys
import time
from random import randrange, uniform
from datetime import datetime as dt
from multiprocessing import Process
import fbchat
from dotenv import load_dotenv
import cookies
FORMAT = "%(asctime)s %(levelname)s: %(message)s"
logging.basicConfig(
format... |
host.py |
# Copyright IBM Corp, All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
import datetime
import logging
import os
import random
import sys
import time
from threading import Thread
from uuid import uuid4
from pymongo.collection import ReturnDocument
sys.path.append(os.path.join(os.path.dirname(__file__), ... |
convert.py | import csv
import os
import platform
import queue
import subprocess
import threading
from os import mkdir, unlink
from os.path import abspath, isdir, join, normpath
from tempfile import NamedTemporaryFile
from tkinter import *
from tkinter import messagebox, ttk
from base_window import BaseWindow
from docx2pdf import ... |
__init__.py | # -*- coding: utf-8 -*-
"""
keyboard
========
Take full control of your keyboard with this small Python library. Hook global events, register hotkeys, simulate key presses and much more.
## Features
- **Global event hook** on all keyboards (captures keys regardless of focus).
- **Listen** and **send** keyboard event... |
mp.py |
import logging
import multiprocessing
import select
import unittest
import collections
import os
import sys
import six
import multiprocessing.connection as connection
from nose2 import events, loader, result, runner, session, util
log = logging.getLogger(__name__)
class MultiProcess(events.Plugin):
configSect... |
camera_control.py | #!/usr/bin/env python3
import requests
import io
import os
from datetime import datetime
import random
import time
from urllib.parse import quote
import multiprocessing, threading
from detection import yolo_all
import rtsp
import cv2
import pygame
import numpy as np
IP_ADDRESS = "192.168.1.115"
AUTH ... |
load_alarm_config.py | import threading
import time
from server_common.utilities import print_and_log
class AlarmConfigLoader(object):
"""
Alarm configuration loader class will create a new configuration and load it into the alarm server. While the
instance exists it will count down when it get to 0 it will no longer be the cu... |
driller.py | import os
import re
import time
import shutil
import logging
import tarfile
import pathlib
import tempfile
import webbrowser
import threading
from contextlib import suppress
from timeout_decorator.timeout_decorator import TimeoutError
from . import utils
from . import engines
from . import messages
from . import decode... |
stx_controller_TCP_client.py | #!/usr/bin/env python
from __future__ import print_function
import threading
import time
import rospy
import math
import actionlib
import signal
import json
import os
from std_msgs.msg import Empty
from control_msgs.msg import FollowJointTrajectoryAction, FollowJointTrajectoryGoal
from trajectory_msgs.msg import Join... |
tests.py | import threading
import time
from django.db import OperationalError, connection, transaction
from django.test import TestCase, TransactionTestCase
from . import get_next_value
class SingleConnectionTestsMixin(object):
def test_defaults(self):
self.assertEqual(get_next_value(), 1)
self.assertEqu... |
yudi25.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
from bs4 import BeautifulSoup
import time, random, sys, re, os, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia,tempfile,glob,shutil,unicodedata,goslate
from gtt... |
base_camera.py | import time
import threading
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
class CameraEvent(object):
"""An Event-like class that signals all active clients when a new frame is
... |
test_migrate_stopped_vm_snapshots_progress.py | '''
New Integration test for testing stopped vm migration between hosts.
@author: quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.volume_operations as vol_ops
impo... |
test_auto_scheduler_measure.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... |
ShareVariable.py | import time, threading
balance = 0
def change_id(n):
global balance
balance = balance + n
# balance = balance - n
def run_thread(n):
for i in range(10):
change_id(i)
t1 = threading.Thread(target=run_thread, args=(5,))
t2 = threading.Thread(target=run_thread, args=(8,))
t1.start()
t2.star... |
e2e.py | """
This is an end to end release test automation script used to kick off periodic
release tests, running on Anyscale.
The tool leverages app configs and compute templates.
Calling this script will run a single release test.
Example:
python e2e.py --test-config ~/ray/release/xgboost_tests/xgboost_tests.yaml --test-... |
helpers.py | """Supporting functions for polydata and grid objects."""
import os
import collections.abc
import enum
import logging
import signal
import sys
from threading import Thread
import threading
import traceback
from typing import Optional
import numpy as np
from pyvista import _vtk
import pyvista
from .fileio import from... |
wifiConnection.py | """
Holds all the data and commands needed to fly a Bebop drone.
Author: Amy McGovern, dramymcgovern@gmail.com
"""
from zeroconf import ServiceBrowser, Zeroconf
from datetime import datetime
import time
import socket
import ipaddress
import json
from pyparrot.utils.colorPrint import color_print
import struct
import t... |
plugin.py | from binascii import hexlify, unhexlify
from electrum.util import bfh, bh2u
from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT,
is_segwit_address)
from electrum import constants
from electrum.i18n import _
from e... |
masterserver.py | #!/usr/bin/env python
from threading import Thread
import socket
import time
from time import gmtime, strftime
import os
import sys
import string
class masterserver(object):
settings = {
"host": "sauerbraten-fork.org",
"port": 28787,
"log": "master.log"
}
proxy = {
"h... |
cmake.py | # Copyright (c) Pypperoni
#
# Pypperoni is licensed under the MIT License; you may
# not use it except in compliance with the License.
#
# You should have received a copy of the License with
# this source code under the name "LICENSE.txt". However,
# you may obtain a copy of the License on our GitHub here:
# https://gi... |
tests.py | # -*- coding: utf-8 -*-
# Unit and doctests for specific database backends.
from __future__ import unicode_literals
import datetime
import re
import threading
import unittest
import warnings
from decimal import Decimal, Rounded
from django.core.exceptions import ImproperlyConfigured
from django.core.management.color ... |
test_base_events.py | """Tests for base_events.py"""
import concurrent.futures
import errno
import math
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 test.test_asyncio import utils as test_utils
from test imp... |
trezor.py | import traceback
import sys
from typing import NamedTuple, Any
from electrum_audax.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum_audax.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum_audax.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path
from ele... |
test_poll.py | # Test case for the os.poll() function
import os
import random
import select
try:
import threading
except ImportError:
threading = None
import time
import unittest
from test.test_support import TESTFN, run_unittest, reap_threads, cpython_only
try:
select.poll
except AttributeError:
rai... |
optspec_inst.py | # standard libraries
import threading
import numpy
import queue
import logging
from nion.utils import Event
from nion.utils import Observable
from nion.swift.model import HardwareSource
from ..aux_files.config import read_data
class OptSpecDevice(Observable.Observable):
def __init__(self, MANUFACTURER):
... |
application_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... |
run_multiple.py | import subprocess
from subprocess import Popen
import multiprocessing as mp
mp = mp.get_context('spawn')
from itertools import product
import os
import time
from parse_dir import parse_env_subfolder, plot_best, plot_best_per_model
from main import full_train_test
import argparse
import json
def create_launch_proc... |
mp_classify.py | #!/usr/bin/env python
#
# // SPDX-License-Identifier: BSD-3-CLAUSE
#
# (C) Copyright 2018, Xilinx, Inc.
#
import sys
import timeit
import xdnn, xdnn_io
import numpy as np
import multiprocessing as mp
import ctypes
import threading
import time
import os
manager = mp.Manager()
class ZmqResultPublisher:
def __init__(s... |
server.py | import socket, time, subprocess,pickle
from threading import Thread
from SocketServer import ThreadingMixIn
# '''
# TCP_IP = 'localhost'
# TCP_PORT = 9001
# BUFFER_SIZE = 1024
# class ClientThread(Thread):
# def __init__(self,ip,port,sock):
# Thread.__init__(self)
# self.ip = ip
# self.por... |
server.py | """
Represents the core of the server, with its main functionality and classes.
All communication between server and client is encoded with latin-1.
This ensures compatibility regardless of what encoding is used client-side.
"""
from __future__ import annotations
import socket
import threading
import queue
import fnm... |
cache_extractor.py | #!/usr/bin/python2.6
# filesource \$HeadURL: svn+ssh://csvn@esv4-sysops-svn.corp.linkedin.com/export/content/sysops-svn/cfengine/trunk/generic_cf-agent_policies/config-general/manage_usr_local_admin/CacheExtractor.py $
# version \$Revision: 123922 $
# modifiedby \$LastChangedBy: msvoboda $
# lastmodified \... |
test_baker_operations_cli_options.py | """Simple tests to check support for the following operations-related options
for baking
- --ignore-node-mempool
- --operations-pool [file|uri]
"""
import os
import os.path
import json
import time
from http.server import HTTPServer, SimpleHTTPRequestHandler
from multiprocessing import Process
from typing import L... |
loading_animation.py | import webview
import threading
"""
This example demonstrates a simple loading animation workflow
"""
def load_html():
webview.load_html("""
<style>
body {
background-color: #333;
color: white;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
}
... |
run_estimator_ps.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import cv2
import time
import numpy as np
import multiprocessing as mp
from src import utils
from src.hog_box import HOGBox
from src.estimator import VNectEstimator
##################
### Parameters ###
##################
# the input camera serial number in the PC (int)... |
web_server.py | import Queue
import io
import logging
import threading
import PIL.Image
import pika
from flask import Flask, Response
import config
logging.basicConfig(level=logging.INFO)
app = Flask(__name__)
queue = Queue.Queue(1)
def populate_queue():
def callback(ch, method, properties, body):
image_stream = io.... |
web.py | """
ARBITER.
▄▄▄ ██▀███ ▄▄▄▄ ██▓▄▄▄█████▓▓█████ ██▀███
▒████▄ ▓██ ▒ ██▒▓█████▄ ▓██▒▓ ██▒ ▓▒▓█ ▀ ▓██ ▒ ██▒
▒██ ▀█▄ ▓██ ░▄█ ▒▒██▒ ▄██▒██▒▒ ▓██░ ▒░▒███ ▓██ ░▄█ ▒
░██▄▄▄▄██ ▒██▀▀█▄ ▒██░█▀ ░██░░ ▓██▓ ░ ▒▓█ ▄ ▒██▀▀█▄
▓█ ▓██▒░██▓ ▒██▒░▓█ ▀█▓░██░ ▒██▒ ░ ░▒████▒░██▓ ▒██▒
▒▒ ▓▒█░░ ▒▓ ░▒▓░░▒▓███... |
word2vec_optimized.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... |
athenad.py | #!/usr/bin/env python3
import base64
import hashlib
import io
import json
import os
import sys
import queue
import random
import select
import socket
import threading
import time
from collections import namedtuple
from functools import partial
from typing import Any
import requests
from jsonrpc import JSONRPCResponseM... |
deauth.py | import logging
import sys
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
import socket
from subprocess import call
from threading import Thread
from time import sleep
import printings
# local imports
from scan import WifiScan
conf.verb = 0
RED = "\033[1;31m"
GREEN = "\033[1;32m"
Y... |
tasks1.py | import time
import threading
def countdown(count):
while(count>=0):
print("'{0}' count down -> {1}".format(threading.current_thread().name, count))
count -= 1
time.sleep(3)
def countup():
count=0
while(count<=10):
print("'{0}' count up -> {1}".format(threading.current_thread... |
ucs_agent.py | # -*- coding: utf-8 -*-
# Copyright 2017 Cisco Systems, 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 applicabl... |
multiprocessing_env.py | # Code is from OpenAI baseline.
#https://github.com/openai/baselines/tree/master/baselines/common/vec_env
import numpy as np
from multiprocessing import Process, Pipe
import numpy as np
class RunningMeanStd(object):
# https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
def __i... |
minimal_synthetic_communityServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
execution.py | import abc
import os
import queue
import signal
import sys
import threading
class ProcessWrapper(metaclass=abc.ABCMeta):
process = None
output = None
command_identifier = None
finish_listeners = None
def __init__(self, command, command_identifier, working_directory):
self.command_identifi... |
test_simulation.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# 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.
# You may obtain a copy of the ... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Fujicoin 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 with... |
test_socket.py | import unittest
from test import support
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform
import array
import contextlib
from weakref import proxy
import signal
import math
import pickle
import struct
impo... |
server.py | #!/usr/bin/env python3
import logging
import os
import socket
import threading
from time import sleep
from typing import Optional
from flask import Flask, jsonify, render_template, request
from torch import Tensor
app = Flask(
__name__, static_folder="frontend/build/static", template_folder="frontend/build"
)
vi... |
dispatcher.py | import logging
import multiprocessing
import platform
import time
import typing as T
from logging.handlers import QueueHandler, QueueListener
from threading import Thread
from rembrain_robot_framework import utils
from rembrain_robot_framework.logger.utils import setup_logging
from rembrain_robot_framework.services.wa... |
views.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import collections, json
from threading import Thread, Timer
from background_task import background
from datetime import datetime, timedelta
from django.core.exceptions import PermissionDenied
from django.db.models import Q
from django.conf import settin... |
web_app.py | from flask import Flask, g, render_template
from multiprocessing import Process
from module import verifyIP
import redis
import threading
from tools.settings import *
__all__ = ['app']
app = Flask(__name__)
def get_conn():
if not hasattr(g, 'conn_redis'):
redis_pool = redis.ConnectionPool(host='127.0.0... |
test__xxsubinterpreters.py | from collections import namedtuple
import contextlib
import itertools
import os
import pickle
import sys
from textwrap import dedent
import threading
import time
import unittest
from test import support
from test.support import script_helper
interpreters = support.import_module('_xxsubinterpreters')
##############... |
sales.py | """
Saves a CSV of all plot sales to an output folder.
Methodology:
To reduce the amount of plots in memory at any one point, this script iterates over each district in each world
independently. It first begins by getting the latest state of all plots (1,440 per district). For each individual plot,
it then iterates o... |
sublimepython_repl.py | # encoding: utf-8
import code
import contextlib
from .repl import Repl
try:
from queue import Queue
except ImportError:
from Queue import Queue
import sys
import threading
import sublime
class QueueOut(object):
def __init__(self, queue):
self.queue = queue
def write(self, data):
self.... |
threading_02_demo.py | # -*- coding: utf-8 -*-
import time
from threading import Thread
class CountdownTask:
def __init__(self):
self._running = True
def terminate(self):
self._running = False
def run(self, n):
while self._running and n > 0:
print('T-minus', n)
n -= 1
... |
scripts_test.py | import os
from multiprocessing import Process
from pytest import CaptureFixture
from dotctl.context import Context
from dotctl.manager import Manager, run_setup_script
from dotctl.scripts import messages
def test_script(capfd: CaptureFixture[str]):
context = Context(os.path.realpath("tests/dotfiles"))
context.... |
test_arrow.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 applic... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import tempfile
import urllib.request
import traceback
import asyncore
import weakref
import platform
import functools
ssl =... |
Z.py | # -*- coding: utf-8 -*-
import LINETCR
#import wikipedia
from LINETCR.lib.curve.ttypes import *
#from ASUL.lib.curve.ttypes import *
from datetime import datetime
# https://kaijento.github.io/2017/05/19/web-scraping-youtube.com/
from bs4 import BeautifulSoup
from threading import Thread
from googletrans import Transla... |
systemd.py | #!/usr/bin/env python3
# The MIT License
#
# Copyright (c) 2019-, Rick Lan, dragonpilot community, and a number of other of contributors.
#
# 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 wit... |
master.py | # -*- coding: utf-8 -*-
'''
This module contains all of the routines needed to set up a master server, this
involves preparing the three listeners and the workers needed by the master.
'''
# Import python libs
from __future__ import absolute_import, with_statement, print_function, unicode_literals
import copy
import c... |
semaphore.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import threading
def run():
semaphore.acquire()
print(f'{threading.current_thread().name} is running at {time.ctime()}.')
time.sleep(1)
semaphore.release()
semaphore = threading.BoundedSemaphore(2)
for i in range(6):
threading.Thread(tar... |
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 unittest
import subprocess
import textwrap
from contextlib import ExitStack
from io import StringIO
from test import support
# This little helper class is essential for testing pdb under do... |
test_virtualtime.py | #!/usr/bin/env python
import virtualtime
from virtualtime import datetime_tz
from virtualtime.datetime_tz import test_datetime_tz
import datetime
import time
import pytz
import pickle
import os
import subprocess
import sys
import decorator
import threading
import logging
import datetime
from nose.plugins.attrib import... |
executor.py | import json
import logging
import os
import socket
import subprocess
import sys
import threading
import time
import uuid
import pika
import shutil
rabbitmq_uri = os.getenv('RABBITMQ_URI', 'amqp://guest:guest@rabbitmq/%2F')
rabbitmq_queue = os.getenv('RABBITMQ_QUEUE', 'pecan')
default_application = os.getenv('APPLICAT... |
test_stats.py | # Copyright 2013 Hewlett-Packard Development Company, L.P.
# Copyright 2014 OpenStack Foundation
# Copyright 2018 Red Hat, 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:/... |
utils.py | # -*- coding: utf-8 -*-
# Copyright 2012-2021 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
_a4c_start.py |
from cloudify import ctx
from cloudify import utils
from cloudify.exceptions import NonRecoverableError
from StringIO import StringIO
import base64
import os
import platform
import re
import subprocess
import sys
import time
import threading
import platform
import json
def convert_env_value_to_string(envDict):
... |
selenium_utils.py | from chromedriver_py import binary_path as driver_path
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver import Chrome, ChromeOptions # TODO: Combine these two dependencies. Leaving it for now since it touches too many sites atm.
from selenium.webdriver.chrome.options import Options
from seleni... |
lazy_process.py | import subprocess
import threading
import time
class LazyProcess(object):
""" Abstraction describing a command line launching a service - probably
as needed as functionality is accessed in Galaxy.
"""
def __init__(self, command_and_args):
self.command_and_args = command_and_args
self.... |
sleepycat.py | from rdflib.store import Store, VALID_STORE, NO_STORE
from rdflib.term import URIRef
from six import b
from six.moves.urllib.request import pathname2url
def bb(u):
return u.encode('utf-8')
try:
from bsddb import db
has_bsddb = True
except ImportError:
try:
from bsddb3 import db
has_b... |
httpclient_test.py | # -*- coding: utf-8 -*-
import base64
import binascii
from contextlib import closing
import copy
import threading
import datetime
from io import BytesIO
import subprocess
import sys
import time
import typing # noqa: F401
import unicodedata
import unittest
from tornado.escape import utf8, native_str, to... |
test_new_kvstore.py | import os
import time
import numpy as np
import socket
from scipy import sparse as spsp
import dgl
import backend as F
import unittest, pytest
from dgl.graph_index import create_graph_index
import multiprocessing as mp
from numpy.testing import assert_array_equal
if os.name != 'nt':
import fcntl
import struct
... |
test_nntplib.py | import io
import socket
import datetime
import textwrap
import unittest
import functools
import contextlib
import os.path
import re
import threading
from test import support
from test.support import socket_helper
from nntplib import NNTP, GroupInfo
import nntplib
from unittest.mock import patch
try:
import ssl
exc... |
test_protocol_util.py | # Copyright 2018 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
jumanpp.py | import argparse
import logging
import socketserver
import subprocess
from multiprocessing import Process
def main():
logger = logging.getLogger(__name__)
parser = _mk_argparser(logger=logger)
args = parser.parse_arg()
pass
def _mk_argparser(*, logger=None):
logger = logger or logging.getLogger(_... |
duploiotagent.py | from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
import logging
import time
import sys
import traceback
import argparse
import os
import json
import requests
import socket
import boto3
import datetime
from threading import Thread
import basicPubSub
from dockerutils import processGoalState
from dockerutils import ge... |
process.py | # -*- coding: utf-8 -*-
'''
Functions for daemonizing and otherwise modifying running processes
'''
# Import python libs
from __future__ import absolute_import, with_statement, print_function, unicode_literals
import copy
import os
import sys
import time
import errno
import types
import signal
import logging
import th... |
tasks.py | import sys
import threading
from abc import ABC, abstractmethod
from collections import UserList
from typing import Dict, List, Optional, Union
import attr
import rich.console
from spotcli.providers.spot import SpotProvider
from spotcli.utils.elastigroup import Elastigroup, ElastigroupProcess
console = rich.console.... |
simple_http_dynamic_server.py | #!/usr/bin/python3
# file: multiprocess_web_server.py
# Created by Guang at 19-7-19
# description:
# *-* coding:utf8 *-*
import multiprocessing
import socket
import re
import time
class WSGIServer(object):
def __init__(self, ip, port):
# 1.创建套接字
self.listen_server = socket.socket(socket.AF_INET,... |
apollo.py | import json
import logging
import threading
import time
from http import HTTPStatus
from typing import Dict
import requests
from configalchemy import BaseConfig, ConfigType
time_counter = time.time
class ConfigException(Exception):
...
logger = logging.getLogger(__name__)
class ApolloBaseConfig(BaseConfig)... |
gui.py | #!/usr/bin/env python3
import tkinter
import threading
import os
from sit_idcardlib_py import Reader
FILE_NAME = "ids.txt"
class App(tkinter.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widg... |
main.py | import argparse
import sys
import signal
import time
import os
import subprocess
from multiprocessing import Process, Pool
from multiprocessing.managers import BaseManager
from itertools import product
from termcolor import colored
from server_comm import ServerConnection, set_vars
from vlc_comm import player
from uti... |
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... |
test_radius.py | # RADIUS tests
# Copyright (c) 2013-2016, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
from remotehost import remote_compatible
import binascii
import hashlib
import hmac
import logging
logger = logging.getLogger()
import os
import sele... |
test_cgroupconfigurator.py | # Copyright 2018 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
p2p_stress.py | import testUtils
import p2p_test_peers
import random
import time
import copy
import threading
from core_symbol import CORE_SYMBOL
class StressNetwork:
speeds=[1,5,10,30,60,100,500]
sec=10
maxthreads=100
trList=[]
def maxIndex(self):
return len(self.speeds)
def randAcctName(self):
... |
reset_env.py | import unittest
from util import *
from threading import Thread
FILE_SIZE = 1024 * 1024
def test_create_100M_0KB_thread(max_number):
cids = []
dir_name = TEST_DIR + random_string()
# 500 dirs
for j in range(max_number):
# each has 200K files
cid = create_file(dir_name + "/" + str(j),... |
06_wrong_again.py | import multiprocessing
import time
start = time.perf_counter()
def schlafen(n_sec=1):
print(f"Sleep for {n_sec}(s) ...")
time.sleep(n_sec)
print(f"Done sleeping {n_sec}(s) ...")
n_processes = 40
for _ in range(n_processes):
p = multiprocessing.Process(target=schlafen)
p.start()
p.join()
fini... |
utils.py | from __future__ import print_function, division, absolute_import
import atexit
from collections import deque
from contextlib import contextmanager
from datetime import timedelta
import functools
from hashlib import md5
import inspect
import json
import logging
import multiprocessing
from numbers import Number
import o... |
client.py | import websocket
import json
from threading import Thread
import time
# Channel options: ['live_trades_[currency_pair]', 'live_orders_[currency_pair]', 'order_book_[currency_pair]', 'detail_order_book_[currency_pair]', 'diff_order_book_[currency_pair]']
class wsClient(object):
def __init__(self,channels,url='wss... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.