-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Missing attributes for MappingView and subclasses in stdlib/collections_abc_.pyi #7576
Comments
Hmm, this attribute is marked as private, and doesn't appear to be documented anywhere. Can I ask what your use case is for accessing it? 🙂 We're generally happy to add undocumented undocumented/private attributes to stubs if there's a valid use case, but we need to be more cautious when making changes to |
@AlexWaygood I would propose only adding them to In fact, I would be against adding them to As for the use case, in my case I wanted to create a custom mapping class that would convert the keys automatically, for which i need custom views to apply the conversions in case someone uses |
If you're proposing decoupling the types in |
This is similar to #7153. |
entirely undocumented but also required if you want any tangible benefit from using collections.abc.MappingView and descendants. its really no big deal to work around, but since its even implemented in slots in the abc i do think you're meant to use it. |
Feel free to make a PR that adds |
Closing due to lack of response from OP on the PR: #7583 (comment) Feel free to open a new PR with the requested changes, if you're still interested in this issue, @laundmo :) |
Due to
stdlib/_collections_abc.pyi
importing most directly fromstdlib/typing.pyi
, MappingView and its subclasses are missing theself._mapping
attribute. This is an issue if inheriting from them for implementing custom views. This causes pyright and mypy (with--check-untyped-defs
) to fail.Minimal Example:
mypy --check-untyped-defs test.py
pyright test.py
I'm open to trying to PR this myself, though I have little experience writing stub files.
The text was updated successfully, but these errors were encountered: