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.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

pending-1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pending-1.0.tar.gz
  • Upload date:
  • Size: 9.1 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.0.tar.gz
Algorithm Hash digest
SHA256 abfa46af26cde4ae8c544553aaa72ec2e26fc0dffa00c35cb87c34ca3a2c2d12
MD5 121924d9a9f4ff963cea2350fc96594d
BLAKE2b-256 f0236a873f43454f6e3c3faeb090666f32c5868fb37a3960ce7569972a945f9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pending-1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 758ddab05cf744ab6c89b1733d673d1d3a88ec2ae45f1fafa67c4adf9f791693
MD5 5ce4d770bd86d72fc50fceb463f87f80
BLAKE2b-256 7873aad96326d9a05e2ca81084404389078162a1d844b31366f7e1001d857506

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