Add @type_check_only to various typeshed-only procotols in stdlib (#14465)

Mark various typeshed-only protocols as `@type_check_only` in stdlib
This commit is contained in:
Brian Schubert
2025-07-26 20:02:17 +01:00
committed by GitHub
parent e2d0c451e2
commit f88a09d479
15 changed files with 42 additions and 19 deletions
+2 -1
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Protocol, TypeVar
from typing import Any, Protocol, TypeVar, type_check_only
from typing_extensions import Self
__all__ = ["Error", "copy", "deepcopy"]
@@ -7,6 +7,7 @@ __all__ = ["Error", "copy", "deepcopy"]
_T = TypeVar("_T")
_SR = TypeVar("_SR", bound=_SupportsReplace)
@type_check_only
class _SupportsReplace(Protocol):
# In reality doesn't support args, but there's no other great way to express this.
def __replace__(self, *args: Any, **kwargs: Any) -> Self: ...