Steven Troxler
0f89acf6cc
gh-101561: Add typing.override decorator ( #101564 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-02-27 13:16:11 -08:00
Nikita Sobolev
a498de4c0e
gh-101100: Fix sphinx warnings in `typing` module docs ( #102260 )
2023-02-25 21:48:00 +00:00
Furkan Onder
3690688149
GH-101898: Fix missing term references for hashable definition ( #101899 )
...
Fix missing term references for hashable definition
2023-02-14 14:20:11 +04:00
FrozenBob
deaf090699
gh-100673: Removed erroneous note in the get_type_hints docs ( #100701 )
...
Removed erroneous note in the get_type_hints docs
typing.get_type_hints still includes base class type hints.
2023-01-07 17:31:47 +00:00
MonadChains
f5b7b19bf1
gh-99535: Add test for inheritance of annotations and update documentation ( #99990 )
2022-12-24 12:07:14 -08:00
Erik De Bonte
5c19050546
gh-99957: Add `frozen_default` parameter on `dataclass_transform` ( #99958 )
2022-12-05 19:35:43 -08:00
GabrielAnguita
1bf983ce7e
gh-99662: fix typo in typing.TypeVarTuple docs ( #99672 )
2022-11-21 20:02:55 -08:00
Sebastian Rittau
65d1407737
gh-92871: Postpone the removal of typing.{io,re} to 3.13 ( #98958 )
2022-11-01 20:51:45 -07:00
Eclips4
be0cf82ae4
gh-98602: [typing docs] Use quotes for forward reference in TypeVarTuple example ( #98605 )
2022-10-25 16:32:52 +01:00
Nikita Sobolev
5076108872
gh-98623: Fix base classes in `typing.rst` ( #98626 )
2022-10-25 07:06:13 -07:00
Nikita Sobolev
e3b9dd8e87
gh-98507: [typing docs] Rephrase "now supports `[]`" to "now supports subscripting" ( #98508 )
2022-10-24 19:10:25 +01:00
Nikita Sobolev
1a217f9ffc
gh-98500: Fix typing docs for `*View` classes ( #98511 )
2022-10-24 10:47:32 -07:00
Omkaar
b6d5d5b60a
gh-98561: Fix a typo in typing (GH-98562)
2022-10-23 22:05:08 +08:00
Simon Legner
02389658a4
docs(typing): harmonize "See PEP x for more details" ( #97927 )
2022-10-15 12:17:51 -07:00
Shantanu
ed6344eed0
gh-96130: Rephrase use of "typecheck" verb for clarity ( #98144 )
...
I'm sympathetic to the issue report, especially in case this helps
clarify to new users that Python itself does not do type checking at runtime
2022-10-11 19:37:58 -07:00
Simon Legner
2016bc54a2
docs(typing): add "see PEP 675" to LiteralString ( #97926 )
2022-10-05 13:08:07 -07:00
Shantanu
5b3a2569f4
gh-96917: link to typing.readthedocs.io from typing.rst ( #96921 )
...
See the discussion at https://github.com/python/cpython/issues/91533
2022-09-19 12:09:41 -07:00
Adrian Garcia Badaracco
07f12b5c15
gh-95337: update TypeVarTuple example ( #95338 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-08-30 07:57:03 -07:00
Howie Zhao
f235178bec
gh-94439: typing docs: Add minimum version to `__required_keys__` and `__optional_keys__` ( #95373 )
2022-08-12 21:23:33 -07:00
Max Zhenzhera
90a6e56e56
docs: typing.Self, fix typo (GH-94771)
...
* fix typo - double spelled word 'use'
* change methods names to the infinitive form
2022-07-12 18:45:52 +01:00
MonadChains
e8e4b550f5
gh-94309: Deprecate typing.Hashable/Sized (GH-94626)
...
Deprecate typing.Hashable/Sized. Use the collections.abc counterparts directly instead.
To be consistent with PEP 585, deprecated aliases will not raise any DeprecationWarning.
2022-07-10 19:04:01 +01:00
Ned Batchelder
3440d197a5
Docs: remove redundant "adverb-adjective" hyphens from compound modifiers (GH-94551)
...
Discussion: https://discuss.python.org/t/slight-grammar-fix-throughout-adverbs-dont-need-hyphen/17021
2022-07-05 11:16:10 +02:00
Erik De Bonte
81ac9ac492
Add docs for decorated object and field specifier params (GH-94354)
2022-06-28 11:58:35 +02:00
David Foster
711eda7dec
gh-91243: Document Required and NotRequired ( #93173 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-27 15:11:45 -07:00
Shantanu
f20a6a54fb
gh-91860: documentation for typing.dataclass_transform ( #92768 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-20 07:32:29 -07:00
Alex Waygood
bdc99a830f
`typing.Text`: tweak deprecation notice ( #92405 )
...
https://github.com/python/cpython/pull/92351/files#r866869469
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-08 08:22:32 -07:00
Alex Waygood
e5b4bd4d60
gh-92417: `typing` docs: `from __future__ import annotations` can be used in all supported Python versions (GH-92418)
2022-05-08 16:15:38 +03:00
Alex Waygood
6f18b86fda
gh-92332: Docs-only deprecation of `typing.Text` (GH-92351)
...
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-05-06 18:15:18 +08:00
Jelle Zijlstra
27e3665715
Improve the typing docs ( #92264 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-03 15:49:21 -06:00
Samodya Abey
f6f36cc269
bpo-44863: Allow generic typing.TypedDict ( #27663 )
...
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-03 07:21:42 -06:00
Serhiy Storchaka
b04e02c57f
bpo-43923: Add support for generic typing.NamedTuple ( #92027 )
2022-05-02 16:41:23 -06:00
Sam Bull
9588f880a2
typing docs: Add example for async functions ( #20386 )
...
Fixes python/typing#424
2022-04-30 22:40:27 -06:00
Shantanu
2f7952c35b
Rephrase typing.assert_never docs ( #92061 )
...
This change is similar to that in #32069
2022-04-29 21:13:21 -06:00
Jelle Zijlstra
7861a9e327
Fix indentation for typing.Unpack docs ( #92058 )
...
https://docs.python.org/3.11/library/typing.html#typing.Unpack
2022-04-29 16:58:40 -06:00
Serhiy Storchaka
81120b6754
bpo-44791: Accept ellipsis as the last argument of typing.Concatenate ( #30969 )
2022-04-29 15:01:40 -06:00
Ken Jin
64113a4ba8
gh-91873: Summarise deprecations in typing at the top level (GH-91864)
2022-04-29 12:22:25 +08:00
Jelle Zijlstra
93d280141c
gh-90633: Improve error and docs for typing.assert_never ( #91720 )
...
Closes #90633
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-04-25 06:40:18 -07:00
Dominic Davis-Foster
9fe82d0b70
gh-91764: Mark version typing.Unpack and LiteralString were added in ( #91817 )
...
Closes GH-91764
2022-04-22 07:28:39 -07:00
Jelle Zijlstra
055760ed9e
gh-89263: Add typing.get_overloads (GH-31716)
...
Based on suggestions by Guido van Rossum, Spencer Brown, and Alex Waygood.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2022-04-16 09:01:43 -07:00
Jelle Zijlstra
cfb849a326
bpo-47088: Add typing.LiteralString (PEP 675) (GH-32064)
...
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2022-04-05 07:21:03 -07:00
Shantanu
5a4973e29f
bpo-46998: Allow subclassing Any at runtime (GH-31841)
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-04 19:35:29 -07:00
Matthew Rahtz
38ae5b8c0c
bpo-47097: Add documentation for TypeVarTuple ( #32103 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-04-04 16:37:01 -07:00
Shantanu
3354245daf
bpo-46480: rephrase typing.assert_type docs (GH-32069)
...
The goal here is to reduce potential confusion between
`assert_type(val, type)` and `assert isinstance(val, typ)`.
The former is meant to ask a type checker to confirm a fact, the latter
is meant to tell a type checker a fact. The behaviour of the latter more
closely resembles what I'd expect from the prior phrasing of
"assert [something] to the type checker".
2022-03-23 19:15:06 -07:00
Jelle Zijlstra
96568e995d
bpo-46480: add typing.assert_type (GH-30843)
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: David Foster <david@dafoster.net>
2022-03-16 20:02:26 -07:00
Alex Waygood
81b425d4dc
bpo-46769: Improve documentation for `typing.TypeVar` (GH-31712)
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-16 08:51:26 -07:00
Charlie Zhao
8a207e0321
bpo-46677: Add examples of inheritance and attributes to `TypedDict` docs (GH-31349)
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-10 08:40:54 -08:00
Meer Suri
8debeed307
bpo-46494: Mention the typing_extensions pkg in typing docs (GH-31260)
2022-03-07 20:04:04 -08:00
Nikita Sobolev
20a1c8ee4b
bpo-46195: Do not add `Optional` in `get_type_hints` (GH-30304)
...
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-01 21:29:46 -08:00
Nikita Sobolev
395029b0bd
bpo-46571: improve `typing.no_type_check` to skip foreign objects (GH-31042)
...
There are several changes:
1. We now don't explicitly check for any base / sub types, because new name check covers it
2. I've also checked that `no_type_check` do not modify foreign functions. It was the same as with `type`s
3. I've also covered `except TypeError` in `no_type_check` with a simple test case, it was not covered at all
4. I also felt like adding `lambda` test is a good idea: because `lambda` is a bit of both in class bodies: a function and an assignment
<!-- issue-number: [bpo-46571](https://bugs.python.org/issue46571 ) -->
https://bugs.python.org/issue46571
<!-- /issue-number -->
2022-02-18 17:53:29 -08:00
97littleleaf11
de6043e596
bpo-46066: Deprecate kwargs syntax for TypedDict definitions (GH-31126)
...
Closes python/typing#981
https://bugs.python.org/issue46066
2022-02-16 19:26:07 -08:00
Jelle Zijlstra
243436f377
bpo-46475: Add typing.Never and typing.assert_never (GH-30842)
2022-02-08 10:50:26 -08:00
James Hilton-Balfe
7ba1cc8049
bpo-46534: Implement PEP 673 Self in typing.py (GH-30924)
...
Co-authored-by: Pradeep Kumar Srinivasan <gohanpra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-07 12:47:48 -08:00
Jelle Zijlstra
abcc3d75f6
bpo-46414: Add typing.reveal_type ( #30646 )
...
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-01 18:48:55 -08:00
Jelle Zijlstra
d75a51bea3
fix typo in typing.rst ( #30841 )
2022-01-23 15:36:08 -08:00
Jelle Zijlstra
0bbf30e2b9
bpo-46342: make @typing.final introspectable (GH-30530)
...
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2022-01-12 11:38:25 -08:00
Michael Oliver
73decdf021
Remove unused `Any` from `Concatenate` example in typing docs (GH-30516)
2022-01-11 21:59:26 +08:00
Nikita Sobolev
1b30660c3b
bpo-46120: State that `|` is preferred over `Union` (GH-30222)
...
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2021-12-24 13:36:09 -08:00
Alex Waygood
7c5c3f7254
bpo-46104: Fix example broken by GH-30148 (GH-30203)
...
See discussion in GH-30179.
2021-12-20 12:48:35 +08:00
Alex Waygood
6ada013df1
bpo-46104: Reduce use of pre-PEP 526 syntax in typing docs (GH-30148)
...
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2021-12-18 18:23:51 +08:00
Alex Waygood
31b3a70edb
[doc] bpo-45680: Disambiguate ``__getitem__`` and ``__class_getitem__`` in the data model (GH-29389)
...
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.
2021-11-18 16:54:25 +01:00
Alex Waygood
87032cfa3d
Remove reference to ``Tuple`` at top of ``typing`` docs (GH-29401)
...
``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.
2021-11-04 19:48:40 +08:00
Alex Waygood
e03e50377d
bpo-45680: ``typing`` docs: improve links to docs on ``GenericAlias``/``__class_getitem__`` (GH-29387)
2021-11-04 12:06:34 +08:00
Alex Waygood
d9575218d7
bpo-45655: Add ref to union type expressions at top of typing docs (GH-29309)
2021-10-29 21:56:21 +08:00
Alex Waygood
03db1bbfd2
bpo-45655: Add "relevant PEPs" section to ``typing`` documentation (GH-29280)
...
The list of PEPs at the top of the documentation for the ``typing`` module has
become too long to be readable. This PR proposes presenting this
information in a more structured and readable way by adding a new "relevant
PEPs" section to the ``typing`` docs.
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-10-28 21:55:50 +02:00
Alex Waygood
d9e1dae35a
Add PEPs 593 & 647 to list of PEPs at top of typing docs (GH-29097)
2021-10-20 23:15:59 +08:00
Micael Jarniac
a98b273ce4
Replace usage of List[...] with list[...] in typing docs (GH-28821)
...
The ``List[...]`` form is deprecated since 3.9.
2021-10-09 11:33:37 +08:00
DonnaDia
edae42f99f
bpo-44925: [docs] Fix confusing deprecation notice for typing.IO (GH-28004)
2021-08-31 17:44:27 +08:00
Sebastian Rittau
dabb6e8ddd
bpo-44957: Promote PEP 604 syntax in typing docs (GH-27833)
...
* Use "X | Y" instead of "Union" where it makes sense.
* Mention that "X | Y" is equivalent to "Union[X, Y]" in Union section.
* Remove "Optional[X]" as shorthand for "Union[X, None]" as the new
shorthand is now "X | None".
* Mention that "Optional[X]" can be written as "X | None" in section
about "Optional".
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-08-22 20:45:01 +02:00
Maximilian Hils
16b9be4861
bpo-44926: `get_type_hints`: Add note about type aliases with forward refs ( #27859 )
2021-08-20 07:36:51 -07:00
Ori Avtalion
f4367ba3c5
Doc: Change errant 3.10.0 to 3.10, to match other mentions (GH-27459)
2021-07-30 15:55:09 +02:00
Ken Jin
7aac3f6236
bpo-44353: Document that typing.NewType is now a class ( #27319 )
2021-07-24 10:53:49 +02:00
andrei kulakov
17f94e2888
bpo-43453: Update and re-add example to typing runtime_checkable ( #27013 )
...
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-07-05 09:23:42 -07:00
Sebastian Rittau
8a76683cfb
bpo-38291: Remove mention of typing.io and typing.re again (GH-26113)
...
They were originally removed in GH-10173 per bpo-35089, but then
readded in GH-21574. Cf. bpo-38291 for decision to remove.
2021-06-14 07:45:19 -07:00
Jelle Zijlstra
87109f4d85
bpo-44001: improve Literal documentation (GH-25877)
2021-05-04 10:54:12 +02:00
Ken Jin
99fdd78200
bpo-43766: Fix TypeGuard docs ( #25660 )
2021-04-27 08:55:08 -07:00
Ken Jin
05ab4b60ab
bpo-43766: Implement PEP 647 (User-Defined Type Guards) in typing.py ( #25282 )
2021-04-27 07:31:04 -07:00
Jelle Zijlstra
522433601a
bpo-43783: Add ParamSpecArgs/Kwargs (GH-25298)
2021-04-10 19:57:05 -07:00
DevilXD
ac05f82ad4
bpo-41974: Remove part of the note regarding complex.__float__ (GH-25197)
...
(The deleted example no longer works and is thus irrelevant.)
2021-04-10 15:36:40 -07:00
Ken Jin
2b5913b4ee
bpo-41370: Add note about ForwardRefs and PEP585 generic types in docs ( #25183 )
2021-04-04 08:14:44 -07:00
Paul Bryan
1e3c68246e
bpo-43345: Enhance TypedDict documentation. ( #24668 )
2021-02-27 23:02:14 -08:00
Ken Jin
da21f7b6e1
bpo-41824: Add versionadded for typing.ForwardRef docs ( #24224 )
2021-02-08 17:58:50 -08:00
Ken Jin
ace008c531
Fix various ParamSpec errors in typing (GH-24176)
...
1. ParamSpec -> TypeVar for ``typing.Concatenate``
2. ParamSpec's call signature should align with its documentation.
Noticed in GH-24169
2021-01-10 16:11:41 -08:00
Johan Dahlin
68e1f259be
Fix a typo in docs for typing.Concatenate ( #24169 )
...
Return param spec should be R, not T
2021-01-08 10:08:21 -08:00
Ken Jin
11276cd9c4
bpo-41559: Documentation for PEP 612 (GH-24000)
2021-01-01 16:45:50 -08:00
John Belmonte
5ef53a88f3
Doc: fix typo in typing.Type docs (GH-23460)
2020-11-22 23:54:19 +09:00
kj
e1dc0db8c7
bpo-42345: Add whatsnew and versionchanged for typing.Literal in 3.9 (GH-23386)
...
* Whatsnew entry in 3.9 same as the one in 3.10.
* versionchanged for typing.Literal docs
Needs backport to 3.9.
2020-11-19 09:37:26 -08:00
Yurii Karabas
1b54077ff6
bpo-42345: Fix hash implementation of typing.Literal (GH-23383)
...
Fix hash implementation of `typing.Literal`.
Update docs regarding `typing.Litaral` caching.
Base implementation was done in PR #23294 .
2020-11-19 08:17:38 -08:00
Dominik1123
c3b9592244
bpo-42317: Improve docs of typing.get_args concerning Union (GH-23254)
2020-11-15 17:30:55 -08:00
kj
9129af6050
bpo-42198: Link to GenericAlias in typing and expressions (GH-23030)
...
Follow up to 7cdf30fff3
and 4173320920
. This addresses the point "1. Update links in typing, subscription and union to point to GenericAlias." in the bpo for this PR.
2020-10-29 21:01:17 -07:00
Andre Delfino
975d10a4f8
[doc] Add mentions of PEP 613 (TypeAlias) to docs (GH-22733)
2020-10-16 19:34:01 -07:00
Saiyang Gou
ba06a70c82
Fix typo in "Context manager types" section in typing.rst (GH-22676)
...
Fix typo in the "Context manager types" section in `typing.rst`.
Automerge-Triggered-By: @gvanrossum
2020-10-12 16:34:33 -07:00
abdo
0ff8a3b374
Fix typo in typing.rst (GH-22625)
2020-10-11 11:40:21 +05:30
Mikhail Golubev
4f3c25043d
bpo-41923: PEP 613: Add TypeAlias to typing module ( #22532 )
...
This special marker annotation is intended to help in distinguishing
proper PEP 484-compliant type aliases from regular top-level variable
assignments.
2020-10-07 14:44:31 -07:00
Fidget-Spinner
8e1dd55e63
bpo-41428: Documentation for PEP 604 (gh-22517)
2020-10-04 21:40:52 -07:00
Andre Delfino
7f54e563dc
[doc] Use list[int] instead of List[int] (etc.) in a few more places (GH-22524)
...
This changes a few occurrences left behind by #22340 .
Automerge-Triggered-By: @gvanrossum
2020-10-03 15:10:59 -07:00
Andre Delfino
3fe6148937
[doc] Fix link to abc.collections.Iterable (GH-22520)
...
Missed this occurrence before, sorry. Also changed "the PEP" to "PEP".
Automerge-Triggered-By: @gvanrossum
2020-10-03 08:51:13 -07:00
Andre Delfino
d4b9edd505
[doc] Fix link to abc.collections.Iterable (GH-22502)
...
Automerge-Triggered-By: @gvanrossum
2020-10-02 16:15:28 -07:00
Andre Delfino
bd71a43340
Fix is_typeddict markup ( #22501 )
2020-10-02 15:36:26 -07:00
Andre Delfino
d9ab95ff1f
[doc] Leverage the fact that the actual types can now be indexed for typing (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
2020-09-27 12:07:04 -07:00
Andre Delfino
83f6dcd207
[doc] Minor improvements to is_typeddict (GH-22280)
...
1. The check is on the type
2. Add link to TypeDict
2020-09-16 08:06:23 -07:00