mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-25 12:26:44 +08:00
Audit stdlib object annotations (#9519)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import abc
|
||||
import sys
|
||||
from _typeshed import FileDescriptorOrPath, Self
|
||||
from _typeshed import FileDescriptorOrPath, Self, Unused
|
||||
from abc import abstractmethod
|
||||
from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Callable, Generator, Iterator
|
||||
from types import TracebackType
|
||||
@@ -108,7 +108,7 @@ _SupportsCloseT = TypeVar("_SupportsCloseT", bound=_SupportsClose)
|
||||
|
||||
class closing(AbstractContextManager[_SupportsCloseT]):
|
||||
def __init__(self, thing: _SupportsCloseT) -> None: ...
|
||||
def __exit__(self, *exc_info: object) -> None: ...
|
||||
def __exit__(self, *exc_info: Unused) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
class _SupportsAclose(Protocol):
|
||||
@@ -117,7 +117,7 @@ if sys.version_info >= (3, 10):
|
||||
|
||||
class aclosing(AbstractAsyncContextManager[_SupportsAcloseT]):
|
||||
def __init__(self, thing: _SupportsAcloseT) -> None: ...
|
||||
async def __aexit__(self, *exc_info: object) -> None: ...
|
||||
async def __aexit__(self, *exc_info: Unused) -> None: ...
|
||||
|
||||
class suppress(AbstractContextManager[None]):
|
||||
def __init__(self, *exceptions: type[BaseException]) -> None: ...
|
||||
@@ -178,9 +178,9 @@ if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
|
||||
def __enter__(self) -> _T: ...
|
||||
def __exit__(self, *exctype: object) -> None: ...
|
||||
def __exit__(self, *exctype: Unused) -> None: ...
|
||||
async def __aenter__(self) -> _T: ...
|
||||
async def __aexit__(self, *exctype: object) -> None: ...
|
||||
async def __aexit__(self, *exctype: Unused) -> None: ...
|
||||
|
||||
else:
|
||||
class nullcontext(AbstractContextManager[_T]):
|
||||
@@ -190,7 +190,7 @@ else:
|
||||
@overload
|
||||
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
|
||||
def __enter__(self) -> _T: ...
|
||||
def __exit__(self, *exctype: object) -> None: ...
|
||||
def __exit__(self, *exctype: Unused) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
_T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=FileDescriptorOrPath)
|
||||
@@ -199,4 +199,4 @@ if sys.version_info >= (3, 11):
|
||||
path: _T_fd_or_any_path
|
||||
def __init__(self, path: _T_fd_or_any_path) -> None: ...
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(self, *excinfo: object) -> None: ...
|
||||
def __exit__(self, *excinfo: Unused) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user