-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Use typeshed.Incomplete and object instead of Any in tkinter stubs #8458
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
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Alex Waygood <[email protected]>
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
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, this is very useful! I skimmed it, and while there are a few more places where the Incomplete
could be removed, since this is only a stylistic nit, we can merge as is.
This comment has been minimized.
This comment has been minimized.
@@ -1126,7 +1131,7 @@ class Canvas(Widget, XView, YView): | |||
insertontime: int = ..., | |||
insertwidth: _ScreenUnits = ..., | |||
name: str = ..., | |||
offset: Any = ..., # undocumented | |||
offset: Incomplete = ..., # undocumented |
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.
offset: Incomplete = ..., # undocumented | |
offset=..., # undocumented |
@@ -1165,7 +1170,7 @@ class Canvas(Widget, XView, YView): | |||
insertofftime: int = ..., | |||
insertontime: int = ..., | |||
insertwidth: _ScreenUnits = ..., | |||
offset: Any = ..., # undocumented | |||
offset: Incomplete = ..., # undocumented |
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.
offset: Incomplete = ..., # undocumented | |
offset=..., # undocumented |
def go(self, dir_or_file: Any = ..., pattern: str = ..., default: str = ..., key: Any | None = ...): ... | ||
def quit(self, how: Any | None = ...) -> None: ... | ||
how: Incomplete | None | ||
def go(self, dir_or_file: Incomplete = ..., pattern: str = ..., default: str = ..., key: Incomplete | 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.
def go(self, dir_or_file: Incomplete = ..., pattern: str = ..., default: str = ..., key: Incomplete | None = ...): ... | |
def go(self, dir_or_file=..., pattern: str = ..., default: str = ..., key: Incomplete | None = ...): ... |
@@ -77,7 +78,7 @@ class Button(Widget): | |||
default: Literal["normal", "active", "disabled"] = ..., | |||
image: tkinter._ImageSpec = ..., | |||
name: str = ..., | |||
padding: Any = ..., # undocumented | |||
padding: Incomplete = ..., # undocumented |
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.
padding: Incomplete = ..., # undocumented | |
padding=..., # undocumented |
@@ -96,7 +97,7 @@ class Button(Widget): | |||
cursor: tkinter._Cursor = ..., | |||
default: Literal["normal", "active", "disabled"] = ..., | |||
image: tkinter._ImageSpec = ..., | |||
padding: Any = ..., | |||
padding: Incomplete = ..., |
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.
padding: Incomplete = ..., | |
padding=..., |
@@ -546,7 +547,7 @@ class Notebook(Widget): | |||
sticky: str = ..., # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty | |||
padding: tkinter._Padding = ..., | |||
text: str = ..., | |||
image: Any = ..., # Sequence of an image name, followed by zero or more (sequences of one or more state names followed by an image name) | |||
image: Incomplete = ..., # Sequence of an image name, followed by zero or more (sequences of one or more state names followed by an image name) |
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.
image: Incomplete = ..., # Sequence of an image name, followed by zero or more (sequences of one or more state names followed by an image name) | |
image=..., # Sequence of an image name, followed by zero or more (sequences of one or more state names followed by an image name) |
@@ -662,7 +663,7 @@ class Radiobutton(Widget): | |||
cursor: tkinter._Cursor = ..., | |||
image: tkinter._ImageSpec = ..., | |||
name: str = ..., | |||
padding: Any = ..., # undocumented | |||
padding: Incomplete = ..., # undocumented |
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.
padding: Incomplete = ..., # undocumented | |
padding=..., # undocumented |
@@ -682,7 +683,7 @@ class Radiobutton(Widget): | |||
compound: _TtkCompound = ..., | |||
cursor: tkinter._Cursor = ..., | |||
image: tkinter._ImageSpec = ..., | |||
padding: Any = ..., | |||
padding: Incomplete = ..., |
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.
padding: Incomplete = ..., | |
padding=..., |
@@ -869,7 +870,7 @@ class Spinbox(Entry): | |||
invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented | |||
justify: Literal["left", "center", "right"] = ..., # undocumented | |||
name: str = ..., | |||
show: Any = ..., # undocumented | |||
show: Incomplete = ..., # undocumented |
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.
show: Incomplete = ..., # undocumented | |
show=..., # undocumented |
@@ -898,7 +899,7 @@ class Spinbox(Entry): | |||
increment: float = ..., | |||
invalidcommand: tkinter._EntryValidateCommand = ..., | |||
justify: Literal["left", "center", "right"] = ..., | |||
show: Any = ..., | |||
show: Incomplete = ..., |
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.
show: Incomplete = ..., | |
show=..., |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Don't know how I missed all of those :D I'll make a new PR. |
Created by replacing all
Any
s withIncomplete
and then reviewing manually withgit add -p
.Tkinter had quite a lot of
Any
for a few reasons:Any | None
(actuallyOptional[Any]
) for parameters with aNone
default value.Any
in callables before I learned aboutCallable[[foo], object]
for ignored return values.Any
.