Skip to main content

pending time-delayed events handler

Project description

Pending events awaitable for asyncio

Instantiate a Pending awaitable, register events scheduled to be returned after a given number of seconds, and then await.

Once the first one (with smallest scheduling delay) is returned, re-await to get the next one, and so on. Optionally cancel or postpone (reschedule) scheduled events.

Example of use:

>>> import asyncio
>>> from pending import Pending
>>> events = Pending()
>>> events.expect("second", 10)
>>> events.expect("first", 9)
>>> async def main():
...    for i in len(events):
...       evt = await events
...       print(evt)
...
>>> asyncio.run(main())
first
second

Note: the registered "event" can be any hashable object.

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

pending-1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

pending-1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file pending-1.1.tar.gz.

File metadata

  • Download URL: pending-1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for pending-1.1.tar.gz
Algorithm Hash digest
SHA256 b280b3e359e126301127ea8843c7d82bf373d289c62ae0849d418b92a9654bc1
MD5 da0371b9c09839a2b3c8f9227b435358
BLAKE2b-256 ccfe89e8546659ebdaf4169084854e03c5f1c582aa7ba25a2307e161c28f89dd

See more details on using hashes here.

File details

Details for the file pending-1.1-py3-none-any.whl.

File metadata

  • Download URL: pending-1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for pending-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a84dbe0e3f2ded31e7518f203b0e42c9b1b4a13f9172ad955769c31bd151194
MD5 e20bdc6c42cf821bc44c5932d682bfca
BLAKE2b-256 f61dfd710d3571e7cb2f49ebd847e1beb5b91f1eb4447e809da7197e31c1593c

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