mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-01 13:40:23 +08:00
Add @type_check_only to stub-only private classes in stdlib (#14512)
This commit is contained in:
@@ -3,7 +3,7 @@ from _typeshed import MaybeNone
|
||||
from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, Sequence
|
||||
from contextlib import _GeneratorContextManager
|
||||
from types import TracebackType
|
||||
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload
|
||||
from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -262,6 +262,7 @@ class _patch(Generic[_T]):
|
||||
# This class does not exist at runtime, it's a hack to make this work:
|
||||
# @patch("foo")
|
||||
# def bar(..., mock: MagicMock) -> None: ...
|
||||
@type_check_only
|
||||
class _patch_pass_arg(_patch[_T]):
|
||||
@overload
|
||||
def __call__(self, func: _TT) -> _TT: ...
|
||||
@@ -288,6 +289,7 @@ class _patch_dict:
|
||||
|
||||
# This class does not exist at runtime, it's a hack to add methods to the
|
||||
# patch() function.
|
||||
@type_check_only
|
||||
class _patcher:
|
||||
TEST_PREFIX: str
|
||||
dict: type[_patch_dict]
|
||||
|
||||
Reference in New Issue
Block a user