Use typeshed.Incomplete and object instead of Any in tkinter stubs (#8458)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Akuli
2022-08-02 22:10:25 +03:00
committed by GitHub
parent 1dc1c91429
commit 5e5f3b4ecc
10 changed files with 230 additions and 218 deletions

View File

@@ -1,8 +1,8 @@
import sys
from _typeshed import StrOrBytesPath
from _typeshed import Incomplete, StrOrBytesPath
from collections.abc import Iterable
from tkinter import Button, Entry, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, commondialog
from typing import IO, Any, ClassVar
from typing import IO, ClassVar
from typing_extensions import Literal
if sys.version_info >= (3, 9):
@@ -22,12 +22,12 @@ if sys.version_info >= (3, 9):
"askdirectory",
]
dialogstates: dict[Any, tuple[Any, Any]]
dialogstates: dict[Incomplete, tuple[Incomplete, Incomplete]]
class FileDialog:
title: str
master: Any
directory: Any | None
master: Incomplete
directory: Incomplete | None
top: Toplevel
botframe: Frame
selection: Entry
@@ -41,21 +41,21 @@ class FileDialog:
filter_button: Button
cancel_button: Button
def __init__(
self, master, title: Any | None = ...
self, master, title: Incomplete | None = ...
) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either
how: Any | None
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 = ...): ...
def quit(self, how: Incomplete | None = ...) -> None: ...
def dirs_double_event(self, event) -> None: ...
def dirs_select_event(self, event) -> None: ...
def files_double_event(self, event) -> None: ...
def files_select_event(self, event) -> None: ...
def ok_event(self, event) -> None: ...
def ok_command(self) -> None: ...
def filter_command(self, event: Any | None = ...) -> None: ...
def filter_command(self, event: Incomplete | None = ...) -> None: ...
def get_filter(self): ...
def get_selection(self): ...
def cancel_command(self, event: Any | None = ...) -> None: ...
def cancel_command(self, event: Incomplete | None = ...) -> None: ...
def set_filter(self, dir, pat) -> None: ...
def set_selection(self, file) -> None: ...
@@ -126,7 +126,7 @@ def asksaveasfile(
parent: Misc | None = ...,
title: str | None = ...,
typevariable: StringVar | str | None = ...,
) -> IO[Any] | None: ...
) -> IO[Incomplete] | None: ...
def askopenfile(
mode: str = ...,
*,
@@ -137,7 +137,7 @@ def askopenfile(
parent: Misc | None = ...,
title: str | None = ...,
typevariable: StringVar | str | None = ...,
) -> IO[Any] | None: ...
) -> IO[Incomplete] | None: ...
def askopenfiles(
mode: str = ...,
*,
@@ -148,5 +148,5 @@ def askopenfiles(
parent: Misc | None = ...,
title: str | None = ...,
typevariable: StringVar | str | None = ...,
) -> tuple[IO[Any], ...]: ... # can be empty tuple
) -> tuple[IO[Incomplete], ...]: ... # can be empty tuple
def test() -> None: ...