Skip to content

Fix stubtest complaints for various .get() methods #10690

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

Merged
merged 8 commits into from
Sep 10, 2023

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Sep 10, 2023

key and default can be passed as keyword arguments for all of these methods

@AlexWaygood AlexWaygood marked this pull request as draft September 10, 2023 15:39
@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood changed the title Fix stubtest complaints for collections.ChainMap.get() and collections.UserDict.get() Fix stubtest complaints for various .get() methods Sep 10, 2023
@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member Author

AlexWaygood commented Sep 10, 2023

Looks like a lot of the dict.get()-related errors in #10690 (comment) are actually "desirable" to some extent; mypy seems to be flagging a lot of issues in user code there. But the proposed changes to dict.get() were disruptive enough that they deserve to be considered in their own PR, so I've backed them out for now.

@github-actions

This comment has been minimized.

@AlexWaygood AlexWaygood marked this pull request as ready for review September 10, 2023 16:29
@AlexWaygood AlexWaygood marked this pull request as draft September 10, 2023 20:25
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood marked this pull request as ready for review September 10, 2023 20:39
@AlexWaygood
Copy link
Member Author

Thanks for the great review @Daverball!

@@ -96,6 +96,11 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
@overload
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
if sys.version_info >= (3, 12):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is from python/cpython#17910

@JelleZijlstra JelleZijlstra merged commit 6dda2fe into python:main Sep 10, 2023
@AlexWaygood AlexWaygood deleted the dot-get branch September 10, 2023 21:54
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 this pull request may close these issues.

3 participants