Polling2: Never write another polling function

Release v0.5.0.

https://travis-ci.com/ddmee/polling2.svg?branch=master https://img.shields.io/pypi/dm/polling2.svg https://img.shields.io/pypi/pyversions/polling2.svg Documentation Status Quality Gate Status Bugs Vulnerabilities Security Rating Code Smells

Polling2 is a powerful python utility used to wait for a function to return when the specified condition is met.

Install

polling2 is available from Pypi.:

python -m pip install polling2

Examples

Watch polling do some arbitrary dances:

>> import polling2, time
>> # Wait until the number of seconds (ignoring milliseconds) is divisible by 5.
>>  polling2.poll(target=time.time, check_success=lambda x: int(x) % 5 == 0, step=0.5, timeout=6)
1599737060.4507122
>> # Lets use the decorator version to create a function that waits until the next even second.
>> @polling2.poll_decorator(check_success=lambda x: int(x) % 2 == 0, step=0.5, timeout=6)
... def even_time():
...     return time.time()
>> even_time()
1599737080.016323
>> even_time()
1599737082.035758

View all the examples:

API

Contributor Guide

If you want to contribute to the project…

Release notes

The change log for each released version.

Indices and tables