Add @type_check_only to stub-only private classes in stdlib (#14512)

This commit is contained in:
Brian Schubert
2025-08-03 10:13:16 +02:00
committed by GitHub
parent dde70aeecd
commit 622df68c1c
61 changed files with 188 additions and 51 deletions
+5 -1
View File
@@ -3,7 +3,7 @@ import tkinter
from _typeshed import Incomplete, MaybeNone
from collections.abc import Callable
from tkinter.font import _FontDescription
from typing import Any, Literal, TypedDict, overload
from typing import Any, Literal, TypedDict, overload, type_check_only
from typing_extensions import TypeAlias
__all__ = [
@@ -928,6 +928,7 @@ class Spinbox(Entry):
config = configure # type: ignore[assignment]
def set(self, value: Any) -> None: ...
@type_check_only
class _TreeviewItemDict(TypedDict):
text: str
image: list[str] | Literal[""] # no idea why it's wrapped in list
@@ -935,6 +936,7 @@ class _TreeviewItemDict(TypedDict):
open: bool # actually 0 or 1
tags: list[str] | Literal[""]
@type_check_only
class _TreeviewTagDict(TypedDict):
# There is also 'text' and 'anchor', but they don't seem to do anything, using them is likely a bug
foreground: str
@@ -942,6 +944,7 @@ class _TreeviewTagDict(TypedDict):
font: _FontDescription
image: str # not wrapped in list :D
@type_check_only
class _TreeviewHeaderDict(TypedDict):
text: str
image: list[str] | Literal[""]
@@ -949,6 +952,7 @@ class _TreeviewHeaderDict(TypedDict):
command: str
state: str # Doesn't seem to appear anywhere else than in these dicts
@type_check_only
class _TreeviewColumnDict(TypedDict):
width: int
minwidth: int