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
Use typeshed.Incomplete and object instead of Any in tkinter stubs #8458
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 <Alex.Waygood@Gmail.com>
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
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. |
* master: Remove `Enum.__hash__`, improve `Enum.__reduce_ex__` (python#8477) refactor: prefer f-strings to other format/concatentation styles (python#8474) Remove redundant `__str__` methods (python#8475) Add some missing stubs in datetimerange (python#8470) tkinter: get rid of unnecessary Incomplete (python#8471) Improve urllib3.util.url annotations (python#8460) Fix `complex` constructor (python#8473) [pre-commit.ci] pre-commit autoupdate (python#8461) Use typeshed.Incomplete and object instead of Any in tkinter stubs (python#8458)
* master: Add `urllib3.contrib.socks`; improve `urllib3.connectionpool` (python#8457) Improve `multiprocessing.context` module (python#8466) Always return `True` from `xml.dom.minidom.Node.__bool__` (python#8480) Adds missing `__dir__` definitions (python#8479) Various pyvmomi improvements (python#8469) Bump pytype version. (python#8478) Remove `Enum.__hash__`, improve `Enum.__reduce_ex__` (python#8477) refactor: prefer f-strings to other format/concatentation styles (python#8474) Remove redundant `__str__` methods (python#8475) Add some missing stubs in datetimerange (python#8470) tkinter: get rid of unnecessary Incomplete (python#8471) Improve urllib3.util.url annotations (python#8460) Fix `complex` constructor (python#8473) [pre-commit.ci] pre-commit autoupdate (python#8461) Use typeshed.Incomplete and object instead of Any in tkinter stubs (python#8458) `io.IOBase`: correct metaclass (python#8468)
Created by replacing all
Anys withIncompleteand then reviewing manually withgit add -p.Tkinter had quite a lot of
Anyfor a few reasons:Any | None(actuallyOptional[Any]) for parameters with aNonedefault value.Anyin callables before I learned aboutCallable[[foo], object]for ignored return values.Any.