typeshed
typeshed copied to clipboard
Additional return types for psycopg2 connections
Adds correct return types for DB connection and cursor methods that deal with namedtuple
and dict
-like cursors. Currently the types are either incomplete (e.g. the connections' cursor
methods do not specify return types) or wrong (e.g. DictCursor
's fetch*
methods should not return tuple
s, which is currently inherited from DictCursorBase
).
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
I'm not sure of the best approach to solving the mypy errors in CI. The cases where it is reporting that an override's return types are incompatible with the super return types are how it is actually implemented in the underlying library's code (i.e. the stubs I've added merely reflect the reality of the code). Thoughts?
Stubs should reflect what the library actually does. We use # type: ignore[override]
to silence type checker errors in situations like this.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
All right. I have made several changes, including adding # type: ignore
for the incompatible return types. I believe this PR is ready for review now.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
One new commit for review.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉