mypy 无法识别 attrs:无法确定 's' 的类型
mypy does not recognize attrs: Cannot determine type of 's'
> pip3.8 list
Package Version
----------------- -------
attrs 19.3.0
mypy 0.761
mypy-extensions 0.4.3
pip 19.3.1
setuptools 42.0.2
typed-ast 1.4.1
typing-extensions 3.7.4.1
wheel 0.33.6
> mypy --version
mypy 0.761
# types.py
import typing
import attr
@attr.s(auto_attribs=True, slots=True, frozen=True)
class Test:
b: bool = False
> mypy types.py
types.py:4: error: Cannot determine type of 's'
Found 1 error in 1 file (checked 1 source file)
我是否需要安装其他东西以获得 attrs
支持?
嘿,这很奇怪,可能是 mypy 中的错误!将 types.py
重命名为其他名称即可:
$ mypy types.py
types.py:4: error: Cannot determine type of 's'
Found 1 error in 1 file (checked 1 source file)
$ mv types.py t.py
$ mypy t.py
Success: no issues found in 1 source file
电脑! ¯\_(ツ)_/¯
> pip3.8 list
Package Version
----------------- -------
attrs 19.3.0
mypy 0.761
mypy-extensions 0.4.3
pip 19.3.1
setuptools 42.0.2
typed-ast 1.4.1
typing-extensions 3.7.4.1
wheel 0.33.6
> mypy --version
mypy 0.761
# types.py
import typing
import attr
@attr.s(auto_attribs=True, slots=True, frozen=True)
class Test:
b: bool = False
> mypy types.py
types.py:4: error: Cannot determine type of 's'
Found 1 error in 1 file (checked 1 source file)
我是否需要安装其他东西以获得 attrs
支持?
嘿,这很奇怪,可能是 mypy 中的错误!将 types.py
重命名为其他名称即可:
$ mypy types.py
types.py:4: error: Cannot determine type of 's'
Found 1 error in 1 file (checked 1 source file)
$ mv types.py t.py
$ mypy t.py
Success: no issues found in 1 source file
电脑! ¯\_(ツ)_/¯