Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)

This commit is contained in:
Brian Schubert
2025-08-08 05:29:48 -04:00
committed by GitHub
parent a358dc24e8
commit 81c8fcb2e6
131 changed files with 334 additions and 147 deletions
+2 -1
View File
@@ -1,7 +1,7 @@
from collections.abc import Callable, Iterable, Sequence
from re import Pattern
from types import FunctionType, MethodType
from typing import Any, Literal, TypedDict, overload
from typing import Any, Literal, TypedDict, overload, type_check_only
from typing_extensions import TypeAlias
from Xlib import error
@@ -22,6 +22,7 @@ _ResourceBaseClass: TypeAlias = (
)
# Is the type of the `_resource_baseclasses` variable, defined in this file at runtime
@type_check_only
class _ResourceBaseClassesType(TypedDict): # noqa: Y049
resource: type[resource.Resource]
drawable: type[drawable.Drawable]
+2 -1
View File
@@ -1,7 +1,7 @@
from _typeshed import SupportsDunderGT, SupportsDunderLT, SupportsRead
from collections.abc import Iterable, Mapping, Sequence
from re import Pattern
from typing import Any, Final, Protocol, TypeVar, overload
from typing import Any, Final, Protocol, TypeVar, overload, type_check_only
from typing_extensions import TypeAlias
from Xlib.display import Display
@@ -15,6 +15,7 @@ _DB: TypeAlias = dict[str, tuple[_DB, ...]]
# so this is a slightly less precise version of the _DB alias for parameter annotations
_DB_Param: TypeAlias = dict[str, Any]
@type_check_only
class _SupportsComparisons(SupportsDunderLT[_T_contra], SupportsDunderGT[_T_contra], Protocol[_T_contra]): ...
comment_re: Final[Pattern[str]]