gpt4 book ai didi

python - 如何让 mypy 全局忽略缺失的导入?

转载 作者:行者123 更新时间:2023-12-03 08:16:40 25 4
gpt4 key购买 nike

我有许多导入其他非类型化库的文件。

我已将其添加到 mypy.ini 例如:

[coloredlogs]
ignore_missing_imports = True

那么也许这可以不检查库本身?例如,在 /venv 中,但仍在 every.single.place 中导入了库,我收到这些警告。

我可以让忽略工作的唯一方法是在 every.single.import 上添加注释

导入 colorlogs # 类型:忽略

引用:https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

最佳答案

您的配置语法错误。 example in the docs you've linked

[mypy-foobar.*]
ignore_missing_imports = True

所以你会想要

[mypy-coloredlogs.*]
ignore_missing_imports = True

关于python - 如何让 mypy 全局忽略缺失的导入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69168960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com