aslooper-1.1.4
توضیحات
looper-佛跳墙活套
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | aslooper-1.1.4 |
| نام | aslooper |
| نسخه کتابخانه | 1.1.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | vastxiao <vastxiao@gmail.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/aslooper/ |
| مجوز | - |
# aslooper
> looper
> Used to cancel all running tasks after catching SIGINT, SIGTERM signals,
> Quit running without raise asyncio cancelled error.
## use looper
```python
import asyncio
from aslooper import looper
async def run(i):
while True:
print(f"{i} running.")
await asyncio.sleep(1)
@looper()
async def main():
tasks = [run(i) for i in range(3)]
await asyncio.gather(*tasks)
asyncio.run(main())
```
## run with a call
```python
import asyncio
from aslooper import looper
async def run(i):
while True:
print(f"{i} running.")
await asyncio.sleep(1)
def some_call():
print("some_call")
@looper(some_call)
async def main():
while True:
print("run something.")
await asyncio.sleep(1)
asyncio.run(main())
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9 | Python |
نحوه نصب
نصب پکیج whl aslooper-1.1.4:
pip install aslooper-1.1.4.whl
نصب پکیج tar.gz aslooper-1.1.4:
pip install aslooper-1.1.4.tar.gz