【发布时间】:2021-07-25 13:20:11
【问题描述】:
Pycharm 似乎并没有真正理解sync_to_async。例如,在以下代码中:
@sync_to_async
def get_point(...) -> Point:
...
def other_func():
point = await get_point()
我收到警告 Class 'Point' does not define '__await__' so the 'await' operator cannot be used on its instance。
为 sync_to_async 添加正确类型定义的最简单方法是什么? (这比忽略错误更可取)
【问题讨论】:
标签: python asynchronous python-asyncio