source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
select_ticket_info.py | # -*- coding=utf-8 -*-
import datetime
import random
import os
import socket
import sys
import threading
import time
import TickerConfig
import wrapcache
from agency.cdn_utils import CDNProxy
from config import urlConf, configCommon
from config.TicketEnmu import ticket
from config.configCommon import seat_conf_2, seat_... |
playgroundServer.py | import base64
import json
import os
import random
import re
import sys
import threading
import time
from datetime import datetime
import numpy as np
import tensorflow as tf
import dataHandler as dh
import symbolDNNClassifier as DNNC
import zmq
'''
Model attributes for prediction
'''
classes = 15
tags = ['button', ... |
motion.py | #!/usr/bin/python
import paho.mqtt.client as paho
import time
import pyupm_biss0001
from threading import Thread
motion = pyupm_biss0001.BISS0001(6)
def functionDataSensor():
return motion.value()
def functionDataSensorMqttPublish():
mqttclient = paho.Client()
mqttclient.connect("iot.eclipse.org", 1883,... |
test_views.py | from __future__ import print_function
from __future__ import unicode_literals
from threading import Thread
from django.core.urlresolvers import reverse
from django.conf import settings
from django import forms
from django.http import HttpRequest, QueryDict
from django.test import TestCase
from django.utils.six.moves im... |
discoveryservice.py | import datetime
import threading
import requests
from pymongo import MongoClient
from .discoverygatewaybt import *
from .discoverygatewaylan import *
from . import discoveryconst as const
class DiscoveryService(ServiceAdapter):
def __init__(self):
"""
Initialize the discovery service and the dat... |
remote_console_commands.py | """
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license... |
test_mt_mp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# mt: multithreading
# mp: multiprocessing
import os
import time
import threading as t
import multiprocessing as mp
import sqlite3
import funcy as fy
import pymysql
import sqlalchemy.pool
import mosql.db as modb
def run_in_thread(f, *args, **kwargs):
return t.Th... |
comm.py | import queue
import threading
import paho.mqtt.client as mqtt
from log import HomelabLogger
from config import config
class Session(object):
def __init__(self, func=None) -> None:
self._func = func
self.client = mqtt.Client()
self.client.on_connect = self.on_connect
self.client... |
rdd.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
test_indexes.py | # encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import datetime
import time
from threading import Thread
from django.test import TestCase
from django.utils.six.moves import queue
from test_haystack.core.models import (AFifthMockModel, AThirdMockModel, MockModel, M... |
test_dist_graph_store.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
import dgl
import sys
import numpy as np
import time
import socket
from scipy import sparse as spsp
from numpy.testing import assert_array_equal
from multiprocessing import Process, Manager, Condition, Value
import multiprocessing as mp
from dgl.heterograph_index import cre... |
connection.py | # Copyright (c) 2020 DeNA Co., Ltd.
# Licensed under The MIT License [see LICENSE for details]
# https://github.com/DeNA/HandyRL/blob/master/handyrl/connection.py
'''
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to de... |
input.py | import cv2
import ffmpeg
from time import sleep
from threading import Thread
from queue import PriorityQueue
# from multiprocessing import Queue
from realtime_object_detection.utils.logger import logger
class InputStream:
def __init__(self, src, max_queue_size, fps=None):
self.src = src
self.fp... |
pco_gui.py | __author__ = 'Polychronis Patapis'
from PyQt4 import QtCore, QtGui
from core.pco_definitions import PixelFly
from threading import Thread
import os, time, sys, pickle
import pyqtgraph as pg
from astropy.io import fits
import numpy as np
import matlab.engine
from queue import Empty
import pygame, os, time, pic... |
core.py | """
Copyright (C) Cortic Technology Corp. - All Rights Reserved
Written by Michael Ng <michaelng@cortic.ca>, 2021
"""
import os
import sys
curt_path = os.getenv("CURT_PATH")
sys.path.insert(0, curt_path)
from curt.command import CURTCommands
import paho.mqtt.client as mqtt
import logging
import time
import json
impo... |
coordination_server.py | # Copyright 2017 Yahoo Inc.
# Licensed under the terms of the Apache 2.0 license.
# Please see LICENSE file in the project root for terms.
"""This module contains client/server methods to manage node reservations during TFCluster startup."""
from __future__ import absolute_import
from __future__ import division
from _... |
purls.py | #!/usr/bin/env python
import BaseHTTPServer
import urlparse
import re
from signal import signal, SIGINT, SIGTERM
from sys import exit
import logging
# Actual shortener
from URLShortener import URLShortener
# Option parsing
from docopt import docopt
# Used for control interface
from threading import Thread
import th... |
server.py | #!/usr/bin/env python
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
native_str = str
str = type('')
import sys
PY2 = sys.version_info.major == 2
import io
import os
import shutil
from subprocess import Popen, PIPE
from string import Template
from struct im... |
multi_process_runner_test.py | # Copyright 2019 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... |
anomalydetect.py | '''
Created on Mar 26, 2019
@author: barnwaldo
'''
import time
from core.kbuilder import KStreamBuilder, KStream
from core.kutils import KeyValuePair, KWindow
from kafka import KafkaProducer
from random import randint
from multiprocessing import Process
# config info for Kafka broker
config = {'bootstrap.servers': '... |
saltmod.py | # -*- coding: utf-8 -*-
"""
Control the Salt command interface
==================================
This state is intended for use from the Salt Master. It provides access to
sending commands down to minions as well as access to executing master-side
modules. These state functions wrap Salt's :ref:`Python API <python-ap... |
example3.py | # ch6/example3.py
from multiprocessing import Process, current_process
import time
import os
from os import system, name
def print_info(title):
print(title)
if hasattr(os, 'getppid'):
print('Parent process ID: %s.' % str(os.getppid()))
print('Current Process ID: %s.\n' % str(os.getpid()))
def f... |
bot.py | import configparser
import os
import re
import secrets
import threading
import time
import traceback
from datetime import datetime, timedelta
from os import getenv
import pymongo
import qrcode
import qrcode.image.svg
import requests
from pyrogram import Client, Filters, InlineKeyboardButton, InlineKeyboardMarkup
from ... |
MCTSVanilla.py | from multiprocessing import Queue, Process, cpu_count
import numpy as np
import pytablut.config as cfg
import pytablut.loggers as lg
from pytablut.game import State
class Node:
def __init__(self, state):
"""
each node of represents a state
:param state: state
"""
self.sta... |
microservice.py | import argparse
import os
import importlib
import json
import time
import logging
import multiprocessing as mp
import sys
import seldon_core.persistence as persistence
from distutils.util import strtobool
from seldon_core.flask_utils import ANNOTATIONS_FILE
import seldon_core.wrapper as seldon_microservice
from typing ... |
views.py | import threading
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
from utils.google_search_utils import getSavePage, searchWeb
from .forms import SearchForm
# Create your views here.
# Create your views here.
def home(request):
return render(request, "engine/home.html", {"s... |
test_backend.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
test_weakref.py | import gc
import sys
import unittest
import collections
import weakref
import operator
import contextlib
import copy
import threading
import time
import random
from test import support
from test.support import script_helper, ALWAYS_EQ
from test.support import gc_collect
# Used in ReferencesTestCase.test_ref_created_d... |
coordinator.py | # Copyright 2020 Petuum, Inc. 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... |
test_websocketd_volume.py | from websocket import create_connection
import time
import Queue
import threading
import urllib2
def make_connection(tc, url, connection):
print "Connection %5d" % connection
ws = create_connection(url)
time.sleep(0.2)
print " Connected %5d. Waiting..." % connection
ws.close()
# print " Close... |
cbInteract.py | from threading import Thread
import cmd, time, os, pprint
import cbapi
SERVERURL = "https://172.16.0.154"
APITOKEN = "e917126683af622723eaed989b1f40defcf663af"
historyAll = []
historySizeRetention = 100
historyAlertSearch = []
historyProcessSearch = []
historyProcessEvents = []
historyBinarySearch = []
... |
bridge.py | #!/usr/bin/env python3
import argparse
import atexit
import carla # pylint: disable=import-error
import math
import numpy as np
import time
import threading
from typing import Any
import cereal.messaging as messaging
from common.params import Params
from common.realtime import Ratekeeper, DT_DMON
from lib.can import c... |
engineprocess.py | from abc import ABC
from multiprocessing.queues import Queue
from threading import Thread
import pickle
import logging
import numpy as np
from dataclasses import dataclass
from viz3d.opengl.pygame_engine import ExplorationEngine, Optional, assert_debug, ModelData, Model
# -------------------------------------------... |
tree-orders.py | # python3
import sys, threading
sys.setrecursionlimit(10**6) # max depth of recursion
threading.stack_size(2**27) # new thread will get stack of such size
class TreeOrders:
def read(self):
self.n = int(sys.stdin.readline())
self.key = [0 for i in range(self.n)]
self.left = [0 for i in range(s... |
pg_process.py | import multiprocessing as mp
import queue
import signal
from time import sleep, time
import pyqtgraph as pg
from PyQt5 import QtWidgets
class PGProcess:
def __init__(self, updater, max_freq=60):
self._queue = mp.Queue()
self._exit_event = mp.Event()
args = (
self._queue,
... |
priority_queue_test.py | # Copyright 2016 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... |
vpn_status.py | """
Drop-in replacement for i3status run_watch VPN module.
Expands on the i3status module by displaying the name of the connected vpn
using pydbus. Asynchronously updates on dbus signals unless check_pid is True.
Configuration parameters:
cache_timeout: How often to refresh in seconds when check_pid is True.
... |
bfo_experiments.py | import multiprocessing as mp
import numpy as np
import pandas as pd
from niapy.task import Task
from niapy.algorithms.basic import (
BacterialForagingOptimization,
DifferentialEvolution,
ParticleSwarmAlgorithm,
BatAlgorithm,
)
from niapy.algorithms.basic.de import cross_rand1
def to_latex(df, filename... |
twitch.py | import irc.client
import logging
import re
import requests
import time
from threading import Thread
from .env import env
TWITCH_API = "https://api.twitch.tv/kraken/"
TWITCH_API_HELIX = "https://api.twitch.tv/helix/"
TWITCH_SERVER = "irc.chat.twitch.tv"
TWITCH_PORT = 6667
logger = logging.getLogger("twitch-bot")
cl... |
dark_reaper.py | # Copyright 2016-2018 CERN for the benefit of the ATLAS collaboration.
#
# 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... |
garbage_collector.py | """
Module for garbage collector checks.
"""
from typing import Any, Callable, List
def check_gc_referrers(typename: Any, w_obj: Callable, name: str) -> None:
"""
Check if any variable is getting out of control.
Great for checking and tracing memory leaks.
"""
import threading
import time
... |
__init__.py | # -*- coding: utf-8 -*-
''' Implements the main InputStream Helper class '''
from __future__ import absolute_import, division, unicode_literals
import os
from inputstreamhelper import config
from .kodiutils import (addon_profile, browsesingle, get_addon_info, get_proxies, get_setting, jsonrpc, kodi_to_ascii, localize,
... |
poppy_origin_helpers.py | # Minet Origin node identification functions
# Import modules
import networkx as nx
import multiprocessing as mp
# Import scripts
from poppy_helpers import *
def find_start_comp_nodes(network):
"""Returns a list starting compound nodes in a MINE network."""
start_comp_nodes = []
for node in network.nodes... |
remotepy.py | # -*- coding: utf8 -*-
# Copyright (c) 2019 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, mo... |
encode_png_benchmark.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... |
git_common.py | # Copyright 2014 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.
# Monkeypatch IMapIterator so that Ctrl-C can kill everything properly.
# Derived from https://gist.github.com/aljungberg/626518
from __future__ import prin... |
MainRunner.py |
import datetime
import logging
import threading
import time
import traceback
from multiprocessing import Process, Value
from BiliLive import BiliLive
from DanmuRecorder import BiliDanmuRecorder
class MainRunner():
def __init__(self, config):
self.config = config
self.prev_live_status = False
... |
test_poplib.py | """Test script for poplib module."""
# Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL
# a real test suite
import poplib
import socket
import os
import errno
import threading
from unittest import TestCase, skipUnless
from test import support as test_support
from test.support import hashlib_help... |
create_images.py | #!/usr/bin/env python3
#
# Copyright 2018 The Bazel 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 ... |
local.py | import pika, os, logging, re
from servoCamera import *
import threading
'''
Authors:
Alejandro Ortega Martinez: alejandro.ormar@gmail.com
Juan Luis Garcia Gonzalez: jgg1009@alu.ubu.es
'''
'''
Script that creates the connection with the AMQP server
and listen for messages about how the camera ... |
db.py | # Copyright 2017 Google 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 agreed to in writing, ... |
groupme.py | from WindowsNotification import notify
import requests
import ssl
import json
import threading
import time
import os
import websocket
import SimpleHTTPServer
import SocketServer
import webbrowser
class GroupMe:
request_URL = "oauth.groupme.com/oauth/authorize?client_id=DRHcjc2QwMkHNtoB0dP6o3skAzIhhVo2j9oja3d26c0... |
MyThreadClass_lock.py | import threading
import time
konci = threading.Lock()
#lock = digunakan untuk block sebuah thread untuk melakukan execute sebelum thread lain beres
def orang_pertama(konci):
konci.acquire()
print('orang - 1 sedang menggunakan kamar mandi')
time.sleep(1)
print('orang - 1 sudah selesai')
konci.relea... |
threaded.py | # -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... |
3_train_model.py | #!/usr/bin/python3
from constants import *
from crate.client import connect
from threading import Thread
import numpy as np
import sys
import pickle
import base64
import io
import time
import json
from sklearn.preprocessing import StandardScaler
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_sel... |
microservice.py | import argparse
import os
import importlib
import json
import time
import logging
import multiprocessing as mp
import threading
import sys
from typing import Dict, Callable
from distutils.util import strtobool
from seldon_core import persistence, __version__, wrapper as seldon_microservice
from seldon_core.metrics im... |
wifijammer.py | #!/usr/bin/env python
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up Scapy
from scapy.all import *
conf.verb = 0 # Scapy I thought I told you to shut up
import os
import sys
import time
from threading import Thread, Lock
from subprocess import Popen, PIPE
from signal import SIGINT,... |
test_states_server.py | # -*- coding: utf-8 -*-
from .context import services
import threading
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.request import urlopen
import json, socket
import unittest
import sys
class StatesHTTPRequestTestSuite(unittest.TestCase):
def test_states_request(self):
... |
receiver.py | # Copyright 2018 Dalton Durst
#
# 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 ... |
mq_client.py | from mq_client_consumer import consumer
from mq_client_producer import producer
from threading import Thread
if __name__ == "__main__":
# Ideally these would be your logic
# on the flow of the data, before and after
# prediction.
# Producer Thread
p = Thread(target=producer)
p.start()
# C... |
process.py | import logging
import os
from queue import Queue as PyQueue
import re
import threading
import weakref
import asyncio
import dask
from .utils import mp_context, TimeoutError
from tornado import gen
from tornado.concurrent import Future
from tornado.ioloop import IOLoop
logger = logging.getLogger(__name__)
def _loo... |
threading_11_philosopher.py | """
哲学家就餐问题
五位哲学家围坐在一张桌子前,每个人 面前有一碗饭和一只筷子。
在这里每个哲学家可以看做是一个独立的线程,而每只筷子可以看做是一个锁。
每个哲学家可以处在静坐、 思考、吃饭三种状态中的一个。需要注意的是,每个哲学家吃饭是需要两只筷子的,
这样问题就来了:如果每个哲学家都拿起自己左边的筷子, 那么他们五个都只能拿着一只筷子坐在那儿,直到饿死。
"""
import threading
from contextlib import contextmanager
_local = threading.local()
@contextmanager
def acquire(*locks):
# 使用锁对象... |
Thread02.py | #Python Thread Synchronization(동기화) 예제2
import threading
tot = 0
lock = threading.Lock()
def add_total(amount):
"""
쓰레드에서 실행 할 함수
전역변수 tot에 amount 더하기
"""
global tot
lock.acquire()
try:
tot += amount
finally:
lock.release()
print (threading.currentThread().getNa... |
test_asyncore.py | import asyncore
import unittest
import select
import os
import socket
import sys
import time
import warnings
import errno
import struct
from test import support
from test.support import TESTFN, run_unittest, unlink, HOST, HOSTv6
from io import BytesIO
from io import StringIO
try:
import threading
except ImportErr... |
utils.py | # coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
run_examples.py | # -------------------------------------------------------------------------------------------------------------------- #
# external imports
# ----------------
import sys
import traceback
import pandas as pd
import multiprocessing as mp
# src imports
# -----------
import src.misc.config as config
from src.misc.init_mod... |
fsfreezer.py | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 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
#
# U... |
ib_gateway.py | """
IB Symbol Rules
SPY-USD-STK SMART
EUR-USD-CASH IDEALPRO
XAUUSD-USD-CMDTY SMART
ES-202002-USD-FUT GLOBEX
SI-202006-1000-USD-FUT NYMEX
ES-2020006-C-2430-50-USD-FOP GLOBEX
"""
from copy import copy
from datetime import datetime
from threading import Thread, Condition
from typing import Optional
import shelve... |
gui.py | import base64
import json
import threading
import os
from tkinter import *
import websocket
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA
import helpers
import gui_layouts
private_key, public_key = None, None
with open("otherPrK.pem") as f:
private_key = RSA.import_key(f.read())
with open... |
test_pynative_hccl.py | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
auto_friends_add.py | from ...objects import dp, MySignalEvent, DB
from ... import utils
from threading import Thread, Timer
import time
from vkapi import VkApi, VkApiResponseException
import typing
import logging
logger = logging.getLogger(__name__)
afa_thread: Thread = None
stop_thread = False
def set_afa(v):
global... |
pinger_process.py | import os
import time
import multiprocessing
def pinger():
pinger = os.popen('ping www.bbc.co.uk')
print list(pinger)
if __name__ == '__main__':
processes = []
for _ in range(4):
p = multiprocessing.Process(target=pinger)
processes.append(p)
start = time.clock()
for proces... |
AutoGenParallel.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: Joseph Tarango
# *****************************************************************************/
##################################################################################... |
XBOX_threading_test.py | '''
Date: 2021-11-09 16:29:29
LastEditors: Guo Yuqin,12032421@mail.sustech.edu.cn
LastEditTime: 2021-11-10 21:02:30
FilePath: /IMU_Python_Reading/Python_multiThread/XBOX_threading_test.py
'''
from queue import Queue
from threading import Thread
from Xbox_value import XBOX_class
import numpy as np
## create a thr... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
rtasr_demo.py | #-*- encoding:utf-8 -*-
import sys
import hashlib
from hashlib import sha1
import hmac
import base64
from socket import *
import json, time, threading
from websocket import create_connection
import websocket
from urllib import quote
import logging
reload(sys)
sys.setdefaultencoding("utf8")
logging.bas... |
ytmp3.py | import logging
import requests
import sys
import inspect
from os import path
from threading import Thread
from youtube_dl import YoutubeDL
from ytsearch import ytsearch
class ytmp3(object):
options = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
... |
conftest.py | import asyncio
import json
import threading
import time
import pytest
import yaml
from uvicorn import Config, Server
class TestServer(Server):
@property
def address(self):
return f"http://{self.config.host}:{self.config.port}"
def install_signal_handlers(self):
pass
async def app(scope... |
partial.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# flake8: noqa
import multiprocessing
from builtins import _test_sink, _test_source
from functools import partial
def a_flows_to_sink(a, b... |
bitbucket.org_servant.py | # url for searches: https://bitbucket.org/repo/all?name=survari
# search for all lines structured like:
# <a class="repo-link" href="/user/repo">user / repo</a>
import requests
import json
import sys
import urllib
import threading
import re
query = ""
for arg in sys.argv[1:]:
if arg.find(" "):
quer... |
server.py | import socket
import threading
import datetime
host = "127.0.0.1"
port = 6001
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((host, port))
server.listen(5)
allsockets = {}
allthreads = []
def sendAllClients(msg, dontSendTo="None"):
for t in allsockets.keys():
if t =... |
marshal.py | # Copyright 2019 Atalaya Tech, 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 agreed to in writing, ... |
test_downloader_http.py | #!/usr/bin/env python3
# Allow direct execution
import os
import re
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import threading
from test.helper import http_server_port, try_rm
from yt_dlp import YoutubeDL
from yt_dlp.compat import compat_http_server
fr... |
tictactoe.py | from random import randint, choices, choice
from tinge import colored
import threading
import subprocess
# different marker for board to make it look interesting
markers = [
("\U0000274C", "\U00002B55"),
("\U0001F642", "\U0001F975"),
("\U0001F60E", "\U0001F974"),
("\U0001F620", "\U0001F608"),
]
def we... |
videoreader.py | # import the necessary packages
from threading import Thread
from cv2 import VideoCapture
from queue import Queue
class VideoReader:
def __init__(self, video_path, max_queue=50):
self.stream = VideoCapture(video_path)
self.queue = Queue(maxsize=max_queue)
self.stop_queue_updating = False ... |
tests.py | # -*- coding: utf-8 -*-
import random
import socket
import threading
import unittest
from coapthon.messages.response import Response
from coapthon.messages.request import Request
from coapthon import defines
from coapthon.serializer import Serializer
from plugtest_coapserver import CoAPServerPlugTest
__author__ = 'Gia... |
tensorflow_serving_client_workload.py | """Tensorflow Serving client workload.
Performs image classification requests against a Tensorflow Model Server.
Inspired by
https://github.com/tensorflow/serving/blob/master/tensorflow_serving/example/resnet_client_grpc.py
This client-side load generator does the following:
* launches a specified number of worker ... |
test3.py | import multiprocessing as mp
import subprocess as sp
import sys
import os
import io
import msvcrt
# pass file handle
def wri(fh):
fd = msvcrt.open_osfhandle(fh,0)
print(fd,fh)
if 0:
f=os.fdopen(fd,'wb')
f.write('to\n')
f.write('jest\n')
f.write('test\n')
f.flush()
os.write(fd,b'to\n')
os.write(fd,b'jes... |
conftest.py | # shapely has to be imported before rasterio to work around
# https://github.com/Toblerity/Shapely/issues/553
import shapely.geometry # noqa: F401
import os
import multiprocessing
import time
from functools import partial
import pytest
import numpy as np
import rasterio
def pytest_configure(config):
os.enviro... |
sandbox.py | import os
import threading
from base64 import b64decode
from contextlib import contextmanager
from functools import wraps
from os.path import abspath
from pathlib import Path
from random import randrange
from subprocess import CalledProcessError
from typing import Optional
import requests
from flask import Flask, abor... |
tl_poke_controller_worker.py |
import sys
from os import path
current_dir = path.dirname(path.abspath(__file__))
while path.split(current_dir)[-1] != r'Heron':
current_dir = path.dirname(current_dir)
sys.path.insert(0, path.dirname(current_dir))
import numpy as np
import serial
import threading
import pandas as pd
from datetime import datetim... |
execution_manager.py | """
`madats.management.execution_manager`
====================================
.. currentmodule:: madats.management.execution_manager
:platform: Unix, Mac
:synopsis: Module that manages the execution of workflow tasks
.. moduleauthor:: Devarshi Ghoshal <dghoshal@lbl.gov>
"""
from madats.utils import dagman
from ma... |
parec.py | import threading
import subprocess
import sys
def setupAudioConfig(ac, ww):
ww.setnchannels(ac.getChannels())
ww.setsampwidth(ac.getSampleWidth())
ww.setframerate(ac.getFramerate())
def parseAudioConfig(ac):
return '--channels={} --format={} --rate={}'.format(ac.getChannels(), ac.getFormat(), ac.getF... |
ThreadTest.py | import unittest
import threading
import time
import random
class MyTestCase(unittest.TestCase):
def test_thread_fun(self):
print("thread run ", random.random(), threading.currentThread().getName())
time.sleep(1)
def test_thread(self):
thread1 = threading.Thread(target=self.test_threa... |
vnokex.py | # encoding: UTF-8
import hashlib
import zlib
import json
from time import sleep
from threading import Thread
import traceback
import websocket
import requests
import sys
# API文档 https://github.com/okcoin-okex/OKEx.com-api-docs
from vnpy.api.okex.okexData import SPOT_TRADE_SIZE_DICT,SPOT_ERROR_DICT, FUTURES_ERROR_DIC... |
iterators.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
## Overview
This part of the documentation covers the __advanced usage__ of Infinibatch by assembling __custom data loading pipelines__.
Before you continue, please go through the tutorial on the top-level of the documentation of the `infini... |
runebase_transaction_receipt_origin_contract_address.py | #!/usr/bin/env python3
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
from test_framework.address import *
import threading
def waitforlogs(node, contract_address):
logs = node.cli.waitforlo... |
test_pool.py | """Test pool."""
import threading
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from homeassistant.components.recorder.const import DB_WORKER_PREFIX
from homeassistant.components.recorder.pool import RecorderPool
async def test_recorder_pool_called_from_event_loop():
... |
LoadBalancer.py | import socket
import threading
from scapy.all import *
firstIface = 'eth0'
firstIfaceFlows = ['52:54:00:42:84:65', '52:54:00:4a:f7:66']
secondIface = 'eth1'
secondIfaceFlows = ['52:54:00:a1:54:c0']
thirdIface = 'eth2'
thirdIfaceFlows = ['52:54:00:d3:a3:df']
def inOutServer():
global firstIface
global secondI... |
DesktopPet.py | from flask import Flask, jsonify, request
from util.pathLoader import CONF_PATH, init_conf_path
from util.window import root, gs, playMeow
from PyQt5.QtWidgets import QApplication
import sys
import threading
import json
from flask_cors import CORS
import os
from util.edit import delWebSite, addWebSite
flask_app = Flask... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.