| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
| |
Remove direct support of typing types in the C code because they are already supported by defining methods __or__ and __ror__ in the Python code.
|
|
|
| |
Make NewType pickleable by name.
|
| |
|
|
|
|
| |
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Denis Laxalde <denis@laxalde.org>
|
| |
|
|
|
|
|
| |
(#27237)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
| |
This fixes TypedDict to work with get_type_hints and postponed evaluation of annotations across modules.
This is done by adding the module name to ForwardRef at the time the object is created and using that to resolve the globals during the evaluation.
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
|
| |
|
| |
|
|
|
|
|
|
|
| |
help(object) via pydoc.TextDoc.docclass(object) iterates over the
subclasses of object, which includes typing.io and typing.re if typing
is imported. It tries to access cls.__module__ for each of those
sub-classes. This change suppresses warnings when accessing
cls.__module__.
|
|
|
|
| |
invalid `.__module__`. (GH-26862)
|
| |
|
|
|
|
|
|
|
|
|
| |
(GH-26013)
Added two new attributes to ``_GenericAlias``:
* ``_typevar_types``, a single type or tuple of types indicating what types are treated as a ``TypeVar``. Used for ``isinstance`` checks.
* ``_paramspec_tvars ``, a boolean flag which guards special behavior for dealing with ``ParamSpec``. Setting it to ``True`` means this class deals with ``ParamSpec``.
Automerge-Triggered-By: GH:gvanrossum
|
|
|
|
| |
(#26067)
|
| |
|
|
|
|
|
|
| |
This adds IO, TextIO, BinaryIO, Match, and Pattern.
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
|
|
|
|
|
| |
classes and modules (#25623)
Change class and module objects to lazy-create empty annotations dicts on demand. The annotations dicts are stored in the object's `__dict__` for backwards compatibility.
|
| |
|
|
|
| |
While surprising (searching globals before locals in one specific case), this is needed for backwards compatibility.
|
|
|
|
|
|
| |
(GH-25490)
This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
|
|
|
|
|
|
| |
* pyclbr no longer uses copy
* typing no longer uses ast
Issue discovered by pyflakes.
|
|
|
|
|
| |
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: efahl <36704995+efahl@users.noreply.github.com>
|
| |
|
| |
|
| |
|
|
|
|
|
| |
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[...].
|
| |
|