| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
1. ParamSpec -> TypeVar for ``typing.Concatenate``
2. ParamSpec's call signature should align with its documentation.
Noticed in GH-24169
|
| |
|
| |
|
| |
|
|
|
| |
PR 1/2. Needs backport to 3.9.
|
| |
|
|
|
|
| |
typing (GH-23060)
|
| |
|
|
|
|
|
|
|
| |
Fix hash implementation of `typing.Literal`.
Update docs regarding `typing.Litaral` caching.
Base implementation was done in PR #23294.
|
|
|
|
|
|
|
| |
Literal equality no longer depends on the order of arguments.
Fix issue related to `typing.Literal` caching by adding `typed` parameter to `typing._tp_cache` function.
Add deduplication of `typing.Literal` arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Noticed by @serhiy-storchaka in the bpo. `typing`'s types were not showing the parameterized generic.
Eg. previously:
```python
>>> typing.Union[dict[str, float], list[int]]
'typing.Union[dict, list]'
```
Now:
```python
>>> typing.Union[dict[str, float], list[int]]
'typing.Union[dict[str, float], list[int]]'
```
Automerge-Triggered-By: GH:gvanrossum
|
|
|
|
|
| |
This special marker annotation is intended to help in distinguishing
proper PEP 484-compliant type aliases from regular top-level variable
assignments.
|
|
|
|
|
| |
The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions.
For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
|
|
|
|
|
| |
Closes issue41792.
Also closes https://github.com/python/typing/issues/751.
|
|
|
|
|
| |
See https://www.python.org/dev/peps/pep-0604/ for more information.
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
|
|
|
| |
This is a trivial PR to fix a typo in a docstring in typing.py. From reverences -> references
|
| |
|
|
|
|
|
|
| |
The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
|
|
|
| |
Automerge-Triggered-By: @gvanrossum
|
|
|
|
| |
* Add the terminating period.
* Omit module name for builtin types.
|
|
|
|
| |
(GH-20021)
|
|
|
|
| |
(GH-19984)
|
|
|
|
|
|
| |
Make the design more object-oriented.
Split _GenericAlias on two almost independent classes: for special
generic aliases like List and for parametrized generic aliases like List[int].
Add specialized subclasses for Callable, Callable[...], Tuple and Union[...].
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
https://bugs.python.org/issue39942
|
|
|
|
|
|
| |
* Show docstring for special forms.
* Show docstring for special generic aliases.
* Show documentation for __origin__ for generic aliases.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements things like `list[int]`,
which returns an object of type `types.GenericAlias`.
This object mostly acts as a proxy for `list`,
but has attributes `__origin__` and `__args__`
that allow recovering the parts (with values `list` and `(int,)`.
There is also an approximate notion of type variables;
e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`.
Type variables are objects of type `typing.TypeVar`.
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
(Adapted from https://github.com/python/typing/pull/700)
|
|
|
| |
I forgot to do it in https://github.com/python/cpython/pull/18260.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* bpo-39491: Merge PEP 593 (typing.Annotated) support
PEP 593 has been accepted some time ago. I got a green light for merging
this from Till, so I went ahead and combined the code contributed to
typing_extensions[1] and the documentation from the PEP 593 text[2].
My changes were limited to:
* removing code designed for typing_extensions to run on older Python
versions
* removing some irrelevant parts of the PEP text when copying it over as
documentation and otherwise changing few small bits to better serve
the purpose
* changing the get_type_hints signature to match reality (parameter
names)
I wasn't entirely sure how to go about crediting the authors but I used
my best judgment, let me know if something needs changing in this
regard.
[1] https://github.com/python/typing/blob/8280de241fd8c8afe727c7860254b753e383b360/typing_extensions/src_py3/typing_extensions.py
[2] https://github.com/python/peps/blob/17710b879882454d55f82c2d44596e8e9f8e4bff/pep-0593.rst
|
| |
|
|
|
|
|
| |
This patch enables downstream projects inspecting a TypedDict subclass at runtime to tell which keys are optional.
This is essential for generating test data with Hypothesis or validating inputs with typeguard or pydantic.
|
|
|
|
|
|
| |
(GH-17126)
https://bugs.python.org/issue37838
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
(GH-16222)
This includes such names as "cls", "self", "typename", "_typename",
"fields" and "_fields".
Passing positional arguments by keyword is deprecated.
|
|
|
|
|
| |
Ideally if we stick a ForwardRef in a dictionary we would like to reliably be able to get it out again.
https://bugs.python.org/issue37953
|
|
|
|
| |
Fixes https://bugs.python.org/issue38008
|