mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
[3.12] Add version directives to ast docs (GH-108788) (#109106)
Add version directives to ast docs (GH-108788)
(cherry picked from commit 74fc96bc60
)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
parent
68ba35eecb
commit
fff524ede8
1 changed files with 42 additions and 4 deletions
|
@ -663,6 +663,7 @@ Expressions
|
||||||
target=Name(id='x', ctx=Store()),
|
target=Name(id='x', ctx=Store()),
|
||||||
value=Constant(value=4)))
|
value=Constant(value=4)))
|
||||||
|
|
||||||
|
.. versionadded:: 3.8
|
||||||
|
|
||||||
Subscripting
|
Subscripting
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
@ -1036,6 +1037,7 @@ Statements
|
||||||
value=Name(id='int', ctx=Load()))],
|
value=Name(id='int', ctx=Load()))],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.12
|
||||||
|
|
||||||
Other statements which are only applicable inside functions or loops are
|
Other statements which are only applicable inside functions or loops are
|
||||||
described in other sections.
|
described in other sections.
|
||||||
|
@ -1318,6 +1320,7 @@ Control flow
|
||||||
finalbody=[])],
|
finalbody=[])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.11
|
||||||
|
|
||||||
.. class:: ExceptHandler(type, name, body)
|
.. class:: ExceptHandler(type, name, body)
|
||||||
|
|
||||||
|
@ -1407,6 +1410,8 @@ Pattern matching
|
||||||
that is being matched against the cases) and ``cases`` contains an iterable of
|
that is being matched against the cases) and ``cases`` contains an iterable of
|
||||||
:class:`match_case` nodes with the different cases.
|
:class:`match_case` nodes with the different cases.
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. class:: match_case(pattern, guard, body)
|
.. class:: match_case(pattern, guard, body)
|
||||||
|
|
||||||
A single case pattern in a ``match`` statement. ``pattern`` contains the
|
A single case pattern in a ``match`` statement. ``pattern`` contains the
|
||||||
|
@ -1458,6 +1463,8 @@ Pattern matching
|
||||||
value=Constant(value=Ellipsis))])])],
|
value=Constant(value=Ellipsis))])])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. class:: MatchValue(value)
|
.. class:: MatchValue(value)
|
||||||
|
|
||||||
A match literal or value pattern that compares by equality. ``value`` is
|
A match literal or value pattern that compares by equality. ``value`` is
|
||||||
|
@ -1485,6 +1492,8 @@ Pattern matching
|
||||||
value=Constant(value=Ellipsis))])])],
|
value=Constant(value=Ellipsis))])])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. class:: MatchSingleton(value)
|
.. class:: MatchSingleton(value)
|
||||||
|
|
||||||
A match literal pattern that compares by identity. ``value`` is the
|
A match literal pattern that compares by identity. ``value`` is the
|
||||||
|
@ -1510,6 +1519,8 @@ Pattern matching
|
||||||
value=Constant(value=Ellipsis))])])],
|
value=Constant(value=Ellipsis))])])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. class:: MatchSequence(patterns)
|
.. class:: MatchSequence(patterns)
|
||||||
|
|
||||||
A match sequence pattern. ``patterns`` contains the patterns to be matched
|
A match sequence pattern. ``patterns`` contains the patterns to be matched
|
||||||
|
@ -1541,6 +1552,8 @@ Pattern matching
|
||||||
value=Constant(value=Ellipsis))])])],
|
value=Constant(value=Ellipsis))])])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. class:: MatchStar(name)
|
.. class:: MatchStar(name)
|
||||||
|
|
||||||
Matches the rest of the sequence in a variable length match sequence pattern.
|
Matches the rest of the sequence in a variable length match sequence pattern.
|
||||||
|
@ -1581,6 +1594,8 @@ Pattern matching
|
||||||
value=Constant(value=Ellipsis))])])],
|
value=Constant(value=Ellipsis))])])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. class:: MatchMapping(keys, patterns, rest)
|
.. class:: MatchMapping(keys, patterns, rest)
|
||||||
|
|
||||||
A match mapping pattern. ``keys`` is a sequence of expression nodes.
|
A match mapping pattern. ``keys`` is a sequence of expression nodes.
|
||||||
|
@ -1627,6 +1642,8 @@ Pattern matching
|
||||||
value=Constant(value=Ellipsis))])])],
|
value=Constant(value=Ellipsis))])])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. class:: MatchClass(cls, patterns, kwd_attrs, kwd_patterns)
|
.. class:: MatchClass(cls, patterns, kwd_attrs, kwd_patterns)
|
||||||
|
|
||||||
A match class pattern. ``cls`` is an expression giving the nominal class to
|
A match class pattern. ``cls`` is an expression giving the nominal class to
|
||||||
|
@ -1691,6 +1708,8 @@ Pattern matching
|
||||||
value=Constant(value=Ellipsis))])])],
|
value=Constant(value=Ellipsis))])])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. class:: MatchAs(pattern, name)
|
.. class:: MatchAs(pattern, name)
|
||||||
|
|
||||||
A match "as-pattern", capture pattern or wildcard pattern. ``pattern``
|
A match "as-pattern", capture pattern or wildcard pattern. ``pattern``
|
||||||
|
@ -1732,6 +1751,8 @@ Pattern matching
|
||||||
value=Constant(value=Ellipsis))])])],
|
value=Constant(value=Ellipsis))])])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. class:: MatchOr(patterns)
|
.. class:: MatchOr(patterns)
|
||||||
|
|
||||||
A match "or-pattern". An or-pattern matches each of its subpatterns in turn
|
A match "or-pattern". An or-pattern matches each of its subpatterns in turn
|
||||||
|
@ -1764,6 +1785,8 @@ Pattern matching
|
||||||
value=Constant(value=Ellipsis))])])],
|
value=Constant(value=Ellipsis))])])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.10
|
||||||
|
|
||||||
.. _ast-type-params:
|
.. _ast-type-params:
|
||||||
|
|
||||||
Type parameters
|
Type parameters
|
||||||
|
@ -1795,6 +1818,8 @@ aliases.
|
||||||
ctx=Load()))],
|
ctx=Load()))],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.12
|
||||||
|
|
||||||
.. class:: ParamSpec(name)
|
.. class:: ParamSpec(name)
|
||||||
|
|
||||||
A :class:`typing.ParamSpec`. ``name`` is the name of the parameter specification.
|
A :class:`typing.ParamSpec`. ``name`` is the name of the parameter specification.
|
||||||
|
@ -1818,6 +1843,8 @@ aliases.
|
||||||
ctx=Load()))],
|
ctx=Load()))],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.12
|
||||||
|
|
||||||
.. class:: TypeVarTuple(name)
|
.. class:: TypeVarTuple(name)
|
||||||
|
|
||||||
A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable tuple.
|
A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable tuple.
|
||||||
|
@ -1842,6 +1869,8 @@ aliases.
|
||||||
ctx=Load()))],
|
ctx=Load()))],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionadded:: 3.12
|
||||||
|
|
||||||
Function and class definitions
|
Function and class definitions
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -1861,6 +1890,9 @@ Function and class definitions
|
||||||
|
|
||||||
``type_comment`` is an optional string with the type annotation as a comment.
|
``type_comment`` is an optional string with the type annotation as a comment.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.12
|
||||||
|
Added ``type_params``.
|
||||||
|
|
||||||
|
|
||||||
.. class:: Lambda(args, body)
|
.. class:: Lambda(args, body)
|
||||||
|
|
||||||
|
@ -2059,6 +2091,9 @@ Function and class definitions
|
||||||
type_params=[])],
|
type_params=[])],
|
||||||
type_ignores=[])
|
type_ignores=[])
|
||||||
|
|
||||||
|
.. versionchanged:: 3.12
|
||||||
|
Added ``type_params``.
|
||||||
|
|
||||||
Async and await
|
Async and await
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -2067,6 +2102,9 @@ Async and await
|
||||||
An ``async def`` function definition. Has the same fields as
|
An ``async def`` function definition. Has the same fields as
|
||||||
:class:`FunctionDef`.
|
:class:`FunctionDef`.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.12
|
||||||
|
Added ``type_params``.
|
||||||
|
|
||||||
|
|
||||||
.. class:: Await(value)
|
.. class:: Await(value)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue