python - mypy - 如何处理签入存储库的第三方代码
问题描述
MCVE 将是:
$ mkdir ext_libs
$ pip install Twisted==19.7.0 -t ext_libs
$ ls
client.py ext_libs mypy.ini
客户端.py:
import twisted
print(twisted.__version__)
mypy.ini:
[mypy]
mypy_path=ext_libs:.
exclude=ext_libs/
follow_imports=normal
运行命令:mypy client.py
输出:
$ mypy client.py
ext_libs\incremental\__init__.py:25: error: Name "cmp" is not defined
ext_libs\incremental\__init__.py:125: error: Cannot assign to a type
ext_libs\incremental\__init__.py:125: error: Incompatible types in assignment (expression has type "_inf", variable has type "Type[_inf]")
Found 3 errors in 1 file (checked 1 source file)
我如何强制 mypy 排除对 ext_libs 内容的错误检查(将这些文件视为任何其他站点包)?
解决方案
推荐阅读
- azure - Azure Dev-ops Pipeline - 有条件地执行任务
- python - 无法打印字符串匹配模式
- python - Python Turtle Graphics Tic - Tac - 脚趾游戏
- python - PyCon 2012 David Mertz 谈协程作为线程
- java - 长度可变的数组
- python - 反正有实时的DHT22数据吗?
- java - 如何从firebase中检索键和值并将它们存储在两个单独的变量中
- php - 有没有办法将数组元素添加到 SESSION 变量中?
- xamarin.forms - FreshPageModelResolver.ResolvePageModel() 在 UWP Release 中抛出异常
- hbase - Hbase 区域始终处于过渡状态