Switch to PEP-604 syntax in python2 stubs (#5915)

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
Oleg Höfling
2021-08-14 11:12:30 +02:00
committed by GitHub
parent 431c4f7fc1
commit ff63953188
235 changed files with 2473 additions and 2768 deletions

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import Iterator, MutableMapping, Optional, Tuple, Type, Union
from typing import Iterator, MutableMapping, Tuple, Type, Union
from typing_extensions import Literal
_KeyType = Union[str, bytes]
@@ -15,7 +15,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
def __del__(self) -> None: ...
def __enter__(self) -> _Database: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
class _error(Exception): ...

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import Iterator, MutableMapping, Optional, Type, Union
from typing import Iterator, MutableMapping, Type, Union
_KeyType = Union[str, bytes]
_ValueType = Union[str, bytes]
@@ -19,7 +19,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
def __del__(self) -> None: ...
def __enter__(self) -> _Database: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def open(file: str, flag: str = ..., mode: int = ...) -> _Database: ...

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import List, Optional, Type, TypeVar, Union, overload
from typing import List, Type, TypeVar, Union, overload
_T = TypeVar("_T")
_KeyType = Union[str, bytes]
@@ -9,8 +9,8 @@ class error(OSError): ...
# Actual typename gdbm, not exposed by the implementation
class _gdbm:
def firstkey(self) -> Optional[bytes]: ...
def nextkey(self, key: _KeyType) -> Optional[bytes]: ...
def firstkey(self) -> bytes | None: ...
def nextkey(self, key: _KeyType) -> bytes | None: ...
def reorganize(self) -> None: ...
def sync(self) -> None: ...
def close(self) -> None: ...
@@ -20,12 +20,12 @@ class _gdbm:
def __len__(self) -> int: ...
def __enter__(self) -> _gdbm: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
@overload
def get(self, k: _KeyType) -> Optional[bytes]: ...
def get(self, k: _KeyType) -> bytes | None: ...
@overload
def get(self, k: _KeyType, default: Union[bytes, _T]) -> Union[bytes, _T]: ...
def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ...
def keys(self) -> List[bytes]: ...
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
# Don't exist at runtime

View File

@@ -1,5 +1,5 @@
from types import TracebackType
from typing import List, Optional, Type, TypeVar, Union, overload
from typing import List, Type, TypeVar, Union, overload
_T = TypeVar("_T")
_KeyType = Union[str, bytes]
@@ -19,12 +19,12 @@ class _dbm:
def __del__(self) -> None: ...
def __enter__(self) -> _dbm: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
@overload
def get(self, k: _KeyType) -> Optional[bytes]: ...
def get(self, k: _KeyType) -> bytes | None: ...
@overload
def get(self, k: _KeyType, default: Union[bytes, _T]) -> Union[bytes, _T]: ...
def get(self, k: _KeyType, default: bytes | _T) -> bytes | _T: ...
def keys(self) -> List[bytes]: ...
def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ...
# Don't exist at runtime