Skip to main content

pending time-delayed events scheduling

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.schedule("second", 10)
>>> events.schedule("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.3.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

pending-1.3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pending-1.3.tar.gz
  • Upload date:
  • Size: 9.6 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.3.tar.gz
Algorithm Hash digest
SHA256 824b74dde80606f993d2976b034e6ce6edaf3892e16f2e2b4a64cd8a29e59a34
MD5 c561923e7e5b2dbed600445e42374ce2
BLAKE2b-256 38d5420f1c40e868225f46a93fc71f2e477cefb6a9d7123dd41667f91f4b8976

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pending-1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a51fdc3fe5311c43dcd541049e76c666ba6c4938ff7515ae9ebb80f61f0ea77d
MD5 491c62c90a8fc07c260e0a52d1fc1a59
BLAKE2b-256 9e5b0057f8aaa87f54171fae453d2fc92c89182e43f437adad70dc39d2e0c95f

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