From b020f0d8ebf06e10b131f712259a7a65f3861c42 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 6 Jun 2021 16:35:47 +0300 Subject: [PATCH 1/4] finish types of tkinter.Menu --- stdlib/tkinter/__init__.pyi | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 8d328abae4d5..368e7f593a5f 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1841,10 +1841,10 @@ class Menu(Widget): @overload def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ... config = configure - def tk_popup(self, x: int, y: int, entry: _MenuIndex = ...): ... - def activate(self, index): ... - def add(self, itemType, cnf=..., **kw): ... - def insert(self, index, itemType, cnf=..., **kw): ... + def tk_popup(self, x: int, y: int, entry: _MenuIndex = ...) -> None: ... + def activate(self, index: _MenuIndex) -> None: ... + def add(self, itemType, cnf=..., **kw): ... # docstring says "Internal function." + def insert(self, index, itemType, cnf=..., **kw): ... # docstring says "Internal function." def add_cascade( self, cnf: Optional[Dict[str, Any]] = ..., @@ -2035,17 +2035,17 @@ class Menu(Widget): variable: Variable = ..., ) -> None: ... def insert_separator(self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., *, background: _Color = ...) -> None: ... - def delete(self, index1, index2: Optional[Any] = ...): ... - def entrycget(self, index, option): ... - def entryconfigure(self, index, cnf: Optional[Any] = ..., **kw): ... - entryconfig: Any - def index(self, index): ... - def invoke(self, index): ... - def post(self, x, y): ... - def type(self, index): ... - def unpost(self): ... - def xposition(self, index): ... - def yposition(self, index): ... + def delete(self, index1: _MenuIndex, index2: Optional[_MenuIndex] = ...): ... + def entrycget(self, index: _MenuIndex, option: str) -> Any: ... + def entryconfigure(self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., **kw: Any): ... + entryconfig = entryconfigure + def index(self, index: _MenuIndex) -> Optional[int]: ... + def invoke(self, index: _MenuIndex) -> Any: ... + def post(self, x: int, y: int) -> None: ... + def type(self, index: _MenuIndex) -> Literal["cascade", "checkbutton", "command", "radiobutton", "separator"]: ... + def unpost(self) -> None: ... + def xposition(self, index: _MenuIndex) -> int: ... + def yposition(self, index: _MenuIndex) -> int: ... class Menubutton(Widget): def __init__( From 00140df0a5ff8a3d3cdff8bf59bf1a04de0bccd9 Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 6 Jun 2021 16:41:57 +0300 Subject: [PATCH 2/4] add missing return types --- stdlib/tkinter/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 368e7f593a5f..3853da2ebc13 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -2035,9 +2035,9 @@ class Menu(Widget): variable: Variable = ..., ) -> None: ... def insert_separator(self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., *, background: _Color = ...) -> None: ... - def delete(self, index1: _MenuIndex, index2: Optional[_MenuIndex] = ...): ... + def delete(self, index1: _MenuIndex, index2: Optional[_MenuIndex] = ...) -> None: ... def entrycget(self, index: _MenuIndex, option: str) -> Any: ... - def entryconfigure(self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., **kw: Any): ... + def entryconfigure(self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., **kw: Any) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... entryconfig = entryconfigure def index(self, index: _MenuIndex) -> Optional[int]: ... def invoke(self, index: _MenuIndex) -> Any: ... From d15f3be04380def5d9f2d0822e0ff9742ab322be Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 6 Jun 2021 16:42:32 +0300 Subject: [PATCH 3/4] blakkk --- stdlib/tkinter/__init__.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 3853da2ebc13..12c839807492 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -2037,7 +2037,9 @@ class Menu(Widget): def insert_separator(self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., *, background: _Color = ...) -> None: ... def delete(self, index1: _MenuIndex, index2: Optional[_MenuIndex] = ...) -> None: ... def entrycget(self, index: _MenuIndex, option: str) -> Any: ... - def entryconfigure(self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., **kw: Any) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + def entryconfigure( + self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., **kw: Any + ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... entryconfig = entryconfigure def index(self, index: _MenuIndex) -> Optional[int]: ... def invoke(self, index: _MenuIndex) -> Any: ... From b2ef91fcb206e2652f9fb9559402adf7b15cab2a Mon Sep 17 00:00:00 2001 From: Akuli Date: Sun, 6 Jun 2021 19:10:34 +0300 Subject: [PATCH 4/4] nit --- stdlib/tkinter/__init__.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 12c839807492..45cdc60c07cc 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -2035,13 +2035,13 @@ class Menu(Widget): variable: Variable = ..., ) -> None: ... def insert_separator(self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., *, background: _Color = ...) -> None: ... - def delete(self, index1: _MenuIndex, index2: Optional[_MenuIndex] = ...) -> None: ... + def delete(self, index1: _MenuIndex, index2: _MenuIndex | None = ...) -> None: ... def entrycget(self, index: _MenuIndex, option: str) -> Any: ... def entryconfigure( - self, index: _MenuIndex, cnf: Optional[Dict[str, Any]] = ..., **kw: Any - ) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ... + self, index: _MenuIndex, cnf: dict[str, Any] | None = ..., **kw: Any + ) -> dict[str, Tuple[str, str, str, Any, Any]] | None: ... entryconfig = entryconfigure - def index(self, index: _MenuIndex) -> Optional[int]: ... + def index(self, index: _MenuIndex) -> int | None: ... def invoke(self, index: _MenuIndex) -> Any: ... def post(self, x: int, y: int) -> None: ... def type(self, index: _MenuIndex) -> Literal["cascade", "checkbutton", "command", "radiobutton", "separator"]: ...