source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
capture_logs_test.py | import logging
import os
import tempfile
from pathlib import Path
from threading import Thread
from typing import Callable
from unittest import TestCase
from puma.helpers.testing.logging.capture_logs import CaptureLogs
from puma.logging import LogLevel, Logging
from tests.logging.capture_logs_test_secondary import log... |
test_cogapp.py | """ Test cogapp.
http://nedbatchelder.com/code/cog
Copyright 2004-2019, Ned Batchelder.
"""
from __future__ import absolute_import
import os
import os.path
import random
import re
import shutil
import stat
import sys
import tempfile
import threading
from .backward import StringIO, to_bytes, TestCase, PY3
fr... |
sense_and_actuate.py | #!/usr/bin/env python3
from __future__ import print_function
import argparse
import json
import os.path
import pathlib2 as pathlib
import grovepi
import sys
import os
import time
import threading
import concurrent.futures
import socket
import http.client
# Import MQTT client modules
#import paho.mqtt.client as mqtt
... |
focuser.py | import os
from abc import ABCMeta
from abc import abstractmethod
from threading import Event
from threading import Thread
import numpy as np
from scipy.ndimage import binary_dilation
from astropy.modeling import models
from astropy.modeling import fitting
from panoptes.pocs.base import PanBase
from panoptes.utils.time... |
msg_hz_test.py | #!/usr/bin/env python3
# Set MAVLink protocol to 2.
import os
os.environ["MAVLINK20"] = "1"
import time
import threading
import traceback
import logging
from apscheduler.schedulers.background import BackgroundScheduler
from mycelium.components import RedisBridge, Connector
from mycelium_utils import Scripter, utils,... |
server.py | import time
import board
import neopixel
import threading
from flask import Flask
# Choose an open pin connected to the Data In of the NeoPixel strip, i.e. board.D18
# NeoPixels must be connected to D10, D12, D18 or D21 to work.
pixel_pin = board.D18
# The number of NeoPixels
num_pixels = 60
# The order of the pixe... |
web_app_mapper.py | import os
import queue
import threading
import urllib.error
import urllib.parse
import urllib.request
threads = 10
target = "http://blackhatpython.com"
directory = "."
filters = [".jpg", ".gif", "png", ".css"]
os.chdir(directory)
web_paths = queue.Queue()
for r, d, f in os.walk("."):
for files in f:
remo... |
unit_test_lock.py | import random
import time
from threading import Thread
from datetime import timedelta
from synapseclient.core.lock import Lock
def test_lock():
user1_lock = Lock("foo", max_age=timedelta(seconds=5))
user2_lock = Lock("foo", max_age=timedelta(seconds=5))
assert user1_lock.acquire()
assert user1_lock.... |
server.py | #!/usr/bin/python2
import argparse
import atexit
import logging
import os
import signal
import subprocess
import sys
import tempfile
import time
from mininet.node import UserSwitch, OVSSwitch
from mininet.link import TCLink, TCIntf
from mininet.net import Mininet
import mininet.term
import Pyro4
import threading
impo... |
node.py | # TODO: OSErrors / can.CanErrors are thrown if the CAN bus goes down, need to do threaded Exception handling
# See http://stackoverflow.com/questions/2829329/catch-a-threads-exception-in-the-caller-thread-in-python
# TODO: Check for BUS-OFF before attempting to send
# TODO: NMT error handler (CiA302-2)
from binasc... |
dbapi.py | # pysqlite2/test/dbapi.py: tests for DB-API compliance
#
# Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of t... |
counter.py | # coding: UTF-8
import os
import json
import re
# in_path = r"D:\work\law_pre\test\in"
# out_path = r"D:\work\law_pre\test\out"
in_path = r"/disk/mysql/law_data/final_data"
out_path = r"/disk/mysql/law_data/count_data"
mid_text = u" _(:з」∠)_ "
title_list = ["docId", "caseNumber", "caseName", "spcx", "court", "time"... |
bluetooth_comm.py | #!/usr/bin/python
import os
import signal
from bluetooth import *
import rospy
from std_msgs.msg import String
from threading import Thread
import time
import socket
global runThreads
runThreads = False
global theadStarted
threadStarted = False
rospy.init_node("bluetooth_comm")
pub1 = rospy.Publisher("blue_pull", St... |
multiprocessing_pipe_opencv.py | import cv2
from timeit import timeit
from multiprocessing import Process, Pipe, Lock
import time
def caputarar_video(conn1_child,conn2_parent,l):
"""
Metodo que crea un proceso que captura el trafico de manera sincrona (Lock).
input:
conn1_child: conexion de la pipe entre hijos
... |
runner.py | # -*- coding: UTF-8 -*-
"""
This module provides Runner class to run behave feature files (or model elements).
"""
from __future__ import absolute_import, print_function, with_statement
import contextlib
import logging
import re
import os
import os.path
import sys
import warnings
import weakref
import time
import col... |
etcd_rendezvous.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import json
import logging
import sys
import threadin... |
util.py | # 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 without limitation the rights t... |
gcsio.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_weakref.py | import gc
import sys
import unittest
import collections
import weakref
import operator
import contextlib
import copy
import time
from test import support
from test.support import script_helper
# Used in ReferencesTestCase.test_ref_created_during_del() .
ref_from_del = None
# Used by FinalizeTestCase as a global that... |
main.py | import argparse
from datetime import datetime
import gzip
import json
import logging
import os
import signal
import socket
import struct
import sys
import subprocess
from threading import Thread
import time
from urllib.parse import urlparse
import logging.handlers
import msgpack
from persistent_queue import PersistentQ... |
queue.py | import os
import redis
import threading
from rq import Queue
from typing import Callable
from django.conf import settings
redis_url = os.getenv('REDISTOGO_URL', 'redis://localhost:6379')
conn = redis.from_url(redis_url)
q = settings.REDIS_ENABLED and Queue(connection=conn)
def enqueue(job_func: Callable, *args):
... |
test_core.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... |
web_service.py | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
main.py | #!/usr/bin/env python2
import socket
import time
import json
import sys
import argparse
import webbrowser
import threading
import io
from websocket_server import WebsocketServer
BROADCAST_PORT = 42424
WEB_PORT = 9000
DISCOVER_SLEEP = 0.2
def discover(owner):
sock = socket.socket(socket.AF_INET, ... |
api.py | import abc
import asyncio
import io
import json
import os
import sys
import tempfile
import threading
from typing import Dict, Optional
from .util.types import PathLike
from .util import jsoncomm
__all__ = [
"API"
]
class BaseAPI(abc.ABC):
"""Base class for all API providers
This base class provides th... |
credit_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... |
exec.py | import json
import urllib.error
import urllib.request
from typing import Dict, List, Any, Optional, Union
from IPython.display import display
import threading
import time
import ipywidgets
URL_BASE = "http://localhost:9090/"
JOB_EXECUTE_URL = URL_BASE + "jobs/execute?duration={duration}"
JOB_LIST_URL = URL_BASE + "jo... |
streammanager.py | import uuid
import threading
from time import sleep
from sys import version_info
from collections import deque
from ceptic.common import CepticException, Timer, SafeCounter, CepticResponse
from ceptic.network import select_ceptic, SocketCepticException
from ceptic.encode import EncodeGetter
# for python 2, bind socke... |
wsgi_server.py | #!/usr/bin/env python
#
# Copyright 2007 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 o... |
gnupg.py | """ A wrapper for the 'gpg' command::
Portions of this module are derived from A.M. Kuchling's well-designed
GPG.py, using Richard Jones' updated version 1.3, which can be found
in the pycrypto CVS repository on Sourceforge:
http://pycrypto.cvs.sourceforge.net/viewvc/pycrypto/gpg/GPG.py
This module is *not* forward-... |
cluster_health_check.py | # Copyright 2018 The OpenEBS 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 writ... |
debug.py | import sys
import time
import threading
class Debug(object):
def __init__(self, arg):
super(Debug, self).__init__()
self.debug_verbose = arg
self.stop_spinner = False
def log(self, text, log=False, pre=True, new=False):
if log and pre:
if new: print(f"\n\033[1;34m[... |
keploy.py | import json
import logging
import http.client
import re
import threading
import time
from typing import Iterable, List, Mapping, Optional, Sequence
from keploy.mode import getMode
from keploy.constants import MODE_TEST, USE_HTTPS
from keploy.models import Config, Dependency, HttpResp, TestCase, TestCaseRequest, TestRe... |
visualiser_test.py | """
Test the visualiser's javascript using PhantomJS.
"""
from __future__ import print_function
import os
import luigi
import subprocess
import sys
import unittest
import time
import threading
from selenium import webdriver
here = os.path.dirname(__file__)
# Patch-up path so that we can import from the directory ... |
timer.py | #Version 1.1
import sys
sys.path.append('/var/www/html/modules/libraries')
import schedule
import time
import pytz
from astral import *
import datetime
import os
import subprocess
import mysql.connector
import threading
import paho.mqtt.client as mqtt
import random
file = open('/var/www/html/config.php', 'r')
for li... |
sneeze-translator.py | #!/usr/bin/env python
# sneeze-translator/sneeze-translator.py
from Processor import Processor
import os
import json
from dotenv import load_dotenv
import logging
import discord
import tweepy
from tweepy.streaming import StreamListener
from time import strftime
from datetime import datetime
from queue import Queue
fro... |
main.py | from .config import Config
from .db import cursor
from .app import taxi_search
from threading import Thread
TOTAL_TAXI = Config().total_taxi
def _handle_taxi_messages():
taxi_search.track_taxi_position()
def _handle_passenger_messages():
taxi_search.handle_passenger_request()
if __name__ == '__main__':
... |
test_failure.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import logging
import os
import sys
import tempfile
import threading
import time
import numpy as np
import pytest
import redis
import ray
import ray.ray_constants as ray_constants
from ray.cluster... |
cache.py | import time
import threading
from django.conf import settings
from django.core.cache import cache
from djutils.cache import key_from_args, cached_filter, CachedNode
from djutils.test import TestCase
from djutils.tests.cache_backend import CacheClass
class CacheUtilsTestCase(TestCase):
def setUp(self):
c... |
spark.py | import copy
import threading
import time
import timeit
import traceback
from hyperopt import base, fmin, Trials
from hyperopt.base import validate_timeout, validate_loss_threshold
from hyperopt.utils import coarse_utcnow, _get_logger, _get_random_id
try:
from pyspark.sql import SparkSession
_have_spark = Tru... |
save_predictions.py | import pymysql
import pandas as pd
import numpy as np
import transformations
import config
import prediction_helper
conn = pymysql.connect(config.host, user=config.username,port=config.port,
passwd=config.password)
#gather all historical data to build model
RideWaits = pd.read_sql_query("ca... |
test_utilities.py | import threading
from _pydevd_bundle.pydevd_utils import convert_dap_log_message_to_expression
from tests_python.debug_constants import IS_PY26, IS_PY3K, TEST_GEVENT, IS_CPYTHON
import sys
from _pydevd_bundle.pydevd_constants import IS_WINDOWS, IS_PY2, IS_PYPY
import pytest
import os
import codecs
from _pydevd_bundle.... |
main.py | import queue
import threading
import pandas as pd
from myfilter import *
from spider import *
# =================== Global =================
# query_queue = Queue()
# cnt = 0
query_queue = [] # url 的 请求队列
init_url = 'https://xmu.edu.cn/' # 一切罪恶的源头
query_queue.append(init_url)
# tel_filter = init_bloom(1e5) #初始化联... |
rpc.py | import socket
import threading
from _pydev_comm.server import TSingleThreadedServer
from _pydev_comm.transport import TSyncClient, open_transports_as_client, _create_client_server_transports
from _shaded_thriftpy.protocol import TBinaryProtocolFactory
from _shaded_thriftpy.thrift import TProcessor
def make_rpc_clien... |
song_converter.py | import xrns2tt
try:
from tkinter import *
try:
import ttk
except:
import tkinter.ttk as ttk
try:
import tkFileDialog
except:
import tkinter.filedialog as tkFileDialog
except:
from Tkinter import *
import tkFileDialog
import ttk
import time
import threadin... |
sensordata.py | """
SleekXMPP: The Sleek XMPP Library
Implementation of xeps for Internet of Things
http://wiki.xmpp.org/web/Tech_pages/IoT_systems
Copyright (C) 2013 Sustainable Innovation, Joachim.lindborg@sust.se, bjorn.westrom@consoden.se
This file is part of SleekXMPP.
See the file LICENSE for copying per... |
pipeline.py | # -*- coding: utf-8 -*-
import multiprocessing
from queue import Empty
from collections import deque
from collections.abc import Sequence, Mapping
import time
def stage(loop_func, queue_size=10, **kwargs):
""" Decorator que transforma a função em um objeto da classe Stage. """
return Stage(loop_func=loop_func... |
udpflood.py |
# Citrus v 2.0.1
# Copyright (C) 2020, ZEN project. All Rights Reserved.
#
# 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 Softw... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including witho... |
Server_for_multiple_clients.py | import socket
import struct
import pickle
import numpy as np
import json
import torch
import torch.nn as nn
from torch.optim import Adam, SGD, AdamW
from threading import Thread
import torch.nn.functional as F
import time
from torch.autograd import Variable
import random
import sys
# load data from json file
f = open(... |
test_actions.py | # Copyright (c) 2009-2014, Christian Haintz
# 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 ... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import pickle
import numpy as np
from PIL import Image, ExifTags
from paddle.io import Dataset, DistributedBatchSampler, DataLoader
from tqdm import tqdm
from utils.general import... |
build.py | #!/usr/bin/env python3
import argparse
import multiprocessing
import os
import sys
args = None
WORKSPACE_DIR = os.getcwd()
def install_dependencies():
print("Installing apt packages (Debian/Ubuntu)...")
os.system("sudo apt install g++-aarch64-linux-gnu wget scons caffe python3-caffe")
print("Installin... |
dataclient.py | """This file implements a threaded stream controller to abstract a data stream
back to the ray clientserver.
"""
import logging
import queue
import threading
import grpc
from typing import Any
from typing import Dict
import ray.core.generated.ray_client_pb2 as ray_client_pb2
import ray.core.generated.ray_client_pb2_g... |
lambda_executors.py | import os
import re
import sys
import glob
import json
import time
import logging
import threading
import subprocess
import six
import base64
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
from pipes import quote as cmd_quote # for Python 2.7
from local... |
clue_tf_eval_both.py | import threading
import sys
import os
import traceback
import game_board
from Clue import Director
from player import NaiveComputerPlayer, HumanPlayer
from ai_players import RLPlayer, DuelAiPlayer
from paths import Board
new_game_barrier = threading.Barrier(3)
end_game_lock = threading.Lock()
set_guess_barrier = th... |
bridge.py | #!/usr/bin/env python
#
# Copyright (c) 2018-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
"""
Rosbridge class:
Class that handle communication between CARLA and ROS
"""
try:
import queue
except ImportError:
impor... |
test_pool.py | import collections
import random
import threading
import time
from unittest.mock import ANY
from unittest.mock import call
from unittest.mock import Mock
from unittest.mock import patch
import weakref
import sqlalchemy as tsa
from sqlalchemy import event
from sqlalchemy import pool
from sqlalchemy import select
from s... |
control_cpu_usage.py | """
使用方法:命令行模式
python control_cpu_usage.py -c 20 -t 0.1
-c 指定cpu核数:不指定-c参数默认为所有核数。
-t 数值越大,cpu使用率越低。
"""
import argparse
import time
from multiprocessing import Process
from multiprocessing import cpu_count
def exec_func(bt):
while True:
for i in range(0, 9600000):
pass
try:
... |
ClusterMigrator.py | import json
import threading
from bson.json_util import dumps
from pymongo import MongoClient
from common.logger import get_logger
from .CollectionMigrator import CollectionMigrator
from .DatabaseMigrator import DatabaseMigrator
from .TokenTracker import TokenTracker
logger = get_logger(__name__)
class ClusterMigr... |
notebookapp.py | # coding: utf-8
"""A tornado based Jupyter notebook server."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import absolute_import, print_function
import notebook
import binascii
import datetime
import errno
import gettext
import hashlib
import ... |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-"
"""
UFONet - DDoS Botnet via Web Abuse - 2013/2014/2015 - by psy (epsylon@riseup.net)
You should have received a copy of the GNU General Public License along
with UFONet; if not, write to the Free Software Foundation, Inc., 51
Franklin St, Fifth Floor, Boston, MA 02110-1... |
test_functionality.py | import os
import sys
import time
import threading
import unittest
import yappi
import _yappi
import tests.utils as utils
import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6
import subprocess
_counter = 0
class BasicUsage(utils.YappiUnitTestCase):
def test_callbac... |
hackserv.py | #!/usr/bin/env python3
#
# HackServ IRC Bot
# hackserv.py
#
# Copyright (c) 2018-2022 Stephen Harris <trackmastersteve@gmail.com>
#
# 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 res... |
tests.py | import re
import threading
import unittest
from djmodels.db import connection
from djmodels.db.models import Avg, StdDev, Sum, Variance
from djmodels.db.models.fields import CharField
from djmodels.db.utils import NotSupportedError
from djmodels.test import TestCase, TransactionTestCase, override_settings
from djmodel... |
main.py | import socket
import threading
import json
import discordpresence
HEADER = 64
PORT = 5050
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
SERVER = "" #Host IP example 192.168.0.22
ADDR = (SERVER, PORT)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(ADDR)
presence = discordpresence.Disc... |
test_multiprocessing_cluster.py | import pytest
import multiprocessing
import contextlib
import rediscluster
from rediscluster.connection import ClusterConnection, ClusterConnectionPool
from redis.exceptions import ConnectionError
from .conftest import _get_client
@contextlib.contextmanager
def exit_callback(callback, *args):
try:
yield... |
bridge.py | #!/usr/bin/env python3
import argparse
import math
import threading
import time
import os
from multiprocessing import Process, Queue
from typing import Any
import carla # pylint: disable=import-error
import numpy as np
import pyopencl as cl
import pyopencl.array as cl_array
from lib.can import can_function
import ce... |
conftest.py | import pytest
import os
from http import HTTPStatus
from multiprocessing import Process
from wsgiref.simple_server import make_server
from basic_shopify_api.constants import RETRY_HEADER
def local_server_app(environ, start_response):
method = environ["REQUEST_METHOD"].lower()
path = environ["PATH_INFO"].split... |
odom_smoother.py | # Copyright 2021 Andreas Steck (steck.andi@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 a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
test_inlet.py | import asyncio
import threading
from unittest import TestCase
from unittest.mock import MagicMock
from databay import Inlet, Record
class DummyInlet(Inlet):
def __init__(self, array=True, raw=True, *args, **kwargs):
super().__init__(*args, **kwargs)
self.array = array
self.raw = raw
... |
kivy_asyncio.py | """
Kivy asyncio example app.
From: https://gist.github.com/dolang/42df81c78bf0108209d837f6ba9da052
Kivy needs to run on the main thread and its graphical instructions have to be
called from there. But it's still possible to run an asyncio EventLoop, it
just has to happen on its own, separate thread.
Requires Python... |
fuse.py | from __future__ import print_function
import os
import stat
from errno import ENOENT, EIO
from fuse import Operations, FuseOSError
import threading
import time
from fuse import FUSE
class FUSEr(Operations):
def __init__(self, fs, path):
self.fs = fs
self.cache = {}
self.root = path.rstrip... |
__init__.py | # Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 3 of the License, or
# (at your option) any later versio... |
fuzzer.py | # Copyright 2020 Google 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 applicable law or agreed to in writing, softw... |
dispatcher.py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
vrsdisplay.py | import os
import pygame
import time
import random
from threading import Thread
from datetime import datetime
import socket
import fcntl
import struct
import urllib2
import base64
import json
import sys
station="YourStationname" #In my case it is EDDT
url="http://example.com/AircraftList.json" #Enter your VRS-Url
login... |
base_component_tests.py | """openbts.tests.base_component_tests
tests for the base component class
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in t... |
test.py | import logging
import random
import threading
import time
from collections import Counter
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance('node1', macros={'cluster': 'test1'}, with_zookeeper=True)
# Check, that limits on max part size for... |
demo.py | import threading
import time
def communicate(n):
for i in range(n):
print("------ communicate -----")
time.sleep(1)
def accept(n):
for i in range(n):
print("------ accept -----")
time.sleep(1)
def main():
t1 = threading.Thread(target = communicate, args = (3,))
t2 = th... |
tests.py | # Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import copy
import io
import os
import pickle
import re
import shutil
import sys
import tempfile
import threading
import time
import unittest
from pathlib import Path
from unittest import mock, skipIf
from django.conf impo... |
__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
pywebview is a lightweight cross-platform wrapper around a webview component that allows to display HTML content in its
own dedicated window. Works on Windows, OS X and Linux and compatible with Python 2 and 3.
(C) 2014-2019 Roman Sirokov and contributors
Licensed under B... |
test_target_codegen_vulkan.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... |
train.py | import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from data import Vocab, DataLoader, STR, END, CLS, SEL, TL, rCLS
from generator import Generator
from extract import LexicalMap
from adam import AdamWeightDecayOptimizer
from utils import move_to_device
from work import validate
import ar... |
UDP_client.py | import socket
import time
import threading
import random
HOST = '127.0.0.1' # The server's hostname or IP address
PORT = 63455 # The port used by the server
server_addr = (HOST,PORT)
messages = [b'Message 1 from client.', b'Message 2 from client.',b'Message 3 from client.',b'KRAJ']
def spoji(tid):
print('c... |
print_service.py | import time
import Queue
import threading
from contextlib import contextmanager
from kivy.utils import platform
from kivy.event import EventDispatcher
from kivy.properties import (StringProperty, ObjectProperty)
from kivy.clock import Clock, mainthread
from ristomele.logger import Logger
from ristomele.gui.error import... |
dataloader.py | # -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
manager.py | from dataclasses import dataclass
import logging
import threading
import time
import traceback
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
from concurrent.futures.thread import ThreadPoolExecutor
from blspy import G1Element
from chiapos import DiskProver
from rolls.cons... |
subprocess_consumer.py | import multiprocessing
import random
from mixpanel import Mixpanel, BufferedConsumer
'''
As your application scales, it's likely you'll want to
to detect events in one place and send them somewhere
else. For example, you might write the events to a queue
to be consumed by another process.
This demo shows how you mig... |
bokeh server flask.py | # -*- coding: utf-8 -*-
"""
Created on Sat May 26 13:19:57 2018
@author: Christophe
"""
from flask import Flask, render_template
from bokeh.embed import server_document
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, Button
from bokeh.plotting import figure, curdoc
from bokeh... |
timekeeper.py | import asyncio
import websockets
import time
import threading
import random
state = ""
send_freq = 10
async def hello():
global state
uri = "ws://192.168.1.2:8765"
async with websockets.connect(uri) as websocket:
while True:
await websocket.send(state)
back_val = await w... |
camera.py | import time
import threading
import io
import picamera
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 cli... |
core.py | # -*- coding: utf-8 -*-
#
# 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
... |
test_thread.py | """TestCases for multi-threaded access to a DB.
"""
import os
import sys
import time
import errno
from random import random
DASH = '-'
try:
WindowsError
except NameError:
class WindowsError(Exception):
pass
import unittest
from test_all import db, dbutils, test_support, verbose, have_threads, \
... |
init.py | #!/usr/bin/python
# Init script for Sky Pi
import logging
import os
import time
import threading
import sys
import subprocess
import picamera
import Adafruit_BMP.BMP085 as BMP085
from gps import *
fileId = ""
speakLock = threading.Lock()
speakProcess = None
gpsd = None
# NOTE(nox): Speaking
def speakWorker(msg):
... |
Fisherman.py | import pyautogui,pyaudio,audioop,threading,time,win32api,configparser,mss,mss.tools,cv2,numpy
from dearpygui.core import *
from dearpygui.simple import *
import random
#Loads Settings
parser = configparser.ConfigParser()
parser.read('settings.ini')
debugmode = parser.getboolean('Settings','debug')
max_volume ... |
gui.py | import wx
import nstmulti as nst
import threading
import scipy
import os
from multiprocessing import Lock
from multiprocessing import Value
import time
import sys
import styleTransfer as st
import utils
import nstModels
# class responsible for reacting on event caused by button pressing, text typed etc.
class GUIContr... |
app.py | import json
import time
from Queue import Queue
from threading import Thread
import msgpack
from xbos import get_client
from xbos.services.hod import HodClient
from xbos.devices.thermostat import Thermostat
from xbos.devices.light import Light
with open("params.json") as f:
try:
params = json.loads(f.read(... |
fetch_index.py | import multiprocessing
import time
import copy
import requests
from sharepoint_utils import encode
from urllib.parse import urljoin
from elastic_enterprise_search import WorkplaceSearch
from checkpointing import Checkpoint
from sharepoint_client import SharePoint
from configuration import Configuration
import logger_ma... |
basic_multiprocessing_function.py | ###################################
# File Name : basic_multiprocessing_function.py
###################################
#!/usr/bin/python3
import os
import multiprocessing
def worker(count):
print ("name : %s, argument : %s" % (multiprocessing.current_process().name, count))
print ("parent pid : %s, pid : %s"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.