source
stringlengths
3
86
python
stringlengths
75
1.04M
topology_test.py
import re import time import pytest import logging from threading import Thread from cassandra import ConsistencyLevel from ccmlib.node import TimeoutError, ToolError from dtest import Tester, create_ks, create_cf, mk_bman_path from tools.assertions import assert_almost_equal, assert_all, assert_none from tools.data...
SampleService_test.py
# These tests cover the integration of the entire system and do not go into details - that's # what unit tests are for. As such, typically each method will get a single happy path test and # a single unhappy path test unless otherwise warranted. # Tests of the auth user lookup and workspace wrapper code are at the bot...
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...
io.py
# coding: utf-8 # pylint: disable=invalid-name, protected-access, fixme, too-many-arguments, W0221, W0201, no-self-use """NDArray interface of mxnet""" from __future__ import absolute_import from collections import OrderedDict import ctypes import sys import numpy as np import logging import threading from .base impo...
server-gunn-pi-v1.py
import socket from multiprocessing import Process, Manager import time import sys import os ''' scp ~/Documents/Code/python/client-server_simple/server.py pi@raspberrypi:~/Desktop/ ''' ### Server Stuff HOST = "169.254.209.111" # 169.254.209.111 PORT = 6789 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bi...
bomber.py
from tkinter import ttk from tkinter import* import smtplib, threading, random, time sent, stop, badCred = 0,0,0 def spam(): global sent, var, badCred credentials = emailSender.get().split(",") server = smtplib.SMTP_SSL("smtp.gmail.com", 465) try: server.login(f"{credentials[0]}"...
futures.py
"""Tools for dealing with asynchronous execution""" from globus_sdk import GlobusAPIError from concurrent.futures import Future from threading import Thread from time import sleep class DLHubFuture(Future): """Utility class for simplifying asynchronous execution in DLHub""" def __init__(self, client, task_id...
views.py
# -*- coding: UTF-8 -*- import re, time import simplejson as json from threading import Thread from collections import OrderedDict from django.db.models import Q, F from django.db import connection, transaction from django.utils import timezone from django.conf import settings from django.shortcuts import render, ge...
run.py
#! /usr/bin/env python import io import codecs import base64 import argparse import collections import logging import json import os import stat import signal import sys import threading import time import pexpect import psutil logger = logging.getLogger('cyborgbackup.main.utils.expect') def args2cmdline(*args): ...
testing.py
############################################################################## # # Copyright (c) 2011 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
extraction_line_pyscript.py
# =============================================================================== # Copyright 2011 Jake Ross # # 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/licens...
daemon.py
from multiprocessing import Process from multiprocessing.sharedctypes import RawValue from time import perf_counter,sleep from logging import info import numpy as np from unitreepy.utils.exception_parser import parse_exception from unitreepy.interfaces.shared_state import SharedState,SHM_IMPORTED class Daemon: ''...
test.py
import requests import json import cv2 import time from threading import Thread def test(): imagelist=["apple.jpeg","tomato2.jpeg","mango.jpeg","tomato.jpeg","apple2.jpeg"] counter=0 start_time=time.time() for i in range(10): for imgs in imagelist: addr = 'http://app-hyperpigmented-strontian.mybluemix.net' ...
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...
parameter_dialog.py
# Software License Agreement (BSD License) # # Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko # 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 mus...
looper.py
import threading import time class Looper: def __init__(self, func, interval=1, daemon=True, *args, **kwargs): super().__init__() self.func = None self.interval = None self.running = False self.thread = None self.daemon = daemon self.set_interval(interval=in...
basic_multiprocessing.py
""" "Multiprocessing" section example showing how to create new processes with `multiprocessing` module """ from multiprocessing import Process import os def work(identifier): print(f"Hey, I am the process " f"{identifier}, pid: {os.getpid()}") def main(): processes = [Process(target=work, args=(number,)) ...
vfs.py
# Adapted from imutils https://github.com/jrosebr1/imutils from queue import Queue import sys from threading import Thread import time from cv2 import VideoCapture, CAP_PROP_POS_FRAMES class FileVideoStream: def __init__(self, path, start, length, queue_size=128): # initialize the file video stream along...
test.py
import tempfile import cmmap from multiprocessing import Process def test_file(): fd, filename = tempfile.mkstemp() f = open(filename, 'w') data = 'foobarbing' f.write(data) f.close() f = open(filename, 'r+') m = cmmap.mmap(prot=cmmap.PROT_READ, length=len(data), flags=cmmap.MAP_SHARED, fd...
sample_vnf.py
# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
run_camera_frame_producer.py
import os import threading import signal from functools import partial from io import BytesIO from typing import Dict from multiprocessing import Process import logging from mqtt.mqtt_client import get_mqtt from camera.camera_config import camera_config from camera.camera_frame_producer import CameraFrameProducer from...
log.py
""" Logging module for printing status during an exploit, and internally within ``pwntools``. Exploit Developers ------------------ By using the standard ``from pwn import *``, an object named ``log`` will be inserted into the global namespace. You can use this to print out status messages during exploitation. For e...
test_smtplib.py
import asyncore import email.mime.text import email.utils import socket import smtpd import smtplib import io import re import sys import time import select import errno import unittest from test import support, mock_socket try: import threading except ImportError: threading = None HOST = support.HOST if sy...
falskICD.py
import enum from datetime import datetime from flask import Flask, Response, render_template, request, jsonify from flask_socketio import SocketIO, emit, send import airsim import numpy as np import math import time import sys from threading import Thread import json app = Flask(__name__,instance_relative_config=Tr...
base.py
# Copyright (c) 2008-2010 Aldo Cortesi # Copyright (c) 2011 Florian Mounier # Copyright (c) 2011 Kenji_Takahashi # Copyright (c) 2011 Paul Colomiets # Copyright (c) 2012 roger # Copyright (c) 2012 Craig Barnes # Copyright (c) 2012-2015 Tycho Andersen # Copyright (c) 2013 dequis # Copyright (c) 2013 David R. Andersen # ...
bulldog_vision_2.py
#!/usr/bin/env python #!coding=utf-8 import rospy import numpy as np import PIL.Image as pilimage import actionlib from sensor_msgs.msg import CompressedImage from sensor_msgs.msg import Image from std_msgs.msg import Float64 from cv_bridge import CvBridge, CvBridgeError import cv2 import time from yolo import YOLO fr...
test_itemdb.py
""" The main usage tests. """ import os import time import random import sqlite3 import tempfile import threading from contextlib import closing from pytest import raises from testutils import run_tests from itemdb import ItemDB def get_fresh_filename(): filename = os.path.join(tempfile.gettempdir(), "test.db"...
zip-cracker-gui.py
# Python Version 2.7.3 # File: zip-cracker-gui.py import zipfile import sys, os import tkMessageBox from Tkinter import * from tkFileDialog import askopenfilename from threading import Thread class Cracker: def __init__(self, master): #set up frame frame = Frame(master) frame.pack() ...
zjsfb_grabno_2020.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Copyright: error.d # Date : 2018-02-24 # Update : 2020-05-02 # Create by: error.d<error.d@gmail.com> # import re import time import json import requests import threading import ipdb from lxml import etree from ying import * #from ding import * """ todolist: * 退出机...
groups.py
import tkinter as tk from config.colours import LIGHT_RED, DARK_RED, GLOBAL_SIDEBAR_BG, HEADING_COLOR, BG_COLOR, COUNTRY_SEARCH_BG, COUNTRYBOX_BG_COLOR, COUNTRIES_TEXT_COLOR, COUNTRIES_DETAILS_BG from config.fonts import TITLE_FONT, HEADING_FONT, SEARCHBAR_FONT, COUNTRY_NOT_FOUND_FONT from config.paths import titlebar_...
test_unix_events.py
"""Tests for unix_events.py.""" import contextlib import errno import io import os import pathlib import signal import socket import stat import sys import tempfile import threading import unittest from unittest import mock from test.support import os_helper from test.support import socket_helper if sys.platform == '...
__init__.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: r""" A Python module to maintain unique, run-wide *dMRIPrep* settings. This module implements the memory structures to keep a consistent, singleton config. Settings are passed across processes via filesyst...
runFastTextWiki.py
from helper import * import multiprocessing import fasttext.util import sys import time numKeywords = int(sys.argv[1]) vectorSize = int(sys.argv[2]) maxCandidateArticles = int(sys.argv[3]) reducedSet = str(sys.argv[4]) printTimestamp("Getting candidate articles") if reducedSet=='true': candidate_articles = getCand...
test_fx.py
import builtins import contextlib import copy import functools import inspect import math import numbers import operator import os import pickle import sys import torch import traceback import warnings import unittest from math import sqrt from torch.multiprocessing import Process from torch.testing import FileCheck fr...
recipe-576910.py
#! /usr/bin/python import threading import Queue import time import sys Instance = None def getInstance(): global Instance if not Instance: Instance = ThreadPool() return Instance class ThreadPool: def __init__(self,maxWorkers = 10): self.tasks = Queue.Queue() self.workers ...
great-four.py
from utils import load_configs from twarc import Twarc import json import os import datetime from multiprocessing import Process from DB_Communicator import send_to_db def stream_city(cf, city, keywords=None): bbox = { "great_syd": [149.971885992, -34.33117400499998, 151.63054702400007, -32.99606922499993...
surface_stats_collector.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import Queue import datetime import logging import re import threading # Log marker containing SurfaceTexture timestamps. _SURFACE_TEXTURE_TIMESTAMPS_MESSA...
panic_bcast.py
#!/usr/bin/python2.7 # Copyright (c) 2012, Niklas Femerstrand <nik@qnrq.se> # 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 not...
test_app.py
import json import webssh.handler as handler import random import threading import tornado.websocket import tornado.gen from tornado.testing import AsyncHTTPTestCase from tornado.options import options from webssh.main import make_app, make_handlers from webssh.settings import get_app_settings from tests.sshserver imp...
test_webserver.py
import subprocess import time import sys import os import re import threading from six.moves import queue import pytest import requests from pytest_test_filters import skip_on_windows pytestmark = skip_on_windows( reason="Subprocess based approach is problematic on windows." ) from testplan.common.utils.process...
multiprocess1.py
""" 使用Process类创建多个进程 Version: 0.1 Author: 骆昊 Date: 2018-03-20 """ # 通过下面程序的执行结果可以证实 父进程在创建子进程时复制了进程及其数据结构 # 每个进程都有自己独立的内存空间 所以进程之间共享数据只能通过IPC的方式 from multiprocessing import Process, Queue from time import sleep def sub_task(string, q): number = q.get() while number: print('%d: %s' % (number, strin...
fifo_queue_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...
GenerateTFRecord.py
import warnings warnings.filterwarnings("ignore") import tensorflow as tf import numpy as np import traceback import cv2 import os import string import pickle from selenium import webdriver from selenium.webdriver.firefox.firefox_binary import FirefoxBinary from multiprocessing import Process,Lock from TableGeneration...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
data_loader_base.py
# Copyright 2019 Uber Technologies, 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 applica...
kube_env.py
#!/usr/bin/env python3 import argparse import csv import time import logging import sys import os from multiprocessing import Process from concurrent.futures import ThreadPoolExecutor from pathlib import Path import requests import kube_util as util log = logging.getLogger(__name__) FILE_DIR = Path(__file__).parent....
texteditorbase.py
from PIL import Image from PIL import ImageTk from tkinter import colorchooser, filedialog, messagebox, font import tkinter as tk from os.path import exists, split, splitext import platform if platform.system() == 'Linux': try: import cups except: pass elif platform.system() == 'Windows': tr...
test_io.py
"""Unit tests for io.py.""" from __future__ import print_function from __future__ import unicode_literals import os import sys import time import array import threading import random import unittest from itertools import cycle, count from test import test_support import codecs import io # The module u...
PipelinesRicartAgrawala.py
import multiprocessing from ctypes import Structure, c_int, c_bool from enum import Enum from time import sleep from heapq import heappush, heappop from random import randint, uniform from functools import reduce TIMEOUT = 1.0/3.0 NUMBER_OF_ENTRIES = 5 class Message(Enum): REQUEST = "REQUEST" REPLY = "REPLY"...
commands.py
import threading import telegram from . import config from .logger import Logger def config_editor_command(bot, update, args): ConfigEditorCommand(bot, update, args).run() def restart_command(bot, update, args): RestartCommand(bot, update, args).run() class Command: def __init__(self, bot: telegram....
_plugin.py
from . import _PluginInstance from nanome._internal import _network as Network from nanome._internal._process import _ProcessManager from nanome._internal._network._serialization._serializer import Serializer from nanome._internal._util._serializers import _TypeSerializer from nanome.util.logs import Logs from nanome.u...
GluttonousSnake.py
import time import threading import os import random import keyboard import sys config = { "divider": 50, "speed": 1, # Timestamp "size-x": 20, "size-y": 48 } state = { "state": "running", # Control if it is running "time": 0, "score": 0, "delta_speed": 1, "food": [], # A list of ...
context.py
import threading from contextlib import contextmanager class Context(threading.local): def __init__(self): self._ctx = [{}] def __getattr__(self, name): for scope in reversed(self._ctx): if name in scope: return scope[name] raise AttributeError(name) d...
redmatic_to_sqldb.py
import datetime import json import os import queue import threading import time import paho.mqtt.client as mqtt import toml from db_model_postgrest import Datum from db_model_postgrest import sende_daten SKRIPTPFAD = os.path.abspath(os.path.dirname(__file__)) CONFIGDATEI = "redmatic_to_sqldb_cfg.toml" def load_con...
paho_backend.py
import os import logging import paho.mqtt.client as mqtt import threading log = logging.getLogger("mqttwrapper.paho_backend") def on_connect(client, userdata, flags, rc): log.debug("Connected") for topic in userdata['topics']: client.subscribe(topic) log.debug("Subscribed to %s", topic) def o...
hpsearch.py
#!/usr/bin/env python3 # Copyright 2019 Christian Henning # # 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...
trezor.py
import traceback import sys from typing import NamedTuple, Any from electrum_mona.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum_mona.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum_mona.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path from...
test_carpark.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
__init__.py
# -*- coding: utf-8 -*- ''' Set up the Salt integration test suite ''' # Import Python libs from __future__ import absolute_import, print_function import os import re import sys import copy import json import time import stat import errno import signal import shutil import pprint import atexit import socket import lo...
_socketcan.py
# Copyright (c) 2019 UAVCAN Consortium # This software is distributed under the terms of the MIT License. # Author: Pavel Kirienko <pavel@uavcan.org> import enum import time import errno import typing import socket import struct import select import asyncio import logging import warnings import threading import contex...
tls_server_openssl.py
from __future__ import print_function import sys import os if not ('..' in sys.path or os.path.realpath('..') in sys.path): sys.path.append(os.path.realpath('..')) if not ('.' in sys.path or os.path.realpath('.') in sys.path): sys.path.append(os.path.realpath('.')) from net_common import * from xre_common import * from...
test_manager.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...
pureblood.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ Script Created By: Cr4sHCoD3 Page: https://github.com/cr4shcod3 https://github.com/cr4shcod3/pureblood FB Page: https://facebook.com/cr4shcod3.py Copyrights: Cr4sHCoD3 2018 MIT LICENSE Special Mentions: PureHackers PH Blood Sec...
server.py
import os import signal import ssl import threading from base64 import b64encode from contextlib import contextmanager from textwrap import dedent from typing import TYPE_CHECKING from unittest.mock import Mock from pip._vendor.contextlib2 import nullcontext from werkzeug.serving import WSGIRequestHandler from werkzeu...
mobility.py
#!/bin/sh ### BEGIN INIT INFO # Provides: RoverMobilityServer # Required-Start: $remote_fs $network $syslog # Required_Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Simple script to start a program at boot # Description:...
02-olog_integration.py
import os if os.getenv("BS_ENABLE_OLOG_CALLBACK", 1) == 1: from bluesky.callbacks.olog import logbook_cb_factory from functools import partial from pyOlog import SimpleOlogClient import queue import threading from warnings import warn import bluesky.callbacks.olog bluesky.callbacks.olog...
crash.py
import os, re, stat, sys import logging import argparse import syzscope.interface.utilities as utilities import time import threading import json import pathlib import queue from syzscope.interface.vm import VM from subprocess import call, Popen, PIPE, STDOUT from .syzbotCrawler import Crawler from dateutil import par...
linkCreationHelpers.py
#!/usr/bin/env python3 # Corona-Info-App # # © 2020 Tobias Höpp. # Include utilities import urllib import json from sqlalchemy import or_ import bs4 import visvalingamwyatt as vw # Include db connection from main import db, api # Include models from models.districts import districts, updateDistrictIncidence, create...
SBFI_Profiler.py
# Pre-injection Profiling # Measures switching activity on the inputs of macrocells # Identifies the used/unused memory cells # Any other metric that can improve the fault injection in any way # Author: Ilya Tuzov, Universitat Politecnica de Valencia import sys import xml.etree.ElementTree as ET import re import os i...
video_utils.py
import cv2 import time import threading class VideoStream: # Opens a video with OpenCV from file in a thread def __init__(self, src, name="VideoStream", real_time=True): """Initialize the video stream from a video Args: src (str): Video file to process. name (str, defau...
transfer.py
import os import gzip from operator import itemgetter from sys import exit from threading import Thread from threading import Condition from Queue import Queue from fabric.api import local, put, sudo, cd from fabric.colors import red class FileSplitter: """ Works like the UNIX split command break up a file...
pod.py
""" Pod related functionalities and context info Each pod in the openshift cluster will have a corresponding pod object """ import logging import os import re import yaml import tempfile import time import calendar from threading import Thread import base64 from ocs_ci.ocs.ocp import OCP, verify_images_upgraded from ...
Active_Directory_Query_test.py
import demistomock as demisto from Active_Directory_Query import main, group_dn import socket import ssl from threading import Thread import time import os import pytest import json from IAMApiModule import * from unittest.mock import patch BASE_TEST_PARAMS = { 'server_ip': '127.0.0.1', 'secure_connection': '...
main.py
import os import sys import random import traceback from tensorflow.keras.optimizers import RMSprop, Adam from scipy.stats import rankdata import math import numpy as np from tqdm import tqdm import argparse random.seed(42) import threading import configs import logging logger = logging.getLogger(__name__) logging.bas...
guiManager.py
import cv2 import tkinter from PIL import ImageTk, Image import threading from settings import * import sys class GuiManager: def __init__(self, tracker): self.drawing = False self.ax,self.ay = -1, -1 self.bx, self.by = -1,-1 self.tracker = tracker self.mainWindowThread = t...
app.py
# # from flask import Flask # # from flask import render_template # # app = Flask(__name__) # # @app.route("/") # # def hello_world(): # # return render_template("index.html") # from flask import Flask, request, abort # from urllib.parse import parse_qs # import requests # import json # import time # from flask...
functional_tests.py
#!/usr/bin/env python """ This script cannot be run directly, because it needs to have test/functional/test_toolbox.py in sys.argv in order to run functional tests on repository tools after installation. The install_and_test_tool_shed_repositories.sh will execute this script with the appropriate parameters. """ import ...
eventlet.py
"""A eventlet based handler.""" from __future__ import absolute_import import contextlib import logging import eventlet from eventlet.green import socket as green_socket from eventlet.green import time as green_time from eventlet.green import threading as green_threading from eventlet.green import selectors as green_...
test_end_to_end.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
util.py
import ctypes import os import re import shutil import sys from pathlib import Path from colorama import Back, Fore, Style from .settings import * if sys.version_info[0] < 3 or sys.version_info[1] <= 5: raise RuntimeError( "\nPlease restart with Python 3.6+\n" + "Current Python version:", sys.ver...
myo_genData.py
import myo import sys from threading import Thread import time import numpy as np import os import matplotlib matplotlib.use('GTKAgg') import scipy from math import ceil, floor e = [] emg_correctmean = [] emg_filtered = [] emg_rectified = [] emg_envelope = [] normalized = [] import config count =0 lastLine = "" impor...
test_connection_pool.py
import os import mock import pytest import re import redis import time from threading import Thread from redis.connection import ssl_available, to_bool from .conftest import skip_if_server_version_lt, _get_client, REDIS_6_VERSION from .test_pubsub import wait_for_message class DummyConnection(object): descriptio...
app.py
import json import tkinter as tk import requests from PIL import ImageTk, Image import os import interface import renderingUtil import database import multiprocessing as mp from functools import partial import ctypes import testyboi as testy import time import Camera.camera as camera import cv2 # import functions and ...
light_reaper.py
# -*- coding: utf-8 -*- # Copyright 2016-2020 CERN # # 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...
demo.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import glob import multiprocessing as mp import numpy as np import os import queue import threading import time from typing import NoReturn import cv2 import tqdm from detectron2.config import get_cfg from detectron2.data.detection_...
test_execute.py
# pylint doesn't know about pytest fixtures # pylint: disable=unused-argument import os from threading import Thread from unittest import mock import pytest from dagster_celery_tests.repo import COMPOSITE_DEPTH from dagster import ( CompositeSolidExecutionResult, PipelineExecutionResult, SolidExecutionRe...
scylla_node.py
# ccm node from __future__ import with_statement import datetime import errno import os import signal import shutil import socket import stat import subprocess import time import threading import psutil import yaml from six import print_ from ccmlib import common from ccmlib.node import Node from ccmlib.node import ...
foo.py
# Python 3.3.3 and 2.7.6 # python fo.py from threading import Thread, Lock # Potentially useful thing: # In Python you "import" a global variable, instead of "export"ing it when you declare it # (This is probably an effort to make you feel bad about typing the word "global") i = 0 mutex = Lock() def incrementing...
monitor.py
#!/usr/bin/env python import sys import os import hashlib import md5 import mmap import datetime import time import threading import Queue import logging from watchdog.observers import Observer from watchdog.events import LoggingEventHandler import watchdog from libs.comictaggerlib.comicarchive import * from libs.com...
node.py
import time import queue from queue import Queue from threading import Thread from random import randint from . import config from constellations.socket_transport import SocketTransport class Data: def __init__(self): self.me = {} self.peers = {} self.peer_set = [] class Node: """ ...
trait_notifiers.py
# ------------------------------------------------------------------------------ # # Copyright (c) 2005-2013, Enthought, Inc. # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in enthought/LICENSE.txt and may be redistributed only # under the condit...
upd_bot.py
'''' пост про регулярки https://habr.com/ru/post/349860/ тестер регулярок https://regex101.com/r/ документация бс https://www.crummy.com/software/BeautifulSoup/bs4/doc/ ''' # пример использования флажка # import time # done_flag=False # while done_flag==False: # try: # print("stuff done...
test_closing.py
from fixtures import * # noqa: F401,F403 from flaky import flaky from lightning import RpcError from utils import only_one, sync_blockheight, wait_for, DEVELOPER, TIMEOUT, VALGRIND, SLOW_MACHINE import os import queue import pytest import re import threading import unittest @unittest.skipIf(not DEVELOPER, "Too slow...
reader.py
# Copyright (c) 2019 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...
chord.py
import requests import pickle import time from time import time import threading import asyncio from Node import Node from config import * from flask import Blueprint, request node = Node() chord = Blueprint('chord', __name__) ''' This is the single point in the application used for returning to the client and term...
Thread_Communication_Queue.py
# Thread communication Queue from threading import Thread from queue import Queue from time import sleep class Producer: def __init__(self): self.q = Queue() def produce(self): for i in range(1, 6): print("Item Produce", i) self.q.put(i) sleep(1) class Con...
discoverer.py
import sys import struct import socket from threading import Thread from logging import getLogger from . constants import MAGIC from . utils import str_to_bytes LOG = getLogger(__name__) class Discoverer: ''' Emulates a SSDP-like discovery protocol on a specified discovery port. Each Discoverer has a (p...
utils.py
# -*- coding:utf-8 -*- """ Author: Weichen Shen,weichenswc@163.com """ import json import logging from threading import Thread import requests try: from packaging.version import parse except ImportError: from pip._vendor.packaging.version import parse def check_version(version): """Return version...
app.py
from flask import Flask, jsonify, Session, render_template, request import os from time import sleep from multiprocessing import Process import configparser from spotify_background_color import SpotifyBackgroundColor from current_spotify_playback import CurrentSpotifyPlayback, NoArtworkException from led_controller imp...
dispatcher.py
#!/usr/bin/env python3 # 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...