Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncpg.Record is not a mapping #122

Closed
poofeg opened this issue Nov 5, 2022 · 2 comments
Closed

asyncpg.Record is not a mapping #122

poofeg opened this issue Nov 5, 2022 · 2 comments

Comments

@poofeg
Copy link

poofeg commented Nov 5, 2022

Why doesn't asyncpg.Record inherit collections.abc.Mapping[str, Any]? This is a valid code:

record: asyncpg.Record
...
some_func(**record)

But mypy says: error: Argument after ** must be a mapping, not "Record".

poofeg added a commit to poofeg/asyncpg-stubs that referenced this issue Nov 5, 2022
@bryanforbes
Copy link
Owner

I opened a discusson over at the Python Type School to find out how to solve this issue and it turns out that this is a bug in both mypy and pyright. The bug in pyright has been fixed in version 1.1.301 and I have opened an issue with mypy to fix it there. Once that has been addressed in mypy, the code you have shared here will work.

@bryanforbes
Copy link
Owner

mypy version 1.3 has been released with the fix for this issue. Consequently, this is no longer a problem with pyright or mypy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants