source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
integration_test_support.py | # flask-hello-world
# Copyright 2012-2013 Michael Gruber, Alexander Metzner
#
# 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
#
# ... |
braille.py | # -*- coding: UTF-8 -*-
#braille.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2008-2018 NV Access Limited, Joseph Lee, Babbage B.V., Davy Kager, Bram Duvigneau
import sys
import itertools
import os... |
v2_serving.py | # Copyright 2018 Iguazio
#
# 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, softwa... |
tanenbaum.py | # Tanenbaum's solution
from threading import Semaphore, Thread
import time
from typing import Callable
def solution__tanenbaum():
PHILOSOPHERS = 5
state = ['thinking'] * PHILOSOPHERS
sem = [Semaphore(0) for _ in range(PHILOSOPHERS)]
mutex = Semaphore(1)
def philosopher(i: int, stop: Callable):... |
create_process_get_result__communication__Queue.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from multiprocessing import Process, Queue
def f(q, name):
q.put('Hello, ' + name)
if __name__ == '__main__':
q = Queue()
p = Process(target=f, args=(q, 'bob'))
p.start()
print(q.get()) # Hello, bob
p.join()
|
bucketloader.py | # this script will connect to the node in the given ini file and create "n" buckets
# and load data until program is terminated
# example python bucketloader.py -i node.ini -p count=6,delete=True,load=True,bucket_quota=219,prefix=cloud,threads=2
# it will delete all existing buckets and create 6 buckets each 219 MB and... |
server.py | '''
Run this file before playing in Arena mode.
This code has been sourced in its entirely from the provided module. Only few
small changes have been made to adjust to the variables I was using.
https://kdchin.gitbooks.io/sockets-module-manual/content/
'''
####################################
# Modules
###############... |
opencv.py | import logging
from collections import deque
from contextlib import contextmanager
from itertools import cycle
from time import monotonic, sleep
from threading import Event, Thread
from typing import (
Callable, ContextManager, Deque, Iterable, Iterator,
Generic,
Optional,
TypeVar
)
from cv2 import cv2... |
tutorial_wms.py | """
mss.tutorials.tutorial_wms
~~~~~~~~~~~~~~~~~~~~~~~~~~
This python script generates an automatic demonstration of how to use the web map service section of Mission
Support System and plan flighttracks accordingly.
This file is part of mss.
:copyright: Copyright 2021 Hrithik Kumar Verma
... |
vidIO.py | #!/usr/bin/env python3
import cv2
import numpy as np
from time import perf_counter, sleep
from queue import Queue
from threading import Thread, Event
from pcv.interact import DoNothing, waitKey
from pcv.source import VideoSource
class BlockingVideoWriter(cv2.VideoWriter):
''' A cv2.VideoWriter with a context man... |
test_pipeline_process.py | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
test_utils.py | # -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding 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 require... |
deepnano2_caller_gpu.py | #!/usr/bin/env python
from ont_fast5_api.fast5_interface import get_fast5_file
import argparse
import os
import numpy as np
import datetime
import deepnano2
from torch import multiprocessing as mp
from torch.multiprocessing import Pool
import torch
from deepnano2.gpu_model import Net
from tqdm import tqdm
# TODO: cha... |
test_base_events.py | """Tests for base_events.py"""
import errno
import logging
import math
import os
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from asyncio import events
from test.test_asyncio import utils a... |
run.py | """
2 THREADS:
single thread calc 245.961
single thread calc_release 242.391
2 thread calc 251.481
2 thread calc_release 130.035
4 THREADS:
single thread calc 253.464
single thread calc_release 247.712
4 thread calc 251.756
4 thread calc_release 103.160
single thread calc 242.183
single thread calc_release 242.092
4 ... |
test_utils.py | """Utilities shared by tests."""
import collections
import contextlib
import io
import logging
import os
import re
import socket
import socketserver
import sys
import tempfile
import threading
import time
import unittest
import weakref
from unittest import mock
from http.server import HTTPServer
from wsgiref.simple_... |
single_process_with_api.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage:
single_process_with_api [options]
Options:
-h, --help Show this page
--debug Show debug logging
--verbose Show verbose logging
-n=<i> n [default: 1000000]
--partition=<p> Partition
--ke... |
SQL_to_JSON.py | import sys
from subprocess import Popen, PIPE
from threading import Thread
from queue import Queue, Empty
mongoQuery = "db."
SQL_Logical_Operators = {"AND": "$and", "NOT": "$not", "OR": "$or"}
SQL_Comparison_Operators = {"=": "$eq", "!=": "$ne", "<>": "$ne", ">": "$gt", "<": "$lt", ">=": "$gte", "<=": "$lte", "!<": "... |
fetch_parallel.py | import urllib.request
import urllib.parse
import urllib.error
import pathlib
import os
import threading
import concurrent.futures
import time
import urllib3
import queue
def read_url(url, queue):
try:
data = urllib.request.urlopen(url, None, 15).read()
print(f"Fetched {len(data)} from {url}")
... |
test_toggle_fullscreen.py | import pytest
import threading
from .util import run_test, destroy_window
def toggle_fullscreen():
import webview
def _toggle_fullscreen(webview):
webview.toggle_fullscreen()
t = threading.Thread(target=_toggle_fullscreen, args=(webview,))
t.start()
destroy_window(webview)
webview.c... |
net.py | """
Handles P2P connections.
All networking functions are ultimately done through
this class.
"""
import hashlib
import signal
import zlib
from ast import literal_eval
from .nat_pmp import NatPMP
from .rendezvous_client import *
from .unl import UNL
from .upnp import *
# How many times a single messa... |
debug_events_writer_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... |
multiprocessing_garbage_collection_prevention.py | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# {fact rule=multiprocessing-garbage-collection-prevention@v1.0 defects=1}
def garbage_collect_noncompliant(self):
from multiprocessing import Pipe
pipe = Pipe()
try:
# Trigger a refresh.
... |
tello_py3.py | import socket
import threading
import time
from stats_py3 import Stats
class Tello:
def __init__(self):
self.local_ip = ''
self.local_port = 8889
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # socket for sending cmd
self.socket.bind((self.local_ip, self.local_port... |
xtpGateway.py | # encoding: UTF-8
'''
vn.xtp的gateway接入
'''
import os
import json,copy
import traceback
from vnpy.api.xtp import *
from vnpy.trader.vtGateway import *
from vnpy.trader.vtFunction import getJsonPath, getTempPath
from vnpy.trader.vtUtility import BarGenerator
from pytdx.hq import TdxHq_API
from multiprocessing.dummy im... |
multiobj_ops_threads.py | import time
class SomeClass(object):
def __init__(self):
self.c=0
def do(self):
for i in range(100):
time.sleep(0.01) # sleep makes the os continue another thread
self.c = self.c + 1
print( self.c)
import threading
threads = []
for _ in range(100):
... |
smoke-tests.py |
"""Basic tests to ensure all the browsers are launchable with the COM server
"""
import sys, os, unittest, threading, time, multiprocessing, BaseHTTPServer
from win32com import client #http://sourceforge.net/projects/pywin32/files/pywin32/
SERVER_ADDRESS = ('127.0.0.1', 9393)
SERVER_PAGE = """
<html>
<head>
<ti... |
bridge_dino_carla.py | #!/usr/bin/env python3
# type: ignore
import time
import math
import atexit
import numpy as np
import threading
import random
import cereal.messaging as messaging
import argparse
from common.params import Params
from common.realtime import Ratekeeper
from lib.helpers import FakeSteeringWheel
STEER_RATIO = 25.
parser ... |
row_mat_bit_no_rec.py | #!/usr/bin/python
#
# This file is part of PyRQA.
# Copyright 2015 Tobias Rawald, Mike Sips.
"""
RQA, Fixed Radius, OpenCL, RowMatBitNoRec
"""
import numpy as np
import os
import pyopencl as cl
import threading
import Queue
from ....abstract_classes import AbstractRunnable
from ....opencl import OpenCL
from ....pro... |
test_daemon_factory.py | import functools
import logging
import pprint
import re
import sys
import time
import attr
import psutil
import pytest
from pytestskipmarkers.utils import platform
from saltfactories.bases import Daemon
from saltfactories.exceptions import FactoryNotRunning
from saltfactories.exceptions import FactoryNotStarted
from ... |
ucomm_relay_server.py | #!/usr/bin/env python
#
# Cloudlet Infrastructure for Mobile Computing
#
# Author: Kiryong Ha <krha@cmu.edu>
# Zhuo Chen <zhuoc@cs.cmu.edu>
#
# Copyright (C) 2011-2013 Carnegie Mellon University
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in com... |
named_threads.py | import threading
import time
def worker():
print( threading.currentThread().getName(), 'Starting')
time.sleep(2)
print( threading.currentThread().getName(), 'Exiting')
def my_service():
print( threading.currentThread().getName(), 'Starting')
time.sleep(3)
print( threading.currentThread().getNa... |
utils.py | import threading
from pathlib import Path
import playsound
import rpipes
from rpipes.border import draw_boundary
def get_int_input(prompt: str, x: int, y: int) -> int:
"""Ask for integer input with `prompt` positioned at `x`, `y`."""
print(rpipes.terminal.clear, end="")
draw_boundary()
previous_inpu... |
detection_thread.py | """Thread for processing object detection."""
import logging
import threading
import time
from datetime import datetime
from multiprocessing.context import Process
import cv2
import imutils
from PIL import Image
from edgetpu_server.image_writer_thread import ImageWriterThread
from edgetpu_server.models.detection_enti... |
server.py | ########### Please use python3 to run the codes. ##########
########### Usage: python3 server.py port_number try_times ###########
############ This program is simulate the server behaviour with different functions ########
from socket import *
import sys
import time
import datetime
import threading
#check the input ... |
test_gil_scoped.py | # -*- coding: utf-8 -*-
import multiprocessing
import threading
from pybind11_tests import gil_scoped as m
def _run_in_process(target, *args, **kwargs):
"""Runs target in process and returns its exitcode after 10s (None if still alive)."""
process = multiprocessing.Process(target=target, args=args, kwargs=kwa... |
inference_throughput.py | #!/usr/bin/env python3
'''aionfpga ~ inference throughput
Copyright (C) 2020 Dominik Müller and Nico Canzani
'''
import sys
import math
import base64
import ctypes
from threading import Thread
from datetime import datetime
import cv2
import numpy as np
from dnndk import n2cube
from pynq_dpu import DpuOverlay
impo... |
base_crash_reporter.py | # Electrum - lightweight Bitcoin client
#
# 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, modify, merge,
# publish... |
__init__.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2021 -- Lars Heuer
# All rights reserved.
#
# License: BSD License
#
"""\
QR Code and Micro QR Code implementation.
"QR Code" and "Micro QR Code" are registered trademarks of DENSO WAVE INCORPORATED.
"""
from __future__ import absolute_import, unicode_literals
import sy... |
test_context.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import gc
import logging
from multiprocessing import Process
import os
import random
import sys
import time
from shellbot import Context
class ContextTests(unittest.TestCase):
def setUp(self):
self.context = Context()
def tearDown(self)... |
__init__.py | # some worker's process function
from minibatch import connectdb, Stream, streaming
from minibatch.example.util import clean
def consumer():
# process window.data. maybe split processing in parallel... whatever
# @stream('test', size=2, emitter=SampleFunctionWindow)
# @stream('test', interval=5)
# @s... |
ionosphere.py | from __future__ import division
import logging
import os
from os import kill, getpid, listdir
from os.path import join, isfile
from sys import version_info
try:
from Queue import Empty
except:
from queue import Empty
from time import time, sleep
from threading import Thread
# @modified 20190522 - Task #3034: Re... |
test_cuttlepool.py | # -*- coding: utf-8 -*-
"""
CuttlePool tests.
"""
import gc
import threading
import time
import pytest
# Travis CI uses pytest v2.9.2 for Python 3.3 tests. Any fixtures that yield
# a resource using pytest <= v2.9.2 should use yield_fixture explicitly,
# otherwise use fixture as per the docs.
if int(pytest.__version_... |
HTTPDownloader.py | # Written by John Hoffman
# see LICENSE.txt for license information
from BitTornado.CurrentRateMeasure import Measure
from random import randint
from urlparse import urlparse
from httplib import HTTPConnection
from urllib import quote
from threading import Thread
from BitTornado.__init__ import product_name,v... |
run_benchmarks.py |
import os, sys, subprocess, re, time, threading
last_benchmarked_commit_file = '.last_benchmarked_commit'
def log(msg):
print(msg)
FNULL = open(os.devnull, 'w')
benchmark_runner = os.path.join('build', 'release', 'benchmark', 'benchmark_runner')
out_file = 'out.csv'
log_file = 'out.log'
benchmark_results_folder... |
sauce.py | import csv
import os
import subprocess
import threading
# Gather the packages to test.
PREFIX = './packages/node_modules/'
CISCOSPARK = os.path.join(PREFIX, '@ciscospark')
WEBEX = os.path.join(PREFIX, '@webex')
PROD_ENV_VARS = {
# 'ACL_SERVICE_URL': 'https://acl-a.wbx2.com/acl/api/v1', ?
'ATLAS_SERVICE_URL': 'ht... |
test_selenium.py | import re
import threading
import time
import unittest
from selenium import webdriver
from app import create_app, db
from app.models import Role, User, Post
class SeleniumTestCase(unittest.TestCase):
client = None
@classmethod
def setUpClass(cls):
try:
cls.client = webdriver.Chrome()
... |
batch.py | """
OEvent: Oscillation event detection and feature analysis.
batch.py - runs analysis on a set of files
Written by Sam Neymotin (samuel.neymotin@nki.rfmh.org) & Idan Tal (idan.tal@nki.rfmh.org)
References: Taxonomy of neural oscillation events in primate auditory cortex
https://doi.org/10.1101/2020.04.16.045021
"""
fr... |
load.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 Capital One Services, LLC
#
# 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 ... |
PC_Miner.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Python PC Miner (v2.6.1)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
# Import libraries
import sys
from configparser import ... |
test_forward.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
display_server.py | #######################################################
# Display Server - Handle multiple requests by queuing
#######################################################
import queue
import threading
class DisplayServer:
def __init__(self, config):
try:
if config.model == 'SSD1306':
... |
test_pool.py | import threading
import time
from sqlalchemy import pool, select, event
import sqlalchemy as tsa
from sqlalchemy import testing
from sqlalchemy.testing.util import gc_collect, lazy_gc
from sqlalchemy.testing import eq_, assert_raises, is_not_, is_
from sqlalchemy.testing.engines import testing_engine
from sqlalchemy.te... |
face_detector_tutorial_node.py | #!/usr/bin/env python
import rospy
import numpy as np
import math
from duckietown_msgs.msg import Twist2DStamped
from sensor_msgs.msg import CompressedImage, Image
from cv_bridge import CvBridge, CvBridgeError
import cv2
import sys
import time
import threading
class face_detector_wama(object):
def __init__(self):
s... |
__init__.py | from .. import db
from sqlalchemy.exc import DatabaseError
from threading import Thread
def add_to_database(obj):
try:
db.session.add(obj)
db.session.commit()
return True
except DatabaseError:
db.session.rollback()
return False
def wait_in_other_thread(func, callback)... |
bot.py | #!/usr/bin/env python
# (c) 2011 Anton Romanov
#
#
"""
"""
import os, imp, sys,threading,inspect
import re, struct
import socket, asyncore, asynchat
from hon import masterserver,packets
from struct import unpack
from hon.honutils import normalize_nick
import time
from hon.honutils import normalize_nick
from utils.dep ... |
HRM.py | # Copyright 2021 by RaithSphere
# With thanks to Ryuvi
# All rights reserved.
# This file is part of the NeosVR-HRM,
# and is released under the "MIT License Agreement". Please see the LICENSE
# file that should have been included as part of this package.
import argparse
import configparser
import logging
import math
... |
monitoringservice.py | import datetime
import logging as log
import threading
import time
from pymongo import MongoClient
from . import discoveryconst as const
class MonitoringService:
def __init__(self):
"""
Initialize the monitoring service and all database collections.
"""
self.db_client = MongoClie... |
test_context.py | # -*- coding: utf-8 -*-
"""
tests.unit.context_test
~~~~~~~~~~~~~~~~~~~~
"""
# Import python libs
from __future__ import absolute_import
import threading
import time
import salt.ext.tornado.gen
import salt.ext.tornado.stack_context
# Import Salt libs
import salt.utils.json
from salt.ext.six.moves import rang... |
display_server.py | import threading
import Adafruit_SSD1306
import time
import PIL.Image
import PIL.ImageFont
import PIL.ImageDraw
from flask import Flask
from .utils import ip_address, cpu_usage, memory_usage, disk_usage, temp
from pidisplay import ads1115
from pidisplay import ina219
import os
class DisplayServer(object):
def... |
listen.py | # -*- coding: utf-8 -*-
import socket
import logging
from errno import ENOPROTOOPT
import time
import threading
from .upnp_class import UPNPObject
SSDP_PORT = 1900
SSDP_ADDR = '239.255.255.250'
def listen(timeout, log_level=None):
logger = logging.getLogger('UPNP_Devices')
logger.setLevel(logging.NOTSET)
... |
service_async.py | # Copyright (c) 2018 http://reportportal.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
aws_backend.py | """AWS implementation of backend.py
Not thread-safe
"""
import glob
import os
import pprint
import shlex
import signal
import stat
import threading
import time
from typing import Tuple, List
import paramiko
from ncluster import ncluster_globals
from . import aws_create_resources as create_lib
from . import aws_util... |
train_pg_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany
"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
import gym... |
state.py | # -*- coding: utf-8 -*-
"""This class maintains the internal dfTimewolf state.
Use it to track errors, abort on global failures, clean up after modules, etc.
"""
from __future__ import print_function
from __future__ import unicode_literals
import sys
import threading
import traceback
from dftimewolf.lib import erro... |
runner.py | #!/usr/bin/python
import base64
import donlib
import io
import cortexlib
import os
import sys
import threading
import time
from halocelery import tasks
from halocelery.apputils import Utility as util
from collections import deque
def main():
global slack_inbound
global slack_outbound
global health_string... |
executorselenium.py | import json
import os
import socket
import threading
import time
import traceback
import urlparse
import uuid
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
extra_timeout,
st... |
lcd20x4_i2c.py | #!/usr/bin/env python2.7
"""Handle messages from Node-RED and display them on the LCD"""
# Topic: Send message to 20x4 LCD
#
# file : LCD20x4-I2C.py
import time
import threading
import json
import sys
import math
import lcddriver
if len(sys.argv) == 5:
CMD = sys.argv[1].lower()
LCD_TYPE = sys.argv[2].lower()... |
diff-filterer.py | #!/usr/bin/python
#
# 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 r... |
test_remote.py | import threading
import time
import unittest
from jina.logging import get_logger
from jina.main.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_t... |
Faster_RCNN_data_multiprocessing.py | from multiprocessing import Process, Manager
from PIL import Image, ImageDraw
from tqdm import tqdm
import tensorflow as tf
import numpy as np
import scipy.misc
import random
import math
import json
import sys
import cv2
import os
class Data(object):
def __init__(self, dataset_root, proposal_root, COCO_name_file):
... |
lisp-rtr.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... |
ttsx.py | from threading import Thread
import pyttsx3
def do_ttsx(s, voice, non_blocking=True):
def _do_say():
engine = pyttsx3.init()
engine.setProperty('voice', voice)
engine.say(s)
engine.runAndWait()
if non_blocking:
t = Thread(target=_do_say)
t.daemon = True
... |
provisioning.py | #!/usr/bin/env python3
import fileinput
import inspect
import os
import re
import subprocess
import time
from datetime import datetime
from multiprocessing import Process
from subprocess import PIPE
env = dict(os.environ)
env['PATH'] = f"{env['PATH']}:/usr/local/bin"
env['BRANCH'] = 'master' if not env.get('BRANCH') e... |
base_camera.py | import time
import threading
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
class CameraEvent(object):
"""An Event-like class that signals all active clients when a new frame is
... |
test_operator.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
test.py | import pytest
import time
import psycopg2
import os.path as p
import random
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import assert_eq_with_retry
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
from helpers.test_tools import TSV
from random import randrange
import threading
clu... |
sdca_ops_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... |
impl_rabbit.py | # Copyright 2011 OpenStack Foundation
#
# 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 l... |
SuperchargedBots.py | from __future__ import annotations
import configparser
import math
import os
from threading import Thread
from traceback import print_exc
from typing import List
import numpy as np
from rlbot.agents.base_script import BaseScript
from rlbot.messages.flat.PlayerInputChange import PlayerInputChange
from rlbo... |
stream_server.py | """
Module to handle one or more clients requesting video stream.
Using async with intentional blocking sockets because I had issues using
async non-blocking sockets, and because it yielded much better performance
compared to threading only prototype.
"""
import asyncio as aio
import socket
import logging
import queu... |
test_pyca.py | import sys
import time
import threading
import logging
import pytest
import numpy as np
import pyca
from conftest import test_pvs, pvbase
if sys.version_info.major >= 3:
long = int
logger = logging.getLogger(__name__)
class ConnectCallback(object):
def __init__(self, name):
self.name = name
... |
cluster.py | # Copyright (c) 2021 MIT
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
... |
ayylmao.py | from Tkinter import *
from ScrolledText import *
import socket, select, sys, time, json, threading
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
class Server:
def __init__(self, app):
self.app = app
self.server = socket.socket(socket.AF_... |
asyncimagesender.py | from imagezmq.imagezmq import ImageSender
from queue import Queue
import time
import threading
from logging import getLogger
"""
Class used to simplify the sending of images in an asychronous fashion.
See tests/test_send_async_images.py for an example usage
See test/test_mac_receive_images_montage.py for an example o... |
yt_gui_400x400.pyw | from file_path_adder import getpth
import internet
from tkinter import *
from tkinter import font
from tkinter.tix import Balloon,Tk
from PIL import Image, ImageTk
from io import BytesIO
from urllib.request import urlopen
from pywhatkit import playonyt
from threading import Thread
from webbrowser import open_new_tab as... |
fn_api_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... |
serve.py | # Most of this code is:
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# The server command includes the additional header:
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/C... |
__init__.py | '''
xbrlDB is an interface to XBRL databases.
Two implementations are provided:
(1) the XBRL Public Database schema for Postgres, published by XBRL US.
(2) an graph database, based on the XBRL Abstract Model PWD 2.
(c) Copyright 2013 Mark V Systems Limited, California US, All rights reserved.
Mark V copyright app... |
3.thread_getting_thinfo.py | import threading
import time
def worker():
print(threading.currentThread().getName(), "Starting")
time.sleep(2)
print(threading.currentThread().getName(), "Ending")
return
t = threading.Thread(target=worker)
t.start()
print("testing")
|
test_start_manager.py | import threading
import time as ttime
import json
from bluesky_queueserver.manager.start_manager import WatchdogProcess
from bluesky_queueserver.tests.common import format_jsonrpc_msg
import logging
class ReManagerEmulation(threading.Thread):
"""
Emulation of RE Manager, which is using Thread instead of Pro... |
datasets.py | # Dataset utils and dataloaders
import glob
import logging
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
import torch.nn.functional ... |
ethereum_storage.py | import time
from threading import Thread, Lock, Event
from typing import Optional, Union, Tuple, Generator, Dict, Set
from flask import current_app
from web3.exceptions import BadFunctionCallOutput
from app import socketio
from app.utils.settings import Settings
from app.models import KeyLookupTable
from app.utils.et... |
eventEngine.py | # encoding: UTF-8
# 系统模块
from queue import Queue, Empty
from threading import Thread, Timer
from time import sleep
from collections import defaultdict
# 第三方模块
#from qtpy.QtCore import QTimer
#import threading
#import time
# 自己开发的模块
#from .eventType import *
from vnpy.trader.event.eventType import EV... |
controller.py | """KEYBOARD CONTROLLER"""
from threading import Thread
from kivy.core.window import Window
from .rateLimitDecorator import RateLimited
class Controller:
def __init__(self, widget, key_press_handler, key_release_handler=None):
self.widget = widget
self.key_press_handler = key_press_handler
... |
server.py | """
Utilities for creating bokeh Server instances.
"""
import datetime as dt
import html
import inspect
import logging
import os
import pathlib
import signal
import sys
import traceback
import threading
import uuid
from collections import OrderedDict
from contextlib import contextmanager
from functools import partial,... |
test_program_for_MyPlotterPureTkinterStandAloneProcess_ReubenPython2and3Class.py | # -*- coding: utf-8 -*-
'''
Reuben Brewer, Ph.D.
reuben.brewer@gmail.com
www.reubotics.com
Apache 2 License
Software Revision C, 09/03/2021
Verified working on: Python 3 for Windows 8.1 64-bit and Raspberry Pi Buster (no Mac testing yet).
THE SEPARATE-PROCESS-SPAWNING COMPONENT OF THIS CLASS IS NOT AVAILA... |
attack.py | import time
from multiprocessing import Queue, Process, set_start_method
from victim import *
# Enable this to allow tensors being converted to numpy arrays
tf.compat.v1.enable_eager_execution()
try:
set_start_method('spawn')
except Exception:
pass
logging.basicConfig(level=logging.INFO)
# Silent unimportant ... |
main.py | """PythonHere app."""
# pylint: disable=wrong-import-order,wrong-import-position
from launcher_here import try_startup_script
try:
try_startup_script() # run script entrypoint, if it was passed
except Exception as exc:
startup_script_exception = exc # pylint: disable=invalid-name
else:
startup_script_ex... |
session_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.