| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
all supported Python versions (GH-92418)
(cherry picked from commit e5b4bd4d60aaf0292c5b9d628512145b8987b3c6)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
|
|
|
|
|
| |
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>.
(cherry picked from commit 27e366571590e9e98f61dccf69dbeaa88ee66737)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
|
|
|
| |
Fixes python/typingGH-424
(cherry picked from commit 9588f880a286a8cc5597188f6ab44108c8f18761)
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
|
|
|
|
|
| |
* Use double backticks to appease rstlint
* Update susp-ignored.csv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-31941) (GH-32067)
* [3.9] [3.10] bpo-46769: Improve documentation for `typing.TypeVar` (GH-31712) (GH-31941)
* [3.10] bpo-46769: Improve documentation for `typing.TypeVar` (GH-31712)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 81b425d4dc43b60dd11a3e9abc5c84a4b8b384db)
* Remove references to `reveal_type`, add new section on `self` types.
(cherry picked from commit d5ed8a8258eaf7a241978b1b0aeb971108d0f7e0)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* remove unused susp allowlist
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
|
|
|
|
|
|
|
| |
docs. (GH-31349) (GH-31808)
* bpo-46677: Add examples of inheritance and attributes to `TypedDict` docs (GH-31349)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
(cherry picked from commit 8a207e0321db75f3342692905e342f1d5e1add54)
|
|
|
|
|
| |
(cherry picked from commit 8debeed3075bf4d7e568e65da16bec63cf276f4f)
Co-authored-by: Meer Suri <46469858+meersuri@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
| |
See discussion in GH-30179.
(cherry picked from commit 7c5c3f7254d78babcaf7a2ec187fd6ec53b8403c)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Automerge-Triggered-By: GH:Fidget-Spinner
|
|
|
|
|
|
|
|
|
| |
(GH-30180)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit 6ada013df170b0afb6b61a0d942388c6fd81cbc9)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
``__class_getitem__`` in the data model (GH-29389) (GH-29619)
The documentation explaining Python's data model does not adequately explain
the differences between ``__getitem__`` and ``__class_getitem__``, nor does it
explain when each is called. There is an attempt at explaining
``__class_getitem__`` in the documentation for ``GenericAlias`` objects, but
this does not give sufficient clarity into how the method works. Moreover, it
is the wrong place for that information to be found; the explanation of
``__class_getitem__`` should be in the documentation explaining the data model.
This PR has been split off from GH-29335.
(cherry picked from commit 31b3a70edb1216bdc8fab3b2eafd8ddb00487f41)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
|
|
|
|
|
| |
``typing.Tuple`` has been deprecated since Python 3.9, so it makes no sense to mention it so prominently in the documentation for the ``typing`` module.
(cherry picked from commit 87032cfa3dc975d7442fd57dea2c6a56d31c911a)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
|
|
|
|
|
|
| |
``GenericAlias``/``__class_getitem__`` (GH-29387)
(cherry picked from commit e03e50377d6f8f212af60fed4ae405ebeb73237d)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
|
|
|
| |
Backport of https://github.com/python/cpython/pull/29280 to the 3.9 branch.
|
|
|
|
|
|
|
| |
They were originally removed in GH-10173 per bpo-35089, but then
readded in GH-21574. Cf. bpo-38291 for decision to remove.
(cherry picked from commit 8a76683cfb842e12b57f6d276839f6c68fd94e1a)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
|
|
|
|
|
| |
(cherry picked from commit 87109f4d85c93a870ee8aa0d2b394547d4636b17)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
(GH-25183) (GH-25184)
(cherry picked from commit 2b5913b4ee5852a28ca1509478f5582beb3aff7b)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Automerge-Triggered-By: GH:gvanrossum
|
| |
|
|
|
|
|
| |
(cherry picked from commit 5ef53a88f3130cfcf9a9be3abd2ff2f997902647)
Co-authored-by: John Belmonte <john@neggie.net>
|
|
|
|
|
|
|
|
|
| |
* Whatsnew entry in 3.9 same as the one in 3.10.
* versionchanged for typing.Literal docs
Needs backport to 3.9.
(cherry picked from commit e1dc0db8c7cb8c4d7343e051ba85146b375bb8e0)
Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
| |
Fix hash implementation of `typing.Literal`.
Update docs regarding `typing.Litaral` caching.
Base implementation was done in PR GH-23294.
(cherry picked from commit 1b54077ff6f5c1379e097e9f8e8648da9826d6ec)
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit c3b9592244a9112d8af9610ff1c4e1e4cd4bfaca)
Co-authored-by: Dominik1123 <15989985+Dominik1123@users.noreply.github.com>
|
|
|
|
|
|
| |
Follow up to 7cdf30fff39ea97f403b5472096349998d190e30 and 4173320920706b49a004bdddd8d7108e8984e3fc. This addresses the point "1. Update links in typing, subscription and union to point to GenericAlias." in the bpo for this PR.
(cherry picked from commit 9129af6050b747f288baa9d4e7d43031647ed222)
Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com>
|
|
|
|
|
|
| |
(cherry picked from commit 5bfd60fc2bf26bd6fa23a3a50c7990b7f68b3ea3)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
|
|
|
|
|
|
|
|
| |
Fix typo in the "Context manager types" section in `typing.rst`.
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit ba06a70c822ede62688136add488eb78957689fe)
Co-authored-by: Saiyang Gou <gousaiyang@163.com>
|
|
|
|
|
| |
(cherry picked from commit 0ff8a3b374286d2218fc18f47556a5ace202dad3)
Co-authored-by: abdo <abd.nh25@gmail.com>
|
|
|
|
|
|
|
|
| |
This changes a few occurrences left behind by GH-22340.
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 7f54e563dc150cd670ca8df678437455c3a7f2cd)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
|
|
|
|
|
|
|
|
| |
Missed this occurrence before, sorry. Also changed "the PEP" to "PEP".
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 3fe614893742faee3c64e6d974e11329a496424f)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
|
|
|
|
|
|
| |
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit d4b9edd5052a2d9ae3d2be69975cc933afb37737)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-22340)
This shows users that they can use the actual types. Using deprecated types is confusing.
This also prefers colections.abc.Sized instead of the alias typing.Sized. I guess the aliases were created to make it convenient to import all collections related types from the same place.
This should be backported to 3.9.
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit d9ab95ff1fe81efdf70e545d536d9f6927d1ba81)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
|
|
|
|
|
|
|
| |
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 2623868ede4ef3c848fc83a9b1e19e0d031dee1d)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
|
|
|
|
|
|
|
| |
(cherry picked from commit 8c58d2a)
Co-authored-by: MingZhe Hu <humingzhework@163.com>
Co-authored-by: MingZhe Hu <humingzhework@163.com>
|
|
|
|
|
|
| |
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit fa5d7251987c70a9c5d58b59a0b36ac9287eaafa)
Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
|
|
|
|
|
|
|
|
|
| |
sub-sections and ordering (GH-21574) (#21843)
Also added PEP 585 deprecation notes.
(cherry picked from commit ab72fdeb82)
Co-authored-by: Luciano Ramalho <luciano@ramalho.org>
|
|
|
|
|
| |
(cherry picked from commit b40e434386cd94a367d4a256e3364771140160e7)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit 2b0e654f91f28379c6c7ef5fd80e8754afb70935)
Co-authored-by: ziheng <zihenglv@gmail.com>
|
| |
|
|
|
|
| |
(GH-18784)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
|
|
| |
(GH-16743)
Metaclass was removed in Python 3.7 (there is already a `versionchanged` item about this).
https://bugs.python.org/issue28556
|
|
|
|
|
|
|
| |
PR #4906 changed the typing.Generic class hierarchy, leaving an
outdated comment in the library reference. User-defined Generic ABCs now
must get a abc.ABCMeta metaclass from something other than typing.Generic
inheritance.
|
|
|
|
| |
This PR replaces the old note mentioning that `typing` is a provisional module with a new one mentioning types are not enforced at runtime. I am not sure if there was any official announcement about making `typing` non-provisional, but _de-facto_ no new features were added during Python 3.7, and no backwards incompatible changes were made except for few small things that were considered bugs.
|
|
|
|
|
|
|
|
| |
https://bugs.python.org/issue37814:
> The empty tuple syntax in type annotations, `Tuple[()]`, is not obvious from the examples given in the documentation (I naively expected `Tuple[]` to work); it has been documented in PEP 484 and in mypy, but not in the documentation for the typing module.
https://bugs.python.org/issue37814
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
(GH-13685)
This is an old feature request that appears from time to time. After a year of experimenting with various introspection capabilities in `typing_inspect` on PyPI, I propose to add these two most commonly used functions: `get_origin()` and `get_args()`. These are essentially thin public wrappers around private APIs: `__origin__` and `__args__`.
As discussed in the issue and on the typing tracker, exposing some public helpers instead of `__origin__` and `__args__` directly will give us more flexibility if we will decide to update the internal representation, while still maintaining backwards compatibility.
The implementation is very simple an is essentially a copy from `typing_inspect` with one exception: `ClassVar` was special-cased in `typing_inspect`, but I think this special-casing doesn't really help and only makes things more complicated.
|
|
|
|
|
| |
I tried to get rid of the `_ProtocolMeta`, but unfortunately it didn'y work. My idea to return a generic alias from `@runtime_checkable` made runtime protocols unpickleable. I am not sure what is worse (a custom metaclass or having some classes unpickleable), so I decided to stick with the status quo (since there were no complains so far). So essentially this is a copy of the implementation in `typing_extensions` with two modifications:
* Rename `@runtime` to `@runtime_checkable` (plus corresponding updates).
* Allow protocols that extend `collections.abc.Iterable` etc.
|
|
|
|
| |
The implementation is straightforward and essentially is just copied from `typing_extensions`.
|
|
|
|
| |
The implementation is straightforward and essentially is just copied from `typing_extensions`.
|