From 553f6e839d6db2432058e517ff8a3532de79446e Mon Sep 17 00:00:00 2001 From: Akuli Date: Mon, 4 Jan 2021 14:25:29 +0200 Subject: [PATCH 1/2] make __getitem__ and cget behave the same --- stdlib/3/tkinter/font.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/3/tkinter/font.pyi b/stdlib/3/tkinter/font.pyi index 19afbd90d120..67f3ca3b5cd3 100644 --- a/stdlib/3/tkinter/font.pyi +++ b/stdlib/3/tkinter/font.pyi @@ -46,7 +46,6 @@ class Font: underline: bool = ..., overstrike: bool = ..., ) -> None: ... - def __getitem__(self, key: str) -> Any: ... def __setitem__(self, key: str, value: Any) -> None: ... @overload def cget(self, option: Literal["family"]) -> str: ... @@ -59,6 +58,9 @@ class Font: @overload def cget(self, option: Literal["underline", "overstrike"]) -> Literal[0, 1]: ... @overload + def cget(self, option: str) -> Any: ... + __getitem__ = cget + @overload def actual(self, option: Literal["family"], displayof: Optional[tkinter.Misc] = ...) -> str: ... @overload def actual(self, option: Literal["size"], displayof: Optional[tkinter.Misc] = ...) -> int: ... From fde610fb37af6e9596b4c84b02caa916367a000a Mon Sep 17 00:00:00 2001 From: Akuli Date: Mon, 4 Jan 2021 14:40:15 +0200 Subject: [PATCH 2/2] whitelist __getitem__ --- tests/stubtest_whitelists/py3_common.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/stubtest_whitelists/py3_common.txt b/tests/stubtest_whitelists/py3_common.txt index 86a538bd95c9..063c91798510 100644 --- a/tests/stubtest_whitelists/py3_common.txt +++ b/tests/stubtest_whitelists/py3_common.txt @@ -362,6 +362,7 @@ timeit.main tkinter.Misc.grid_propagate tkinter.Misc.pack_propagate tkinter.Tk.report_callback_exception # A bit of a lie, since it's actually a method, but typing it as an attribute allows it to be assigned to +tkinter.font.Font.__getitem__ # Argument name differs (doesn't matter for __dunder__ methods) trace.CoverageResults.__init__ traceback.FrameSummary.__init__ traceback.TracebackException.__init__