source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
app.py | from flask import Flask, jsonify, render_template, request
import os
from time import sleep
from multiprocessing import Process
import configparser
from spotify_background_color import SpotifyBackgroundColor
from current_spotify_playback import CurrentSpotifyPlayback, NoArtworkException
from led_controller import LEDCo... |
test_callbacks.py | import os
import sys
import multiprocessing
import numpy as np
import pytest
from keras import optimizers
np.random.seed(1337)
from keras import callbacks
from keras.models import Sequential
from keras.layers.core import Dense
from keras.utils.test_utils import get_test_data
from keras import backend as K
from keras... |
test_setup.py | """Test component/platform setup."""
# pylint: disable=protected-access
import asyncio
import os
from unittest import mock
import threading
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import EVENT_HOMEASSISTANT_START, CONSTRAINT_FILE
import homeassistant.co... |
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... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import (verbose, import_module, cpython_only,
requires_type_collecting)
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thread
import threading
import... |
reset_job_test.py | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
test_classify_async_multinet.py | #!/usr/bin/env python
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
Hiwin_RT605_ArmCommand_Socket_20190627193018.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##ๅคๅท่กๅบ
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
main.py | import sys
import time
from cv2 import cv2
import numpy as np
import mss
from pynput.mouse import Button, Controller
import os
from bot import Fisher
import threading
# Some images we will use to dynamically find catch bar
#dirname = os.path.dirname(__file__)
path = os.path.dirname(os.path.dirname(__file__))
img_path ... |
__init__.py | #!/usr/bin/env python
#
# Copyright 2017-2018 Amazon.com, Inc. and its affiliates. All Rights Reserved.
#
# Licensed under the MIT License. See the LICENSE accompanying this file
# for the specific language governing permissions and limitations under
# the License.
#
#
# Copy this script to /sbin/mount.efs and make sur... |
multiproc_vec.py | from .utils.shared_array import SharedArray
from .utils.space_wrapper import SpaceWrapper
import multiprocessing as mp
import numpy as np
import traceback
import gym.vector
def compress_info(infos):
non_empty_infs = [(i, info) for i, info in enumerate(infos) if info]
return non_empty_infs
def decompress_inf... |
example_sync.py | #!/usr/bin/env python3
"""
This is an example of how the pytradfri-library can be used.
To run the script, do the following:
$ pip3 install pytradfri
$ Download this file (example_sync.py)
$ python3 example_sync.py <IP>
Where <IP> is the address to your IKEA gateway. The first time
running you will be asked to input ... |
__init__.py | import sys
import threading
import itertools
class Spinner(object):
spinner_cycle = itertools.cycle(['-', '/', '|', '\\'])
def __init__(self, beep=False, disable=False, force=False, stream=sys.stdout):
self.disable = disable
self.beep = beep
self.force = force
self.stream = st... |
dataset_np_ipc.py | """Data fetching with pandas
"""
# MIT License
#
# Copyright (c) 2018 Yichun Shi
# Copyright (c) 2021 Kai Chen
#
# 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, includin... |
send fuel measure.py | # Import standard python modules
import time
import os
import sys
import threading
# Import Adafruit IO Client.
from Adafruit_IO import Client
# Import RPi.GPIO Module
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO! This is probably because you need \
superuser privileges. You ... |
agent.py | from abc import ABC, abstractmethod
import logging
from ROAR.utilities_module.vehicle_models import Vehicle
from ROAR.utilities_module.data_structures_models import SensorsData, IMUData, Transform
from ROAR.utilities_module.vehicle_models import VehicleControl
from typing import Optional, List
from pathlib import Path
... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
from threading import Thread
import time
import traceback
import csv
from decimal import Decimal
from bitcoin import COIN
from i18n import _
from util import PrintError, ThreadJob
from util import format_satoshis
# See https://en.wikipedia.org/w... |
PyShell.py | #! /usr/bin/env python3
import getopt
import os
import os.path
import re
import socket
import subprocess
import sys
import threading
import time
import tokenize
import io
import linecache
from code import InteractiveInterpreter
from platform import python_version, system
try:
from tkinter import *
except ImportE... |
ChatRoom1.1Server.py | #!/usr/bin/env python
# -.- coding: utf-8 -.-y
import threading
import subprocess
import Queue
import socket
import time
import sys
import os
import datetime
from cmd import Cmd
#Created by Camerin Figueroa
cv = "1.1"
q = Queue.Queue()
q.put([[]])
errors = Queue.Queue()
errors.put([])
motd = Queue.Queue()
quit = Queue.... |
sock4-local.py | #coding=utf-8
import socket
import select
import socketserver
import logging
import json
#import time
from multiprocessing import Process
#import threading
with open('config.json', 'rb') as f:
config = json.load(f)
#port = int(config['loaclport'])
serverdd = config['server']
port = int(config[... |
sim.py | from serial import Serial
import threading
import config
import time
serial = Serial(config.SERIAL_PORT_SIM, config.SERIAL_BAUD_SIM)
NODE_MAX = 2
def loop_write():
address = 0
location_x = 123.456
location_y = 99.2222
location_z = 789.123
cnt = 0
while True:
if(address < NODE_MAX/2):
... |
test_flaskparser.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import threading
from werkzeug.exceptions import HTTPException
import mock
import pytest
from flask import Flask
from webargs import fields, ValidationError, missing
from webargs.flaskparser import parser, abort
from webargs.core import MARSHMALLOW_VERSI... |
beni_s_hammer.py | import logging
from fragile import _instrument
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s'))
logger.addHandler(ch)
import multiprocessing as mp
def send_errors(batch):
opbeat = _instrumen... |
safe_t.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_xzc.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum_xzc.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum_xzc.bip32 import BIP32Node
from electrum_xzc import constants
from electrum_xzc.i18n imp... |
testhread.py | import time
from threading import Thread
def sleeper(i):
print ("thread %d sleeps for 5 seconds" % i)
time.sleep(5)
print ("thread %d woke up" % i)
for i in range(10):
t = Thread(target=sleeper, args=(i,))
t.start() |
profiler_test.py |
from mail_serv_test import *
from mail_serv.profiler import *
os.environ['PROFILER_REPORT_DIR'] = f"{THIS_DIR}/tmp/profiler"
def dummy_fun1(index:int) -> None:
time.sleep(0.010)
def dummy_fun2(index:int) -> None:
time.sleep(0.020)
def test_system_profiler():
print()
profiler = SystemProfiler() ... |
train.py | from dataloader import EvalDataset, TrainDataset, NewBidirectionalOneShotIterator
from dataloader import get_dataset
import argparse
import os
import logging
import time
backend = os.environ.get('DGLBACKEND', 'pytorch')
if backend.lower() == 'mxnet':
import multiprocessing as mp
from train_mxnet import load_m... |
vnokex.py | # encoding: UTF-8
from __future__ import print_function
import ssl
import hashlib
import json
import traceback
from threading import Thread
from time import sleep
import websocket
# ๅธธ้ๅฎไน
OKEX_SPOT_HOST = 'wss://real.okex.com:10441/websocket'
SPOT_CURRENCY = ["usdt",
"btc",
"l... |
lisp-itr.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain... |
interactive.py | import asyncio
import logging
import os
import tempfile
import textwrap
import uuid
from functools import partial
from multiprocessing import Process
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union
import numpy as np
from aiohttp import ClientError
from colorclass import Color
from sanic imp... |
Backend.py | from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QPixmap
from utils.Design_Files.MainFrontEnd import *
from utils.Design_Files import download_dialog
import music_tag
import os, sys, time, shutil, re
import threading, webbrowser, zipfile, shutil
class DownloadWidget(QDialog):
def ... |
video_demo.py | # -*- coding: utf-8 -*-
"""
This Module is ppe
Example:
$python video_demo.py
Author: Ming'en Zheng
"""
import os
import time
from multiprocessing import Process, Queue, Value
import queue
import numpy as np
import tensorflow as tf
import cv2
import argparse
import requests
from distutils.version import StrictVersi... |
pid.py | '''
Created on 11/04/2015
@author: david
'''
import logging
from threading import Thread
import time
class PID(object):
'''
Proportional Integrative Derivative stabilizer
'''
#Period range to be considered as correct loop rate
PERIOD_RANGE_MARGIN = 0.1
def __init__(self, period, kpMatr... |
lrf_node.py | #!/usr/bin/env python
"""
Controls and publishes readings from the laser range finder.
"""
from __future__ import print_function
import os
import time
import sys
from math import pi
from threading import Thread
import io
import yaml
from PIL import Image as PilImage
import cv2
# from scipy.signal import medfilt2d
imp... |
testCfsVersusVfs.py | #!/usr/bin/python3
import os
import re
import string
import sys
import subprocess
import time
import traceback
from queue import Queue
from queue import Empty
import random
from threading import Thread
macro_var_regex = re.compile("%(?P<var>[-0-9]+)%")
macro_rand_uint_regex = re.compile("%RANDUINT\((?P<length>[-0-9A-Z... |
simple_sample.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
@ Author : Max_Pengjb
@ date : 2018/9/23 22:37
@ IDE : PyCharm
@ GitHub : https://github.com/JackyPJB
@ Contact : pengjianbiao@hotmail.com
-----------... |
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... |
process.py | # Princeton University licenses this file to You under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy of the License at:
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writin... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement
import os
import re
import sys
import copy
import time
import types
import signal
import random
import fnmatch
import logging
import threading
import traceback
import c... |
fetcher.py | from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from bs4 import BeautifulSoup
from urllib2 import urlopen
import threading
import Queue
import re
class Fetcher(object):
"""Fetching Cap... |
regrtest.py | #! /usr/bin/env python3
"""
Script to run Python regression tests.
Run this script with -h or --help for documentation.
"""
USAGE = """\
python -m test [options] [test_name1 [test_name2 ...]]
python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
"""
DESCRIPTION = """\
Run Python regression tes... |
composer.py | # Copyright 2021 The FedLearner 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... |
zhidao_v5.py | import requests
from bs4 import BeautifulSoup
import threading
import json
import time
import os
import re
def BetterTime(timestr):
"ๅฐๅ็งๆ ผๅผ็ๆถ้ดๅญ็ฌฆไธฒ่ง่ๅ"
if 'ไปๅคฉ' in timestr or 'ๅ' in timestr:
localtime = time.localtime()
year = str(localtime.tm_year)
month = str(localtime.tm_mon)
da... |
test_repeatable_read_update_blocks.py | ##############
# Setup Django
import django
django.setup()
#############
# Test proper
import threading
import time
import pytest
from django.db import connection, transaction
from django.db.models import F, Subquery
from app.models import Sock
@pytest.mark.django_db
def test_repeatable_read_update_blocks():
... |
dataset_reader.py | import re
import gc
import time
from timeit import default_timer as timer
import random
import logging
from iterable_queue import IterableQueue
from multiprocessing import Process
from concurrent.futures import ProcessPoolExecutor, as_completed
from collections import Counter
from .counter_sampler import CounterSamp... |
make.py | import errno
import glob
import json
import os
from queue import Queue
import shlex
import shutil
import stat
import subprocess
import threading
import time
from typing import Callable
import webbrowser
import bpy
import arm.assets as assets
from arm.exporter import ArmoryExporter
import arm.lib.make_datas
import arm... |
autopollingcachepolicy.py | import logging
import sys
import datetime
import time
from threading import Thread, Event
from requests import HTTPError
from .readwritelock import ReadWriteLock
from .interfaces import CachePolicy
log = logging.getLogger(sys.modules[__name__].__name__)
class AutoPollingCachePolicy(CachePolicy):
def __init__(s... |
bazel_build.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2016 The Tulsi 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/LICE... |
test_server.py | import os
import threading
import json
import numpy as np
import pytest
from skimage import io
from skimage._shared._tempfile import temporary_file
from scipy import ndimage as ndi
from gala import features, serve, evaluate as ev
D = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.join(D, 'example-data... |
test_dag_serialization.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
slave.py | from platform import node, version, system, processor, machine
from shutil import disk_usage
from time import sleep
from argparse import ArgumentParser
from datetime import datetime
from socket import socket, gethostbyname, gethostname
from threading import Thread
from re import findall
from uuid import getnode... |
gui.py | import eel
import os
import battlecode_cli as cli
import threading
import sys
import json
import signal
import psutil
import player_plain
import battlecode as bc
import zipfile
import requests
import base64
import shutil
target_dir = os.path.abspath(os.path.dirname(__file__))
print('Moving into', target_dir)
os.chdir... |
dask_util.py | # -*- coding: utf-8 -*-
from collections import defaultdict
from timeit import default_timer
from threading import Event, Thread, Lock
import os
import time
import sys
try:
from dask.callbacks import Callback
from dask.utils import ignoring
except ImportError as e:
opt_import_err = e
Callback = object
... |
backend.py | # -*- coding: utf-8 -*-
# This code is based on AjaxTerm/Web-Shell which included a fairly complete
# vt100 implementation as well as a stable process multiplexer.
# I made some small fixes, improved some small parts and added a Session class
# which can be used by the widget.
# License: GPL2
import sys
import os
impor... |
benchmarks.py | #!/usr/bin/env python
"""Compare new solver `gr1x` to `slugs`."""
import argparse
import datetime
import pprint
import logging
import multiprocessing as mp
import sys
import time
from dd import cudd
from omega.logic import bitvector as bv
from omega.symbolic import symbolic
from openpromela import slugs
import psutil
f... |
game_controller.py | import os
import threading
import time
import cv2
from utils.auto_settings import check_settings
from bot import Bot
from config import Config
from death_manager import DeathManager
from game_recovery import GameRecovery
from game_stats import GameStats
from health_manager import HealthManager
from logger import Logge... |
perception.py | __author__ = 'Mehmet Mert Yildiran, mert.yildiran@bil.omu.edu.tr'
import datetime # Supplies classes for manipulating dates and times in both simple and complex ways.
import imutils # A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization etc... |
multinode_runner.py | import fabric
from fabric import Connection
from .hostinfo import HostInfo, HostInfoList
from multiprocessing import Pipe, Process
from multiprocessing import connection as mp_connection
import click
def run_on_host(hostinfo: HostInfo, workdir: str, recv_conn: mp_connection.Connection,
send_conn: mp_c... |
cli.py | #!/usr/bin/env python3
import sys
import time
import threading
import requests as rq
import json
from base64 import b64decode
import click
import six
import questionary
from questionary import ValidationError, Validator, Choice
from prompt_toolkit.styles import Style
from pyfiglet import figlet_format
try:
im... |
test_random.py | from __future__ import division, absolute_import, print_function
import warnings
import numpy as np
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_raises, assert_equal,
assert_warns, assert_no_warnings, assert_array_equal,
assert_array_almost_equal, suppress_warnings)
f... |
multiprocess_demo.py | #import multiprocessing
from pymongo import MongoClient
import pandas as pd
import numpy as np
import string
import re
from multiprocessing import Lock, Process
from datetime import datetime
def process_data(maxx,l):
pass
def process_cursor(skip_n, limit_n,l):
print('Starting process', skip_n // limit_n, '.... |
test_executor.py | #!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... |
recovery_2i.py | import logging
from threading import Thread
import time
from .base_2i import BaseSecondaryIndexingTests
from couchbase.n1ql import CONSISTENCY_REQUEST
from couchbase_helper.query_definitions import QueryDefinition
from lib.memcached.helper.data_helper import MemcachedClientHelper
from membase.api.rest_client import Re... |
test_index.py | import os
import multiprocessing as mp
import pytest
import numpy as np
from jina.enums import FlowOptimizeLevel
from jina.executors.indexers.vector import NumpyIndexer
from jina.flow import Flow
from jina.parser import set_flow_parser
from jina.proto import jina_pb2
from jina import Document
from tests import random... |
penv.py | from multiprocessing import Process, Pipe
import gym
import numpy as np
def worker(conn, env):
while True:
cmd, data = conn.recv()
if cmd == "step":
obs, reward, done, info = env.step(data)
if done:
obs = env.reset()
conn.send((obs, reward, done,... |
exe.py | """WizardKit: Execution functions"""
#vim: sts=2 sw=2 ts=2
import json
import logging
import os
import re
import subprocess
import time
from threading import Thread
from queue import Queue, Empty
import psutil
# STATIC VARIABLES
LOG = logging.getLogger(__name__)
# Classes
class NonBlockingStreamReader():
"""Cl... |
Thread_join.py | #join() blocks indefinitely
import threading
import time
import logging
def daemon():
print 'Daemon'
time.sleep(2)
print 'Exit Daemon'
def worker():
print 'Starting Worker'
print 'Exiting Worker'
d = threading.Thread(name='Daemon',target=(daemon))
d.setDaemon(True)
w = threading.Thread(name='Wokr',tar... |
model.py | # -*- coding: utf-8 -*-
import datetime
import json
import logging
import re
import threading
import time
import gocept.cache.method as cache
import requests
log = logging.getLogger()
# we only want data for these types, errors and what not begone
TYPES = set(['Buses', 'Metros', 'Trains', 'Trams'])
# what we're in... |
wxStocks_gui.py | #################################################################
# Most of the wxPython in wxStocks is located here. #
# Table of Contents: #
# 1: Imports and line_number function #
# 2: Main Frame, where tab order is placed. ... |
app.py | """Provides a class for creating custom HTTP servers."""
import functools
import queue
import socket
import threading
import collect
from . import server
from . import http
from .logger import Logger
__all__ = ['ActiveRequest', 'App']
sender_q = queue.Queue()
def sender_d():
"""Daemon procedure for FIFO HTTP ... |
egg_pair.py | # -*- coding: utf-8 -*-
# Copyright (c) 2019 - now, Eggroll 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... |
tasks.py | import json
import time
import requests
from flask import g, request, current_app, url_for
from ..models import User, Watch, Check
from .. import db
from . import main
from .authentication import auth_user
from .errors import bad_request, unauthorized, forbidden, not_found
from flask.ext.mail import Message
from thre... |
Misc.py | ## @file
# Common routines used by all tools
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the lic... |
cs.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : cs.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 01/22/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import collections
import contextlib
import queue
import threading
import zmq
from jacinle.conc... |
watcher.py | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
can_watch = True
except ImportError:
Observer = None
FileSystemEventHandler = object
PollingO... |
upnp.py | import logging
import threading
from queue import Queue
from typing import Optional
try:
import miniupnpc
except ImportError:
pass
log = logging.getLogger(__name__)
class UPnP:
thread: Optional[threading.Thread] = None
queue: Queue = Queue()
def __init__(self):
def run():
t... |
mmfunction.py | import itertools
import functools
import time
import sys
import threading
def benchmark(func):
'''
ใใณใฌใผใใใ้ขๆฐใฎๅฎ่กๆ้ใ่จๆธฌใใ้ขๆฐ
'''
@functools.wraps(func)
def Wrapper(*arg, **kw):
stime = time.clock()
ret = func(*arg, **kw)
etime = time.clock()
print('{0}: {1:,f}ms'.format... |
kb_gtdbtkServer.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... |
deletionwatcher.py | # coding=utf-8
import json
import os.path
import pickle
import requests
import time
import threading
# noinspection PyPackageRequirements
import websocket
# noinspection PyPackageRequirements
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import chatcommunicate
import metasmoke
from globalvars import G... |
loader_base.py | """ Module dmt/data/loading/loader_base.py
Loading Concepts:
Given:
- SampleSet & custom/default preprocessing
-
Assumptions:
- # of samples per example & # of tensors per example is same for epoch
samples = [Sample(file) for file in os.listdir('dataset')]
sample_set = dmt.data.SampleSet(samp... |
utils.py | # -*- coding: utf-8 -*-
"""
Various useful functions
"""
# Author: Remi Flamary <remi.flamary@unice.fr>
#
# License: MIT License
import multiprocessing
from functools import reduce
import time
import numpy as np
from scipy.spatial.distance import cdist
import sys
import warnings
from inspect import signature
__time... |
download_manager_test.py | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# 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 appl... |
manager.py | from dataclasses import dataclass
import logging
import threading
import time
import traceback
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Iterator
from concurrent.futures.thread import ThreadPoolExecutor
from blspy import G1Element
from chiapos import DiskProver
from ... |
client.py | from __future__ import print_function, division
__version__ = '0.0.1'
import os.path
from threading import Thread, RLock
import logging
logger = logging.getLogger('onvif')
logging.basicConfig(level=logging.INFO)
logging.getLogger('zeep.client').setLevel(logging.CRITICAL)
from urllib.parse import urlparse
from zeep.cl... |
test_s3.py | import boto3
import botocore.session
from botocore.exceptions import ClientError
from botocore.exceptions import ParamValidationError
from nose.tools import eq_ as eq
from nose.plugins.attrib import attr
from nose.plugins.skip import SkipTest
import isodate
import email.utils
import datetime
import threading
import re
... |
autorunner.py | import random
from multiprocessing import Process
from parser import drawState, from_python
from states import State, JoinResult
from orbiter import OrbiterStrategy
from swarmer import SwarmerStrategy
from interaction import send2
from orbit_util import sign, trace_orbit
_, [p1, p2] = send2([1, 0])
def survivor_stra... |
flow_control.py | import logging
import sys
import threading
import time
from parsl.dataflow.task_status_poller import TaskStatusPoller
logger = logging.getLogger(__name__)
class FlowNoControl(object):
"""FlowNoControl implements similar interfaces as FlowControl.
Null handlers are used so as to mimic the FlowControl class.... |
app.py | #!/usr/bin/env python
import argparse
import logging
import settings
import pydoc
import os
import sys
import threading
def import_plugins(plugin_package, plugin_modules):
plugins = []
for plugin_path in plugin_modules:
plugin_class = pydoc.locate('{}.{}'.format(plugin_package, plugin_path))
i... |
test_lock.py | import os
from subprocess import Popen
from tempfile import mktemp
from threading import Thread
import time
from unittest import TestCase
from combo_lock import ComboLock
class TestComboLock(TestCase):
def setUp(self):
self.lock_file = mktemp()
def tearDown(self):
os.remove(self.lock_file)
... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import verbose, strip_python_stderr, import_module
from test.script_helper import assert_python_ok
import random
import re
import sys
_thread = import_module('_thread')
threading = import_module('threading')
import time
import... |
train.py | # -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 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... |
controlsd.py | #!/usr/bin/env python3
import os
import math
import requests
import threading
from numbers import Number
from cereal import car, log
from common.numpy_fast import clip
from common.realtime import sec_since_boot, config_realtime_process, Priority, Ratekeeper, DT_CTRL
from common.profiler import Profiler
from common.par... |
cli.py | import ast
import inspect
import os
import platform
import re
import sys
import traceback
from functools import update_wrapper
from operator import attrgetter
from threading import Lock
from threading import Thread
import click
from werkzeug.utils import import_string
from .globals import current_app
from .helpers im... |
threadlocal.py | import threading
local_school = threading.local()
def process_student():
print 'Hello, %s (in %s)\n' % (local_school.student, threading.current_thread().name)
def process_thread(name):
local_school.student = name
process_student()
t1 = threading.Thread(target= process_thread, args=('Alice',), name='Thre... |
test_logging.py | #!/usr/bin/env python
#
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright n... |
spoof.py | import time
import threading
from scapy.all import ARP, send # pylint: disable=no-name-in-module
from .host import Host
from evillimiter.common.globals import BROADCAST
class ARPSpoofer(object):
def __init__(self, interface, gateway_ip, gateway_mac):
self.interface = interface
self.gateway_ip = g... |
armFreqServer.py | from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import subprocess
from time import sleep
import smbus
import time
# for RPI version 1, use "bus = smbus.SMBus(0)"
bus = smbus.SMBus(1)
def acceptConnections():
while True:
client, client_address = SERVER.accept()
print(... |
timed_subprocess.py | # -*- coding: utf-8 -*-
"""
For running command line executables with a timeout
"""
from __future__ import absolute_import, print_function, unicode_literals
import shlex
import subprocess
import threading
import salt.exceptions
import salt.utils.data
from salt.ext import six
class TimedProc(object):
"""
Cre... |
docker_ctl.py | from __future__ import annotations
import os
import threading
import time
from collections import defaultdict
from typing import List, Tuple, Dict
import uuid
from assemblyline.odm.models.service import DependencyConfig, DockerConfig
from .interface import ControllerInterface, ServiceControlError
# Where to find the ... |
Loops.py | import os
import os.path
import sys
import threading
import asyncio
import subprocess
import shutil
from multiprocessing.pool import ThreadPool
from osbot_utils.testing.Duration import Duration
from osbot_utils.utils.Files import create_folder, folder_exists, folder_delete_all
from cdr_plugin_folder_to_folder.common_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.