mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-10 10:26:31 +08:00
Add @type_check_only to stub-only private classes in stdlib (#14512)
This commit is contained in:
@@ -6,9 +6,10 @@ from collections.abc import Callable, Iterable, Mapping
|
||||
from datetime import datetime
|
||||
from io import BytesIO
|
||||
from types import TracebackType
|
||||
from typing import Any, ClassVar, Final, Literal, Protocol, overload
|
||||
from typing import Any, ClassVar, Final, Literal, Protocol, overload, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
@type_check_only
|
||||
class _SupportsTimeTuple(Protocol):
|
||||
def timetuple(self) -> time.struct_time: ...
|
||||
|
||||
|
||||
@@ -4,28 +4,34 @@ import socketserver
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Callable, Iterable, Mapping
|
||||
from re import Pattern
|
||||
from typing import Any, ClassVar, Protocol
|
||||
from typing import Any, ClassVar, Protocol, type_check_only
|
||||
from typing_extensions import TypeAlias
|
||||
from xmlrpc.client import Fault, _Marshallable
|
||||
|
||||
# The dispatch accepts anywhere from 0 to N arguments, no easy way to allow this in mypy
|
||||
@type_check_only
|
||||
class _DispatchArity0(Protocol):
|
||||
def __call__(self) -> _Marshallable: ...
|
||||
|
||||
@type_check_only
|
||||
class _DispatchArity1(Protocol):
|
||||
def __call__(self, arg1: _Marshallable, /) -> _Marshallable: ...
|
||||
|
||||
@type_check_only
|
||||
class _DispatchArity2(Protocol):
|
||||
def __call__(self, arg1: _Marshallable, arg2: _Marshallable, /) -> _Marshallable: ...
|
||||
|
||||
@type_check_only
|
||||
class _DispatchArity3(Protocol):
|
||||
def __call__(self, arg1: _Marshallable, arg2: _Marshallable, arg3: _Marshallable, /) -> _Marshallable: ...
|
||||
|
||||
@type_check_only
|
||||
class _DispatchArity4(Protocol):
|
||||
def __call__(
|
||||
self, arg1: _Marshallable, arg2: _Marshallable, arg3: _Marshallable, arg4: _Marshallable, /
|
||||
) -> _Marshallable: ...
|
||||
|
||||
@type_check_only
|
||||
class _DispatchArityN(Protocol):
|
||||
def __call__(self, *args: _Marshallable) -> _Marshallable: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user