Skip to main content

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


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 hashes)

Uploaded Source

Built Distribution

ascall-0.1.1-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

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