mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +08:00
ContextVar.get() default has wrong type, it should mirror Mapping.get (#4726)
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
import sys
|
||||
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar
|
||||
from typing import Any, Callable, ClassVar, Generic, Iterator, Mapping, TypeVar, Union, overload
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_D = TypeVar("_D")
|
||||
|
||||
class ContextVar(Generic[_T]):
|
||||
def __init__(self, name: str, *, default: _T = ...) -> None: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
def get(self, default: _T = ...) -> _T: ...
|
||||
@overload
|
||||
def get(self) -> _T: ...
|
||||
@overload
|
||||
def get(self, default: Union[_D, _T]) -> Union[_D, _T]: ...
|
||||
def set(self, value: _T) -> Token[_T]: ...
|
||||
def reset(self, token: Token[_T]) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
|
||||
@@ -23,6 +23,7 @@ collections.abc.AsyncGenerator.ag_frame
|
||||
collections.abc.AsyncGenerator.ag_running
|
||||
contextvars.Context.__init__
|
||||
contextvars.Context.get
|
||||
contextvars.ContextVar.get
|
||||
copy.PyStringMap
|
||||
ctypes.CDLL.__init__
|
||||
dataclasses.Field.__init__
|
||||
|
||||
Reference in New Issue
Block a user