Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2.1k
Update typing-extensions; some 3.12 updates#10200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
6664a00ea4c90e1f42ee312df74b060bd3ccfd5be2ef6698c8d2800e10a065c2779a39dcb2f99446170750af9b42813cff15ad7062bb54f0f8ee0854168a7e052197c8feb81de9dfb2b63ed9e34a944c12973ebdd0d7e67059d8ceFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import sys | ||
| from abc import abstractmethod | ||
| from types import MappingProxyType | ||
| from typing import ( # noqa: Y022,Y038 | ||
| AbstractSet as Set, | ||
| @@ -23,11 +24,13 @@ from typing import ( # noqa: Y022,Y038 | ||
| MutableMapping as MutableMapping, | ||
| MutableSequence as MutableSequence, | ||
| MutableSet as MutableSet, | ||
| Protocol, | ||
| Reversible as Reversible, | ||
| Sequence as Sequence, | ||
| Sized as Sized, | ||
| TypeVar, | ||
| ValuesView as ValuesView, | ||
| runtime_checkable, | ||
| ) | ||
| from typing_extensions import final | ||
| @@ -58,6 +61,8 @@ __all__ = [ | ||
| "MutableSequence", | ||
| "ByteString", | ||
| ] | ||
| if sys.version_info >= (3, 12): | ||
| __all__ += ["Buffer"] | ||
| _KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers. | ||
| _VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. | ||
| @@ -79,3 +84,9 @@ class dict_items(ItemsView[_KT_co, _VT_co], Generic[_KT_co, _VT_co]): # undocum | ||
| if sys.version_info >= (3, 10): | ||
| @property | ||
| def mapping(self) -> MappingProxyType[_KT_co, _VT_co]: ... | ||
| if sys.version_info >= (3, 12): | ||
| @runtime_checkable | ||
| class Buffer(Protocol): | ||
| @abstractmethod | ||
| def __buffer__(self, __flags: int) -> memoryview: ... | ||
JelleZijlstra marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -136,14 +136,32 @@ Any = object() | ||
| @_final | ||
| class TypeVar: | ||
| __name__: str | ||
| __bound__: Any | None | ||
| __constraints__: tuple[Any, ...] | ||
| __covariant__: bool | ||
| __contravariant__: bool | ||
| def __init__( | ||
| self, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False | ||
| ) -> None: ... | ||
| @property | ||
| def __name__(self) -> str: ... | ||
| @property | ||
| def __bound__(self) -> Any | None: ... | ||
| @property | ||
| def __constraints__(self) -> tuple[Any, ...]: ... | ||
| @property | ||
| def __covariant__(self) -> bool: ... | ||
| @property | ||
| def __contravariant__(self) -> bool: ... | ||
| if sys.version_info >= (3, 12): | ||
| @property | ||
| def __infer_variance__(self) -> bool: ... | ||
| def __init__( | ||
| self, | ||
| name: str, | ||
| *constraints: Any, | ||
| bound: Any | None = None, | ||
| covariant: bool = False, | ||
| contravariant: bool = False, | ||
| infer_variance: bool = False, | ||
| ) -> None: ... | ||
| else: | ||
| def __init__( | ||
| self, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False | ||
| ) -> None: ... | ||
| if sys.version_info >= (3, 10): | ||
| def __or__(self, right: Any) -> _SpecialForm: ... | ||
| def __ror__(self, left: Any) -> _SpecialForm: ... | ||
| @@ -194,29 +212,50 @@ if sys.version_info >= (3, 11): | ||
| LiteralString: _SpecialForm | ||
| class TypeVarTuple: | ||
| __name__: str | ||
| @property | ||
| def __name__(self) -> str: ... | ||
| def __init__(self, name: str) -> None: ... | ||
| def __iter__(self) -> Any: ... | ||
| def __typing_subst__(self, arg: Never) -> Never: ... | ||
| def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ... | ||
| if sys.version_info >= (3, 10): | ||
| class ParamSpecArgs: | ||
| __origin__: ParamSpec | ||
| @property | ||
| def __origin__(self) -> ParamSpec: ... | ||
| def __init__(self, origin: ParamSpec) -> None: ... | ||
| class ParamSpecKwargs: | ||
| __origin__: ParamSpec | ||
| @property | ||
| def __origin__(self) -> ParamSpec: ... | ||
| def __init__(self, origin: ParamSpec) -> None: ... | ||
| class ParamSpec: | ||
| __name__: str | ||
| __bound__: Any | None | ||
| __covariant__: bool | ||
| __contravariant__: bool | ||
| def __init__( | ||
| self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False | ||
| ) -> None: ... | ||
| @property | ||
| def __name__(self) -> str: ... | ||
| @property | ||
| def __bound__(self) -> Any | None: ... | ||
| @property | ||
| def __covariant__(self) -> bool: ... | ||
| @property | ||
| def __contravariant__(self) -> bool: ... | ||
| if sys.version_info >= (3, 12): | ||
| @property | ||
| def __infer_variance__(self) -> bool: ... | ||
| def __init__( | ||
| self, | ||
| name: str, | ||
| *, | ||
| bound: Any | None = None, | ||
| contravariant: bool = False, | ||
| covariant: bool = False, | ||
| infer_variance: bool = False, | ||
| ) -> None: ... | ||
| else: | ||
| def __init__( | ||
| self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False | ||
| ) -> None: ... | ||
| @property | ||
| def args(self) -> ParamSpecArgs: ... | ||
| @property | ||
| @@ -873,3 +912,26 @@ if sys.version_info >= (3, 10): | ||
| def is_typeddict(tp: object) -> bool: ... | ||
| def _type_repr(obj: object) -> str: ... | ||
| if sys.version_info >= (3, 12): | ||
| def override(__arg: _F) -> _F: ... | ||
| @_final | ||
| class TypeAliasType: | ||
JelleZijlstra marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| def __init__( | ||
| self, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = () | ||
| ) -> None: ... | ||
| @property | ||
| def __value__(self) -> Any: ... | ||
| @property | ||
| def __type_params__(self) -> tuple[TypeVar | ParamSpec | TypeVarTuple, ...]: ... | ||
| @property | ||
| def __parameters__(self) -> tuple[Any, ...]: ... | ||
| @property | ||
| def __name__(self) -> str: ... | ||
AlexWaygood marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # It's writable on types, but not on instances of TypeAliasType. | ||
| @property | ||
| def __module__(self) -> str | None: ... # type: ignore[override] | ||
| def __getitem__(self, parameters: Any) -> Any: ... | ||
| if sys.version_info >= (3, 10): | ||
| def __or__(self, right: Any) -> _SpecialForm: ... | ||
| def __ror__(self, left: Any) -> _SpecialForm: ... | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -25,6 +25,12 @@ from typing import ( # noqa: Y022,Y039 | ||
| NewType as NewType, | ||
| NoReturn as NoReturn, | ||
| Sequence, | ||
| SupportsAbs as SupportsAbs, | ||
| SupportsBytes as SupportsBytes, | ||
| SupportsComplex as SupportsComplex, | ||
| SupportsFloat as SupportsFloat, | ||
| SupportsInt as SupportsInt, | ||
| SupportsRound as SupportsRound, | ||
| Text as Text, | ||
| Type as Type, | ||
| _Alias, | ||
| @@ -39,6 +45,7 @@ if sys.version_info >= (3, 9): | ||
| __all__ = [ | ||
| "Any", | ||
| "Buffer", | ||
| "ClassVar", | ||
| "Concatenate", | ||
| "Final", | ||
| @@ -66,6 +73,12 @@ __all__ = [ | ||
| "OrderedDict", | ||
| "TypedDict", | ||
| "SupportsIndex", | ||
| "SupportsAbs", | ||
| "SupportsRound", | ||
| "SupportsBytes", | ||
| "SupportsComplex", | ||
| "SupportsFloat", | ||
| "SupportsInt", | ||
| "Annotated", | ||
| "assert_never", | ||
| "assert_type", | ||
| @@ -272,16 +285,24 @@ else: | ||
| # New things in 3.xx | ||
| # The `default` parameter was added to TypeVar, ParamSpec, and TypeVarTuple (PEP 696) | ||
| # The `infer_variance` parameter was added to TypeVar (PEP 695) | ||
| # The `infer_variance` parameter was added to TypeVar in 3.12 (PEP 695) | ||
| # typing_extensions.override (PEP 698) | ||
| @final | ||
| class TypeVar: | ||
| __name__: str | ||
| __bound__: Any | None | ||
| __constraints__: tuple[Any, ...] | ||
| __covariant__: bool | ||
| __contravariant__: bool | ||
| __default__: Any | None | ||
| @property | ||
| def __name__(self) -> str: ... | ||
| @property | ||
| def __bound__(self) -> Any | None: ... | ||
| @property | ||
| def __constraints__(self) -> tuple[Any, ...]: ... | ||
| @property | ||
| def __covariant__(self) -> bool: ... | ||
| @property | ||
| def __contravariant__(self) -> bool: ... | ||
| @property | ||
| def __infer_variance__(self) -> bool: ... | ||
| @property | ||
| def __default__(self) -> Any | None: ... | ||
| def __init__( | ||
| self, | ||
| name: str, | ||
| @@ -300,11 +321,18 @@ class TypeVar: | ||
| @final | ||
| class ParamSpec: | ||
| __name__: str | ||
| __bound__: type[Any] | None | ||
| __covariant__: bool | ||
| __contravariant__: bool | ||
| __default__: type[Any] | None | ||
| @property | ||
| def __name__(self) -> str: ... | ||
| @property | ||
| def __bound__(self) -> Any | None: ... | ||
| @property | ||
| def __covariant__(self) -> bool: ... | ||
| @property | ||
| def __contravariant__(self) -> bool: ... | ||
| @property | ||
| def __infer_variance__(self) -> bool: ... | ||
| @property | ||
| def __default__(self) -> Any | None: ... | ||
| def __init__( | ||
| self, | ||
| name: str, | ||
| @@ -321,10 +349,41 @@ class ParamSpec: | ||
| @final | ||
| class TypeVarTuple: | ||
| __name__: str | ||
| __default__: Any | None | ||
| @property | ||
| def __name__(self) -> str: ... | ||
| @property | ||
| def __default__(self) -> Any | None: ... | ||
| def __init__(self, name: str, *, default: Any | None = None) -> None: ... | ||
| def __iter__(self) -> Any: ... # Unpack[Self] | ||
| def override(__arg: _F) -> _F: ... | ||
| def deprecated(__msg: str, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> Callable[[_T], _T]: ... | ||
| if sys.version_info >= (3, 12): | ||
| from collections.abc import Buffer as Buffer | ||
| from types import get_original_bases as get_original_bases | ||
| from typing import TypeAliasType as TypeAliasType, override as override | ||
| else: | ||
| def override(__arg: _F) -> _F: ... | ||
| def get_original_bases(__cls: type) -> tuple[Any, ...]: ... | ||
| @final | ||
| class TypeAliasType: | ||
JelleZijlstra marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| def __init__( | ||
| self, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = () | ||
| ) -> None: ... | ||
| @property | ||
| def __value__(self) -> Any: ... | ||
| @property | ||
| def __type_params__(self) -> tuple[TypeVar | ParamSpec | TypeVarTuple, ...]: ... | ||
| @property | ||
| def __parameters__(self) -> tuple[Any, ...]: ... | ||
| @property | ||
| def __name__(self) -> str: ... | ||
AlexWaygood marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # It's writable on types, but not on instances of TypeAliasType. | ||
| @property | ||
| def __module__(self) -> str | None: ... # type: ignore[override] | ||
| def __getitem__(self, parameters: Any) -> Any: ... | ||
| if sys.version_info >= (3, 10): | ||
| def __or__(self, right: Any) -> _SpecialForm: ... | ||
| def __ror__(self, left: Any) -> _SpecialForm: ... | ||
| class Buffer(abc.ABC): ... | ||
Uh oh!
There was an error while loading. Please reload this page.