A simple async function repeater
Project description
#AsyncRepeat A simple decorator for repeating async functions. The main idea is that a coroutine can only be awaited for one time. In some special case that an async function needs to be run for multiple times, use this tool for an easy approach
Get started
First install it with pip:
pip install async-repeat
Then in your program:
import asyncio
from async_repeat import repeat
@repeat(3)
async def foo():
print("foo")
asyncio.run(foo())
The result will be:
foo
foo
foo
The repeat decorator has two modes:
- Concurrent: The function will create tasks and run the tasks at the same time
- Synchronous: The coroutines will run one by one
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
async-repeat-0.0.1.tar.gz
(2.1 kB
view details)
File details
Details for the file async-repeat-0.0.1.tar.gz
.
File metadata
- Download URL: async-repeat-0.0.1.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03a530b4b5b7f6d0c1d9d26536fd0ff05c175a25c3f7e050d48caa02611e2b25 |
|
MD5 | 2b8ae394fac6ce0bcc3357905ce2681d |
|
BLAKE2b-256 | 31ed93ffb8cf0989b485d8fcb257b776cc76f443e809f12a20f356b10e39ee56 |