麦皮电视马拉松

2024-10-16 20:51:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在建立一个基于telethon图书馆的项目。我想在mypy中使用可选的输入,但在所有telethon导入中都失败了

error: Skipping analyzing "telethon.tl.types": found module but no type hints or library stubs

我可以看到telethon.tl.types中的类构造函数中有一些类型提示

我尝试用mypy --install-types安装类型提示,但在这里运气不佳

是否可以在我的项目中使用telethon并从类型注释中获益

编辑: 用于重新创建问题的简单测试用例

from telethon.tl.types import WebPage

def example(example: WebPage) -> str:
    a: str = example.url
    return a

Tags: 项目类型图书馆exampleerrortypesmodulewebpage