hauntsaninja / mypy_primer

Run mypy and pyright over millions of lines of code
MIT License
55 stars 29 forks source link

Include python-sop #26

Closed mr-c closed 2 years ago

mr-c commented 2 years ago

Would have caught this mypy 0.930 regression: https://ci.debian.net/data/autopkgtest/testing/amd64/p/python-sop/18100014/log.gz

sop/__init__.py:224: error: Missing type parameters for generic type "_SubParsersAction"
sop/__init__.py:387: error: Missing type parameters for generic type "_SubParsersAction"
Akuli commented 2 years ago

Regarding _SubParsersAction: I probably would have merged https://github.com/python/typeshed/pull/6178 even with the new mypy error. It's not uncommon for us to make classes generic to improve something, especially if the class is _NamedLikeThis. The proper solution to this would be default generics (https://github.com/python/typing/issues/307), but while that isn't available yet, you sometimes just have to change Foo to Foo[Bar] in type annotations.