ascall用于将可调用对象自动异步执行。
Project description
ascall
ascall用于自动识别同步或异步的可调用对象, 然后进行转换并执行异步调用返回结果。
ascall可作为函数运行,也可作为装饰器。
装饰器用法
import asyncio
from ascall import ascall
@ascall()
def sync_func():
print("sync func run.")
asyncio.run(sync_func())
函数用法
import asyncio
from ascall import ascall
def sync_func(msg: str):
print("sync func run.", msg)
async def main():
print("async func run.")
await ascall(sync_func, "some msg")
asyncio.run(main())
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
ascall-0.1.2a0.tar.gz
(2.5 kB
view details)
Built Distribution
File details
Details for the file ascall-0.1.2a0.tar.gz
.
File metadata
- Download URL: ascall-0.1.2a0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.9 Linux/6.1.0-kali5-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bc320ad43ed47780bbd6a9f26dd764c54c719c0a99f42ad93f6f67d80c4eaee |
|
MD5 | 0b3f621755f48d1a78464c759172f38b |
|
BLAKE2b-256 | bd5733ba855ccd987b7f4577d7a3c307aecc3bab6e109f622850cc1335b287be |
File details
Details for the file ascall-0.1.2a0-py3-none-any.whl
.
File metadata
- Download URL: ascall-0.1.2a0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.9 Linux/6.1.0-kali5-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e68a4a06c76dd96d9c45fd110bcfbee9585178f3ca799b822a0180cdfeabe0b3 |
|
MD5 | 6c733a94f96c90fd7bba203f0be9fb25 |
|
BLAKE2b-256 | 2a53145bcdb57ec8fe7bacfd75b4e638878bbb3f7d72ce33d7db111e377dcbc6 |