mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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]]
|
||||
|
||||
Reference in New Issue
Block a user