Skip to main content

A waiting based utility with decorator and logger support

Project description

Introduction

Waits for a certain amount of time for an action to complete Designed to wait for a certain length of time, either linearly in 1 second steps, or exponentially, up to a maximum. Returns the output from the function once it completes successfully, along with the time taken to complete the command.

Usage

from wait_for import wait_for

class Incrementor():
    value = 0

    def i_sleep_a_lot(self):
        time.sleep(.1)
        self.value += 1
        return self.value


incman = Incrementor()
ec, tc = wait_for(incman.i_sleep_a_lot,
                  fail_condition=0,
                  delay=.05)
print("Function output {} in time {} ".format(ec, tc))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wait_for-1.2.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

wait_for-1.2.0-py2.py3-none-any.whl (10.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file wait_for-1.2.0.tar.gz.

File metadata

  • Download URL: wait_for-1.2.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for wait_for-1.2.0.tar.gz
Algorithm Hash digest
SHA256 5642975f1fc5850acb55684b2d7842bd820fb068e725cd4ffff4bf3eba8e2788
MD5 732039248d6c50f5a5ed370fd3aa02cf
BLAKE2b-256 59c9d3421164561ecb2a30c63586530fe228a86ca19bd5523a5026571e7e29f9

See more details on using hashes here.

File details

Details for the file wait_for-1.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: wait_for-1.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for wait_for-1.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1129f3350e29b0600889e24328d685a6bff048c8f4cabce28ef7632ed40c5d91
MD5 b71e8be624abda27bec56ca1f8a4c06f
BLAKE2b-256 39e78bdec28f3a0c8d6bce3c5130ca1d782dcd124d62b0c099c2ba71dc656d15

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page