-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
stubtest: analyze metaclass
of types, refs #13327
#13331
Conversation
While we usually don't add private elements to stubs, I think we should make an exception for base and metaclasses. Having a correct mro seems more important to me than omitting those classes. |
I agree with @srittau — I'm fine with adding private classes to stubs if they're used by public classes. |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
I want to merge this, any feedback, @hauntsaninja or @JelleZijlstra? 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you!
Thanks everyone! |
Current
typeshed
produces:There are two different problems:
string._TemplateMetaclass
, because we mostly don't add protected names to stubs. This can be solved by addingand not is_probably_private(stub.metaclass_type.type.fullname)
check (level: primitive). I just wanted to show the full picture: maybe we do want to add them to stubs?ExitStack
: Wrong return type from ExitStack.enter_context when given a child of ExitStack typeshed#7961 This is a real issue with these classes. We can at least addABCMeta
metaclass to themCC @srittau and @AlexWaygood
Closes #13327