Use _typeshed.Self where __enter__ returns self (#5698)

This commit is contained in:
Dominic Davis-Foster
2021-06-27 20:58:58 +01:00
committed by GitHub
parent 1fb100dca4
commit 58559e56b3
7 changed files with 16 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
import collections.abc
from _typeshed import Self
from typing import Any, Dict, Iterator, Optional, Tuple
class Shelf(collections.abc.MutableMapping[Any, Any]):
@@ -12,7 +13,7 @@ class Shelf(collections.abc.MutableMapping[Any, Any]):
def __getitem__(self, key: str) -> Any: ...
def __setitem__(self, key: str, value: Any) -> None: ...
def __delitem__(self, key: str) -> None: ...
def __enter__(self) -> Shelf: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, type: Any, value: Any, traceback: Any) -> None: ...
def close(self) -> None: ...
def __del__(self) -> None: ...