mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-18 06:10:11 +08:00
Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Literal, TypedDict
|
||||
from typing import Literal, TypedDict, type_check_only
|
||||
from typing_extensions import NotRequired, TypeAlias
|
||||
|
||||
_NodeType: TypeAlias = Literal[
|
||||
@@ -26,6 +26,7 @@ _NodeType: TypeAlias = Literal[
|
||||
"value_projection",
|
||||
]
|
||||
|
||||
@type_check_only
|
||||
class _ASTNode(TypedDict):
|
||||
type: _NodeType
|
||||
children: list[_ASTNode]
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from collections.abc import Callable, Iterable
|
||||
from typing import Any, TypedDict, TypeVar
|
||||
from typing import Any, TypedDict, TypeVar, type_check_only
|
||||
from typing_extensions import NotRequired
|
||||
|
||||
TYPES_MAP: dict[str, str]
|
||||
REVERSE_TYPES_MAP: dict[str, tuple[str, ...]]
|
||||
|
||||
@type_check_only
|
||||
class _Signature(TypedDict):
|
||||
types: list[str]
|
||||
variadic: NotRequired[bool]
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from collections.abc import Iterator
|
||||
from typing import ClassVar, TypedDict
|
||||
from typing import ClassVar, TypedDict, type_check_only
|
||||
|
||||
from jmespath.exceptions import EmptyExpressionError as EmptyExpressionError, LexerError as LexerError
|
||||
|
||||
@type_check_only
|
||||
class _LexerTokenizeResult(TypedDict):
|
||||
type: str
|
||||
value: str
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from _typeshed import Unused
|
||||
from collections.abc import Callable, MutableMapping
|
||||
from typing import Any, ClassVar, NoReturn, TypedDict, TypeVar
|
||||
from typing import Any, ClassVar, NoReturn, TypedDict, TypeVar, type_check_only
|
||||
|
||||
from jmespath.functions import Functions
|
||||
|
||||
@@ -27,6 +27,7 @@ class Visitor:
|
||||
def visit(self, node: _TreeNode, *args: Any, **kwargs: Any) -> Any: ...
|
||||
def default_visit(self, node: _TreeNode, *args: Unused, **kwargs: Unused) -> NoReturn: ...
|
||||
|
||||
@type_check_only
|
||||
class _TreeNode(TypedDict):
|
||||
type: str
|
||||
value: Any
|
||||
|
||||
Reference in New Issue
Block a user