微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

开始使用 mypy / 忽略外部库

如何解决开始使用 mypy / 忽略外部库

我正在尝试运行 mypy 类型提示,但在外部库中遇到了很多错误

我已经检查了 this topic in the docs

并有一个像这样的 mypy.ini

# Global options:

[mypy]
python_version = 3.8
; warn_return_any = True
; warn_unused_configs = True

# Per-module options:

[httplib2]
ignore_missing_imports = True

[google.cloud]
ignore_missing_imports = True

但是当我运行 mypy 时,它仍然用这些错误填充控制台。 而且,具有讽刺意味的是,在我自己的代码中没有发现任何故意的错误

(venv) dcollier@dcsan:~/dev/kzen$ mypy cxutils/digger/chat_stat.py 
cxutils/gbot.py:11: error: Skipping analyzing 'httplib2': found module but no type hints or library stubs
cxutils/logit.py:10: error: Skipping analyzing 'google.cloud': found module but no type hints or library stubs
cxutils/logit.py:12: error: Skipping analyzing 'ansimarkup': found module but no type hints or library stubs
cxutils/biglib.py:18: error: Skipping analyzing 'pandas_gbq': found module but no type hints or library stubs

... etc

我在 virtualenv 中使用 mypy,which mypy 证实了这一点。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。