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.1.tar.gz
(2.6 kB
view details)
Built Distribution
File details
Details for the file ascall-0.1.1.tar.gz
.
File metadata
- Download URL: ascall-0.1.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0feb7dda0d609d17764235bdf24fb7eeea299d10e1beba0a150668df6a905358 |
|
MD5 | 9cc77856d48f9ad98fe5f57cb073b98b |
|
BLAKE2b-256 | c1d92b2cde51dae6bdb327865d62b89a9305b038a95697e1994ea5828d13d372 |
File details
Details for the file ascall-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: ascall-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 855827d4ee2c7e6218a993abe50e4cfb09148a593fca5162861962a2542ae810 |
|
MD5 | a9f5f99d17fd9c23151f12cf49792c64 |
|
BLAKE2b-256 | 1345ca9e3c983ae1a9f2bd8172921b5e50f3dd6b51a68083b47a9b7ed2032eae |