Backport many Self-related changes to the Python-2 stdlib (#7128)

This commit is contained in:
Alex Waygood
2022-02-04 18:10:05 +00:00
committed by GitHub
parent 57b2bae031
commit 51cdd2c6be
19 changed files with 37 additions and 21 deletions

View File

@@ -1,3 +1,4 @@
from _typeshed import Self
from types import TracebackType
from typing import Iterator, MutableMapping, Union
from typing_extensions import Literal
@@ -13,7 +14,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
def __iter__(self) -> Iterator[bytes]: ...
def __len__(self) -> int: ...
def __del__(self) -> None: ...
def __enter__(self) -> _Database: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...

View File

@@ -1,3 +1,4 @@
from _typeshed import Self
from types import TracebackType
from typing import Iterator, MutableMapping, Union
@@ -17,7 +18,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
def __iter__(self) -> Iterator[bytes]: ...
def __len__(self) -> int: ...
def __del__(self) -> None: ...
def __enter__(self) -> _Database: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...

View File

@@ -1,3 +1,4 @@
from _typeshed import Self
from types import TracebackType
from typing import TypeVar, Union, overload
@@ -18,7 +19,7 @@ class _gdbm:
def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ...
def __delitem__(self, key: _KeyType) -> None: ...
def __len__(self) -> int: ...
def __enter__(self) -> _gdbm: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...

View File

@@ -1,3 +1,4 @@
from _typeshed import Self
from types import TracebackType
from typing import TypeVar, Union, overload
@@ -17,7 +18,7 @@ class _dbm:
def __delitem__(self, key: _KeyType) -> None: ...
def __len__(self) -> int: ...
def __del__(self) -> None: ...
def __enter__(self) -> _dbm: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...