source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
utils.py | #!/usr/bin/env python
import gym
import marlo
import sys
import os
import importlib
import logging
logger = logging.getLogger(__name__)
from threading import Thread
from queue import Queue
import socket
from contextlib import closing
from marlo.launch_minecraft_in_background import launch_minecraft_in_background
de... |
database_heartbeat.py | import datetime
import logging
import os
import socket
import threading
from galaxy.model import WorkerProcess
from galaxy.model.orm.now import now
log = logging.getLogger(__name__)
class DatabaseHeartbeat:
def __init__(self, application_stack, heartbeat_interval=60):
self.application_stack = applicati... |
chord_sim.py | # coding:utf-8
import threading
from threading import Thread
import time
import random
from typing import List, Optional, Union, cast
import modules.gval as gval
from modules.node_info import NodeInfo
from modules.chord_util import ChordUtil, KeyValue, DataIdAndValue, ErrorCode, PResult, NodeIsDownedExcepti... |
language.py | # coding: utf8
from __future__ import absolute_import, unicode_literals
import random
import itertools
from spacy.util import minibatch
import weakref
import functools
from collections import OrderedDict
from contextlib import contextmanager
from copy import copy, deepcopy
from thinc.neural import Model
import srsly
i... |
HTTPControl.py | from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
from termcolor import colored
import threading
import time
import urllib.parse
from ww import f
class ThreadingSimpleServer(ThreadingMixIn, HTTPServer):
pass
class HTTPControl:
configConfig = {}
configHTT... |
core.py | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
forkVsCreate.py | import threading
from multiprocessing import Process
import time
import os
def MyThread():
time.sleep(2)
t0 = time.time()
threads = []
for i in range(10):
thread = threading.Thread(target=MyThread)
thread.start()
threads.append(thread)
t1 = time.time()
print("Total Time for Creating 10 Threads: {} seconds".fo... |
__init__.py |
from __future__ import print_function
import sys
import re
import threading
import os
import time
if sys.version_info[0] == 2:
from Tkinter import *
import tkFileDialog
import tkMessageBox
import tkFont
_next_method_name = 'next'
else:
from tkinter import *
import tkinter.filedialog as tk... |
update_intraday.py | import os
import sys
from multiprocessing import Process, Value
sys.path.append('hyperdrive')
from DataSource import IEXCloud, Polygon # noqa autopep8
from Constants import POLY_CRYPTO_SYMBOLS, FEW_DAYS # noqa autopep8
import Constants as C # noqa autopep8
counter = Value('i', 0)
iex = IEXCloud()
poly = P... |
process_test.py | from multiprocessing import Process
import os
import random
import time
import sys
def child(n):
indent = " " * n
print '{}child{} ({})'.format(indent, n, os.getpid())
for x in range(1, 6):
time.sleep(random.randint(1, 3))
sys.stdout.write('{}child{} ({}) {}\n'.format(inde... |
mdns_example_test.py | import re
import os
import socket
import time
import struct
import dpkt
import dpkt.dns
from threading import Thread, Event
import subprocess
from tiny_test_fw import DUT
import ttfw_idf
stop_mdns_server = Event()
esp_answered = Event()
def get_dns_query_for_esp(esp_host):
dns = dpkt.dns.DNS(b'\x00\x00\x01\x00\... |
cam_processor.py | import cv2
import queue
import threading
import time
import numpy as np
#from imutils.video import pivideostream as VideoStream
from imutils.video import VideoStream
#import imutilsx.video.videostream.py
#from lib import
class cam_processor:
def __init__(self,
out_queue,
cap_fr... |
python_instance.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
# "... |
websocketconnection.py | import threading
import websocket
import gzip
import ssl
import logging
from urllib import parse
import urllib.parse
# from binance_f.base.printtime import PrintDate
from binance_f.impl.utils.timeservice import get_current_timestamp
from binance_f.impl.utils.urlparamsbuilder import UrlParamsBuilder
from binance_f.impl... |
wts.py | ###############################################################################
#
# Copyright (c) 2016 Wi-Fi Alliance
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear... |
scheduler.py | import multiprocessing
import time
from loguru import logger
from proxypool.processors.getter import Getter
from proxypool.processors.server import app
from proxypool.processors.tester import Tester
from proxypool.setting import CYCLE_GETTER, CYCLE_TESTER, API_HOST, API_THREADED, API_PORT, ENABLE_SERVER, \
ENABLE... |
bot.py | # -*- coding: utf-8 -*-
import logging
import os
import re
import time
from threading import Lock
from threading import Thread
import requests
import telepot
from . import helper
from .helper import download_file
from .helper import pprint_json
from .client import MatrigramClient
BOT_BASE_URL = 'https://api.telegra... |
test_io.py | """Unit tests for io.py."""
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import time
import array
import threading
import random
import unittest
from itertools import chain, cycle
from test import test_support
import codecs
import io # The module under test
cla... |
portable_runner.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
extra_extension.py | import json
import pprint
import select
import paramiko
import threading
import traceback
from nameko.extensions import ProviderCollector, SharedExtension
from logging import getLogger
LOGGER = getLogger(__name__)
class GerritWatcherServer(ProviderCollector, SharedExtension):
"""
A SharedExtension that wra... |
output_devices.py | # GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
# Copyright (c) 2016-2019 Andrew Scheller <github@loowis.durge.org>
# Copyright (c) 2015-2019 Dave Jones <dave@waveform.org.uk>
# Copyright (c) 2015-2019 Ben Nuttall <ben@bennuttall.com>
# Copyright (c) 2019 tuftii <3215045+tuftii@users.noreply.github.... |
sensor.py | from multiprocessing import Process
# Run all python scripts at the same time
def one(): import bme280
def two(): import ccs811
def three(): import top_phat_button
def four(): import weather_bom
Process(target=one).start()
Process(target=two).start()
Process(target=three).start()
Process(target=four).start() |
mt_loader.py |
import logging
import numpy as np
import time
import random
from multiprocessing import Process, Queue, Value
import sys
def transform_mirror(x):
if random.random() < 0.5:
x = np.fliplr(x)
return x
def crop_image(img1, imsize):
h, w, c = img1.shape
x1 = (w - imsize[0])/2
y1 = (h - imsize... |
load_balancer.py | import logging
import random
import socket
import socketserver
import threading
from serverless.worker import Worker
logger = logging.getLogger(__name__)
class _LoadBalancerHandler(socketserver.StreamRequestHandler):
def __init__(self, workers: list[Worker], *args, **kwargs):
self.workers = workers
... |
dask.py | # pylint: disable=too-many-arguments, too-many-locals, no-name-in-module
# pylint: disable=missing-class-docstring, invalid-name
# pylint: disable=too-many-lines
# pylint: disable=import-error
"""Dask extensions for distributed training. See
https://xgboost.readthedocs.io/en/latest/tutorials/dask.html for simple
tutori... |
test_samplers.py | import multiprocessing
import pytest
import numpy as np
import scipy.stats as st
import pandas as pd
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
from pyabc.sampler import (SingleCoreSampler,
MappingSampler,
MulticoreParticleParallelSampler... |
test_pool.py | import threading, time
from sqlalchemy import pool, interfaces, create_engine, select
import sqlalchemy as tsa
from sqlalchemy.test import TestBase, testing
from sqlalchemy.test.util import gc_collect, lazy_gc
from sqlalchemy.test.testing import eq_
mcid = 1
class MockDBAPI(object):
def __init__(self):
sel... |
predict.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 12 10:08:11 2018
@author: rakshith
"""
import os, time
import numpy as np
import argparse
from keras.models import load_model
from keras.preprocessing import image
from multiprocessing import Process
PATH = os.getcwd()
CLASSES = ['Cat', 'Dog']
pri... |
main_utils.py | # Copyright 2020, NTRobotics
#
# 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 ag... |
flask_server.py | """
All responses have
mimetype="application/json",
headers={"Access-Control-Allow-Origin": "*"}
"""
from flask import Flask, request, Response
from logger_mongo import run_logger
from multiprocessing import Process
import time
import json
import logging
import pprint
import pymongo
app = Flask(__name__)
... |
tarea_6.py | import threading
import math
factorial_bunch = []
def calculate_factorial(begin, end, step, n):
result = 0
for i in range(begin, end, step):
result += int(n/5**i)
factorial_bunch.append(result)
if __name__ == "__main__":
process = 4
# process = int(input('Introduce la cantidad de hilos... |
tracing_backend.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cStringIO
import json
import logging
import socket
import threading
from telemetry.core import util
from telemetry.core.chrome import trace_resu... |
key_control.py | #!/usr/bin/env python3
import sys, tty, termios
import threading
import rospy
from std_msgs.msg import Float64
# input variables
ch = ''
def read_input():
global ch
while True:
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
fina... |
test_search_20.py | import threading
import time
import pytest
import random
import numpy as np
from base.client_base import TestcaseBase
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
prefix = "search_collection"
s... |
captcha.py | # !/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/10/27 10:28 下午
# @Author : Destiny_
# @File : captcha.py
import re
import json
import time
import encrypt
import pymysql
import requests
import schedule
import threading
captcha_map = {}
sid_list = encrypt.sid_list
aim_url = encrypt.aim_url
kdt_id =... |
diff-filterer.py | #!/usr/bin/python3
#
# Copyright (C) 2018 The Android Open Source Project
#
# 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 ... |
__init__.py | import numpy as np
import threading
import multiprocessing
import math
def rgb2hsl(rgb):
def core(_rgb, _hsl):
irgb = _rgb.astype(np.uint16)
ir, ig, ib = irgb[:, :, 0], irgb[:, :, 1], irgb[:, :, 2]
h, s, l = _hsl[:, :, 0], _hsl[:, :, 1], _hsl[:, :, 2]
imin, imax = irgb.min(2), ir... |
sphero_edu.py | import math
import threading
import time
from collections import namedtuple, defaultdict
from enum import Enum, IntEnum, auto
from functools import partial
from typing import Union, Callable, Dict, Iterable
import numpy as np
from transforms3d.euler import euler2mat
from spherov2.commands.animatronic import R2LegActi... |
test_tracking.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import contextlib
import os
import multiprocessing
import time
import tempfile
import pickle
import thriftpy
try:
import dbm
except ImportError:
import dbm.ndbm as dbm
import pytest
from thriftpy.contrib.tracking import TTrackedProcessor, TTrac... |
animate_widgets.py | # -*- coding: utf-8 -*-
# **Exercise: Animate the timeseries plot**
# In[1]:
# Imports
from threading import Thread
import datetime
import logging
import time
import numpy as np
import netCDF4
import pandas as pd
from bokeh.plotting import vplot, hplot, cursession, curdoc, output_server, show
from bokeh.models.wid... |
qactabase.py | import copy
import datetime
import json
import os
import re
import sys
import threading
import time
import uuid
import pandas as pd
import pymongo
import requests
from qaenv import (eventmq_amqp, eventmq_ip, eventmq_password, eventmq_port,
eventmq_username, mongo_ip, mongo_uri)
from QUANTAXIS.QAPubS... |
lock_with.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# lock_with.py
#
# An example of using a lock with the Python 2.6 context-manager feature
import threading
X = 0 # A shared Value
COUNT = 1000000
# Primarily used to synchronize threads so that only one thread can make modifications to shared data at any given time.
X_Lo... |
test_pysnooper.py | # Copyright 2019 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
import io
import textwrap
import threading
import time
import types
import os
import sys
from pysnooper.utils import truncate
import pytest
import pysnooper
from pysnooper.variables import needs_parentheses
from .util... |
spikerClient.py | # Backyard Brains Sep. 2019
# Made for python 3
# First install serial library
# Install numpy, pyserial, matplotlib
# pip3 install pyserial
#
# Code will read, parse and display data from BackyardBrains' serial devices
#
# Written by Stanislav Mircic
# stanislav@backyardbrains.com
import threading
import ... |
win32spawn.py | #
# File : win32spawn.py
# This file is part of RT-Thread RTOS
# COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 ... |
ssh.py | #!/usr/bin/env python2
import sys
import os
from subprocess import Popen, PIPE
import Queue
import threading
import re
import datetime
class Ssh:
'''This class can access multiple servers via ssh and scp(both direction)'''
def __init__(self):
'''Run all methods, which will collect all data for thread... |
RoutingAttackKit.py | #!/usr/bin/python
#
# Currently implemented attacks:
# - sniffer - (NOT YET IMPLEMENTED) Sniffer hunting for authentication strings
# - ripv1-route - Spoofed RIPv1 Route Announcements
# - ripv1-dos - RIPv1 Denial of Service via Null-Routing
# - ripv1-ampl - RIPv1 Reflection Amplification DDoS
# - ripv... |
_process_manager.py | from collections import deque
import subprocess
import traceback
import sys
from threading import Thread
try:
from queue import Queue, Empty
except ImportError:
from Queue import Queue, Empty # python 2.x
from nanome._internal._process import _ProcessEntry
from nanome.util import Logs, IntEnum, auto
POSIX = ... |
transaction.py | #!/usr/bin/env python3
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# 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 withou... |
common.py | import inspect
import threading
import netifaces as ni
from netifaces import AF_INET
__author__ = "Piotr Gawlowicz, Anatolij Zubow"
__copyright__ = "Copyright (c) 2015, Technische Universitat Berlin"
__version__ = "0.1.0"
__email__ = "{gawlowicz|zubow}@tkn.tu-berlin.de"
def override():
'''
with this decorat... |
resource_sharer.py | #
# We use a background thread for sharing fds on Unix, and for sharing sockets on
# Windows.
#
# A client which wants to pickle a resource registers it with the resource
# sharer and gets an identifier in return. The unpickling process will connect
# to the resource sharer, sends the identifier and its pid, and then ... |
pythread_per_process_scheduler.py | #ckwg +28
# Copyright 2012 by Kitware, 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 conditio... |
robot.py | #!/usr/bin/env python3
from ev3dev2.motor import Motor, SpeedRPS, MoveTank
from ev3dev2.sensor.lego import ColorSensor, UltrasonicSensor
from ev3dev2.power import PowerSupply
from math import pi, sin, cos, atan, atan2, tan, sqrt
from threading import Thread
import numpy as np
from time import sleep, time
from ev3dev2.... |
engine.py | # =======================================================================================
# \ | | __ __| _ \ | / __| \ \ / __|
# _ \ | | | ( | . < _| \ / \__ \
# @autor: Luis Monteiro _/ _\ \__/ _| \___/ _|\_\ ___| _| ____/
# ========... |
main.py | import logging
import os
import torch
import torch.multiprocessing as mp
import optimizer as my_optim
from config import Params
from envs import create_expansionai_env
from model import ActorCritic
from test import test
from train import train
LOGGING_FORMAT = '%(asctime)s - %(name)s - %(thread)d|%(process)d - %(lev... |
extension_telemetry.py | # Microsoft Azure Linux Agent
#
# Copyright 2020 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 b... |
Midi_Analyzer.py | from Scripts import Scale
import time
import threading
import mido
from mido import MidiFile, MidiTrack
# https://mido.readthedocs.io/en/latest/midi_files.html
# http://support.ircam.fr/docs/om/om6-manual/co/MIDI-Concepts.html
tracks = []
def print_ports():
# for potential sound generation...
# nonfunctional... |
command.py | from __future__ import absolute_import
from collections import defaultdict
from collections import namedtuple
from contextlib import closing
from itertools import chain
from ModestMaps.Core import Coordinate
from multiprocessing.pool import ThreadPool
from random import randrange
from tilequeue.config import create_que... |
sttClient.py | #
# Copyright IBM Corp. 2014
#
# 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, soft... |
scam.py | import sys
import subprocess
import threading
import time
import socket
import shlex
import psutil
import os
import errno
from operator import truediv
import numpy
import DynamicUpdate
import ConfigParser
import matplotlib.pyplot as plt
config = ConfigParser.ConfigParser()
config.read ("scam.ini")
keepRunning = True... |
app_hooks.py | from threading import Thread
from . import audio
def on_server_loaded(server_context):
t = Thread(target=audio.update_audio_data, args=())
t.setDaemon(True)
t.start()
|
mavros_offboard_attctl_test.py | #!/usr/bin/env python2
#***************************************************************************
#
# Copyright (c) 2015 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#... |
test_messaging.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
"""Tests for JSON message streams and channels.
"""
import collections
import fun... |
object_detection_test_increase_fps_multithreading.py | import cv2
import numpy as np
import os
import sys
import tarfile
import time
import argparse
import tensorflow as tf
import multiprocessing
from threading import Thread
from multiprocessing import Queue, Pool
from mytools.app_utils import FPS, WebcamVideoStream, draw_boxes_and_labels
from object_detection.utils imp... |
task.py | import atexit
import os
import signal
import sys
import threading
import time
from argparse import ArgumentParser
from tempfile import mkstemp
try:
# noinspection PyCompatibility
from collections.abc import Callable, Sequence as CollectionsSequence
except ImportError:
from collections import Callable, Seq... |
manual_frame.py | import tkinter as tk
from tkinter import ttk
import threading
import time
from PIL import Image, ImageTk
import sys
import gcodesender as gc
import os
# Constants the determine how far along each axis the imager will attempt to move. Should be set lower
# than the actual movement range, and should be adjusted each tim... |
4-live.py | coin = 'OKEX:DOGE-ETH'
#seconds between requests
time_to_sleep = 30
#how long to keep listening in minutes
time_alive = 20
max_id = 1510238364283338752
resolution = '1' # Available values: 1, 5, 15, 30, 60, 'D', 'W', 'M'
#twitter paramters for live tweets
def get_query_params_live(search_term, max_id):
return {'... |
server.py | import socket
import asyncio
import threading
import time
import numpy
import os
inGame = False
class NonNegativeNumpyIndex:
def __init__(self, numpyArray):
self.array = numpyArray
def __call__(self, rowOrSearchVal = None, col = None, value = None):
# print("A")
if (value != None):
... |
snmp_aruba_agent.py | #!/usr/bin/python3 -tt
# -*- coding: utf-8 -*-
from twisted.internet import task
from twisted.python import log
import subprocess
import datetime
import threading
import time
import re
from sqlalchemy import and_
from sqlalchemy.orm.exc import NoResultFound
__all__ = ['SNMPArubaAgent']
class SNMPArubaAgent(object... |
_channel.py | # Copyright 2016 gRPC 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 applicable law or agreed to in... |
demo_oop.py |
# object oriented programming + single thread
# single thread created by user - basic building block for multiple thread system
# 1 thread - acquire image from camera and show it
# see demo_multithread.py for a more complete version
# multithread demo
# https://nrsyed.com/2018/07/05/multithreading-with-o... |
batchrefresh.py | # -*- coding: utf-8 -*-
import decorator
import sys
import os
import queue
import logging
import copy
import threading
import fileexport
import publish
import httpinvoke
from majorcollege2dict import majorcollege2dict
import util
"""Main module."""
logger=util.create_logger(logging.INFO,__name__)
back_logger=util.... |
ctcn_reader.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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... |
logging.py | """Logging utilities."""
import asyncio
import logging
import threading
from .async import run_coroutine_threadsafe
class HideSensitiveDataFilter(logging.Filter):
"""Filter API password calls."""
def __init__(self, text):
"""Initialize sensitive data filter."""
super().__init__()
sel... |
cli.py | # -*- coding: utf-8 -*-
"""
flask.cli
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details.
"""
from __future__ import print_function
import ast
import inspect
import os
import re
import ssl
import sys
... |
DirtGenerator.py | #! /usr/bin/env python3
import random
import numpy
import copy
import threading
import math
from typing import List
import rospy
import rospkg
from nav_msgs.msg import OccupancyGrid
from gazebo_msgs.srv import DeleteModel, SpawnModel
from geometry_msgs.msg import Pose, Point, Quaternion, TransformStamped, Transform, ... |
__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
import datetime
import json
import logging
import os
import random
import re
import sys
import time
import Queue
import threading
import shelve
import uuid
import urllib2
from geopy.geocoders import GoogleV3
from pg... |
bo_validation.py | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 19 15:51:02 2015
@author: alexeyche
"""
#from bayesopt import ContinuousGaussModel
#from bayesopt import ContinuousStudentTModel
from matplotlib import pyplot as plt
import random
from multiprocessing import Process, Queue
from collections import defaultdict
import os
... |
add.py | import threading
import time
import npyscreen
from vent.api.actions import Action
from vent.api.plugin_helpers import PluginHelper
from vent.menus.add_options import AddOptionsForm
from vent.menus.editor import EditorForm
class AddForm(npyscreen.ActionForm):
""" For for adding a new repo """
default_repo = ... |
_parallelize.py | import os
from multiprocessing import Manager
from threading import Thread
from typing import Any, Callable, Optional, Sequence, Union
from joblib import delayed, Parallel
import numpy as np
from scipy.sparse import issparse, spmatrix
from scvelo import logging as logg
_msg_shown = False
def get_n_jobs(n_jobs):
... |
gui.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from Tkinter import *
import Tkinter
import Similarity
import numpy as np
import rospy, math
from std_msgs.msg import UInt8, String
from sensor_msgs.msg import Imu
from geometry_msgs.msg import Twist, Vector3
from ros_myo.msg import EmgArray
import threading as th
from cop... |
synthetic_test.py | from socialsent3 import constants
from socialsent3 import util
from socialsent3 import polarity_induction_methods
import time
from socialsent3 import seeds
from socialsent3.historical import vocab
import random
import numpy as np
from socialsent3 import evaluate_methods
from multiprocessing.queues import Empty
from mul... |
__init__.py |
from .authenticity import AuthenticityCheckLoopController
from .healthcheck import HealthCheckLoopController
from .abstract import AbstractLoopController
from ..entity.host import Node
from time import sleep
import threading
import tornado.log
import traceback
import sys
class ShellController:
threads = [] ... |
test_cinderjit.py | # Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
import _testcapi
import asyncio
import builtins
import dis
import gc
import sys
import threading
import types
import unittest
import warnings
import weakref
from compiler.static import StaticCodeGenerator
try:
with warnings.catch_warnings... |
course_plan_scraper.py | from math import ceil
from scraper import Scraper
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
import threading
from driver_manager import DriverManager
from time import perf_counter
from rich import print as rprint
import requests
from bs4 import Beautifu... |
transport.py | from threading import Thread, Lock, Event
from zlib import compress, decompress
import time
import zmq
from google import protobuf
from .engine_commons import getUUID, getOpenPort, baseToPubSubPort
from .message_pb2 import SocketMessage
#################
### CONSTANTS ###
#################
from .constants import DELI... |
test_balsa_gui.py | import time
import threading
import pyautogui
from balsa import get_logger, Balsa, __author__
from test_balsa import enter_press_time
def press_enter():
time.sleep(enter_press_time)
pyautogui.press("enter")
def test_balsa_gui():
application_name = "test_balsa_gui"
balsa = Balsa(application_name, ... |
server.py | # -*- coding: utf-8 -*-
# @Author: TD21forever
# @Date: 2019-11-24 01:12:39
# @Last Modified by: TD21forever
# @Last Modified time: 2019-11-24 15:40:39
from socket import *
import threading
def stoc(client_socket, addr):
while True:
try:
client_socket.settimeout(500)
... |
mon.py | # -*- coding: utf-8 =*-
from celery import shared_task
import time,string
from django.template import loader
from dbmanage.myapp.models import MySQL_monitor
from dbmanage.myapp.models import Db_instance,Db_account
import MySQLdb,datetime
from dbmanage.myapp.include.encrypt import prpcrypt
from dbmanage.myapp.tasks impo... |
actor_plus_z.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
" The code for the actor using Z (the reward for imititing the expert in replays) in the actor-learner mode in the IMPALA architecture "
# modified from AlphaStar pseudo-code
import traceback
from time import time, sleep, strftime, localtime
import threading
import torch... |
config_pfsense.py | #!/usr/bin/env python3
# scripts/config_pfsense.py
#
# Import/Export script for vIOS.
#
# @author Alain Degreffe <eczema@ecze.com>
# @copyright 2016 Alain Degreffe
# @license http://www.gnu.org/licenses/gpl.html
# @link http://www.unetlab.com/
# @version 20160422
import getopt, multiprocessing, os, pexpect, re, sys, ... |
test_ext_kerberos.py | #!/usr/bin/env python
# encoding: utf-8
"""Test Kerberos extension."""
from nose.tools import eq_, nottest, ok_, raises
from threading import Lock, Thread
from time import sleep, time
import sys
class MockHTTPKerberosAuth(object):
def __init__(self, **kwargs):
self._lock = Lock()
self._calls = set()
... |
test_remote.py | import threading
import time
import unittest
from jina.logging import get_logger
from jina.parser import set_gateway_parser, set_pea_parser
from jina.peapods.pod import GatewayPod
from jina.peapods.remote import PeaSpawnHelper
from tests import JinaTestCase
class MyTestCase(JinaTestCase):
def test_logging_thread... |
test_setup.py | import multiprocessing
import socket
import time
from contextlib import closing
import pytest
import tornado.httpclient
import tornado.ioloop
import tornado.web
from tornado_swagger.setup import export_swagger, setup_swagger
SERVER_START_TIMEOUT = 3
SWAGGER_URL = "/api/doc"
def find_free_port():
with closing(... |
test.py | import json
import os.path as p
import random
import socket
import subprocess
import threading
import time
import io
import avro.schema
import avro.io
import avro.datafile
from confluent_kafka.avro.cached_schema_registry_client import CachedSchemaRegistryClient
from confluent_kafka.avro.serializer.message_serializer i... |
4_distributed.py | """
Stage 4: Let's do all the same things, but across multiple workers.
Multi-slot tasks in Determined get the following features out-of-the box:
- batch scheduling
- IP address coordination between workers
- distributed communication primitives
- coordinated cross-worker preemption support
- checkpoint download shari... |
multiple_instances.py | #!/usr/bin/env python
from __future__ import print_function
from random import choice
from vizdoom import *
# For multiplayer game use process (ZDoom's multiplayer sync mechanism prevents threads to work as expected).
from multiprocessing import Process
# For singleplayer games threads can also be used.
# from threa... |
test_itertools.py | import unittest
from test import support
from itertools import *
import weakref
from decimal import Decimal
from fractions import Fraction
import operator
import random
import copy
import pickle
from functools import reduce
import sys
import struct
import threading
maxsize = support.MAX_Py_ssize_t
minsize = -maxsize-1
... |
simulation.py | '''
Created on Oct 12, 2016
@author: mwittie
'''
import network
import link
import threading
from time import sleep
##configuration parameters
router_queue_size = 0 #0 means unlimited
simulation_time = 1 #give the network sufficient time to transfer all packets before quitting
if __name__ == '__main__':
object_L... |
control.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
客户端崩溃时刻:
1. 发送业务请求之前 -- 正常
2. 发送业务请求之后,第一阶段 recv 之前 -- 正常
3. 第一阶段 recv 之后、ack 之前 -- 正常
4. 第一阶段 ack 之后、第二阶段 recv 前 -- 无解,数据可能不一致,二阶段提交协议弊端
5. 第二阶段 recv 后、ack 之前 -- 未实现,根据日志可恢复(本地事务范围)
6. 第二阶段 ack 之后, recv result 之前 -- 本地事务范围
7. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.