Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -1,27 +1,27 @@
from _typeshed import Self
from collections.abc import Iterator, MutableMapping
from types import TracebackType
from typing import Optional, Type, TypeVar, Union, overload
from typing import Type, TypeVar, overload
_T = TypeVar("_T")
_VT = TypeVar("_VT")
class Shelf(MutableMapping[str, _VT]):
def __init__(
self, dict: MutableMapping[bytes, bytes], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...
self, dict: MutableMapping[bytes, bytes], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ...
) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __len__(self) -> int: ...
@overload
def get(self, key: str) -> Optional[_VT]: ...
def get(self, key: str) -> _VT | None: ...
@overload
def get(self, key: str, default: _T) -> Union[_VT, _T]: ...
def get(self, key: str, default: _T) -> _VT | _T: ...
def __getitem__(self, key: str) -> _VT: ...
def __setitem__(self, key: str, value: _VT) -> None: ...
def __delitem__(self, key: str) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]
self, type: Type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def close(self) -> None: ...
def sync(self) -> None: ...
@@ -34,6 +34,6 @@ class BsdDbShelf(Shelf[_VT]):
def last(self) -> tuple[str, _VT]: ...
class DbfilenameShelf(Shelf[_VT]):
def __init__(self, filename: str, flag: str = ..., protocol: Optional[int] = ..., writeback: bool = ...) -> None: ...
def __init__(self, filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ...
def open(filename: str, flag: str = ..., protocol: Optional[int] = ..., writeback: bool = ...) -> Shelf[object]: ...
def open(filename: str, flag: str = ..., protocol: int | None = ..., writeback: bool = ...) -> Shelf[object]: ...