# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR , YEAR.
#
# Translators:
# Jyst Breisgau, 2026
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.14\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-09-28 03:11+0000\n"
"PO-Revision-Date: 2026-05-08 17:17+0000\n"
"Last-Translator: Jyst Breisgau, 2026\n"
"Language-Team: German (https://app.transifex.com/python-doc/teams/5390/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../../library/ast.rst:2
msgid ":mod:`!ast` --- Abstract syntax trees"
msgstr ""
#: ../../library/ast.rst:14
msgid "**Source code:** :source:`Lib/ast.py`"
msgstr ""
#: ../../library/ast.rst:18
msgid ""
"The :mod:`!ast` module helps Python applications to process trees of the "
"Python abstract syntax grammar. The abstract syntax itself might change "
"with each Python release; this module helps to find out programmatically "
"what the current grammar looks like."
msgstr ""
#: ../../library/ast.rst:23
msgid ""
"An abstract syntax tree can be generated by passing :data:`ast."
"PyCF_ONLY_AST` as a flag to the :func:`compile` built-in function, or using "
"the :func:`parse` helper provided in this module. The result will be a tree "
"of objects whose classes all inherit from :class:`ast.AST`. An abstract "
"syntax tree can be compiled into a Python code object using the built-in :"
"func:`compile` function."
msgstr ""
#: ../../library/ast.rst:33
msgid "Abstract grammar"
msgstr ""
#: ../../library/ast.rst:35
msgid "The abstract grammar is currently defined as follows:"
msgstr ""
#: ../../library/ast.rst:37
msgid ""
"-- ASDL's 4 builtin types are:\n"
"-- identifier, int, string, constant\n"
"\n"
"module Python\n"
"{\n"
" mod = Module(stmt* body, type_ignore* type_ignores)\n"
" | Interactive(stmt* body)\n"
" | Expression(expr body)\n"
" | FunctionType(expr* argtypes, expr returns)\n"
"\n"
" stmt = FunctionDef(identifier name, arguments args,\n"
" stmt* body, expr* decorator_list, expr? returns,\n"
" string? type_comment, type_param* type_params)\n"
" | AsyncFunctionDef(identifier name, arguments args,\n"
" stmt* body, expr* decorator_list, expr? "
"returns,\n"
" string? type_comment, type_param* type_params)\n"
"\n"
" | ClassDef(identifier name,\n"
" expr* bases,\n"
" keyword* keywords,\n"
" stmt* body,\n"
" expr* decorator_list,\n"
" type_param* type_params)\n"
" | Return(expr? value)\n"
"\n"
" | Delete(expr* targets)\n"
" | Assign(expr* targets, expr value, string? type_comment)\n"
" | TypeAlias(expr name, type_param* type_params, expr value)\n"
" | AugAssign(expr target, operator op, expr value)\n"
" -- 'simple' indicates that we annotate simple name without parens\n"
" | AnnAssign(expr target, expr annotation, expr? value, int "
"simple)\n"
"\n"
" -- use 'orelse' because else is a keyword in target languages\n"
" | For(expr target, expr iter, stmt* body, stmt* orelse, string? "
"type_comment)\n"
" | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, "
"string? type_comment)\n"
" | While(expr test, stmt* body, stmt* orelse)\n"
" | If(expr test, stmt* body, stmt* orelse)\n"
" | With(withitem* items, stmt* body, string? type_comment)\n"
" | AsyncWith(withitem* items, stmt* body, string? type_comment)\n"
"\n"
" | Match(expr subject, match_case* cases)\n"
"\n"
" | Raise(expr? exc, expr? cause)\n"
" | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* "
"finalbody)\n"
" | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* "
"finalbody)\n"
" | Assert(expr test, expr? msg)\n"
"\n"
" | Import(alias* names)\n"
" | ImportFrom(identifier? module, alias* names, int? level)\n"
"\n"
" | Global(identifier* names)\n"
" | Nonlocal(identifier* names)\n"
" | Expr(expr value)\n"
" | Pass | Break | Continue\n"
"\n"
" -- col_offset is the byte offset in the utf8 string the parser "
"uses\n"
" attributes (int lineno, int col_offset, int? end_lineno, int? "
"end_col_offset)\n"
"\n"
" -- BoolOp() can use left & right?\n"
" expr = BoolOp(boolop op, expr* values)\n"
" | NamedExpr(expr target, expr value)\n"
" | BinOp(expr left, operator op, expr right)\n"
" | UnaryOp(unaryop op, expr operand)\n"
" | Lambda(arguments args, expr body)\n"
" | IfExp(expr test, expr body, expr orelse)\n"
" | Dict(expr?* keys, expr* values)\n"
" | Set(expr* elts)\n"
" | ListComp(expr elt, comprehension* generators)\n"
" | SetComp(expr elt, comprehension* generators)\n"
" | DictComp(expr key, expr value, comprehension* generators)\n"
" | GeneratorExp(expr elt, comprehension* generators)\n"
" -- the grammar constrains where yield expressions can occur\n"
" | Await(expr value)\n"
" | Yield(expr? value)\n"
" | YieldFrom(expr value)\n"
" -- need sequences for compare to distinguish between\n"
" -- x < 4 < 3 and (x < 4) < 3\n"
" | Compare(expr left, cmpop* ops, expr* comparators)\n"
" | Call(expr func, expr* args, keyword* keywords)\n"
" | FormattedValue(expr value, int conversion, expr? format_spec)\n"
" | Interpolation(expr value, constant str, int conversion, expr? "
"format_spec)\n"
" | JoinedStr(expr* values)\n"
" | TemplateStr(expr* values)\n"
" | Constant(constant value, string? kind)\n"
"\n"
" -- the following expression can appear in assignment context\n"
" | Attribute(expr value, identifier attr, expr_context ctx)\n"
" | Subscript(expr value, expr slice, expr_context ctx)\n"
" | Starred(expr value, expr_context ctx)\n"
" | Name(identifier id, expr_context ctx)\n"
" | List(expr* elts, expr_context ctx)\n"
" | Tuple(expr* elts, expr_context ctx)\n"
"\n"
" -- can appear only in Subscript\n"
" | Slice(expr? lower, expr? upper, expr? step)\n"
"\n"
" -- col_offset is the byte offset in the utf8 string the parser "
"uses\n"
" attributes (int lineno, int col_offset, int? end_lineno, int? "
"end_col_offset)\n"
"\n"
" expr_context = Load | Store | Del\n"
"\n"
" boolop = And | Or\n"
"\n"
" operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift\n"
" | RShift | BitOr | BitXor | BitAnd | FloorDiv\n"
"\n"
" unaryop = Invert | Not | UAdd | USub\n"
"\n"
" cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn\n"
"\n"
" comprehension = (expr target, expr iter, expr* ifs, int is_async)\n"
"\n"
" excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)\n"
" attributes (int lineno, int col_offset, int? end_lineno, "
"int? end_col_offset)\n"
"\n"
" arguments = (arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs,\n"
" expr?* kw_defaults, arg? kwarg, expr* defaults)\n"
"\n"
" arg = (identifier arg, expr? annotation, string? type_comment)\n"
" attributes (int lineno, int col_offset, int? end_lineno, int? "
"end_col_offset)\n"
"\n"
" -- keyword arguments supplied to call (NULL identifier for **kwargs)\n"
" keyword = (identifier? arg, expr value)\n"
" attributes (int lineno, int col_offset, int? end_lineno, int? "
"end_col_offset)\n"
"\n"
" -- import name with optional 'as' alias.\n"
" alias = (identifier name, identifier? asname)\n"
" attributes (int lineno, int col_offset, int? end_lineno, int? "
"end_col_offset)\n"
"\n"
" withitem = (expr context_expr, expr? optional_vars)\n"
"\n"
" match_case = (pattern pattern, expr? guard, stmt* body)\n"
"\n"
" pattern = MatchValue(expr value)\n"
" | MatchSingleton(constant value)\n"
" | MatchSequence(pattern* patterns)\n"
" | MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n"
" | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, "
"pattern* kwd_patterns)\n"
"\n"
" | MatchStar(identifier? name)\n"
" -- The optional \"rest\" MatchMapping parameter handles "
"capturing extra mapping keys\n"
"\n"
" | MatchAs(pattern? pattern, identifier? name)\n"
" | MatchOr(pattern* patterns)\n"
"\n"
" attributes (int lineno, int col_offset, int end_lineno, int "
"end_col_offset)\n"
"\n"
" type_ignore = TypeIgnore(int lineno, string tag)\n"
"\n"
" type_param = TypeVar(identifier name, expr? bound, expr? default_value)\n"
" | ParamSpec(identifier name, expr? default_value)\n"
" | TypeVarTuple(identifier name, expr? default_value)\n"
" attributes (int lineno, int col_offset, int end_lineno, int "
"end_col_offset)\n"
"}\n"
msgstr ""
#: ../../library/ast.rst:42
msgid "Node classes"
msgstr ""
#: ../../library/ast.rst:46
msgid ""
"This is the base of all AST node classes. The actual node classes are "
"derived from the :file:`Parser/Python.asdl` file, which is reproduced :ref:"
"`above `. They are defined in the :mod:`!_ast` C module "
"and re-exported in :mod:`!ast`."
msgstr ""
#: ../../library/ast.rst:51
msgid ""
"There is one class defined for each left-hand side symbol in the abstract "
"grammar (for example, :class:`ast.stmt` or :class:`ast.expr`). In addition, "
"there is one class defined for each constructor on the right-hand side; "
"these classes inherit from the classes for the left-hand side trees. For "
"example, :class:`ast.BinOp` inherits from :class:`ast.expr`. For production "
"rules with alternatives (aka \"sums\"), the left-hand side class is "
"abstract: only instances of specific constructor nodes are ever created."
msgstr ""
#: ../../library/ast.rst:64
msgid ""
"Each concrete class has an attribute :attr:`!_fields` which gives the names "
"of all child nodes."
msgstr ""
#: ../../library/ast.rst:67
msgid ""
"Each instance of a concrete class has one attribute for each child node, of "
"the type as defined in the grammar. For example, :class:`ast.BinOp` "
"instances have an attribute :attr:`left` of type :class:`ast.expr`."
msgstr ""
#: ../../library/ast.rst:71
msgid ""
"If these attributes are marked as optional in the grammar (using a question "
"mark), the value might be ``None``. If the attributes can have zero-or-more "
"values (marked with an asterisk), the values are represented as Python "
"lists. All possible attributes must be present and have valid values when "
"compiling an AST with :func:`compile`."
msgstr ""
#: ../../library/ast.rst:79
msgid ""
"The :attr:`!_field_types` attribute on each concrete class is a dictionary "
"mapping field names (as also listed in :attr:`_fields`) to their types."
msgstr ""
#: ../../library/ast.rst:82
msgid ""
">>> ast.TypeVar._field_types\n"
"{'name': , 'bound': ast.expr | None, 'default_value': ast.expr "
"| None}"
msgstr ""
#: ../../library/ast.rst:94
msgid ""
"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:"
"`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` "
"attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and "
"last line numbers of source text span (1-indexed so the first line is line "
"1) and the :attr:`col_offset` and :attr:`end_col_offset` are the "
"corresponding UTF-8 byte offsets of the first and last tokens that generated "
"the node. The UTF-8 offset is recorded because the parser uses UTF-8 "
"internally."
msgstr ""
#: ../../library/ast.rst:103
msgid ""
"Note that the end positions are not required by the compiler and are "
"therefore optional. The end offset is *after* the last symbol, for example "
"one can get the source segment of a one-line expression node using "
"``source_line[node.col_offset : node.end_col_offset]``."
msgstr ""
#: ../../library/ast.rst:108
msgid ""
"The constructor of a class :class:`ast.T` parses its arguments as follows:"
msgstr ""
#: ../../library/ast.rst:110
msgid ""
"If there are positional arguments, there must be as many as there are items "
"in :attr:`T._fields`; they will be assigned as attributes of these names."
msgstr ""
#: ../../library/ast.rst:112
msgid ""
"If there are keyword arguments, they will set the attributes of the same "
"names to the given values."
msgstr ""
#: ../../library/ast.rst:115
msgid ""
"For example, to create and populate an :class:`ast.UnaryOp` node, you could "
"use ::"
msgstr ""
#: ../../library/ast.rst:118
msgid ""
"node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n"
" lineno=0, col_offset=0)"
msgstr ""
#: ../../library/ast.rst:121
msgid ""
"If a field that is optional in the grammar is omitted from the constructor, "
"it defaults to ``None``. If a list field is omitted, it defaults to the "
"empty list. If a field of type :class:`!ast.expr_context` is omitted, it "
"defaults to :class:`Load() `. If any other field is omitted, a :"
"exc:`DeprecationWarning` is raised and the AST node will not have this "
"field. In Python 3.15, this condition will raise an error."
msgstr ""
#: ../../library/ast.rst:130
msgid "Class :class:`ast.Constant` is now used for all constants."
msgstr ""
#: ../../library/ast.rst:134
msgid ""
"Simple indices are represented by their value, extended slices are "
"represented as tuples."
msgstr ""
#: ../../library/ast.rst:139
msgid ""
"AST node constructors were changed to provide sensible defaults for omitted "
"fields: optional fields now default to ``None``, list fields default to an "
"empty list, and fields of type :class:`!ast.expr_context` default to :class:"
"`Load() `. Previously, omitted attributes would not exist on "
"constructed nodes (accessing them raised :exc:`AttributeError`)."
msgstr ""
#: ../../library/ast.rst:147
msgid ""
"The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes the "
"values of the node fields."
msgstr ""
#: ../../library/ast.rst:152
msgid ""
"Previous versions of Python provided the AST classes :class:`!ast.Num`, :"
"class:`!ast.Str`, :class:`!ast.Bytes`, :class:`!ast.NameConstant` and :class:"
"`!ast.Ellipsis`, which were deprecated in Python 3.8. These classes were "
"removed in Python 3.14, and their functionality has been replaced with :"
"class:`ast.Constant`."
msgstr ""
#: ../../library/ast.rst:160
msgid ""
"Old classes :class:`!ast.Index` and :class:`!ast.ExtSlice` are still "
"available, but they will be removed in future Python releases. In the "
"meantime, instantiating them will return an instance of a different class."
msgstr ""
#: ../../library/ast.rst:167
msgid ""
"Previous versions of Python allowed the creation of AST nodes that were "
"missing required fields. Similarly, AST node constructors allowed arbitrary "
"keyword arguments that were set as attributes of the AST node, even if they "
"did not match any of the fields of the AST node. This behavior is deprecated "
"and will be removed in Python 3.15."
msgstr ""
#: ../../library/ast.rst:174
msgid ""
"The descriptions of the specific node classes displayed here were initially "
"adapted from the fantastic `Green Tree Snakes `__ project and all its contributors."
msgstr ""
#: ../../library/ast.rst:183
msgid "Root nodes"
msgstr ""
#: ../../library/ast.rst:187
msgid ""
"A Python module, as with :ref:`file input `. Node type generated "
"by :func:`ast.parse` in the default ``\"exec\"`` *mode*."
msgstr ""
#: ../../library/ast.rst:190
msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`."
msgstr ""
#: ../../library/ast.rst:192
msgid ""
"``type_ignores`` is a :class:`list` of the module's type ignore comments; "
"see :func:`ast.parse` for more details."
msgstr ""
#: ../../library/ast.rst:195
msgid ""
">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n"
"Module(\n"
" body=[\n"
" Assign(\n"
" targets=[\n"
" Name(id='x', ctx=Store())],\n"
" value=Constant(value=1))])"
msgstr ""
#: ../../library/ast.rst:208
msgid ""
"A single Python :ref:`expression input `. Node type "
"generated by :func:`ast.parse` when *mode* is ``\"eval\"``."
msgstr ""
#: ../../library/ast.rst:211
msgid ""
"``body`` is a single node, one of the :ref:`expression types `."
msgstr ""
#: ../../library/ast.rst:214
msgid ""
">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n"
"Expression(\n"
" body=Constant(value=123))"
msgstr ""
#: ../../library/ast.rst:223
msgid ""
"A single :ref:`interactive input `, like in :ref:`tut-interac`. "
"Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``."
msgstr ""
#: ../../library/ast.rst:226
msgid "``body`` is a :class:`list` of :ref:`statement nodes `."
msgstr ""
#: ../../library/ast.rst:228
msgid ""
">>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))\n"
"Interactive(\n"
" body=[\n"
" Assign(\n"
" targets=[\n"
" Name(id='x', ctx=Store())],\n"
" value=Constant(value=1)),\n"
" Assign(\n"
" targets=[\n"
" Name(id='y', ctx=Store())],\n"
" value=Constant(value=2))])"
msgstr ""
#: ../../library/ast.rst:245
msgid ""
"A representation of an old-style type comments for functions, as Python "
"versions prior to 3.5 didn't support :pep:`484` annotations. Node type "
"generated by :func:`ast.parse` when *mode* is ``\"func_type\"``."
msgstr ""
#: ../../library/ast.rst:249
msgid "Such type comments would look like this::"
msgstr ""
#: ../../library/ast.rst:251
msgid ""
"def sum_two_number(a, b):\n"
" # type: (int, int) -> int\n"
" return a + b"
msgstr ""
#: ../../library/ast.rst:255
msgid ""
"``argtypes`` is a :class:`list` of :ref:`expression nodes `."
msgstr ""
#: ../../library/ast.rst:257
msgid "``returns`` is a single :ref:`expression node `."
msgstr ""
#: ../../library/ast.rst:259
msgid ""
">>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), "
"indent=4))\n"
"FunctionType(\n"
" argtypes=[\n"
" Name(id='int', ctx=Load()),\n"
" Name(id='str', ctx=Load())],\n"
" returns=Subscript(\n"
" value=Name(id='List', ctx=Load()),\n"
" slice=Name(id='int', ctx=Load()),\n"
" ctx=Load()))"
msgstr ""
#: ../../library/ast.rst:275
msgid "Literals"
msgstr "Literale"
#: ../../library/ast.rst:279
msgid ""
"A constant value. The ``value`` attribute of the ``Constant`` literal "
"contains the Python object it represents. The values represented can be "
"instances of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :"
"class:`complex`, and :class:`bool`, and the constants :data:`None` and :data:"
"`Ellipsis`."
msgstr ""
#: ../../library/ast.rst:284
msgid ""
"The ``kind`` attribute is an optional string. For string literals with a "
"``u`` prefix, ``kind`` is set to ``'u'``. For all other constants, ``kind`` "
"is ``None``."
msgstr ""
#: ../../library/ast.rst:288
msgid ""
">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n"
"Expression(\n"
" body=Constant(value=123))\n"
">>> print(ast.dump(ast.parse(\"u'hello'\", mode='eval'), indent=4))\n"
"Expression(\n"
" body=Constant(value='hello', kind='u'))"
msgstr ""
#: ../../library/ast.rst:300
msgid ""
"Node representing a single formatting field in an f-string. If the string "
"contains a single formatting field and nothing else the node can be isolated "
"otherwise it appears in :class:`JoinedStr`."
msgstr ""
#: ../../library/ast.rst:304
msgid ""
"``value`` is any expression node (such as a literal, a variable, or a "
"function call)."
msgstr ""
#: ../../library/ast.rst:306 ../../library/ast.rst:388
msgid "``conversion`` is an integer:"
msgstr ""
#: ../../library/ast.rst:308
msgid "-1: no formatting"
msgstr ""
#: ../../library/ast.rst:309
msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` formatting"
msgstr ""
#: ../../library/ast.rst:310
msgid "114 (``ord('r')``): ``!r`` :func:`repr` formatting"
msgstr ""
#: ../../library/ast.rst:311
msgid "115 (``ord('s')``): ``!s`` :func:`string ` formatting"
msgstr ""
#: ../../library/ast.rst:313
msgid ""
"``format_spec`` is a :class:`JoinedStr` node representing the formatting of "
"the value, or ``None`` if no format was specified. Both ``conversion`` and "
"``format_spec`` can be set at the same time."
msgstr ""
#: ../../library/ast.rst:320
msgid ""
"An f-string, comprising a series of :class:`FormattedValue` and :class:"
"`Constant` nodes."
msgstr ""
#: ../../library/ast.rst:323
msgid ""
">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), "
"indent=4))\n"
"Expression(\n"
" body=JoinedStr(\n"
" values=[\n"
" Constant(value='sin('),\n"
" FormattedValue(\n"
" value=Name(id='a', ctx=Load()),\n"
" conversion=-1),\n"
" Constant(value=') is '),\n"
" FormattedValue(\n"
" value=Call(\n"
" func=Name(id='sin', ctx=Load()),\n"
" args=[\n"
" Name(id='a', ctx=Load())]),\n"
" conversion=-1,\n"
" format_spec=JoinedStr(\n"
" values=[\n"
" Constant(value='.3')]))]))"
msgstr ""
#: ../../library/ast.rst:349
msgid ""
"Node representing a template string literal, comprising a series of :class:"
"`Interpolation` and :class:`Constant` nodes. These nodes may be any order, "
"and do not need to be interleaved."
msgstr ""
#: ../../library/ast.rst:353
msgid ""
">>> expr = ast.parse('t\"{name} finished {place:ordinal}\"', mode='eval')\n"
">>> print(ast.dump(expr, indent=4))\n"
"Expression(\n"
" body=TemplateStr(\n"
" values=[\n"
" Interpolation(\n"
" value=Name(id='name', ctx=Load()),\n"
" str='name',\n"
" conversion=-1),\n"
" Constant(value=' finished '),\n"
" Interpolation(\n"
" value=Name(id='place', ctx=Load()),\n"
" str='place',\n"
" conversion=-1,\n"
" format_spec=JoinedStr(\n"
" values=[\n"
" Constant(value='ordinal')]))]))"
msgstr ""
#: ../../library/ast.rst:377
msgid ""
"Node representing a single interpolation field in a template string literal."
msgstr ""
#: ../../library/ast.rst:379
msgid ""
"``value`` is any expression node (such as a literal, a variable, or a "
"function call). This has the same meaning as ``FormattedValue.value``."
msgstr ""
#: ../../library/ast.rst:382
msgid ""
"``str`` is a constant containing the text of the interpolation expression."
msgstr ""
#: ../../library/ast.rst:384
msgid ""
"If ``str`` is set to ``None``, then ``value`` is used to generate code when "
"calling :func:`ast.unparse`. This no longer guarantees that the generated "
"code is identical to the original and is intended for code generation."
msgstr ""
#: ../../library/ast.rst:390
msgid "-1: no conversion"
msgstr ""
#: ../../library/ast.rst:391
msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` conversion"
msgstr ""
#: ../../library/ast.rst:392
msgid "114 (``ord('r')``): ``!r`` :func:`repr` conversion"
msgstr ""
#: ../../library/ast.rst:393
msgid "115 (``ord('s')``): ``!s`` :func:`string ` conversion"
msgstr ""
#: ../../library/ast.rst:395
msgid "This has the same meaning as ``FormattedValue.conversion``."
msgstr ""
#: ../../library/ast.rst:396
msgid ""
"``format_spec`` is a :class:`JoinedStr` node representing the formatting of "
"the value, or ``None`` if no format was specified. Both ``conversion`` and "
"``format_spec`` can be set at the same time. This has the same meaning as "
"``FormattedValue.format_spec``."
msgstr ""
#: ../../library/ast.rst:405
msgid ""
"A list or tuple. ``elts`` holds a list of nodes representing the elements. "
"``ctx`` is :class:`Store` if the container is an assignment target (i.e. "
"``(x,y)=something``), and :class:`Load` otherwise."
msgstr ""
#: ../../library/ast.rst:409
msgid ""
">>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))\n"
"Expression(\n"
" body=List(\n"
" elts=[\n"
" Constant(value=1),\n"
" Constant(value=2),\n"
" Constant(value=3)],\n"
" ctx=Load()))\n"
">>> print(ast.dump(ast.parse('(1, 2, 3)', mode='eval'), indent=4))\n"
"Expression(\n"
" body=Tuple(\n"
" elts=[\n"
" Constant(value=1),\n"
" Constant(value=2),\n"
" Constant(value=3)],\n"
" ctx=Load()))"
msgstr ""
#: ../../library/ast.rst:431
msgid "A set. ``elts`` holds a list of nodes representing the set's elements."
msgstr ""
#: ../../library/ast.rst:433
msgid ""
">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n"
"Expression(\n"
" body=Set(\n"
" elts=[\n"
" Constant(value=1),\n"
" Constant(value=2),\n"
" Constant(value=3)]))"
msgstr ""
#: ../../library/ast.rst:446
msgid ""
"A dictionary. ``keys`` and ``values`` hold lists of nodes representing the "
"keys and the values respectively, in matching order (what would be returned "
"when calling :code:`dictionary.keys()` and :code:`dictionary.values()`)."
msgstr ""
#: ../../library/ast.rst:450
msgid ""
"When doing dictionary unpacking using dictionary literals the expression to "
"be expanded goes in the ``values`` list, with a ``None`` at the "
"corresponding position in ``keys``."
msgstr ""
#: ../../library/ast.rst:454
msgid ""
">>> print(ast.dump(ast.parse('{\"a\":1, **d}', mode='eval'), indent=4))\n"
"Expression(\n"
" body=Dict(\n"
" keys=[\n"
" Constant(value='a'),\n"
" None],\n"
" values=[\n"
" Constant(value=1),\n"
" Name(id='d', ctx=Load())]))"
msgstr ""
#: ../../library/ast.rst:468
msgid "Variables"
msgstr ""
#: ../../library/ast.rst:472
msgid ""
"A variable name. ``id`` holds the name as a string, and ``ctx`` is one of "
"the following types."
msgstr ""
#: ../../library/ast.rst:480
msgid ""
"Variable references can be used to load the value of a variable, to assign a "
"new value to it, or to delete it. Variable references are given a context to "
"distinguish these cases."
msgstr ""
#: ../../library/ast.rst:484
msgid ""
">>> print(ast.dump(ast.parse('a'), indent=4))\n"
"Module(\n"
" body=[\n"
" Expr(\n"
" value=Name(id='a', ctx=Load()))])\n"
"\n"
">>> print(ast.dump(ast.parse('a = 1'), indent=4))\n"
"Module(\n"
" body=[\n"
" Assign(\n"
" targets=[\n"
" Name(id='a', ctx=Store())],\n"
" value=Constant(value=1))])\n"
"\n"
">>> print(ast.dump(ast.parse('del a'), indent=4))\n"
"Module(\n"
" body=[\n"
" Delete(\n"
" targets=[\n"
" Name(id='a', ctx=Del())])])"
msgstr ""
#: ../../library/ast.rst:510
msgid ""
"A ``*var`` variable reference. ``value`` holds the variable, typically a :"
"class:`Name` node. This type must be used when building a :class:`Call` node "
"with ``*args``."
msgstr ""
#: ../../library/ast.rst:514
msgid ""
">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n"
"Module(\n"
" body=[\n"
" Assign(\n"
" targets=[\n"
" Tuple(\n"
" elts=[\n"
" Name(id='a', ctx=Store()),\n"
" Starred(\n"
" value=Name(id='b', ctx=Store()),\n"
" ctx=Store())],\n"
" ctx=Store())],\n"
" value=Name(id='it', ctx=Load()))])"
msgstr ""
#: ../../library/ast.rst:534
msgid "Expressions"
msgstr "Ausdrcke"
#: ../../library/ast.rst:538
msgid ""
"When an expression, such as a function call, appears as a statement by "
"itself with its return value not used or stored, it is wrapped in this "
"container. ``value`` holds one of the other nodes in this section, a :class:"
"`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` or :class:"
"`YieldFrom` node."
msgstr ""
#: ../../library/ast.rst:543
msgid ""
">>> print(ast.dump(ast.parse('-a'), indent=4))\n"
"Module(\n"
" body=[\n"
" Expr(\n"
" value=UnaryOp(\n"
" op=USub(),\n"
" operand=Name(id='a', ctx=Load())))])"
msgstr ""
#: ../../library/ast.rst:556
msgid ""
"A unary operation. ``op`` is the operator, and ``operand`` any expression "
"node."
msgstr ""
#: ../../library/ast.rst:565
msgid ""
"Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` "
"is the ``~`` operator."
msgstr ""
#: ../../library/ast.rst:568
msgid ""
">>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\n"
"Expression(\n"
" body=UnaryOp(\n"
" op=Not(),\n"
" operand=Name(id='x', ctx=Load())))"
msgstr ""
#: ../../library/ast.rst:579
msgid ""
"A binary operation (like addition or division). ``op`` is the operator, and "
"``left`` and ``right`` are any expression nodes."
msgstr ""
#: ../../library/ast.rst:582
msgid ""
">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n"
"Expression(\n"
" body=BinOp(\n"
" left=Name(id='x', ctx=Load()),\n"
" op=Add(),\n"
" right=Name(id='y', ctx=Load())))"
msgstr ""
#: ../../library/ast.rst:606
msgid "Binary operator tokens."
msgstr ""
#: ../../library/ast.rst:611
msgid ""
"A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. "
"``values`` are the values involved. Consecutive operations with the same "
"operator, such as ``a or b or c``, are collapsed into one node with several "
"values."
msgstr ""
#: ../../library/ast.rst:616
msgid "This doesn't include ``not``, which is a :class:`UnaryOp`."
msgstr ""
#: ../../library/ast.rst:618
msgid ""
">>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))\n"
"Expression(\n"
" body=BoolOp(\n"
" op=Or(),\n"
" values=[\n"
" Name(id='x', ctx=Load()),\n"
" Name(id='y', ctx=Load())]))"
msgstr ""
#: ../../library/ast.rst:632
msgid "Boolean operator tokens."
msgstr ""
#: ../../library/ast.rst:637
msgid ""
"A comparison of two or more values. ``left`` is the first value in the "
"comparison, ``ops`` the list of operators, and ``comparators`` the list of "
"values after the first element in the comparison."
msgstr ""
#: ../../library/ast.rst:641
msgid ""
">>> print(ast.dump(ast.parse('1 5 if n>> print(ast.dump(ast.parse(\"\"\"\\\n"
"... try:\n"
"... a + 1\n"
"... except TypeError:\n"
"... pass\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Try(\n"
" body=[\n"
" Expr(\n"
" value=BinOp(\n"
" left=Name(id='a', ctx=Load()),\n"
" op=Add(),\n"
" right=Constant(value=1)))],\n"
" handlers=[\n"
" ExceptHandler(\n"
" type=Name(id='TypeError', ctx=Load()),\n"
" body=[\n"
" Pass()])])])"
msgstr ""
#: ../../library/ast.rst:1425
msgid ""
"A ``with`` block. ``items`` is a list of :class:`withitem` nodes "
"representing the context managers, and ``body`` is the indented block inside "
"the context."
msgstr ""
#: ../../library/ast.rst:1435
msgid ""
"A single context manager in a ``with`` block. ``context_expr`` is the "
"context manager, often a :class:`Call` node. ``optional_vars`` is a :class:"
"`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or ``None`` "
"if that isn't used."
msgstr ""
#: ../../library/ast.rst:1440
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\\\n"
"... with a as b, c as d:\n"
"... something(b, d)\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" With(\n"
" items=[\n"
" withitem(\n"
" context_expr=Name(id='a', ctx=Load()),\n"
" optional_vars=Name(id='b', ctx=Store())),\n"
" withitem(\n"
" context_expr=Name(id='c', ctx=Load()),\n"
" optional_vars=Name(id='d', ctx=Store()))],\n"
" body=[\n"
" Expr(\n"
" value=Call(\n"
" func=Name(id='something', ctx=Load()),\n"
" args=[\n"
" Name(id='b', ctx=Load()),\n"
" Name(id='d', ctx=Load())]))])])"
msgstr ""
#: ../../library/ast.rst:1466
msgid "Pattern matching"
msgstr ""
#: ../../library/ast.rst:1471
msgid ""
"A ``match`` statement. ``subject`` holds the subject of the match (the "
"object that is being matched against the cases) and ``cases`` contains an "
"iterable of :class:`match_case` nodes with the different cases."
msgstr ""
#: ../../library/ast.rst:1479
msgid ""
"A single case pattern in a ``match`` statement. ``pattern`` contains the "
"match pattern that the subject will be matched against. Note that the :class:"
"`AST` nodes produced for patterns differ from those produced for "
"expressions, even when they share the same syntax."
msgstr ""
#: ../../library/ast.rst:1484
msgid ""
"The ``guard`` attribute contains an expression that will be evaluated if the "
"pattern matches the subject."
msgstr ""
#: ../../library/ast.rst:1487
msgid ""
"``body`` contains a list of nodes to execute if the pattern matches and the "
"result of evaluating the guard expression is true."
msgstr ""
#: ../../library/ast.rst:1490
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\n"
"... match x:\n"
"... case [x] if x>0:\n"
"... ...\n"
"... case tuple():\n"
"... ...\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Match(\n"
" subject=Name(id='x', ctx=Load()),\n"
" cases=[\n"
" match_case(\n"
" pattern=MatchSequence(\n"
" patterns=[\n"
" MatchAs(name='x')]),\n"
" guard=Compare(\n"
" left=Name(id='x', ctx=Load()),\n"
" ops=[\n"
" Gt()],\n"
" comparators=[\n"
" Constant(value=0)]),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))]),\n"
" match_case(\n"
" pattern=MatchClass(\n"
" cls=Name(id='tuple', ctx=Load())),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))])])])"
msgstr ""
#: ../../library/ast.rst:1528
msgid ""
"A match literal or value pattern that compares by equality. ``value`` is an "
"expression node. Permitted value nodes are restricted as described in the "
"match statement documentation. This pattern succeeds if the match subject is "
"equal to the evaluated value."
msgstr ""
#: ../../library/ast.rst:1533
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\n"
"... match x:\n"
"... case \"Relevant\":\n"
"... ...\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Match(\n"
" subject=Name(id='x', ctx=Load()),\n"
" cases=[\n"
" match_case(\n"
" pattern=MatchValue(\n"
" value=Constant(value='Relevant')),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))])])])"
msgstr ""
#: ../../library/ast.rst:1556
msgid ""
"A match literal pattern that compares by identity. ``value`` is the "
"singleton to be compared against: ``None``, ``True``, or ``False``. This "
"pattern succeeds if the match subject is the given constant."
msgstr ""
#: ../../library/ast.rst:1560
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\n"
"... match x:\n"
"... case None:\n"
"... ...\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Match(\n"
" subject=Name(id='x', ctx=Load()),\n"
" cases=[\n"
" match_case(\n"
" pattern=MatchSingleton(value=None),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))])])])"
msgstr ""
#: ../../library/ast.rst:1582
msgid ""
"A match sequence pattern. ``patterns`` contains the patterns to be matched "
"against the subject elements if the subject is a sequence. Matches a "
"variable length sequence if one of the subpatterns is a ``MatchStar`` node, "
"otherwise matches a fixed length sequence."
msgstr ""
#: ../../library/ast.rst:1587
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\n"
"... match x:\n"
"... case [1, 2]:\n"
"... ...\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Match(\n"
" subject=Name(id='x', ctx=Load()),\n"
" cases=[\n"
" match_case(\n"
" pattern=MatchSequence(\n"
" patterns=[\n"
" MatchValue(\n"
" value=Constant(value=1)),\n"
" MatchValue(\n"
" value=Constant(value=2))]),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))])])])"
msgstr ""
#: ../../library/ast.rst:1614
msgid ""
"Matches the rest of the sequence in a variable length match sequence "
"pattern. If ``name`` is not ``None``, a list containing the remaining "
"sequence elements is bound to that name if the overall sequence pattern is "
"successful."
msgstr ""
#: ../../library/ast.rst:1618
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\n"
"... match x:\n"
"... case [1, 2, *rest]:\n"
"... ...\n"
"... case [*_]:\n"
"... ...\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Match(\n"
" subject=Name(id='x', ctx=Load()),\n"
" cases=[\n"
" match_case(\n"
" pattern=MatchSequence(\n"
" patterns=[\n"
" MatchValue(\n"
" value=Constant(value=1)),\n"
" MatchValue(\n"
" value=Constant(value=2)),\n"
" MatchStar(name='rest')]),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))]),\n"
" match_case(\n"
" pattern=MatchSequence(\n"
" patterns=[\n"
" MatchStar()]),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))])])])"
msgstr ""
#: ../../library/ast.rst:1655
msgid ""
"A match mapping pattern. ``keys`` is a sequence of expression nodes. "
"``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an "
"optional name that can be specified to capture the remaining mapping "
"elements. Permitted key expressions are restricted as described in the match "
"statement documentation."
msgstr ""
#: ../../library/ast.rst:1661
msgid ""
"This pattern succeeds if the subject is a mapping, all evaluated key "
"expressions are present in the mapping, and the value corresponding to each "
"key matches the corresponding subpattern. If ``rest`` is not ``None``, a "
"dict containing the remaining mapping elements is bound to that name if the "
"overall mapping pattern is successful."
msgstr ""
#: ../../library/ast.rst:1667
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\n"
"... match x:\n"
"... case {1: _, 2: _}:\n"
"... ...\n"
"... case {**rest}:\n"
"... ...\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Match(\n"
" subject=Name(id='x', ctx=Load()),\n"
" cases=[\n"
" match_case(\n"
" pattern=MatchMapping(\n"
" keys=[\n"
" Constant(value=1),\n"
" Constant(value=2)],\n"
" patterns=[\n"
" MatchAs(),\n"
" MatchAs()]),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))]),\n"
" match_case(\n"
" pattern=MatchMapping(rest='rest'),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))])])])"
msgstr ""
#: ../../library/ast.rst:1702
msgid ""
"A match class pattern. ``cls`` is an expression giving the nominal class to "
"be matched. ``patterns`` is a sequence of pattern nodes to be matched "
"against the class defined sequence of pattern matching attributes. "
"``kwd_attrs`` is a sequence of additional attributes to be matched "
"(specified as keyword arguments in the class pattern), ``kwd_patterns`` are "
"the corresponding patterns (specified as keyword values in the class "
"pattern)."
msgstr ""
#: ../../library/ast.rst:1709
msgid ""
"This pattern succeeds if the subject is an instance of the nominated class, "
"all positional patterns match the corresponding class-defined attributes, "
"and any specified keyword attributes match their corresponding pattern."
msgstr ""
#: ../../library/ast.rst:1713
msgid ""
"Note: classes may define a property that returns self in order to match a "
"pattern node against the instance being matched. Several builtin types are "
"also matched that way, as described in the match statement documentation."
msgstr ""
#: ../../library/ast.rst:1717
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\n"
"... match x:\n"
"... case Point2D(0, 0):\n"
"... ...\n"
"... case Point3D(x=0, y=0, z=0):\n"
"... ...\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Match(\n"
" subject=Name(id='x', ctx=Load()),\n"
" cases=[\n"
" match_case(\n"
" pattern=MatchClass(\n"
" cls=Name(id='Point2D', ctx=Load()),\n"
" patterns=[\n"
" MatchValue(\n"
" value=Constant(value=0)),\n"
" MatchValue(\n"
" value=Constant(value=0))]),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))]),\n"
" match_case(\n"
" pattern=MatchClass(\n"
" cls=Name(id='Point3D', ctx=Load()),\n"
" kwd_attrs=[\n"
" 'x',\n"
" 'y',\n"
" 'z'],\n"
" kwd_patterns=[\n"
" MatchValue(\n"
" value=Constant(value=0)),\n"
" MatchValue(\n"
" value=Constant(value=0)),\n"
" MatchValue(\n"
" value=Constant(value=0))]),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))])])])"
msgstr ""
#: ../../library/ast.rst:1764
msgid ""
"A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` "
"contains the match pattern that the subject will be matched against. If the "
"pattern is ``None``, the node represents a capture pattern (i.e a bare name) "
"and will always succeed."
msgstr ""
#: ../../library/ast.rst:1769
msgid ""
"The ``name`` attribute contains the name that will be bound if the pattern "
"is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` "
"and the node represents the wildcard pattern."
msgstr ""
#: ../../library/ast.rst:1773
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\n"
"... match x:\n"
"... case [x] as y:\n"
"... ...\n"
"... case _:\n"
"... ...\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Match(\n"
" subject=Name(id='x', ctx=Load()),\n"
" cases=[\n"
" match_case(\n"
" pattern=MatchAs(\n"
" pattern=MatchSequence(\n"
" patterns=[\n"
" MatchAs(name='x')]),\n"
" name='y'),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))]),\n"
" match_case(\n"
" pattern=MatchAs(),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))])])])"
msgstr ""
#: ../../library/ast.rst:1806
msgid ""
"A match \"or-pattern\". An or-pattern matches each of its subpatterns in "
"turn to the subject, until one succeeds. The or-pattern is then deemed to "
"succeed. If none of the subpatterns succeed the or-pattern fails. The "
"``patterns`` attribute contains a list of match pattern nodes that will be "
"matched against the subject."
msgstr ""
#: ../../library/ast.rst:1812
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\n"
"... match x:\n"
"... case [x] | (y):\n"
"... ...\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" Match(\n"
" subject=Name(id='x', ctx=Load()),\n"
" cases=[\n"
" match_case(\n"
" pattern=MatchOr(\n"
" patterns=[\n"
" MatchSequence(\n"
" patterns=[\n"
" MatchAs(name='x')]),\n"
" MatchAs(name='y')]),\n"
" body=[\n"
" Expr(\n"
" value=Constant(value=Ellipsis))])])])"
msgstr ""
#: ../../library/ast.rst:1839
msgid "Type annotations"
msgstr ""
#: ../../library/ast.rst:1843
msgid ""
"A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag "
"specified by the form ``# type: ignore ``."
msgstr ""
#: ../../library/ast.rst:1846
msgid ""
">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), "
"indent=4))\n"
"Module(\n"
" body=[\n"
" Assign(\n"
" targets=[\n"
" Name(id='x', ctx=Store())],\n"
" value=Constant(value=1))],\n"
" type_ignores=[\n"
" TypeIgnore(lineno=1, tag='')])\n"
">>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', "
"type_comments=True), indent=4))\n"
"Module(\n"
" body=[\n"
" AnnAssign(\n"
" target=Name(id='x', ctx=Store()),\n"
" annotation=Name(id='bool', ctx=Load()),\n"
" value=Constant(value=1),\n"
" simple=1)],\n"
" type_ignores=[\n"
" TypeIgnore(lineno=1, tag='[assignment]')])"
msgstr ""
#: ../../library/ast.rst:1869
msgid ""
":class:`!TypeIgnore` nodes are not generated when the *type_comments* "
"parameter is set to ``False`` (default). See :func:`ast.parse` for more "
"details."
msgstr ""
#: ../../library/ast.rst:1877
msgid "Type parameters"
msgstr ""
#: ../../library/ast.rst:1879
msgid ""
":ref:`Type parameters ` can exist on classes, functions, and "
"type aliases."
msgstr ""
#: ../../library/ast.rst:1884
msgid ""
"A :class:`typing.TypeVar`. ``name`` is the name of the type variable. "
"``bound`` is the bound or constraints, if any. If ``bound`` is a :class:"
"`Tuple`, it represents constraints; otherwise it represents the bound. "
"``default_value`` is the default value; if the :class:`!TypeVar` has no "
"default, this attribute will be set to ``None``."
msgstr ""
#: ../../library/ast.rst:1890
msgid ""
">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), "
"indent=4))\n"
"Module(\n"
" body=[\n"
" TypeAlias(\n"
" name=Name(id='Alias', ctx=Store()),\n"
" type_params=[\n"
" TypeVar(\n"
" name='T',\n"
" bound=Name(id='int', ctx=Load()),\n"
" default_value=Name(id='bool', ctx=Load()))],\n"
" value=Subscript(\n"
" value=Name(id='list', ctx=Load()),\n"
" slice=Name(id='T', ctx=Load()),\n"
" ctx=Load()))])"
msgstr ""
#: ../../library/ast.rst:1909 ../../library/ast.rst:1944
#: ../../library/ast.rst:1976
msgid "Added the *default_value* parameter."
msgstr ""
#: ../../library/ast.rst:1914
msgid ""
"A :class:`typing.ParamSpec`. ``name`` is the name of the parameter "
"specification. ``default_value`` is the default value; if the :class:`!"
"ParamSpec` has no default, this attribute will be set to ``None``."
msgstr ""
#: ../../library/ast.rst:1918
msgid ""
">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, "
"int]\"), indent=4))\n"
"Module(\n"
" body=[\n"
" TypeAlias(\n"
" name=Name(id='Alias', ctx=Store()),\n"
" type_params=[\n"
" ParamSpec(\n"
" name='P',\n"
" default_value=List(\n"
" elts=[\n"
" Name(id='int', ctx=Load()),\n"
" Name(id='str', ctx=Load())],\n"
" ctx=Load()))],\n"
" value=Subscript(\n"
" value=Name(id='Callable', ctx=Load()),\n"
" slice=Tuple(\n"
" elts=[\n"
" Name(id='P', ctx=Load()),\n"
" Name(id='int', ctx=Load())],\n"
" ctx=Load()),\n"
" ctx=Load()))])"
msgstr ""
#: ../../library/ast.rst:1949
msgid ""
"A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable "
"tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` "
"has no default, this attribute will be set to ``None``."
msgstr ""
#: ../../library/ast.rst:1953
msgid ""
">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), "
"indent=4))\n"
"Module(\n"
" body=[\n"
" TypeAlias(\n"
" name=Name(id='Alias', ctx=Store()),\n"
" type_params=[\n"
" TypeVarTuple(\n"
" name='Ts',\n"
" default_value=Tuple(ctx=Load()))],\n"
" value=Subscript(\n"
" value=Name(id='tuple', ctx=Load()),\n"
" slice=Tuple(\n"
" elts=[\n"
" Starred(\n"
" value=Name(id='Ts', ctx=Load()),\n"
" ctx=Load())],\n"
" ctx=Load()),\n"
" ctx=Load()))])"
msgstr ""
#: ../../library/ast.rst:1980
msgid "Function and class definitions"
msgstr ""
#: ../../library/ast.rst:1984
msgid "A function definition."
msgstr ""
#: ../../library/ast.rst:1986
msgid "``name`` is a raw string of the function name."
msgstr ""
#: ../../library/ast.rst:1987
msgid "``args`` is an :class:`arguments` node."
msgstr ""
#: ../../library/ast.rst:1988
msgid "``body`` is the list of nodes inside the function."
msgstr ""
#: ../../library/ast.rst:1989
msgid ""
"``decorator_list`` is the list of decorators to be applied, stored outermost "
"first (i.e. the first in the list will be applied last)."
msgstr ""
#: ../../library/ast.rst:1991
msgid "``returns`` is the return annotation."
msgstr ""
#: ../../library/ast.rst:1992 ../../library/ast.rst:2155
msgid "``type_params`` is a list of :ref:`type parameters `."
msgstr ""
#: ../../library/ast.rst:1998 ../../library/ast.rst:2182
#: ../../library/ast.rst:2193
msgid "Added ``type_params``."
msgstr ""
#: ../../library/ast.rst:2004
msgid ""
"``lambda`` is a minimal function definition that can be used inside an "
"expression. Unlike :class:`FunctionDef`, ``body`` holds a single node."
msgstr ""
#: ../../library/ast.rst:2007
msgid ""
">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n"
"Module(\n"
" body=[\n"
" Expr(\n"
" value=Lambda(\n"
" args=arguments(\n"
" args=[\n"
" arg(arg='x'),\n"
" arg(arg='y')]),\n"
" body=Constant(value=Ellipsis)))])"
msgstr ""
#: ../../library/ast.rst:2023
msgid "The arguments for a function."
msgstr ""
#: ../../library/ast.rst:2025
msgid ""
"``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes."
msgstr ""
#: ../../library/ast.rst:2026
msgid ""
"``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the "
"``*args, **kwargs`` parameters."
msgstr ""
#: ../../library/ast.rst:2028
msgid ""
"``kw_defaults`` is a list of default values for keyword-only arguments. If "
"one is ``None``, the corresponding argument is required."
msgstr ""
#: ../../library/ast.rst:2030
msgid ""
"``defaults`` is a list of default values for arguments that can be passed "
"positionally. If there are fewer defaults, they correspond to the last n "
"arguments."
msgstr ""
#: ../../library/ast.rst:2037
msgid ""
"A single argument in a list. ``arg`` is a raw string of the argument name; "
"``annotation`` is its annotation, such as a :class:`Name` node."
msgstr ""
#: ../../library/ast.rst:2042
msgid ""
"``type_comment`` is an optional string with the type annotation as a comment"
msgstr ""
#: ../../library/ast.rst:2044
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\\\n"
"... @decorator1\n"
"... @decorator2\n"
"... def f(a: 'annotation', b=1, c=2, *d, e, f=3, **g) -> 'return "
"annotation':\n"
"... pass\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" FunctionDef(\n"
" name='f',\n"
" args=arguments(\n"
" args=[\n"
" arg(\n"
" arg='a',\n"
" annotation=Constant(value='annotation')),\n"
" arg(arg='b'),\n"
" arg(arg='c')],\n"
" vararg=arg(arg='d'),\n"
" kwonlyargs=[\n"
" arg(arg='e'),\n"
" arg(arg='f')],\n"
" kw_defaults=[\n"
" None,\n"
" Constant(value=3)],\n"
" kwarg=arg(arg='g'),\n"
" defaults=[\n"
" Constant(value=1),\n"
" Constant(value=2)]),\n"
" body=[\n"
" Pass()],\n"
" decorator_list=[\n"
" Name(id='decorator1', ctx=Load()),\n"
" Name(id='decorator2', ctx=Load())],\n"
" returns=Constant(value='return annotation'))])"
msgstr ""
#: ../../library/ast.rst:2084
msgid "A ``return`` statement."
msgstr ""
#: ../../library/ast.rst:2086
msgid ""
">>> print(ast.dump(ast.parse('return 4'), indent=4))\n"
"Module(\n"
" body=[\n"
" Return(\n"
" value=Constant(value=4))])"
msgstr ""
#: ../../library/ast.rst:2098
msgid ""
"A ``yield`` or ``yield from`` expression. Because these are expressions, "
"they must be wrapped in an :class:`Expr` node if the value sent back is not "
"used."
msgstr ""
#: ../../library/ast.rst:2101
msgid ""
">>> print(ast.dump(ast.parse('yield x'), indent=4))\n"
"Module(\n"
" body=[\n"
" Expr(\n"
" value=Yield(\n"
" value=Name(id='x', ctx=Load())))])\n"
"\n"
">>> print(ast.dump(ast.parse('yield from x'), indent=4))\n"
"Module(\n"
" body=[\n"
" Expr(\n"
" value=YieldFrom(\n"
" value=Name(id='x', ctx=Load())))])"
msgstr ""
#: ../../library/ast.rst:2121
msgid ""
"``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings."
msgstr ""
#: ../../library/ast.rst:2123
msgid ""
">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n"
"Module(\n"
" body=[\n"
" Global(\n"
" names=[\n"
" 'x',\n"
" 'y',\n"
" 'z'])])\n"
"\n"
">>> print(ast.dump(ast.parse('nonlocal x,y,z'), indent=4))\n"
"Module(\n"
" body=[\n"
" Nonlocal(\n"
" names=[\n"
" 'x',\n"
" 'y',\n"
" 'z'])])"
msgstr ""
#: ../../library/ast.rst:2146
msgid "A class definition."
msgstr ""
#: ../../library/ast.rst:2148
msgid "``name`` is a raw string for the class name"
msgstr ""
#: ../../library/ast.rst:2149
msgid "``bases`` is a list of nodes for explicitly specified base classes."
msgstr ""
#: ../../library/ast.rst:2150
msgid ""
"``keywords`` is a list of :class:`.keyword` nodes, principally for "
"'metaclass'. Other keywords will be passed to the metaclass, as per :pep:"
"`3115`."
msgstr ""
#: ../../library/ast.rst:2152
msgid ""
"``body`` is a list of nodes representing the code within the class "
"definition."
msgstr ""
#: ../../library/ast.rst:2154
msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`."
msgstr ""
#: ../../library/ast.rst:2157
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\\\n"
"... @decorator1\n"
"... @decorator2\n"
"... class Foo(base1, base2, metaclass=meta):\n"
"... pass\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" ClassDef(\n"
" name='Foo',\n"
" bases=[\n"
" Name(id='base1', ctx=Load()),\n"
" Name(id='base2', ctx=Load())],\n"
" keywords=[\n"
" keyword(\n"
" arg='metaclass',\n"
" value=Name(id='meta', ctx=Load()))],\n"
" body=[\n"
" Pass()],\n"
" decorator_list=[\n"
" Name(id='decorator1', ctx=Load()),\n"
" Name(id='decorator2', ctx=Load())])])"
msgstr ""
#: ../../library/ast.rst:2186
msgid "Async and await"
msgstr ""
#: ../../library/ast.rst:2190
msgid ""
"An ``async def`` function definition. Has the same fields as :class:"
"`FunctionDef`."
msgstr ""
#: ../../library/ast.rst:2199
msgid ""
"An ``await`` expression. ``value`` is what it waits for. Only valid in the "
"body of an :class:`AsyncFunctionDef`."
msgstr ""
#: ../../library/ast.rst:2202
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\\\n"
"... async def f():\n"
"... await other_func()\n"
"... \"\"\"), indent=4))\n"
"Module(\n"
" body=[\n"
" AsyncFunctionDef(\n"
" name='f',\n"
" args=arguments(),\n"
" body=[\n"
" Expr(\n"
" value=Await(\n"
" value=Call(\n"
" func=Name(id='other_func', ctx=Load()))))])])"
msgstr ""
#: ../../library/ast.rst:2223
msgid ""
"``async for`` loops and ``async with`` context managers. They have the same "
"fields as :class:`For` and :class:`With`, respectively. Only valid in the "
"body of an :class:`AsyncFunctionDef`."
msgstr ""
#: ../../library/ast.rst:2228
msgid ""
"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :"
"class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast."
"boolop` and :class:`ast.expr_context`) on the returned tree will be "
"singletons. Changes to one will be reflected in all other occurrences of the "
"same value (for example, :class:`ast.Add`)."
msgstr ""
#: ../../library/ast.rst:2236
msgid ":mod:`!ast` helpers"
msgstr ""
#: ../../library/ast.rst:2238
msgid ""
"Apart from the node classes, the :mod:`!ast` module defines these utility "
"functions and classes for traversing abstract syntax trees:"
msgstr ""
#: ../../library/ast.rst:2243
msgid ""
"Parse the source into an AST node. Equivalent to ``compile(source, "
"filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where "
"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize List[str]``."
msgstr ""
#: ../../library/ast.rst:2262
msgid ""
"Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a "
"\"best-effort\" attempt to parse using that Python version's grammar. For "
"example, setting ``feature_version=(3, 9)`` will attempt to disallow parsing "
"of :keyword:`match` statements. Currently ``major`` must equal to ``3``. The "
"lowest supported version is ``(3, 7)`` (and this may increase in future "
"Python versions); the highest is ``sys.version_info[0:2]``. \"Best-effort\" "
"attempt means there is no guarantee that the parse (or success of the parse) "
"is the same as when run on the Python version corresponding to "
"``feature_version``."
msgstr ""
#: ../../library/ast.rst:2272
msgid ""
"If source contains a null character (``\\0``), :exc:`ValueError` is raised."
msgstr ""
#: ../../library/ast.rst:2275
msgid ""
"Note that successfully parsing source code into an AST object doesn't "
"guarantee that the source code provided is valid Python code that can be "
"executed as the compilation step can raise further :exc:`SyntaxError` "
"exceptions. For instance, the source ``return 42`` generates a valid AST "
"node for a return statement, but it cannot be compiled alone (it needs to be "
"inside a function node)."
msgstr ""
#: ../../library/ast.rst:2282
msgid ""
"In particular, :func:`ast.parse` won't do any scoping checks, which the "
"compilation step does."
msgstr ""
#: ../../library/ast.rst:2286
msgid ""
"It is possible to crash the Python interpreter with a sufficiently large/"
"complex string due to stack depth limitations in Python's AST compiler."
msgstr ""
#: ../../library/ast.rst:2290
msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``."
msgstr ""
#: ../../library/ast.rst:2293
msgid ""
"The minimum supported version for ``feature_version`` is now ``(3, 7)``. The "
"``optimize`` argument was added."
msgstr ""
#: ../../library/ast.rst:2300
msgid ""
"Unparse an :class:`ast.AST` object and generate a string with code that "
"would produce an equivalent :class:`ast.AST` object if parsed back with :"
"func:`ast.parse`."
msgstr ""
#: ../../library/ast.rst:2305
msgid ""
"The produced code string will not necessarily be equal to the original code "
"that generated the :class:`ast.AST` object (without any compiler "
"optimizations, such as constant tuples/frozensets)."
msgstr ""
#: ../../library/ast.rst:2310
msgid ""
"Trying to unparse a highly complex expression would result with :exc:"
"`RecursionError`."
msgstr ""
#: ../../library/ast.rst:2318
msgid ""
"Evaluate an expression node or a string containing only a Python literal or "
"container display. The string or node provided may only consist of the "
"following Python literal structures: strings, bytes, numbers, tuples, lists, "
"dicts, sets, booleans, ``None`` and ``Ellipsis``."
msgstr ""
#: ../../library/ast.rst:2323
msgid ""
"This can be used for evaluating strings containing Python values without the "
"need to parse the values oneself. It is not capable of evaluating "
"arbitrarily complex expressions, for example involving operators or indexing."
msgstr ""
#: ../../library/ast.rst:2328
msgid ""
"This function had been documented as \"safe\" in the past without defining "
"what that meant. That was misleading. This is specifically designed not to "
"execute Python code, unlike the more general :func:`eval`. There is no "
"namespace, no name lookups, or ability to call out. But it is not free from "
"attack: A relatively small input can lead to memory exhaustion or to C stack "
"exhaustion, crashing the process. There is also the possibility for "
"excessive CPU consumption denial of service on some inputs. Calling it on "
"untrusted data is thus not recommended."
msgstr ""
#: ../../library/ast.rst:2338
msgid ""
"It is possible to crash the Python interpreter due to stack depth "
"limitations in Python's AST compiler."
msgstr ""
#: ../../library/ast.rst:2341
msgid ""
"It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:"
"`MemoryError` and :exc:`RecursionError` depending on the malformed input."
msgstr ""
#: ../../library/ast.rst:2345
msgid "Now allows bytes and set literals."
msgstr ""
#: ../../library/ast.rst:2348
msgid "Now supports creating empty sets with ``'set()'``."
msgstr ""
#: ../../library/ast.rst:2351
msgid "For string inputs, leading spaces and tabs are now stripped."
msgstr ""
#: ../../library/ast.rst:2357
msgid ""
"Return the docstring of the given *node* (which must be a :class:"
"`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:"
"`Module` node), or ``None`` if it has no docstring. If *clean* is true, "
"clean up the docstring's indentation with :func:`inspect.cleandoc`."
msgstr ""
#: ../../library/ast.rst:2363
msgid ":class:`AsyncFunctionDef` is now supported."
msgstr ""
#: ../../library/ast.rst:2369
msgid ""
"Get source code segment of the *source* that generated *node*. If some "
"location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :"
"attr:`~ast.AST.col_offset`, or :attr:`~ast.AST.end_col_offset`) is missing, "
"return ``None``."
msgstr ""
#: ../../library/ast.rst:2373
msgid ""
"If *padded* is ``True``, the first line of a multi-line statement will be "
"padded with spaces to match its original position."
msgstr ""
#: ../../library/ast.rst:2381
msgid ""
"When you compile a node tree with :func:`compile`, the compiler expects :"
"attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every "
"node that supports them. This is rather tedious to fill in for generated "
"nodes, so this helper adds these attributes recursively where not already "
"set, by setting them to the values of the parent node. It works recursively "
"starting at *node*."
msgstr ""
#: ../../library/ast.rst:2390
msgid ""
"Increment the line number and end line number of each node in the tree "
"starting at *node* by *n*. This is useful to \"move code\" to a different "
"location in a file."
msgstr ""
#: ../../library/ast.rst:2397
msgid ""
"Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :"
"attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from "
"*old_node* to *new_node* if possible, and return *new_node*."
msgstr ""
#: ../../library/ast.rst:2404
msgid ""
"Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` "
"that is present on *node*."
msgstr ""
#: ../../library/ast.rst:2410
msgid ""
"Yield all direct child nodes of *node*, that is, all fields that are nodes "
"and all items of fields that are lists of nodes."
msgstr ""
#: ../../library/ast.rst:2416
msgid ""
"Recursively yield all descendant nodes in the tree starting at *node* "
"(including *node* itself), in no specified order. This is useful if you "
"only want to modify nodes in place and don't care about the context."
msgstr ""
#: ../../library/ast.rst:2423
msgid ""
"A node visitor base class that walks the abstract syntax tree and calls a "
"visitor function for every node found. This function may return a value "
"which is forwarded by the :meth:`visit` method."
msgstr ""
#: ../../library/ast.rst:2427
msgid ""
"This class is meant to be subclassed, with the subclass adding visitor "
"methods."
msgstr ""
#: ../../library/ast.rst:2432
msgid ""
"Visit a node. The default implementation calls the method called :samp:"
"`self.visit_{classname}` where *classname* is the name of the node class, "
"or :meth:`generic_visit` if that method doesn't exist."
msgstr ""
#: ../../library/ast.rst:2438
msgid "This visitor calls :meth:`visit` on all children of the node."
msgstr ""
#: ../../library/ast.rst:2440
msgid ""
"Note that child nodes of nodes that have a custom visitor method won't be "
"visited unless the visitor calls :meth:`generic_visit` or visits them itself."
msgstr ""
#: ../../library/ast.rst:2446
msgid "Handles all constant nodes."
msgstr ""
#: ../../library/ast.rst:2448
msgid ""
"Don't use the :class:`NodeVisitor` if you want to apply changes to nodes "
"during traversal. For this a special visitor exists (:class:"
"`NodeTransformer`) that allows modifications."
msgstr ""
#: ../../library/ast.rst:2454
msgid ""
"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:"
"`!visit_NameConstant` and :meth:`!visit_Ellipsis` will not be called in "
"Python 3.14+. Add the :meth:`visit_Constant` method instead to handle all "
"constant nodes."
msgstr ""
#: ../../library/ast.rst:2462
msgid ""
"A :class:`NodeVisitor` subclass that walks the abstract syntax tree and "
"allows modification of nodes."
msgstr ""
#: ../../library/ast.rst:2465
msgid ""
"The :class:`NodeTransformer` will walk the AST and use the return value of "
"the visitor methods to replace or remove the old node. If the return value "
"of the visitor method is ``None``, the node will be removed from its "
"location, otherwise it is replaced with the return value. The return value "
"may be the original node in which case no replacement takes place."
msgstr ""
#: ../../library/ast.rst:2471
msgid ""
"Here is an example transformer that rewrites all occurrences of name lookups "
"(``foo``) to ``data['foo']``::"
msgstr ""
#: ../../library/ast.rst:2474
msgid ""
"class RewriteName(NodeTransformer):\n"
"\n"
" def visit_Name(self, node):\n"
" return Subscript(\n"
" value=Name(id='data', ctx=Load()),\n"
" slice=Constant(value=node.id),\n"
" ctx=node.ctx\n"
" )"
msgstr ""
#: ../../library/ast.rst:2483
msgid ""
"Keep in mind that if the node you're operating on has child nodes you must "
"either transform the child nodes yourself or call the :meth:`~ast."
"NodeVisitor.generic_visit` method for the node first."
msgstr ""
#: ../../library/ast.rst:2487
msgid ""
"For nodes that were part of a collection of statements (that applies to all "
"statement nodes), the visitor may also return a list of nodes rather than "
"just a single node."
msgstr ""
#: ../../library/ast.rst:2491
msgid ""
"If :class:`NodeTransformer` introduces new nodes (that weren't part of "
"original tree) without giving them location information (such as :attr:`~ast."
"AST.lineno`), :func:`fix_missing_locations` should be called with the new "
"sub-tree to recalculate the location information::"
msgstr ""
#: ../../library/ast.rst:2496
msgid ""
"tree = ast.parse('foo', mode='eval')\n"
"new_tree = fix_missing_locations(RewriteName().visit(tree))"
msgstr ""
#: ../../library/ast.rst:2499
msgid "Usually you use the transformer like this::"
msgstr ""
#: ../../library/ast.rst:2501
msgid "node = YourTransformer().visit(node)"
msgstr ""
#: ../../library/ast.rst:2506
msgid ""
"Return a formatted dump of the tree in *node*. This is mainly useful for "
"debugging purposes. If *annotate_fields* is true (by default), the returned "
"string will show the names and the values for fields. If *annotate_fields* "
"is false, the result string will be more compact by omitting unambiguous "
"field names. Attributes such as line numbers and column offsets are not "
"dumped by default. If this is wanted, *include_attributes* can be set to "
"true."
msgstr ""
#: ../../library/ast.rst:2514
msgid ""
"If *indent* is a non-negative integer or string, then the tree will be "
"pretty-printed with that indent level. An indent level of 0, negative, or "
"``\"\"`` will only insert newlines. ``None`` (the default) selects the "
"single line representation. Using a positive integer indent indents that "
"many spaces per level. If *indent* is a string (such as ``\"\\t\"``), that "
"string is used to indent each level."
msgstr ""
#: ../../library/ast.rst:2521
msgid ""
"If *show_empty* is false (the default), optional empty lists will be omitted "
"from the output. Optional ``None`` values are always omitted."
msgstr ""
#: ../../library/ast.rst:2525
msgid "Added the *indent* option."
msgstr ""
#: ../../library/ast.rst:2528
msgid "Added the *show_empty* option."
msgstr ""
#: ../../library/ast.rst:2531
msgid ""
">>> print(ast.dump(ast.parse(\"\"\"\\\n"
"... async def f():\n"
"... await other_func()\n"
"... \"\"\"), indent=4, show_empty=True))\n"
"Module(\n"
" body=[\n"
" AsyncFunctionDef(\n"
" name='f',\n"
" args=arguments(\n"
" posonlyargs=[],\n"
" args=[],\n"
" kwonlyargs=[],\n"
" kw_defaults=[],\n"
" defaults=[]),\n"
" body=[\n"
" Expr(\n"
" value=Await(\n"
" value=Call(\n"
" func=Name(id='other_func', ctx=Load()),\n"
" args=[],\n"
" keywords=[])))],\n"
" decorator_list=[],\n"
" type_params=[])],\n"
" type_ignores=[])"
msgstr ""
#: ../../library/ast.rst:2561
msgid "Recursively compares two ASTs."
msgstr ""
#: ../../library/ast.rst:2563
msgid ""
"*compare_attributes* affects whether AST attributes are considered in the "
"comparison. If *compare_attributes* is ``False`` (default), then attributes "
"are ignored. Otherwise they must all be equal. This option is useful to "
"check whether the ASTs are structurally equal but differ in whitespace or "
"similar details. Attributes include line numbers and column offsets."
msgstr ""
#: ../../library/ast.rst:2576
msgid "Compiler flags"
msgstr ""
#: ../../library/ast.rst:2578
msgid ""
"The following flags may be passed to :func:`compile` in order to change "
"effects on the compilation of a program:"
msgstr ""
#: ../../library/ast.rst:2583
msgid ""
"Enables support for top-level ``await``, ``async for``, ``async with`` and "
"async comprehensions."
msgstr ""
#: ../../library/ast.rst:2590
msgid ""
"Generates and returns an abstract syntax tree instead of returning a "
"compiled code object."
msgstr ""
#: ../../library/ast.rst:2595
msgid ""
"The returned AST is optimized according to the *optimize* argument in :func:"
"`compile` or :func:`ast.parse`."
msgstr ""
#: ../../library/ast.rst:2602
msgid ""
"Enables support for :pep:`484` and :pep:`526` style type comments (``# type: "
"``, ``# type: ignore ``)."
msgstr ""
#: ../../library/ast.rst:2611
msgid "Command-line usage"
msgstr ""
#: ../../library/ast.rst:2615
msgid ""
"The :mod:`!ast` module can be executed as a script from the command line. It "
"is as simple as:"
msgstr ""
#: ../../library/ast.rst:2618
msgid "python -m ast [-m ] [-a] [infile]"
msgstr ""
#: ../../library/ast.rst:2622
msgid "The following options are accepted:"
msgstr ""
#: ../../library/ast.rst:2628
msgid "Show the help message and exit."
msgstr ""
#: ../../library/ast.rst:2633
msgid ""
"Specify what kind of code must be compiled, like the *mode* argument in :"
"func:`parse`."
msgstr ""
#: ../../library/ast.rst:2638
msgid "Don't parse type comments."
msgstr ""
#: ../../library/ast.rst:2642
msgid "Include attributes such as line numbers and column offsets."
msgstr ""
#: ../../library/ast.rst:2647
msgid "Indentation of nodes in AST (number of spaces)."
msgstr ""
#: ../../library/ast.rst:2651
msgid ""
"Python version in the format 3.x (for example, 3.10). Defaults to the "
"current version of the interpreter."
msgstr ""
#: ../../library/ast.rst:2659
msgid "Optimization level for parser. Defaults to no optimization."
msgstr ""
#: ../../library/ast.rst:2665
msgid ""
"Show empty lists and fields that are ``None``. Defaults to not showing empty "
"objects."
msgstr ""
#: ../../library/ast.rst:2671
msgid ""
"If :file:`infile` is specified its contents are parsed to AST and dumped to "
"stdout. Otherwise, the content is read from stdin."
msgstr ""
#: ../../library/ast.rst:2677
msgid ""
"`Green Tree Snakes `_, an external "
"documentation resource, has good details on working with Python ASTs."
msgstr ""
#: ../../library/ast.rst:2680
msgid ""
"`ASTTokens `_ "
"annotates Python ASTs with the positions of tokens and text in the source "
"code that generated them. This is helpful for tools that make source code "
"transformations."
msgstr ""
#: ../../library/ast.rst:2685
msgid ""
"`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs "
"by inserting two-way links between tokens and ast nodes."
msgstr ""
#: ../../library/ast.rst:2690
msgid ""
"`LibCST `_ parses code as a Concrete Syntax "
"Tree that looks like an ast tree and keeps all formatting details. It's "
"useful for building automated refactoring (codemod) applications and linters."
msgstr ""
#: ../../library/ast.rst:2695
msgid ""
"`Parso `_ is a Python parser that supports "
"error recovery and round-trip parsing for different Python versions (in "
"multiple Python versions). Parso is also able to list multiple syntax errors "
"in your Python file."
msgstr ""
#: ../../library/ast.rst:59
msgid "? (question mark)"
msgstr ""
#: ../../library/ast.rst:59 ../../library/ast.rst:60
msgid "in AST grammar"
msgstr ""
#: ../../library/ast.rst:60
msgid "* (asterisk)"
msgstr "* (Sternchen)"