Skip to content

Commit 82da1e1

Browse files
authored
Use Final in tkinter (#12545)
1 parent 9ecd07a commit 82da1e1

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

stdlib/_tkinter.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ EXCEPTION: Final = 8
106106
READABLE: Final = 2
107107
WRITABLE: Final = 4
108108

109-
TCL_VERSION: str
110-
TK_VERSION: str
109+
TCL_VERSION: Final[str]
110+
TK_VERSION: Final[str]
111111

112112
@final
113113
class TkttType:

stdlib/tkinter/constants.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from typing import Final
22

33
# These are not actually bools. See #4669
4-
NO: bool
5-
YES: bool
6-
TRUE: bool
7-
FALSE: bool
8-
ON: bool
9-
OFF: bool
4+
NO: Final[bool]
5+
YES: Final[bool]
6+
TRUE: Final[bool]
7+
FALSE: Final[bool]
8+
ON: Final[bool]
9+
OFF: Final[bool]
1010
N: Final = "n"
1111
S: Final = "s"
1212
W: Final = "w"

stdlib/tkinter/dialog.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import sys
22
from _typeshed import Incomplete
33
from collections.abc import Mapping
44
from tkinter import Widget
5-
from typing import Any
5+
from typing import Any, Final
66

77
if sys.version_info >= (3, 9):
88
__all__ = ["Dialog"]
99

10-
DIALOG_ICON: str
10+
DIALOG_ICON: Final = "questhead"
1111

1212
class Dialog(Widget):
1313
widgetName: str

stdlib/tkinter/messagebox.pyi

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from tkinter.commondialog import Dialog
3-
from typing import ClassVar
3+
from typing import ClassVar, Final
44

55
if sys.version_info >= (3, 9):
66
__all__ = [
@@ -14,22 +14,22 @@ if sys.version_info >= (3, 9):
1414
"askretrycancel",
1515
]
1616

17-
ERROR: str
18-
INFO: str
19-
QUESTION: str
20-
WARNING: str
21-
ABORTRETRYIGNORE: str
22-
OK: str
23-
OKCANCEL: str
24-
RETRYCANCEL: str
25-
YESNO: str
26-
YESNOCANCEL: str
27-
ABORT: str
28-
RETRY: str
29-
IGNORE: str
30-
CANCEL: str
31-
YES: str
32-
NO: str
17+
ERROR: Final = "error"
18+
INFO: Final = "info"
19+
QUESTION: Final = "question"
20+
WARNING: Final = "warning"
21+
ABORTRETRYIGNORE: Final = "abortretryignore"
22+
OK: Final = "ok"
23+
OKCANCEL: Final = "okcancel"
24+
RETRYCANCEL: Final = "retrycancel"
25+
YESNO: Final = "yesno"
26+
YESNOCANCEL: Final = "yesnocancel"
27+
ABORT: Final = "abort"
28+
RETRY: Final = "retry"
29+
IGNORE: Final = "ignore"
30+
CANCEL: Final = "cancel"
31+
YES: Final = "yes"
32+
NO: Final = "no"
3333

3434
class Message(Dialog):
3535
command: ClassVar[str]

0 commit comments

Comments
 (0)