mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-25 12:26:44 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user