mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-09 18:09:17 +08:00
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:
@@ -4,7 +4,7 @@ from _typeshed import FileDescriptorOrPath, Unused
|
||||
from abc import ABC, abstractmethod
|
||||
from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Callable, Generator, Iterator
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, Generic, Protocol, TypeVar, overload, runtime_checkable
|
||||
from typing import IO, Any, Generic, Protocol, TypeVar, overload, runtime_checkable, type_check_only
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias
|
||||
|
||||
__all__ = [
|
||||
@@ -112,7 +112,7 @@ else:
|
||||
) -> bool | None: ...
|
||||
|
||||
def asynccontextmanager(func: Callable[_P, AsyncIterator[_T_co]]) -> Callable[_P, _AsyncGeneratorContextManager[_T_co]]: ...
|
||||
|
||||
@type_check_only
|
||||
class _SupportsClose(Protocol):
|
||||
def close(self) -> object: ...
|
||||
|
||||
@@ -123,6 +123,7 @@ class closing(AbstractContextManager[_SupportsCloseT, None]):
|
||||
def __exit__(self, *exc_info: Unused) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
@type_check_only
|
||||
class _SupportsAclose(Protocol):
|
||||
def aclose(self) -> Awaitable[object]: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user