-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Stubs and use of @deprecated
names
#18007
Comments
(I added a topic-pep-702 label, @tyralla fyi.) |
I think suppressing all deprecated errors in stubs could make sense |
I feel that might be too much; if we deprecate something in |
We could just special case typeshed stubs in particular then (mypy already does this in a few places) (And in general that feels niche / for type-only programs removals don't feel too much more disruptive than deprecations) |
Do you mean just extending the current def warn_deprecated(self, node: SymbolNode | None, context: Context) -> None:
"""Warn if deprecated."""
if isinstance(node, Decorator):
node = node.func
if isinstance(node, (FuncDef, OverloadedFuncDef, TypeInfo)) and (
(deprecated := node.deprecated) is not None
) and not self.is_typeshed_stub: # !!!
warn = self.msg.fail if self.options.report_deprecated_as_error else self.msg.note
warn(deprecated, context, code=codes.DEPRECATED) If so (and if it works, not checked so far), I could modify PR #17926 accordingly, which still suffers under typeshed issues. (Thanks for the new label, @JelleZijlstra.) |
Yup! |
Seems I am starting to learn some Mypy slang ;-) |
Running stubtest from mypy main on typeshed produces:
Which is not very useful. Maybe we should suppress
deprecated
in typeshed's configuration or in stubtest in general.The text was updated successfully, but these errors were encountered: