-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Mark stub-only private symbols as @type_check_only
in third-party stubs
#14545
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
Mark stub-only private symbols as @type_check_only
in third-party stubs
#14545
Conversation
class _DatetimeWithFold(datetime): | ||
@property | ||
def fold(self): ... | ||
|
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.
_DatetimeWithFold
only exists in Python <3.6
@runtime_checkable | ||
@type_check_only | ||
class _Readable(Protocol): |
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.
Likely a typo for @type_check_only
- _Readable
didn't exist at the time when it was added to the stubs
class _FieldMaskTree: | ||
def __init__(self, field_mask: Incomplete | None = ...) -> None: ... | ||
def MergeFromFieldMask(self, field_mask: tAny) -> None: ... | ||
def AddPath(self, path: tAny): ... | ||
def ToFieldMask(self, field_mask: tAny) -> None: ... | ||
def IntersectPath(self, path: tAny, intersection: tAny): ... | ||
def AddLeafNodes(self, prefix: tAny, node: tAny) -> None: ... | ||
def MergeMessage(self, source: tAny, destination: tAny, replace_message: tAny, replace_repeated: tAny) -> None: ... | ||
|
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.
Formerly an actual private type, since removed
class _BetaConfiguration(SetuptoolsWarning): ... | ||
class _InvalidFile(SetuptoolsWarning): ... |
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.
Formerly actual private type, since removed
@@ -77,4 +77,3 @@ class _NamespaceInstaller(namespaces.Installer): | |||
|
|||
class InformationOnly(SetuptoolsWarning): ... | |||
class LinksNotSupported(errors.FileError): ... | |||
class _DebuggingTips(SetuptoolsWarning): ... |
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.
Formerly an actual private type, since removed
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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.
Thanks for the final push to redeem @type_check_only
.
This fixes the third-party stubtest errors from python/mypy#19574.
Mostly obvious cases like stub-only Protocols or TypedDicts. I've added inline comments to some of the less obvious cases that took some investigation.