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,5 +1,5 @@
import sys
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, Optional, TypeVar, Union, overload
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -14,7 +14,7 @@ class ContextVar(Generic[_T]):
@overload
def get(self) -> _T: ...
@overload
def get(self, default: Union[_D, _T]) -> Union[_D, _T]: ...
def get(self, default: _D | _T) -> _D | _T: ...
def set(self, value: _T) -> Token[_T]: ...
def reset(self, token: Token[_T]) -> None: ...
if sys.version_info >= (3, 9):
@@ -36,9 +36,9 @@ def copy_context() -> Context: ...
class Context(Mapping[ContextVar[Any], Any]):
def __init__(self) -> None: ...
@overload
def get(self, __key: ContextVar[Any]) -> Optional[Any]: ...
def get(self, __key: ContextVar[Any]) -> Any | None: ...
@overload
def get(self, __key: ContextVar[Any], __default: Optional[Any]) -> Any: ...
def get(self, __key: ContextVar[Any], __default: Any | None) -> Any: ...
def run(self, callable: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
def copy(self) -> Context: ...
def __getitem__(self, key: ContextVar[Any]) -> Any: ...