# 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: # Alireza Shabani (Revisto) , 2025 # Rafael Fontenelle , 2025 # Sepehr Rasouli , 2026 # arman mohebali , 2026 # msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-08 09:24+0330\n" "PO-Revision-Date: 2026-10-10 20:54+0330\n" "Last-Translator: Sepehr Rasouli , 2026\n" "Language-Team: Persian (https://github.com/python/python-docs-fa/)\n" "Language: fa\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" "X-Generator: Poedit 3.6\n" msgid ":mod:`!ast` --- Abstract syntax trees" msgstr ":mod:`!ast` --- درخت‌های سینتکس انتزاعی" msgid "**Source code:** :source:`Lib/ast.py`" msgstr "**کد منبع:** :source:`Lib/ast.py`" 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 "ماژول :mod:`!ast` به برنامه‌های پایتون کمک می‌کند تا درخت‌های دستور زبان سینتکس انتزاعی پایتون را پردازش کنند. خود سینتکس انتزاعی ممکن است با هر انتشار پایتون تغییر کند؛ این ماژول به شما کمک می‌کند تا به‌صورت برنامه‌ای دریابید دستور زبان جاری چگونه است." 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 "می‌توان یک درخت سینتکس انتزاعی را با ارسال :data:`ast.PyCF_ONLY_AST` به‌عنوان پرچم به تابع توکار :func:`compile` یا با استفاده از تابع کمکی :func:`parse` ارائه‌شده در این ماژول، تولید کرد. نتیجه درختی از اشیاء خواهد بود که کلاس‌های آن همگی از :class:`ast.AST` ارث‌بری می‌کنند. می‌توان یک درخت سینتکس انتزاعی را با استفاده از تابع توکار :func:`compile` به یک شیء کد پایتون کامپایل کرد." msgid "Abstract grammar" msgstr "دستور زبان انتزاعی" msgid "The abstract grammar is currently defined as follows:" msgstr "دستور زبان انتزاعی در حال حاضر به‌صورت زیر تعریف شده است:" 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, int? is_lazy)\n" " | ImportFrom(identifier? module, alias* names, int? level, int? is_lazy)\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 "" "-- 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, int? is_lazy)\n" " | ImportFrom(identifier? module, alias* names, int? level, int? is_lazy)\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" msgid "Node classes" msgstr "کلاس‌های گره" msgid "This is the abstract 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 "این کلاس، کلاس پایه‌ی انتزاعی همه‌ی کلاس‌های گره AST است. کلاس‌های واقعی گره از پرونده‌ی :file:`Parser/Python.asdl` مشتق می‌شوند که در :ref:`بالا ` بازتولید شده است. این کلاس‌ها در ماژول Cِ :mod:`!_ast` تعریف شده‌اند و در :mod:`!ast` بازصدور می‌شوند." 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 "برای هر نماد سمت چپ در دستور زبان انتزاعی، یک کلاس تعریف شده است (برای مثال، :class:`ast.stmt` یا :class:`ast.expr`). علاوه بر این، برای هر سازنده در سمت راست، یک کلاس تعریف شده است؛ این کلاس‌ها از کلاس‌های مربوط به درخت‌های سمت چپ ارث می‌برند. برای مثال، :class:`ast.BinOp` از :class:`ast.expr` ارث می‌برد. برای قواعد تولید دارای جایگزین‌ها (معروف به «مجموع‌ها»)، کلاس سمت چپ انتزاعی است: تنها نمونه‌هایی از گره‌های سازنده‌ی خاص ایجاد می‌شوند." msgid "Each concrete class has an attribute :attr:`!_fields` which gives the names of all child nodes." msgstr "هر کلاس عینی یک ویژگی :attr:`!_fields` دارد که نام همه‌ی گره‌های فرزند را می‌دهد." 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 "هر نمونه از یک کلاس مشخص، به ازای هر گره فرزند یک ویژگی دارد که نوع آن در گرامر تعریف شده است. برای مثال، نمونه‌های :class:`ast.BinOp` یک ویژگی :attr:`left` از نوع :class:`ast.expr` دارند." 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 "اگر این ویژگی‌ها در گرامر به‌عنوان اختیاری علامت‌گذاری شده باشند (با استفاده از علامت سؤال)، مقدار ممکن است ``None`` باشد. اگر ویژگی‌ها بتوانند صفر یا بیشتر مقدار داشته باشند (با ستاره علامت‌گذاری شده باشند)، مقادیر به‌صورت فهرست‌های پایتون نمایش داده می‌شوند. هنگام کامپایل یک AST با :func:`compile`، تمام ویژگی‌های ممکن باید موجود باشند و مقادیر معتبر داشته باشند." 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 "ویژگی :attr:`!_field_types` در هر کلاس عینی، یک دیکشنری است که نام فیلدها (که در :attr:`_fields` نیز فهرست شده‌اند) را به نوع آن‌ها نگاشت می‌کند." msgid "" ">>> ast.TypeVar._field_types\n" "{'name': , 'bound': ast.expr | None, 'default_value': ast.expr | None}" msgstr "" ">>> ast.TypeVar._field_types\n" "{'name': , 'bound': ast.expr | None, 'default_value': ast.expr | None}" 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 "نمونه‌های زیرکلاس‌های :class:`ast.expr` و :class:`ast.stmt` دارای ویژگی‌های :attr:`lineno`، :attr:`col_offset`، :attr:`end_lineno` و :attr:`end_col_offset` هستند. :attr:`lineno` و :attr:`end_lineno` شماره‌های خط اول و آخر بازه‌ی متن منبع هستند (با اندیس ۱، بنابراین اولین خط، خط ۱ است) و :attr:`col_offset` و :attr:`end_col_offset` آفست‌های بایتی UTF-8 متناظر با اولین و آخرین توکن‌هایی هستند که گره را تولید کرده‌اند. آفست UTF-8 ثبت می‌شود زیرا پارسر به‌صورت داخلی از UTF-8 استفاده می‌کند." 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 "توجه داشته باشید که موقعیت‌های پایانی مورد نیاز کامپایلر نیستند و بنابراین اختیاری‌اند. آفست پایانی *پس از* آخرین نماد است؛ برای مثال می‌توان بخش منبع یک گره عبارت یک‌خطی را با استفاده از ``source_line[node.col_offset : node.end_col_offset]`` به دست آورد." msgid "The constructor of a class :class:`ast.T` parses its arguments as follows:" msgstr "سازنده‌ی کلاس :class:`ast.T` آرگومان‌های خود را به‌صورت زیر تجزیه می‌کند:" 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 "اگر آرگومان‌های جایگاهی وجود داشته باشند، باید به تعداد آیتم‌های :attr:`T._fields` باشند؛ آن‌ها به‌عنوان ویژگی‌هایی با این نام‌ها انتساب داده می‌شوند." msgid "If there are keyword arguments, they will set the attributes of the same names to the given values." msgstr "اگر آرگومان‌های کلیدواژه‌ای وجود داشته باشند، ویژگی‌های هم‌نام را روی مقدارهای داده‌شده تنظیم می‌کنند." msgid "For example, to create and populate an :class:`ast.UnaryOp` node, you could use ::" msgstr "برای مثال، برای ایجاد و پر کردن یک گره :class:`ast.UnaryOp`، می‌توانید از کد زیر استفاده کنید ::" msgid "" "node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" " lineno=0, col_offset=0)" msgstr "" "node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" " lineno=0, col_offset=0)" 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 "اگر فیلدی که در گرامر اختیاری است، در سازنده آورده نشود، مقدار پیش‌فرض آن ``None`` خواهد بود. اگر یک فیلد فهرستی آورده نشود، مقدار پیش‌فرض آن فهرست خالی است. اگر فیلدی از نوع :class:`!ast.expr_context` آورده نشود، مقدار پیش‌فرض آن :class:`Load() ` خواهد بود. اگر هر فیلد دیگری آورده نشود، یک :exc:`DeprecationWarning` پرتاب می‌شود و گره AST این فیلد را نخواهد داشت. در پایتون 3.15، این وضعیت یک خطا پرتاب خواهد کرد." msgid "Class :class:`ast.Constant` is now used for all constants." msgstr "اکنون از کلاس :class:`ast.Constant` برای همه‌ی ثابت‌ها استفاده می‌شود." msgid "Simple indices are represented by their value, extended slices are represented as tuples." msgstr "اندیس‌های ساده با مقدارشان نمایش داده می‌شوند، اسلایس‌های گسترده (extended slices) به‌صورت تاپل‌ها نمایش داده می‌شوند." 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 "سازنده‌های گره AST تغییر کردند تا پیش‌فرض‌های معقولی برای فیلدهای از قلم افتاده فراهم کنند: اکنون مقدار پیش‌فرض فیلدهای اختیاری ``None`` است، مقدار پیش‌فرض فیلدهای فهرستی یک فهرست خالی است، و مقدار پیش‌فرض فیلدهایی از نوع :class:`!ast.expr_context` برابر :class:`Load() ` است. پیش از این، ویژگی‌های از قلم افتاده در گره‌های ساخته‌شده وجود نداشتند (دسترسی به آن‌ها باعث پرتاب :exc:`AttributeError` می‌شد)." msgid "The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes the values of the node fields." msgstr "خروجی :meth:`~object.__repr__` گره‌های :class:`~ast.AST` شامل مقادیر فیلدهای گره است." 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 "نسخه‌های پیشین پایتون، کلاس‌های AST یعنی :class:`!ast.Num`، :class:`!ast.Str`، :class:`!ast.Bytes`، :class:`!ast.NameConstant` و :class:`!ast.Ellipsis` را فراهم می‌کردند که در پایتون 3.8 منسوخ شده بودند. این کلاس‌ها در پایتون 3.14 حذف شدند و کارکرد آن‌ها با :class:`ast.Constant` جایگزین شده است." 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 "کلاس‌های قدیمی :class:`!ast.Index` و :class:`!ast.ExtSlice` هنوز در دسترس هستند، اما در نسخه‌های آینده پایتون حذف خواهند شد. تا آن زمان، نمونه‌سازی از آن‌ها یک نمونه از کلاسی دیگر را برمی‌گرداند." 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. These cases now raise a :exc:`TypeError`." msgstr "نسخه‌های قبلی پایتون اجازه می‌دادند گره‌های درخت نحوی انتزاعی (AST) که فاقد فیلدهای الزامی بودند، ایجاد شوند. به همین ترتیب، سازنده‌های گره‌های AST به آرگومان کلیدواژه‌ای دلخواهی اجازه می‌دادند که به‌عنوان ویژگی‌های گره AST تنظیم شوند، حتی اگر با هیچ‌یک از فیلدهای گره AST مطابقت نداشتند. این موارد اکنون یک :exc:`TypeError` ایجاد می‌کنند." msgid "In the :ref:`grammar above `, the AST node classes that correspond to production rules with variants (aka \"sums\") are abstract classes. Previous versions of Python allowed for the creation of direct instances of these abstract node classes. This behavior is deprecated and will be removed in Python 3.20." msgstr "در :ref:`دستور زبان بالا `، کلاس‌های گره AST که با قواعد تولید دارای نوع (معروف به «sums») مطابقت دارند، کلاس‌های انتزاعی هستند. نسخه‌های قبلی پایتون امکان ایجاد نمونه‌های مستقیم از این کلاس‌های گره انتزاعی را فراهم می‌کردند. این رفتار منسوخ شده است و در پایتون ۳.۲۰ حذف خواهد شد." 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 "توضیحات کلاس‌های گره خاصی که در اینجا نمایش داده شده‌اند، در ابتدا از پروژه‌ی فوق‌العاده‌ی `Green Tree Snakes `__ و همه‌ی مشارکت‌کنندگان آن اقتباس شده‌اند." msgid "Root nodes" msgstr "گره‌های ریشه" msgid "A Python module, as with :ref:`file input `. Node type generated by :func:`ast.parse` in the default ``\"exec\"`` *mode*." msgstr "یک ماژول پایتون، مانند :ref:`ورودی پرونده `. نوع گره‌ای که توسط :func:`ast.parse` در *حالت* پیش‌فرض ``\"exec\"`` تولید می‌شود." msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." msgstr "``body`` یک :class:`list` از :ref:`ast-statements` ماژول است." msgid "``type_ignores`` is a :class:`list` of the module's type ignore comments; see :func:`ast.parse` for more details." msgstr "``type_ignores`` یک :class:`list` از کامنت‌ها نادیده‌گرفتن نوع ماژول است؛ برای جزئیات بیشتر :func:`ast.parse` را ببینید." 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 "" ">>> 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))])" msgid "A single Python :ref:`expression input `. Node type generated by :func:`ast.parse` when *mode* is ``\"eval\"``." msgstr "یک :ref:`ورودی عبارت ` پایتون. نوع گره‌ای که توسط :func:`ast.parse` هنگامی که *mode* برابر ``\"eval\"`` باشد، تولید می‌شود." msgid "``body`` is a single node, one of the :ref:`expression types `." msgstr "``body`` یک گره واحد است، یکی از :ref:`انواع عبارت `." msgid "" ">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" "Expression(\n" " body=Constant(value=123))" msgstr "" ">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" "Expression(\n" " body=Constant(value=123))" msgid "A single :ref:`interactive input `, like in :ref:`tut-interac`. Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``." msgstr "یک :ref:`ورودی تعاملی ` واحد، مانند :ref:`tut-interac`. نوع گره تولیدشده توسط :func:`ast.parse` هنگامی که *mode* برابر ``\"single\"`` است." msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "``body`` یک :class:`list` از :ref:`گره‌های دستور ` است." 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 "" ">>> 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))])" 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 "بازنمایی‌ای از کامنت‌های نوع به سبک قدیمی برای توابع، زیرا نسخه‌های پایتون پیش از 3.5 از حاشیه‌نویسی‌های :pep:`484` پشتیبانی نمی‌کردند. نوع گره تولیدشده توسط :func:`ast.parse` هنگامی که *mode* برابر ``\"func_type\"`` باشد." msgid "Such type comments would look like this::" msgstr "چنین کامنت‌های نوعی به این شکل خواهند بود::" msgid "" "def sum_two_number(a, b):\n" " # type: (int, int) -> int\n" " return a + b" msgstr "" "def sum_two_number(a, b):\n" " # type: (int, int) -> int\n" " return a + b" msgid "``argtypes`` is a :class:`list` of :ref:`expression nodes `." msgstr "``argtypes`` یک :class:`list` از :ref:`گره‌های عبارت ` است." msgid "``returns`` is a single :ref:`expression node `." msgstr "``returns`` یک :ref:`گره عبارت ` است." msgid "" ">>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), indent=4))\n" "FunctionType(\n" " argtypes=[\n" " Name(id='int'),\n" " Name(id='str')],\n" " returns=Subscript(\n" " value=Name(id='List'),\n" " slice=Name(id='int')))" msgstr "" ">>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), indent=4))\n" "FunctionType(\n" " argtypes=[\n" " Name(id='int'),\n" " Name(id='str')],\n" " returns=Subscript(\n" " value=Name(id='List'),\n" " slice=Name(id='int')))" msgid "Literals" msgstr "مقادیر لفظی" 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 "یک مقدار ثابت. ویژگی ``value`` در لفظی ``Constant`` شامل شیء پایتونی بازنمایی‌شده توسط آن است. مقادیر بازنمایی‌شده می‌توانند نمونه‌هایی از :class:`str`، :class:`bytes`، :class:`int`، :class:`float`، :class:`complex` و :class:`bool`، و ثابت‌های :data:`None` و :data:`Ellipsis` باشند." 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 "ویژگی ``kind`` یک رشته اختیاری است. برای مقادیر لفظی رشته‌ای با پیشوند ``u``، ``kind`` روی ``'u'`` تنظیم می‌شود. برای همه‌ی ثابت‌های دیگر، ``kind`` برابر ``None`` است." 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 "" ">>> 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'))" 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 "گره‌ای که نشان‌دهنده‌ی یک فیلد قالب‌بندی منفرد در یک اف‌استرینگ است. اگر رشته شامل یک فیلد قالب‌بندی منفرد و هیچ چیز دیگری باشد، گره می‌تواند جداگانه باشد؛ در غیر این صورت در :class:`JoinedStr` ظاهر می‌شود." msgid "``value`` is any expression node (such as a literal, a variable, or a function call)." msgstr "``value`` هر گره عبارتی است (مانند یک لفظی، یک متغیر، یا یک فراخوانی تابع)." msgid "``conversion`` is an integer:" msgstr "``conversion`` یک عدد صحیح است:" msgid "-1: no formatting" msgstr "-1: بدون قالب‌بندی" msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` formatting" msgstr "۹۷ (``ord('a')``): ``!a`` قالب‌بندی :func:`ASCII `" msgid "114 (``ord('r')``): ``!r`` :func:`repr` formatting" msgstr "۱۱۴ (``ord('r')``): قالب‌بندی ``!r`` با :func:`repr`" msgid "115 (``ord('s')``): ``!s`` :func:`string ` formatting" msgstr "۱۱۵ (``ord('s')``): ``!s`` قالب‌بندی :func:`string `" 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 "``format_spec`` یک گره :class:`JoinedStr` است که قالب‌بندی مقدار را نشان می‌دهد، یا اگر قالبی مشخص نشده باشد، ``None`` است. هر دو ``conversion`` و ``format_spec`` را می‌توان همزمان تنظیم کرد." msgid "An f-string, comprising a series of :class:`FormattedValue` and :class:`Constant` nodes." msgstr "یک اف‌استرینگ، شامل مجموعه‌ای از گره‌های :class:`FormattedValue` و :class:`Constant`." 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'),\n" " conversion=-1),\n" " Constant(value=') is '),\n" " FormattedValue(\n" " value=Call(\n" " func=Name(id='sin'),\n" " args=[\n" " Name(id='a')]),\n" " conversion=-1,\n" " format_spec=JoinedStr(\n" " values=[\n" " Constant(value='.3')]))]))" msgstr "" ">>> 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'),\n" " conversion=-1),\n" " Constant(value=') is '),\n" " FormattedValue(\n" " value=Call(\n" " func=Name(id='sin'),\n" " args=[\n" " Name(id='a')]),\n" " conversion=-1,\n" " format_spec=JoinedStr(\n" " values=[\n" " Constant(value='.3')]))]))" 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 "گره‌ای که یک لفظی رشته‌ی الگویی (template string literal) را نشان می‌دهد و شامل دنباله‌ای از گره‌های :class:`Interpolation` و :class:`Constant` است. این گره‌ها می‌توانند به هر ترتیبی باشند و نیازی نیست به‌صورت یک‌درمیان باشند." 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'),\n" " str='name',\n" " conversion=-1),\n" " Constant(value=' finished '),\n" " Interpolation(\n" " value=Name(id='place'),\n" " str='place',\n" " conversion=-1,\n" " format_spec=JoinedStr(\n" " values=[\n" " Constant(value='ordinal')]))]))" msgstr "" ">>> 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'),\n" " str='name',\n" " conversion=-1),\n" " Constant(value=' finished '),\n" " Interpolation(\n" " value=Name(id='place'),\n" " str='place',\n" " conversion=-1,\n" " format_spec=JoinedStr(\n" " values=[\n" " Constant(value='ordinal')]))]))" msgid "Node representing a single interpolation field in a template string literal." msgstr "گره‌ای که نشان‌دهنده‌ی یک فیلد درون‌یابی (interpolation field) در یک لفظی رشته‌ی الگو است." 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 "``value`` می‌تواند هر گره‌ی عبارت باشد (مانند یک لفظی، یک متغیر، یا یک فراخوانی تابع). این همان معنای ``FormattedValue.value`` را دارد." msgid "``str`` is a constant containing the text of the interpolation expression." msgstr "``str`` یک ثابت است که حاوی متن عبارت درون‌یابی است." 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 "اگر ``str`` روی ``None`` تنظیم شود، هنگام فراخوانی :func:`ast.unparse` از ``value`` برای تولید کد استفاده می‌شود. در این حالت دیگر تضمین نمی‌شود که کد تولیدشده با کد اصلی یکسان باشد و این برای تولید کد در نظر گرفته شده است." msgid "-1: no conversion" msgstr "-1: بدون تبدیل" msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` conversion" msgstr "۹۷ (``ord('a')``): تبدیل ``!a`` به :func:`ASCII `" msgid "114 (``ord('r')``): ``!r`` :func:`repr` conversion" msgstr "۱۱۴ (``ord('r')``): تبدیل ``!r`` به :func:`repr`" msgid "115 (``ord('s')``): ``!s`` :func:`string ` conversion" msgstr "۱۱۵ (``ord('s')``): تبدیل :func:`string ` با ``!s``" msgid "This has the same meaning as ``FormattedValue.conversion``." msgstr "این همان معنای ``FormattedValue.conversion`` را دارد." 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 "``format_spec`` یک گره :class:`JoinedStr` است که قالب‌بندی مقدار را نشان می‌دهد، یا اگر هیچ قالبی مشخص نشده باشد، ``None`` است. می‌توان هر دو ``conversion`` و ``format_spec`` را همزمان تنظیم کرد. این همان معنای ``FormattedValue.format_spec`` را دارد." 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 "یک فهرست یا تاپل. ``elts`` شامل فهرستی از گره‌های نشان‌دهنده عناصر است. اگر ظرف هدف انتساب باشد (یعنی ``(x,y)=something``)، ``ctx`` :class:`Store` است و در غیر این صورت :class:`Load` است." 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" ">>> 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)]))" msgstr "" ">>> 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" ">>> 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)]))" msgid "A set. ``elts`` holds a list of nodes representing the set's elements." msgstr "یک مجموعه. ``elts`` شامل فهرستی از گره‌هایی است که عناصر مجموعه را نشان می‌دهند." 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 "" ">>> 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)]))" 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 "یک دیکشنری. ``keys`` و ``values`` فهرست‌هایی از گره‌ها را نگه می‌دارند که به‌ترتیب نشان‌دهنده‌ی کلیدها و مقدارها هستند و ترتیب آن‌ها با یکدیگر مطابقت دارد (آنچه هنگام فراخوانی :code:`dictionary.keys()` و :code:`dictionary.values()` بازگردانده می‌شود)." 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 "هنگام انجام واگشایی دیکشنری با استفاده از مقادیر لفظی دیکشنری، عبارت مورد واگشایی در فهرست ``values`` قرار می‌گیرد و یک ``None`` در موقعیت متناظر در ``keys`` قرار می‌گیرد." 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')]))" msgstr "" ">>> 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')]))" msgid "Variables" msgstr "متغیرها" msgid "A variable name. ``id`` holds the name as a string, and ``ctx`` is one of the following types." msgstr "نام یک متغیر. ``id`` نام را به‌عنوان یک رشته نگه می‌دارد، و ``ctx`` یکی از انواع زیر است." 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 "از ارجاع‌های متغیر می‌توان برای بارگذاری مقدار یک متغیر، انتساب مقدار جدید به آن، یا حذف آن استفاده کرد. به ارجاع‌های متغیر یک زمینه داده می‌شود تا این حالت‌ها از یکدیگر تشخیص داده شوند." msgid "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=Name(id='a'))])\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 "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=Name(id='a'))])\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())])])" 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 "یک ارجاع به متغیر ``*var``. ``value`` متغیر را نگه می‌دارد، که معمولاً یک گره :class:`Name` است. هنگام ساخت یک گره :class:`Call` با ``*args`` باید از این نوع استفاده شود." 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'))])" msgstr "" ">>> 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'))])" msgid "Expressions" msgstr "عبارات" 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 "هنگامی که یک عبارت، مانند فراخوانی تابع، به‌تنهایی به‌عنوان یک دستور ظاهر می‌شود و مقدار بازگشتی آن استفاده یا ذخیره نمی‌شود، در این ظرف قرار می‌گیرد. ``value`` یکی از گره‌های دیگر در این بخش را نگه می‌دارد: یک گره :class:`Constant`، یک گره :class:`Name`، یک گره :class:`Lambda`، یک گره :class:`Yield` یا یک گره :class:`YieldFrom`." 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')))])" msgstr "" ">>> 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')))])" msgid "A unary operation. ``op`` is the operator, and ``operand`` any expression node." msgstr "یک عملیات یک‌عملوندی. ``op`` عملگر است و ``operand`` هر گره‌ی عبارت است." msgid "Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` is the ``~`` operator." msgstr "توکن‌های عملگر یک‌عملوندی. :class:`Not` همان کلیدواژه ``not`` است، :class:`Invert` همان عملگر ``~`` است." 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')))" msgstr "" ">>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\n" "Expression(\n" " body=UnaryOp(\n" " op=Not(),\n" " operand=Name(id='x')))" msgid "A binary operation (like addition or division). ``op`` is the operator, and ``left`` and ``right`` are any expression nodes." msgstr "یک عملیات دودویی (مانند جمع یا تقسیم). ``op`` عملگر است و ``left`` و ``right`` گره‌های عبارت دلخواه هستند." msgid "" ">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n" "Expression(\n" " body=BinOp(\n" " left=Name(id='x'),\n" " op=Add(),\n" " right=Name(id='y')))" msgstr "" ">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n" "Expression(\n" " body=BinOp(\n" " left=Name(id='x'),\n" " op=Add(),\n" " right=Name(id='y')))" msgid "Binary operator tokens." msgstr "توکن‌های عملگر دودویی." 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 "یک عملیات بولی، 'or' یا 'and'. ``op`` :class:`Or` یا :class:`And` است. ``values`` مقادیر درگیر هستند. عملیات‌های متوالی با همان عملگر، مانند ``a or b or c``، در یک گره با چند مقدار ادغام می‌شوند." msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." msgstr "این شامل ``not`` نمی‌شود، که یک :class:`UnaryOp` است." 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'),\n" " Name(id='y')]))" msgstr "" ">>> 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'),\n" " Name(id='y')]))" msgid "Boolean operator tokens." msgstr "توکن‌های عملگر بولی." 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 "مقایسه‌ی دو یا چند مقدار. ``left`` نخستین مقدار در مقایسه است، ``ops`` فهرست عملگرها است، و ``comparators`` فهرست مقادیر پس از نخستین عنصر در مقایسه است." msgid "" ">>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\n" "Expression(\n" " body=Compare(\n" " left=Constant(value=1),\n" " ops=[\n" " LtE(),\n" " Lt()],\n" " comparators=[\n" " Name(id='a'),\n" " Constant(value=10)]))" msgstr "" ">>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\n" "Expression(\n" " body=Compare(\n" " left=Constant(value=1),\n" " ops=[\n" " LtE(),\n" " Lt()],\n" " comparators=[\n" " Name(id='a'),\n" " Constant(value=10)]))" msgid "Comparison operator tokens." msgstr "توکن‌های عملگر مقایسه‌ای." msgid "A function call. ``func`` is the function, which will often be a :class:`Name` or :class:`Attribute` object. Of the arguments:" msgstr "یک فراخوانی تابع. ``func`` تابع است، که اغلب یک شیء :class:`Name` یا :class:`Attribute` خواهد بود. از میان آرگومان‌ها:" msgid "``args`` holds a list of the arguments passed by position." msgstr "``args`` فهرستی از آرگومان‌های ارسال‌شده به‌صورت جایگاهی را در خود نگه می‌دارد." msgid "``keywords`` holds a list of :class:`.keyword` objects representing arguments passed by keyword." msgstr "``keywords`` شامل فهرستی از اشیاء :class:`.keyword` است که آرگومان‌های ارسال‌شده با کلیدواژه را نشان می‌دهند." msgid "The ``args`` and ``keywords`` arguments are optional and default to empty lists." msgstr "آرگومان‌های ``args`` و ``keywords`` اختیاری هستند و پیش‌فرض آن‌ها فهرست‌های خالی است." msgid "" ">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), indent=4))\n" "Expression(\n" " body=Call(\n" " func=Name(id='func'),\n" " args=[\n" " Name(id='a'),\n" " Starred(\n" " value=Name(id='d'))],\n" " keywords=[\n" " keyword(\n" " arg='b',\n" " value=Name(id='c')),\n" " keyword(\n" " value=Name(id='e'))]))" msgstr "" ">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), indent=4))\n" "Expression(\n" " body=Call(\n" " func=Name(id='func'),\n" " args=[\n" " Name(id='a'),\n" " Starred(\n" " value=Name(id='d'))],\n" " keywords=[\n" " keyword(\n" " arg='b',\n" " value=Name(id='c')),\n" " keyword(\n" " value=Name(id='e'))]))" msgid "A keyword argument to a function call or class definition. ``arg`` is a raw string of the parameter name, ``value`` is a node to pass in." msgstr "یک آرگومان کلیدواژه‌ای برای فراخوانی تابع یا تعریف کلاس. ``arg`` یک رشته خام از نام پارامتر است، ``value`` یک گره برای ارسال است." msgid "An expression such as ``a if b else c``. Each field holds a single node, so in the following example, all three are :class:`Name` nodes." msgstr "یک عبارت مانند ``a if b else c``. هر فیلد یک گره را نگه می‌دارد، بنابراین در مثال زیر، هر سه، گره‌های :class:`Name` هستند." msgid "" ">>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\n" "Expression(\n" " body=IfExp(\n" " test=Name(id='b'),\n" " body=Name(id='a'),\n" " orelse=Name(id='c')))" msgstr "" ">>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\n" "Expression(\n" " body=IfExp(\n" " test=Name(id='b'),\n" " body=Name(id='a'),\n" " orelse=Name(id='c')))" msgid "Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:`Name`. ``attr`` is a bare string giving the name of the attribute, and ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to how the attribute is acted on." msgstr "دسترسی به ویژگی، مثلاً ``d.keys``. ``value`` یک گره است، معمولاً یک :class:`Name`. ``attr`` یک رشته‌ی ساده است که نام ویژگی را مشخص می‌کند، و ``ctx`` بسته به نوع عمل انجام‌شده روی ویژگی، :class:`Load`، :class:`Store` یا :class:`Del` است." msgid "" ">>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\n" "Expression(\n" " body=Attribute(\n" " value=Name(id='snake'),\n" " attr='colour'))" msgstr "" ">>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\n" "Expression(\n" " body=Attribute(\n" " value=Name(id='snake'),\n" " attr='colour'))" msgid "A named expression. This AST node is produced by the assignment expressions operator (also known as the walrus operator). As opposed to the :class:`Assign` node in which the first argument can be multiple nodes, in this case both ``target`` and ``value`` must be single nodes." msgstr "یک عبارت نام‌دار. این گره AST توسط عملگر عبارت انتساب (که به عملگر walrus نیز شناخته می‌شود) تولید می‌شود. برخلاف گره :class:`Assign` که در آن اولین آرگومان می‌تواند چندین گره باشد، در این حالت هر دو ``target`` و ``value`` باید گره‌های تکی باشند." msgid "" ">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" "Expression(\n" " body=NamedExpr(\n" " target=Name(id='x', ctx=Store()),\n" " value=Constant(value=4)))" msgstr "" ">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" "Expression(\n" " body=NamedExpr(\n" " target=Name(id='x', ctx=Store()),\n" " value=Constant(value=4)))" msgid "Subscripting" msgstr "زیرنویس‌گذاری" msgid "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually sequence or mapping). ``slice`` is an index, slice or key. It can be a :class:`Tuple` and contain a :class:`Slice`. ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to the action performed with the subscript." msgstr "یک زیرنویس (subscript)، مانند ``l[1]``. ``value`` شیء زیرنویس‌شده است (معمولاً یک دنباله یا نگاشت). ``slice`` یک اندیس، اسلایس یا کلید است. این می‌تواند یک :class:`Tuple` باشد و شامل یک :class:`Slice` شود. ``ctx`` بسته به عملیات انجام‌شده با زیرنویس، :class:`Load`، :class:`Store` یا :class:`Del` است." msgid "" ">>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\n" "Expression(\n" " body=Subscript(\n" " value=Name(id='l'),\n" " slice=Tuple(\n" " elts=[\n" " Slice(\n" " lower=Constant(value=1),\n" " upper=Constant(value=2)),\n" " Constant(value=3)])))" msgstr "" ">>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\n" "Expression(\n" " body=Subscript(\n" " value=Name(id='l'),\n" " slice=Tuple(\n" " elts=[\n" " Slice(\n" " lower=Constant(value=1),\n" " upper=Constant(value=2)),\n" " Constant(value=3)])))" msgid "Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can occur only inside the *slice* field of :class:`Subscript`, either directly or as an element of :class:`Tuple`." msgstr "اسلایس معمولی (به‌شکل ``lower:upper`` یا ``lower:upper:step``). فقط می‌تواند درون فیلد *slice* در :class:`Subscript` رخ دهد، چه به‌صورت مستقیم و چه به‌عنوان عنصری از :class:`Tuple`." msgid "" ">>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\n" "Expression(\n" " body=Subscript(\n" " value=Name(id='l'),\n" " slice=Slice(\n" " lower=Constant(value=1),\n" " upper=Constant(value=2))))" msgstr "" ">>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\n" "Expression(\n" " body=Subscript(\n" " value=Name(id='l'),\n" " slice=Slice(\n" " lower=Constant(value=1),\n" " upper=Constant(value=2))))" msgid "Comprehensions" msgstr "درک‌ها" msgid "List and set comprehensions, generator expressions, and dictionary comprehensions. ``elt`` (or ``key`` and ``value``) is a single node representing the part that will be evaluated for each item." msgstr "درک‌های فهرستی و مجموعه‌ای، عبارات تولیدگر، و درک‌های دیکشنری. ``elt`` (یا ``key`` و ``value``) یک گره واحد است که نشان‌دهنده‌ی بخشی است که برای هر آیتم ارزیابی می‌شود." msgid "For dictionary comprehensions using unpacking, for example ``{**item for item in items}``, the expression to be expanded goes in ``key`` and ``value`` is ``None``." msgstr "برای درک‌های دیکشنری که از بازکردن بسته استفاده می‌کنند، مثلاً ``{**item for item in items}``، عبارت قابل گسترش در ``key`` قرار می‌گیرد و ``value`` برابر با ``None`` است." msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "``generators`` فهرستی از گره‌های :class:`comprehension` است." msgid "" ">>> print(ast.dump(\n" "... ast.parse('[x for x in numbers]', mode='eval'),\n" "... indent=4,\n" "... ))\n" "Expression(\n" " body=ListComp(\n" " elt=Name(id='x'),\n" " generators=[\n" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers'),\n" " is_async=0)]))\n" ">>> print(ast.dump(\n" "... ast.parse('{x: x**2 for x in numbers}', mode='eval'),\n" "... indent=4,\n" "... ))\n" "Expression(\n" " body=DictComp(\n" " key=Name(id='x'),\n" " value=BinOp(\n" " left=Name(id='x'),\n" " op=Pow(),\n" " right=Constant(value=2)),\n" " generators=[\n" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers'),\n" " is_async=0)]))\n" ">>> print(ast.dump(\n" "... ast.parse('{x for x in numbers}', mode='eval'),\n" "... indent=4,\n" "... ))\n" "Expression(\n" " body=SetComp(\n" " elt=Name(id='x'),\n" " generators=[\n" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers'),\n" " is_async=0)]))" msgstr "" ">>> print(ast.dump(\n" "... ast.parse('[x for x in numbers]', mode='eval'),\n" "... indent=4,\n" "... ))\n" "Expression(\n" " body=ListComp(\n" " elt=Name(id='x'),\n" " generators=[\n" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers'),\n" " is_async=0)]))\n" ">>> print(ast.dump(\n" "... ast.parse('{x: x**2 for x in numbers}', mode='eval'),\n" "... indent=4,\n" "... ))\n" "Expression(\n" " body=DictComp(\n" " key=Name(id='x'),\n" " value=BinOp(\n" " left=Name(id='x'),\n" " op=Pow(),\n" " right=Constant(value=2)),\n" " generators=[\n" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers'),\n" " is_async=0)]))\n" ">>> print(ast.dump(\n" "... ast.parse('{x for x in numbers}', mode='eval'),\n" "... indent=4,\n" "... ))\n" "Expression(\n" " body=SetComp(\n" " elt=Name(id='x'),\n" " generators=[\n" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers'),\n" " is_async=0)]))" msgid "One ``for`` clause in a comprehension. ``target`` is the reference to use for each element - typically a :class:`Name` or :class:`Tuple` node. ``iter`` is the object to iterate over. ``ifs`` is a list of test expressions: each ``for`` clause can have multiple ``ifs``." msgstr "یک بند ``for`` در یک درک. ``target`` مرجعی است که برای هر عنصر استفاده می‌شود، معمولاً یک گره :class:`Name` یا :class:`Tuple`. ``iter`` شیء‌ای است که بر آن پیمایش می‌شود. ``ifs`` فهرستی از عبارات آزمون است: هر بند ``for`` می‌تواند چندین ``ifs`` داشته باشد." msgid "``is_async`` indicates a comprehension is asynchronous (using an ``async for`` instead of ``for``). The value is an integer (0 or 1)." msgstr "``is_async`` نشان می‌دهد که یک درک ناهمگام است (به جای ``for`` از ``async for`` استفاده می‌کند). مقدار آن یک عدد صحیح (۰ یا ۱) است." msgid "" ">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', mode='eval'),\n" "... indent=4)) # Multiple comprehensions in one.\n" "Expression(\n" " body=ListComp(\n" " elt=Call(\n" " func=Name(id='ord'),\n" " args=[\n" " Name(id='c')]),\n" " generators=[\n" " comprehension(\n" " target=Name(id='line', ctx=Store()),\n" " iter=Name(id='file'),\n" " is_async=0),\n" " comprehension(\n" " target=Name(id='c', ctx=Store()),\n" " iter=Name(id='line'),\n" " is_async=0)]))\n" "\n" ">>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', mode='eval'),\n" "... indent=4)) # generator comprehension\n" "Expression(\n" " body=GeneratorExp(\n" " elt=BinOp(\n" " left=Name(id='n'),\n" " op=Pow(),\n" " right=Constant(value=2)),\n" " generators=[\n" " comprehension(\n" " target=Name(id='n', ctx=Store()),\n" " iter=Name(id='it'),\n" " ifs=[\n" " Compare(\n" " left=Name(id='n'),\n" " ops=[\n" " Gt()],\n" " comparators=[\n" " Constant(value=5)]),\n" " Compare(\n" " left=Name(id='n'),\n" " ops=[\n" " Lt()],\n" " comparators=[\n" " Constant(value=10)])],\n" " is_async=0)]))\n" "\n" ">>> print(ast.dump(ast.parse('[i async for i in soc]', mode='eval'),\n" "... indent=4)) # Async comprehension\n" "Expression(\n" " body=ListComp(\n" " elt=Name(id='i'),\n" " generators=[\n" " comprehension(\n" " target=Name(id='i', ctx=Store()),\n" " iter=Name(id='soc'),\n" " is_async=1)]))" msgstr "" ">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', mode='eval'),\n" "... indent=4)) # Multiple comprehensions in one.\n" "Expression(\n" " body=ListComp(\n" " elt=Call(\n" " func=Name(id='ord'),\n" " args=[\n" " Name(id='c')]),\n" " generators=[\n" " comprehension(\n" " target=Name(id='line', ctx=Store()),\n" " iter=Name(id='file'),\n" " is_async=0),\n" " comprehension(\n" " target=Name(id='c', ctx=Store()),\n" " iter=Name(id='line'),\n" " is_async=0)]))\n" "\n" ">>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', mode='eval'),\n" "... indent=4)) # generator comprehension\n" "Expression(\n" " body=GeneratorExp(\n" " elt=BinOp(\n" " left=Name(id='n'),\n" " op=Pow(),\n" " right=Constant(value=2)),\n" " generators=[\n" " comprehension(\n" " target=Name(id='n', ctx=Store()),\n" " iter=Name(id='it'),\n" " ifs=[\n" " Compare(\n" " left=Name(id='n'),\n" " ops=[\n" " Gt()],\n" " comparators=[\n" " Constant(value=5)]),\n" " Compare(\n" " left=Name(id='n'),\n" " ops=[\n" " Lt()],\n" " comparators=[\n" " Constant(value=10)])],\n" " is_async=0)]))\n" "\n" ">>> print(ast.dump(ast.parse('[i async for i in soc]', mode='eval'),\n" "... indent=4)) # Async comprehension\n" "Expression(\n" " body=ListComp(\n" " elt=Name(id='i'),\n" " generators=[\n" " comprehension(\n" " target=Name(id='i', ctx=Store()),\n" " iter=Name(id='soc'),\n" " is_async=1)]))" msgid "Statements" msgstr "دستورها" msgid "An assignment. ``targets`` is a list of nodes, and ``value`` is a single node." msgstr "یک انتساب. ``targets`` فهرستی از گره‌ها است، و ``value`` یک گره واحد است." msgid "Multiple nodes in ``targets`` represents assigning the same value to each. Unpacking is represented by putting a :class:`Tuple` or :class:`List` within ``targets``." msgstr "گره‌های متعدد در ``targets`` نشان‌دهنده‌ی انتساب یک مقدار یکسان به هر یک هستند. واگشایی با قرار دادن یک :class:`Tuple` یا :class:`List` درون ``targets`` نمایش داده می‌شود." msgid "``type_comment`` is an optional string with the type annotation as a comment." msgstr "``type_comment`` یک رشته اختیاری حاوی حاشیه‌نویسی نوع به‌صورت کامنت است." msgid "" ">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" "Module(\n" " body=[\n" " Assign(\n" " targets=[\n" " Name(id='a', ctx=Store()),\n" " Name(id='b', ctx=Store())],\n" " value=Constant(value=1))])\n" "\n" ">>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking\n" "Module(\n" " body=[\n" " Assign(\n" " targets=[\n" " Tuple(\n" " elts=[\n" " Name(id='a', ctx=Store()),\n" " Name(id='b', ctx=Store())],\n" " ctx=Store())],\n" " value=Name(id='c'))])" msgstr "" ">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" "Module(\n" " body=[\n" " Assign(\n" " targets=[\n" " Name(id='a', ctx=Store()),\n" " Name(id='b', ctx=Store())],\n" " value=Constant(value=1))])\n" "\n" ">>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking\n" "Module(\n" " body=[\n" " Assign(\n" " targets=[\n" " Tuple(\n" " elts=[\n" " Name(id='a', ctx=Store()),\n" " Name(id='b', ctx=Store())],\n" " ctx=Store())],\n" " value=Name(id='c'))])" msgid "An assignment with a type annotation. ``target`` is a single node and can be a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. ``annotation`` is the annotation, such as a :class:`Constant` or :class:`Name` node. ``value`` is a single optional node." msgstr "یک انتساب با حاشیه‌نویسی نوع. ``target`` یک گره واحد است و می‌تواند یک :class:`Name`، یک :class:`Attribute` یا یک :class:`Subscript` باشد. ``annotation`` حاشیه‌نویسی است، مانند یک گره :class:`Constant` یا :class:`Name`. ``value`` یک گره واحد اختیاری است." msgid "``simple`` is always either 0 (indicating a \"complex\" target) or 1 (indicating a \"simple\" target). A \"simple\" target consists solely of a :class:`Name` node that does not appear between parentheses; all other targets are considered complex. Only simple targets appear in the :attr:`~object.__annotations__` dictionary of modules and classes." msgstr "``simple`` همیشه یا ۰ است (نشان‌دهنده‌ی یک هدف «پیچیده») یا ۱ (نشان‌دهنده‌ی یک هدف «ساده»). یک هدف «ساده» فقط شامل یک گره :class:`Name` است که بین پرانتز قرار ندارد؛ تمام اهداف دیگر پیچیده محسوب می‌شوند. تنها اهداف ساده در دیکشنری :attr:`~object.__annotations__` ماژول‌ها و کلاس‌ها ظاهر می‌شوند." msgid "" ">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" "Module(\n" " body=[\n" " AnnAssign(\n" " target=Name(id='c', ctx=Store()),\n" " annotation=Name(id='int'),\n" " simple=1)])\n" "\n" ">>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with parenthesis\n" "Module(\n" " body=[\n" " AnnAssign(\n" " target=Name(id='a', ctx=Store()),\n" " annotation=Name(id='int'),\n" " value=Constant(value=1),\n" " simple=0)])\n" "\n" ">>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation\n" "Module(\n" " body=[\n" " AnnAssign(\n" " target=Attribute(\n" " value=Name(id='a'),\n" " attr='b',\n" " ctx=Store()),\n" " annotation=Name(id='int'),\n" " simple=0)])\n" "\n" ">>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript annotation\n" "Module(\n" " body=[\n" " AnnAssign(\n" " target=Subscript(\n" " value=Name(id='a'),\n" " slice=Constant(value=1),\n" " ctx=Store()),\n" " annotation=Name(id='int'),\n" " simple=0)])" msgstr "" ">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" "Module(\n" " body=[\n" " AnnAssign(\n" " target=Name(id='c', ctx=Store()),\n" " annotation=Name(id='int'),\n" " simple=1)])\n" "\n" ">>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with parenthesis\n" "Module(\n" " body=[\n" " AnnAssign(\n" " target=Name(id='a', ctx=Store()),\n" " annotation=Name(id='int'),\n" " value=Constant(value=1),\n" " simple=0)])\n" "\n" ">>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation\n" "Module(\n" " body=[\n" " AnnAssign(\n" " target=Attribute(\n" " value=Name(id='a'),\n" " attr='b',\n" " ctx=Store()),\n" " annotation=Name(id='int'),\n" " simple=0)])\n" "\n" ">>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript annotation\n" "Module(\n" " body=[\n" " AnnAssign(\n" " target=Subscript(\n" " value=Name(id='a'),\n" " slice=Constant(value=1),\n" " ctx=Store()),\n" " annotation=Name(id='int'),\n" " simple=0)])" msgid "Augmented assignment, such as ``a += 1``. In the following example, ``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` context), ``op`` is :class:`Add`, and ``value`` is a :class:`Constant` with value for 1." msgstr "انتساب تقویتی، مانند ``a += 1``. در مثال زیر، ``target`` یک گره :class:`Name` برای ``x`` (با زمینه‌ی :class:`Store`) است، ``op`` :class:`Add` است، و ``value`` یک :class:`Constant` با مقدار ۱ است." msgid "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, unlike the targets of :class:`Assign`." msgstr "ویژگی ``target`` نمی‌تواند از کلاس :class:`Tuple` یا :class:`List` باشد، برخلاف هدف‌های :class:`Assign`." msgid "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" " body=[\n" " AugAssign(\n" " target=Name(id='x', ctx=Store()),\n" " op=Add(),\n" " value=Constant(value=2))])" msgstr "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" " body=[\n" " AugAssign(\n" " target=Name(id='x', ctx=Store()),\n" " op=Add(),\n" " value=Constant(value=2))])" msgid "A ``raise`` statement. ``exc`` is the exception object to be raised, normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone ``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "یک دستور ``raise``. ``exc`` شیء استثنا است که پرتاب می‌شود، معمولاً یک :class:`Call` یا :class:`Name`، یا ``None`` برای یک ``raise`` مستقل. ``cause`` بخش اختیاری برای ``y`` در ``raise x from y`` است." msgid "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" " body=[\n" " Raise(\n" " exc=Name(id='x'),\n" " cause=Name(id='y'))])" msgstr "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" " body=[\n" " Raise(\n" " exc=Name(id='x'),\n" " cause=Name(id='y'))])" msgid "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. ``msg`` holds the failure message." msgstr "یک ادعا. ``test`` حاوی شرط است، مانند یک گره :class:`Compare`. ``msg`` حاوی پیام شکست است." msgid "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" " body=[\n" " Assert(\n" " test=Name(id='x'),\n" " msg=Name(id='y'))])" msgstr "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" " body=[\n" " Assert(\n" " test=Name(id='x'),\n" " msg=Name(id='y'))])" msgid "Represents a ``del`` statement. ``targets`` is a list of nodes, such as :class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "نشان‌دهنده‌ی یک دستور ``del`` است. ``targets`` فهرستی از گره‌ها است، مانند گره‌های :class:`Name`، :class:`Attribute` یا :class:`Subscript`." msgid "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" " body=[\n" " Delete(\n" " targets=[\n" " Name(id='x', ctx=Del()),\n" " Name(id='y', ctx=Del()),\n" " Name(id='z', ctx=Del())])])" msgstr "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" " body=[\n" " Delete(\n" " targets=[\n" " Name(id='x', ctx=Del()),\n" " Name(id='y', ctx=Del()),\n" " Name(id='z', ctx=Del())])])" msgid "A ``pass`` statement." msgstr "یک دستور ``pass``." msgid "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" " body=[\n" " Pass()])" msgstr "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" " body=[\n" " Pass()])" msgid "A :ref:`type alias ` created through the :keyword:`type` statement. ``name`` is the name of the alias, ``type_params`` is a list of :ref:`type parameters `, and ``value`` is the value of the type alias." msgstr "یک :ref:`نام مستعار نوع ` که از طریق دستور :keyword:`type` ایجاد شده است. ``name`` نام این نام مستعار است، ``type_params`` فهرستی از :ref:`پارامترهای نوع ` است، و ``value`` مقدار این نام مستعار نوع است." msgid "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " value=Name(id='int'))])" msgstr "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " value=Name(id='int'))])" msgid "Other statements which are only applicable inside functions or loops are described in other sections." msgstr "دستورهای دیگر که فقط داخل توابع یا حلقه‌ها قابل استفاده هستند، در بخش‌های دیگر شرح داده شده‌اند." msgid "Imports" msgstr "ایمپورت‌ها" msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "یک دستور ایمپورت. ``names`` فهرستی از گره‌های :class:`alias` است." msgid "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" " body=[\n" " Import(\n" " names=[\n" " alias(name='x'),\n" " alias(name='y'),\n" " alias(name='z')],\n" " is_lazy=0)])" msgstr "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" " body=[\n" " Import(\n" " names=[\n" " alias(name='x'),\n" " alias(name='y'),\n" " alias(name='z')],\n" " is_lazy=0)])" msgid "Represents ``from x import y``. ``module`` is a raw string of the 'from' name, without any leading dots, or ``None`` for statements such as ``from . import foo``. ``level`` is an integer holding the level of the relative import (0 means absolute import)." msgstr "نشان‌دهنده‌ی ``from x import y`` است. ``module`` یک رشته خام از نام 'from'، بدون هیچ نقطه‌ی ابتدایی، یا ``None`` برای دستورهایی مانند ``from . import foo`` است. ``level`` یک عدد صحیح است که سطح ایمپورت نسبی را نگه می‌دارد (۰ به معنای ایمپورت مطلق است)." msgid "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" " body=[\n" " ImportFrom(\n" " module='y',\n" " names=[\n" " alias(name='x'),\n" " alias(name='y'),\n" " alias(name='z')],\n" " level=0,\n" " is_lazy=0)])" msgstr "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" " body=[\n" " ImportFrom(\n" " module='y',\n" " names=[\n" " alias(name='x'),\n" " alias(name='y'),\n" " alias(name='z')],\n" " level=0,\n" " is_lazy=0)])" msgid "Both parameters are raw strings of the names. ``asname`` can be ``None`` if the regular name is to be used." msgstr "هر دو پارامتر، رشته‌های خام نام‌ها هستند. اگر قرار باشد از نام معمولی استفاده شود، ``asname`` می‌تواند ``None`` باشد." msgid "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" " body=[\n" " ImportFrom(\n" " module='foo.bar',\n" " names=[\n" " alias(name='a', asname='b'),\n" " alias(name='c')],\n" " level=2,\n" " is_lazy=0)])" msgstr "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" " body=[\n" " ImportFrom(\n" " module='foo.bar',\n" " names=[\n" " alias(name='a', asname='b'),\n" " alias(name='c')],\n" " level=2,\n" " is_lazy=0)])" msgid "Control flow" msgstr "کنترل جریان" msgid "Optional clauses such as ``else`` are stored as an empty list if they're not present." msgstr "بندهای اختیاری مانند ``else``، اگر وجود نداشته باشند، به‌صورت یک فهرست خالی ذخیره می‌شوند." msgid "An ``if`` statement. ``test`` holds a single node, such as a :class:`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "یک دستور ``if``. ``test`` یک گره واحد را نگه می‌دارد، مانند یک گره :class:`Compare`. ``body`` و ``orelse`` هر کدام فهرستی از گره‌ها را نگه می‌دارند." msgid "``elif`` clauses don't have a special representation in the AST, but rather appear as extra :class:`If` nodes within the ``orelse`` section of the previous one." msgstr "بندهای ``elif`` بازنمایی خاصی در AST ندارند، بلکه به‌صورت گره‌های اضافی :class:`If` در بخش ``orelse`` گره پیشین ظاهر می‌شوند." msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" "... ...\n" "... elif y:\n" "... ...\n" "... else:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " If(\n" " test=Name(id='x'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " If(\n" " test=Name(id='y'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" "... ...\n" "... elif y:\n" "... ...\n" "... else:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " If(\n" " test=Name(id='x'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " If(\n" " test=Name(id='y'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" msgid "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :class:`Subscript` node. ``iter`` holds the item to be looped over, again as a single node. ``body`` and ``orelse`` contain lists of nodes to execute. Those in ``orelse`` are executed if the loop finishes normally, rather than via a ``break`` statement." msgstr "یک حلقه ``for``. ``target`` متغیر(ها)یی را که حلقه به آن‌ها انتساب می‌دهد، به‌صورت یک گره از نوع :class:`Name`، :class:`Tuple`، :class:`List`، :class:`Attribute` یا :class:`Subscript` نگه می‌دارد. ``iter`` آیتم مورد پیمایش حلقه را، باز هم به‌صورت یک گره نگه می‌دارد. ``body`` و ``orelse`` شامل فهرست‌هایی از گره‌ها برای اجرا هستند. گره‌های موجود در ``orelse`` در صورتی اجرا می‌شوند که حلقه به‌طور عادی پایان یابد، نه از طریق یک دستور ``break``." msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" "... ...\n" "... else:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " For(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='y'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" "... ...\n" "... else:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " For(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='y'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])" msgid "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` node." msgstr "یک حلقه‌ی ``while``. ``test`` شرط را نگه می‌دارد، مانند یک گره‌ی :class:`Compare`." msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" "... ...\n" "... else:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " While(\n" " test=Name(id='x'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" "... ...\n" "... else:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " While(\n" " test=Name(id='x'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])" msgid "The ``break`` and ``continue`` statements." msgstr "دستورهای ``break`` و ``continue``." msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" "... if a > 5:\n" "... break\n" "... else:\n" "... continue\n" "...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " For(\n" " target=Name(id='a', ctx=Store()),\n" " iter=Name(id='b'),\n" " body=[\n" " If(\n" " test=Compare(\n" " left=Name(id='a'),\n" " ops=[\n" " Gt()],\n" " comparators=[\n" " Constant(value=5)]),\n" " body=[\n" " Break()],\n" " orelse=[\n" " Continue()])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" "... if a > 5:\n" "... break\n" "... else:\n" "... continue\n" "...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " For(\n" " target=Name(id='a', ctx=Store()),\n" " iter=Name(id='b'),\n" " body=[\n" " If(\n" " test=Compare(\n" " left=Name(id='a'),\n" " ops=[\n" " Gt()],\n" " comparators=[\n" " Constant(value=5)]),\n" " body=[\n" " Break()],\n" " orelse=[\n" " Continue()])])])" msgid "``try`` blocks. All attributes are list of nodes to execute, except for ``handlers``, which is a list of :class:`ExceptHandler` nodes." msgstr "بلوک‌های ``try``. همه ویژگی‌ها فهرستی از گره‌ها برای اجرا هستند، به جز ``handlers`` که فهرستی از گره‌های :class:`ExceptHandler` است." msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" "... ...\n" "... except Exception:\n" "... ...\n" "... except OtherException as e:\n" "... ...\n" "... else:\n" "... ...\n" "... finally:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " Try(\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " handlers=[\n" " ExceptHandler(\n" " type=Name(id='Exception'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " ExceptHandler(\n" " type=Name(id='OtherException'),\n" " name='e',\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])],\n" " orelse=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " finalbody=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" "... ...\n" "... except Exception:\n" "... ...\n" "... except OtherException as e:\n" "... ...\n" "... else:\n" "... ...\n" "... finally:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " Try(\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " handlers=[\n" " ExceptHandler(\n" " type=Name(id='Exception'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " ExceptHandler(\n" " type=Name(id='OtherException'),\n" " name='e',\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])],\n" " orelse=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " finalbody=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])" msgid "``try`` blocks which are followed by ``except*`` clauses. The attributes are the same as for :class:`Try` but the :class:`ExceptHandler` nodes in ``handlers`` are interpreted as ``except*`` blocks rather than ``except``." msgstr "بلوک‌های ``try`` که پس از آن‌ها بندهای ``except*`` می‌آیند. ویژگی‌ها همان ویژگی‌های :class:`Try` هستند، اما گره‌های :class:`ExceptHandler` در ``handlers`` به‌عنوان بلوک‌های ``except*`` تفسیر می‌شوند، نه ``except``." msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" "... ...\n" "... except* Exception:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " TryStar(\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " handlers=[\n" " ExceptHandler(\n" " type=Name(id='Exception'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" "... ...\n" "... except* Exception:\n" "... ...\n" "... \"\"\"), indent=4))\n" "Module(\n" " body=[\n" " TryStar(\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))],\n" " handlers=[\n" " ExceptHandler(\n" " type=Name(id='Exception'),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" msgid "A single ``except`` clause. ``type`` is the exception type it will match, typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` clause). ``name`` is a raw string for the name to hold the exception, or ``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "یک بند ``except`` واحد. ``type`` نوع استثنایی است که با آن مطابقت دارد و معمولاً یک گره :class:`Name` است (یا ``None`` برای یک بند ``except:`` فراگیر). ``name`` یک رشته خام برای نامی است که استثنا را نگه می‌دارد، یا ``None`` اگر بند ``as foo`` نداشته باشد. ``body`` فهرستی از گره‌ها است." msgid "" ">>> 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'),\n" " op=Add(),\n" " right=Constant(value=1)))],\n" " handlers=[\n" " ExceptHandler(\n" " type=Name(id='TypeError'),\n" " body=[\n" " Pass()])])])" msgstr "" ">>> 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'),\n" " op=Add(),\n" " right=Constant(value=1)))],\n" " handlers=[\n" " ExceptHandler(\n" " type=Name(id='TypeError'),\n" " body=[\n" " Pass()])])])" 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 "یک بلوک ``with``. ``items`` فهرستی از گره‌های :class:`withitem` است که مدیران زمینه را نشان می‌دهند، و ``body`` بلوک تورفته‌ی درون زمینه است." 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 "یک مدیر زمینه‌ی واحد در یک بلوک ``with``. ``context_expr`` مدیر زمینه است و معمولاً یک گره :class:`Call` است. ``optional_vars`` یک :class:`Name`، :class:`Tuple` یا :class:`List` برای بخش ``as foo`` است، یا اگر از آن استفاده‌نشده باشد، ``None`` است." 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'),\n" " optional_vars=Name(id='b', ctx=Store())),\n" " withitem(\n" " context_expr=Name(id='c'),\n" " optional_vars=Name(id='d', ctx=Store()))],\n" " body=[\n" " Expr(\n" " value=Call(\n" " func=Name(id='something'),\n" " args=[\n" " Name(id='b'),\n" " Name(id='d')]))])])" msgstr "" ">>> 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'),\n" " optional_vars=Name(id='b', ctx=Store())),\n" " withitem(\n" " context_expr=Name(id='c'),\n" " optional_vars=Name(id='d', ctx=Store()))],\n" " body=[\n" " Expr(\n" " value=Call(\n" " func=Name(id='something'),\n" " args=[\n" " Name(id='b'),\n" " Name(id='d')]))])])" msgid "Pattern matching" msgstr "تطبیق الگو" 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 "یک دستور ``match``. ``subject`` شامل موضوع تطبیق (شیءای که با حالت‌های مختلف تطبیق داده می‌شود) است و ``cases`` شامل یک پیمایش‌پذیر از گره‌های :class:`match_case` برای حالت‌های مختلف است." 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 "یک الگوی case منفرد در یک دستور ``match``. ``pattern`` شامل الگوی تطبیقی است که موضوع با آن تطبیق داده خواهد شد. توجه داشته باشید که گره‌های :class:`AST` تولیدشده برای الگوها با گره‌های تولیدشده برای عبارات متفاوت هستند، حتی زمانی که سینتکس یکسانی دارند." msgid "The ``guard`` attribute contains an expression that will be evaluated if the pattern matches the subject." msgstr "ویژگی ``guard`` شامل عبارتی است که اگر الگو با موضوع مطابقت داشته باشد، ارزیابی می‌شود." msgid "``body`` contains a list of nodes to execute if the pattern matches and the result of evaluating the guard expression is true." msgstr "``body`` شامل فهرستی از گره‌هاست که در صورتی اجرا می‌شوند که الگو مطابقت داشته باشد و نتیجه ارزیابی عبارت نگهبان درست باشد." 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'),\n" " cases=[\n" " match_case(\n" " pattern=MatchSequence(\n" " patterns=[\n" " MatchAs(name='x')]),\n" " guard=Compare(\n" " left=Name(id='x'),\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')),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" msgstr "" ">>> 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'),\n" " cases=[\n" " match_case(\n" " pattern=MatchSequence(\n" " patterns=[\n" " MatchAs(name='x')]),\n" " guard=Compare(\n" " left=Name(id='x'),\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')),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" 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 "یک لفظی تطبیق یا الگوی مقدار که بر اساس برابری مقایسه می‌کند. ``value`` یک گره عبارت است. گره‌های مقدار مجاز، همان‌طور که در مستندات دستور تطبیق توضیح داده‌شده است، محدود شده‌اند. این الگو در صورتی موفق می‌شود که موضوع تطبیق با مقدار ارزیابی‌شده برابر باشد." 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'),\n" " cases=[\n" " match_case(\n" " pattern=MatchValue(\n" " value=Constant(value='Relevant')),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" msgstr "" ">>> 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'),\n" " cases=[\n" " match_case(\n" " pattern=MatchValue(\n" " value=Constant(value='Relevant')),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" 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 "یک الگوی تطبیق لفظی که بر اساس هویت مقایسه می‌کند. ``value`` تک‌نمونه‌ای است که با آن مقایسه می‌شود: ``None``، ``True`` یا ``False``. این الگو در صورتی موفق می‌شود که موضوع تطبیق همان ثابت داده‌شده باشد." 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'),\n" " cases=[\n" " match_case(\n" " pattern=MatchSingleton(value=None),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" msgstr "" ">>> 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'),\n" " cases=[\n" " match_case(\n" " pattern=MatchSingleton(value=None),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))])])])" 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 "یک الگوی تطبیق دنباله. ``patterns`` شامل الگوهایی است که در صورت دنباله بودن موضوع، با عناصر موضوع تطبیق داده می‌شوند. اگر یکی از زیرالگوها یک گره ``MatchStar`` باشد، با یک دنباله با طول متغیر تطبیق می‌یابد، در غیر این صورت با یک دنباله با طول ثابت تطبیق می‌یابد." 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'),\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 "" ">>> 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'),\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))])])])" 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 "بقیه‌ی دنباله را در یک الگوی دنباله‌ی تطبیق با طول متغیر تطبیق می‌دهد. اگر ``name`` برابر ``None`` نباشد، در صورت موفق بودن الگوی دنباله‌ی کلی، فهرستی حاوی عناصر باقی‌مانده‌ی دنباله به آن نام مقید می‌شود." 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'),\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 "" ">>> 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'),\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))])])])" 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 "یک الگوی نگاشت تطبیق. ``keys`` دنباله‌ای از گره‌های عبارت است. ``patterns`` دنباله‌ای متناظر از گره‌های الگو است. ``rest`` نامی اختیاری است که می‌توان آن را برای گرفتن عناصر باقی‌مانده‌ی نگاشت مشخص کرد. عبارات مجاز برای کلیدها، همان‌طور که در مستندات دستور match توضیح داده شده است، محدود شده‌اند." 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 "این الگو زمانی موفق می‌شود که موضوع یک نگاشت باشد، همه عبارت‌های کلید ارزیابی‌شده در نگاشت وجود داشته باشند، و مقدار متناظر با هر کلید با زیرالگوی متناظر مطابقت داشته باشد. اگر ``rest`` برابر ``None`` نباشد، یک دیکشنری شامل عناصر باقی‌مانده نگاشت، در صورت موفقیت کل الگوی نگاشت، به آن نام مقید می‌شود." 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'),\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 "" ">>> 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'),\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))])])])" 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 "یک الگوی تطبیق کلاس. ``cls`` عبارتی است که کلاس اسمی مورد تطبیق را مشخص می‌کند. ``patterns`` دنباله‌ای از گره‌های الگو است که باید با دنباله‌ای از ویژگی‌های تطبیق الگو که کلاس آن را تعریف کرده است تطبیق داده شوند. ``kwd_attrs`` دنباله‌ای از ویژگی‌های اضافی برای تطبیق است (که به‌صورت آرگومان‌های کلیدواژه‌ای در الگوی کلاس مشخص می‌شوند)، ``kwd_patterns`` الگوهای متناظر هستند (که به‌صورت مقادیر کلیدواژه‌ای در الگوی کلاس مشخص می‌شوند)." 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 "این الگو در صورتی موفق می‌شود که موضوع یک نمونه از کلاس نام‌برده‌شده باشد، همه‌ی الگوهای جایگاهی با ویژگی‌های متناظر تعریف‌شده در کلاس مطابقت داشته باشند، و هر یک از ویژگی‌های کلیدواژه‌ای مشخص‌شده با الگوی متناظر خود مطابقت داشته باشند." 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 "نکته: کلاس‌ها ممکن است یک پراپرتی تعریف کنند که self را برمی‌گرداند تا یک گره الگو را با نمونه‌ای که در حال تطبیق است، تطبیق دهند. چندین نوع توکار نیز به همین روش تطبیق داده می‌شوند، همان‌طور که در مستندات دستور match توضیح داده شده است." 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'),\n" " cases=[\n" " match_case(\n" " pattern=MatchClass(\n" " cls=Name(id='Point2D'),\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'),\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 "" ">>> 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'),\n" " cases=[\n" " match_case(\n" " pattern=MatchClass(\n" " cls=Name(id='Point2D'),\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'),\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))])])])" 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 "یک «الگوی as» (as-pattern) در تطبیق، یک الگوی ثبت‌کننده (capture pattern) یا یک الگوی wildcard (wildcard pattern). ``pattern`` شامل الگوی تطبیقی است که موضوع با آن تطبیق داده خواهد شد. اگر الگو ``None`` باشد، این گره بیانگر یک الگوی ثبت‌کننده (یعنی یک نام ساده) است و همیشه با موفقیت تطبیق داده خواهد شد." 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 "ویژگی ``name`` شامل نامی است که در صورت موفقیت الگو مقید خواهد شد. اگر ``name`` برابر ``None`` باشد، ``pattern`` نیز باید ``None`` باشد و گره نشان‌دهنده‌ی الگوی وایلدکارد است." 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'),\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 "" ">>> 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'),\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))])])])" 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 "یک «الگوی یا» (or-pattern) در تطبیق. یک الگوی یا هر یک از الگوهای فرعی خود را به‌نوبت با موضوع تطبیق می‌دهد، تا یکی موفق شود. سپس الگوی یا موفق تلقی می‌شود. اگر هیچ‌کدام از الگوهای فرعی موفق نشوند، الگوی یا شکست می‌خورد. ویژگی ``patterns`` شامل فهرستی از گره‌های الگوی تطبیق است که با موضوع تطبیق داده می‌شوند." 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'),\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 "" ">>> 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'),\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))])])])" msgid "Type annotations" msgstr "حاشیه‌نویسی‌های نوع" msgid "A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag specified by the form ``# type: ignore ``." msgstr "یک کامنت ``# type: ignore`` در *lineno* قرار دارد. *tag* برچسب اختیاری است که با قالب ``# type: ignore `` مشخص می‌شود." 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'),\n" " value=Constant(value=1),\n" " simple=1)],\n" " type_ignores=[\n" " TypeIgnore(lineno=1, tag='[assignment]')])" msgstr "" ">>> 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'),\n" " value=Constant(value=1),\n" " simple=1)],\n" " type_ignores=[\n" " TypeIgnore(lineno=1, tag='[assignment]')])" 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 "گره‌های :class:`!TypeIgnore` زمانی که پارامتر *type_comments* روی ``False`` (پیش‌فرض) تنظیم شده باشد، ایجاد نمی‌شوند. برای جزئیات بیشتر :func:`ast.parse` را ببینید." msgid "Type parameters" msgstr "پارامترهای نوع" msgid ":ref:`Type parameters ` can exist on classes, functions, and type aliases." msgstr ":ref:`پارامترهای نوع ` می‌توانند در کلاس‌ها، توابع و نام‌های مستعار نوع وجود داشته باشند." 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 "یک :class:`typing.TypeVar`. ``name`` نام متغیر نوع است. ``bound`` کران یا محدودیت‌ها است، در صورت وجود. اگر ``bound`` یک :class:`Tuple` باشد، بیانگر محدودیت‌ها است؛ در غیر این صورت بیانگر کران است. ``default_value`` مقدار پیش‌فرض است؛ اگر :class:`!TypeVar` مقدار پیش‌فرض نداشته باشد، این ویژگی روی ``None`` تنظیم خواهد شد." 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'),\n" " default_value=Name(id='bool'))],\n" " value=Subscript(\n" " value=Name(id='list'),\n" " slice=Name(id='T')))])" msgstr "" ">>> 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'),\n" " default_value=Name(id='bool'))],\n" " value=Subscript(\n" " value=Name(id='list'),\n" " slice=Name(id='T')))])" msgid "Added the *default_value* parameter." msgstr "پارامتر *default_value* افزوده شد." 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 "یک :class:`typing.ParamSpec`. ``name`` نام مشخصه پارامتر است. ``default_value`` مقدار پیش‌فرض است؛ اگر :class:`!ParamSpec` پیش‌فرضی نداشته باشد، این ویژگی به ``None`` تنظیم می‌شود." 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'),\n" " Name(id='str')]))],\n" " value=Subscript(\n" " value=Name(id='Callable'),\n" " slice=Tuple(\n" " elts=[\n" " Name(id='P'),\n" " Name(id='int')])))])" msgstr "" ">>> 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'),\n" " Name(id='str')]))],\n" " value=Subscript(\n" " value=Name(id='Callable'),\n" " slice=Tuple(\n" " elts=[\n" " Name(id='P'),\n" " Name(id='int')])))])" 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 "یک :class:`typing.TypeVarTuple` است. ``name`` نام تاپل متغیر نوع است. ``default_value`` مقدار پیش‌فرض است؛ اگر :class:`!TypeVarTuple` پیش‌فرضی نداشته باشد، این ویژگی روی ``None`` تنظیم می‌شود." 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(name='Ts', default_value=Tuple())],\n" " value=Subscript(\n" " value=Name(id='tuple'),\n" " slice=Tuple(\n" " elts=[\n" " Starred(\n" " value=Name(id='Ts'))])))])" msgstr "" ">>> 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(name='Ts', default_value=Tuple())],\n" " value=Subscript(\n" " value=Name(id='tuple'),\n" " slice=Tuple(\n" " elts=[\n" " Starred(\n" " value=Name(id='Ts'))])))])" msgid "Function and class definitions" msgstr "تعاریف تابع و کلاس" msgid "A function definition." msgstr "تعریف یک تابع." msgid "``name`` is a raw string of the function name." msgstr "``name`` یک رشته خام از نام تابع است." msgid "``args`` is an :class:`arguments` node." msgstr "``args`` یک گره :class:`arguments` است." msgid "``body`` is the list of nodes inside the function." msgstr "``body`` فهرست گره‌های درون تابع است." 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 "``decorator_list`` فهرستی از دکوراتورهایی است که باید اعمال شوند و بیرونی‌ترین آن‌ها در ابتدا ذخیره شده است (یعنی اولین دکوراتور فهرست، در آخر اعمال می‌شود)." msgid "``returns`` is the return annotation." msgstr "``returns`` حاشیه‌نویسی بازگشت (return annotation) است." msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "``type_params`` فهرستی از :ref:`پارامترهای نوع ` است." msgid "Added ``type_params``." msgstr "``type_params`` اضافه شد." msgid "``lambda`` is a minimal function definition that can be used inside an expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." msgstr "``lambda`` یک تعریف حداقلی تابع است که می‌تواند درون یک عبارت استفاده شود. برخلاف :class:`FunctionDef`، ``body`` تنها شامل یک گره است." 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 "" ">>> 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)))])" msgid "The arguments for a function." msgstr "آرگومان‌های یک تابع." msgid "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "``posonlyargs``، ``args`` و ``kwonlyargs`` فهرست‌هایی از گره‌های :class:`arg` هستند." msgid "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the ``*args, **kwargs`` parameters." msgstr "``vararg`` و ``kwarg`` گره‌های :class:`arg` تکی هستند که به پارامترهای ``*args, **kwargs`` اشاره می‌کنند." msgid "``kw_defaults`` is a list of default values for keyword-only arguments. If one is ``None``, the corresponding argument is required." msgstr "``kw_defaults`` فهرستی از مقادیر پیش‌فرض برای آرگومان‌های فقط کلیدواژه‌ای است. اگر یکی ``None`` باشد، آرگومان متناظر الزامی است." 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 "``defaults`` فهرستی از مقادیر پیش‌فرض برای آرگومان‌هایی است که می‌توانند به‌صورت جایگاهی ارسال شوند. اگر تعداد مقادیر پیش‌فرض کمتر باشد، آن‌ها با آخرین n آرگومان متناظر هستند." 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 "یک آرگومان منفرد در یک فهرست. ``arg`` یک رشته خام از نام آرگومان است؛ ``annotation`` حاشیه‌نویسی آن است، مانند یک گره :class:`Name`." msgid "``type_comment`` is an optional string with the type annotation as a comment" msgstr "``type_comment`` یک رشته اختیاری است که حاشیه‌نویسی نوع را به‌صورت یک کامنت دارد" 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'),\n" " Name(id='decorator2')],\n" " returns=Constant(value='return annotation'))])" msgstr "" ">>> 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'),\n" " Name(id='decorator2')],\n" " returns=Constant(value='return annotation'))])" msgid "A ``return`` statement." msgstr "یک دستور ``return``." msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" " body=[\n" " Return(\n" " value=Constant(value=4))])" msgstr "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" " body=[\n" " Return(\n" " value=Constant(value=4))])" 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 "یک عبارت ``yield`` یا ``yield from``. از آنجا که این‌ها عبارت هستند، در صورتی که مقدار بازگشتی آن‌ها استفاده نشود، باید در یک گره :class:`Expr` قرار گیرند." msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=Yield(\n" " value=Name(id='x')))])\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')))])" msgstr "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=Yield(\n" " value=Name(id='x')))])\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')))])" msgid "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "دستورهای ``global`` و ``nonlocal``. ``names`` فهرستی از رشته‌های خام است." 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 "" ">>> 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'])])" msgid "A class definition." msgstr "تعریف یک کلاس." msgid "``name`` is a raw string for the class name" msgstr "``name`` یک رشته خام برای نام کلاس است" msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` فهرستی از گره‌ها برای کلاس‌های پایه‌ای است که به‌صراحت مشخص‌شده‌اند." 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 "``keywords`` فهرستی از گره‌های :class:`.keyword` است، عمدتاً برای 'metaclass'. سایر کلیدواژه‌ها مطابق :pep:`3115` به فراکلاس ارسال می‌شوند." msgid "``body`` is a list of nodes representing the code within the class definition." msgstr "``body`` فهرستی از گره‌هایی است که کد درون تعریف کلاس را نشان می‌دهند." msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` فهرستی از گره‌ها است، همان‌طور که در :class:`FunctionDef` وجود دارد." 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'),\n" " Name(id='base2')],\n" " keywords=[\n" " keyword(\n" " arg='metaclass',\n" " value=Name(id='meta'))],\n" " body=[\n" " Pass()],\n" " decorator_list=[\n" " Name(id='decorator1'),\n" " Name(id='decorator2')])])" msgstr "" ">>> 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'),\n" " Name(id='base2')],\n" " keywords=[\n" " keyword(\n" " arg='metaclass',\n" " value=Name(id='meta'))],\n" " body=[\n" " Pass()],\n" " decorator_list=[\n" " Name(id='decorator1'),\n" " Name(id='decorator2')])])" msgid "Async and await" msgstr "ناهمگام و await" msgid "An ``async def`` function definition. Has the same fields as :class:`FunctionDef`." msgstr "یک تعریف تابع ``async def``. دارای همان فیلدهای :class:`FunctionDef` است." msgid "An ``await`` expression. ``value`` is what it waits for. Only valid in the body of an :class:`AsyncFunctionDef`." msgstr "یک عبارت ``await``. ``value`` مقداری است که برای آن انتظار می‌رود. فقط در بدنه‌ی یک :class:`AsyncFunctionDef` معتبر است." 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'))))])])" msgstr "" ">>> 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'))))])])" 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 "حلقه‌های ``async for`` و مدیران زمینه‌ی ``async with``. آن‌ها به‌ترتیب همان فیلدهای :class:`For` و :class:`With` را دارند. فقط در بدنه‌ی یک :class:`AsyncFunctionDef` معتبر هستند." 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 "هنگامی که یک رشته توسط :func:`ast.parse` تجزیه می‌شود، گره‌های عملگر (زیرکلاس‌های :class:`ast.operator`، :class:`ast.unaryop`، :class:`ast.cmpop`، :class:`ast.boolop` و :class:`ast.expr_context`) در درخت برگردانده‌شده تک‌نمونه خواهند بود. تغییر در یکی از آن‌ها در تمام موارد دیگر با همان مقدار بازتاب خواهد یافت (برای مثال، :class:`ast.Add`)." msgid ":mod:`!ast` helpers" msgstr "کمک‌کننده‌های :mod:`!ast`" msgid "Apart from the node classes, the :mod:`!ast` module defines these utility functions and classes for traversing abstract syntax trees:" msgstr "جدا از کلاس‌های گره، ماژول :mod:`!ast` این توابع و کلاس‌های سودمند را برای پیمایش درختان سینتکس انتزاعی تعریف می‌کند:" msgid "Parse the source into an AST node. Equivalent to ``compile(source, filename, mode, flags=FLAGS_VALUE, optimize=optimize, module=module)``, where ``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast.PyCF_OPTIMIZED_AST`` otherwise." msgstr "منبع را به یک گره درخت نحوی انتزاعی (AST) تجزیه کنید. معادل ``compile(source, filename, mode, flags=FLAGS_VALUE, optimize=optimize, module=module)`` است، که در آن ``FLAGS_VALUE`` برابر با ``ast.PyCF_ONLY_AST`` است اگر ``optimize <= 0`` و در غیر این صورت ``ast.PyCF_OPTIMIZED_AST`` است." msgid "If ``type_comments=True`` is given, the parser is modified to check and return type comments as specified by :pep:`484` and :pep:`526`. This is equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed to :func:`compile`. This will report syntax errors for misplaced type comments. Without this flag, type comments will be ignored, and the ``type_comment`` field on selected AST nodes will always be ``None``. In addition, the locations of ``# type: ignore`` comments will be returned as the ``type_ignores`` attribute of :class:`Module` (otherwise it is always an empty list)." msgstr "اگر ``type_comments=True`` داده شود، پارسر به‌گونه‌ای تغییر می‌یابد که کامنت‌های نوع را مطابق :pep:`484` و :pep:`526` بررسی کند و برگرداند. این معادل افزودن :data:`ast.PyCF_TYPE_COMMENTS` به پرچم‌های ارسال‌شده به :func:`compile` است. این حالت خطاهای سینتکسی مربوط به کامنت‌های نوع نابجا را گزارش می‌دهد. بدون این پرچم، کامنت‌های نوع نادیده گرفته می‌شوند و فیلد ``type_comment`` در گره‌های AST انتخاب‌شده همیشه ``None`` خواهد بود. علاوه بر این، موقعیت‌های کامنت‌های ``# type: ignore`` به‌عنوان ویژگی ``type_ignores`` در :class:`Module` برگردانده می‌شوند (در غیر این صورت همیشه یک فهرست خالی است)." msgid "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to correspond to :pep:`484` \"signature type comments\", for example ``(str, int) -> List[str]``." msgstr "علاوه بر این، اگر ``mode`` برابر با ``'func_type'`` باشد، سینتکس ورودی برای تطابق با :pep:`484` «کامنت‌های نوع امضا» تغییر می‌کند، برای مثال ``(str, int) -> List[str]``." 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 "تنظیم ``feature_version`` به یک تاپل ``(major, minor)`` منجر به تلاش «بهترین تلاش» برای تجزیه با استفاده از دستور زبان آن نسخه از پایتون می‌شود. برای مثال، تنظیم ``feature_version=(3, 9)`` تلاش می‌کند تجزیه‌ی دستورهای :keyword:`match` را غیرمجاز کند. در حال حاضر ``major`` باید برابر با ``3`` باشد. کمترین نسخه‌ی پشتیبانی‌شده ``(3, 7)`` است (و ممکن است در نسخه‌های آینده‌ی پایتون افزایش یابد)؛ بیشترین نسخه ``sys.version_info[0:2]`` است. تلاش «بهترین تلاش» به این معناست که تضمینی وجود ندارد که تجزیه (یا موفقیت تجزیه) همانند حالتی باشد که در نسخه‌ی پایتون متناظر با ``feature_version`` اجرا می‌شود." msgid "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "اگر source حاوی یک نویسه‌ی نال (``\\0``) باشد، :exc:`ValueError` پرتاب می‌شود." 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 "توجه داشته باشید که تجزیه‌ی موفقیت‌آمیز کد منبع به یک شیء AST تضمین نمی‌کند که کد منبع ارائه‌شده، کد پایتون معتبری باشد که بتواند اجرا شود، زیرا مرحله‌ی کامپایل می‌تواند استثناهای بیشتری از نوع :exc:`SyntaxError` پرتاب کند. برای مثال، کد منبع ``return 42`` یک گره AST معتبر برای یک دستور return تولید می‌کند، اما نمی‌تواند به‌تنهایی کامپایل شود (باید داخل یک گره تابع باشد)." msgid "In particular, :func:`ast.parse` won't do any scoping checks, which the compilation step does." msgstr "به‌طور خاص، :func:`ast.parse` هیچ‌گونه بررسی محدوده‌ای انجام نمی‌دهد، در حالی که مرحله‌ی کامپایل این کار را انجام می‌دهد." 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 "ممکن است مفسر پایتون به دلیل محدودیت‌های عمق پشته در کامپایلر AST پایتون، با رشته‌ای به‌اندازه کافی بزرگ/پیچیده از کار بیفتد." msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "``type_comments``، ``mode='func_type'`` و ``feature_version`` افزوده شد." msgid "The minimum supported version for ``feature_version`` is now ``(3, 7)``. The ``optimize`` argument was added." msgstr "حداقل نسخه پشتیبانی‌شده برای ``feature_version`` اکنون ``(3, 7)`` است. آرگومان ``optimize`` افزوده شد." msgid "Added the *module* parameter." msgstr "پارامتر *module* اضافه شد." 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 "یک شیء :class:`ast.AST` را به کد بازگردانید و رشته‌ای حاوی کدی تولید کنید که اگر دوباره با :func:`ast.parse` تجزیه شود، یک شیء :class:`ast.AST` معادل تولید می‌کند." 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 "رشته‌ی کد تولیدشده لزوماً با کد اصلی که شیء :class:`ast.AST` را تولید کرده است برابر نخواهد بود (بدون هیچ‌گونه بهینه‌سازی کامپایلر، مانند تاپل‌ها/فروزن‌ست‌های ثابت)." msgid "Trying to unparse a highly complex expression would result with :exc:`RecursionError`." msgstr "تلاش برای بازگردانی (unparse) یک عبارت بسیار پیچیده منجر به :exc:`RecursionError` می‌شود." 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 "یک گره عبارت یا رشته‌ای را که فقط شامل یک لفظی پایتون یا نمایش ظرف (container display) باشد، ارزیابی می‌کند. رشته یا گره ارائه‌شده فقط می‌تواند شامل ساختارهای لفظی پایتون زیر باشد: رشته‌ها، بایت‌ها، اعداد، تاپل‌ها، فهرست‌ها، دیکشنری‌ها، مجموعه‌ها، بولی‌ها، ``None`` و ``Ellipsis``." 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 "می‌توان از این برای ارزیابی رشته‌های حاوی مقادیر پایتون استفاده کرد، بدون نیاز به اینکه خودتان مقادیر را تجزیه کنید. این مورد قادر به ارزیابی عبارت‌های با پیچیدگی دلخواه نیست، برای مثال عبارت‌هایی که شامل عملگرها یا اندیس‌دهی باشند." 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 "این تابع در گذشته بدون این‌که تعریف شود منظور از «امن» چیست، به‌عنوان «امن» مستند شده بود. این موضوع گمراه‌کننده بود. این تابع به‌طور خاص به‌گونه‌ای طراحی شده است که برخلاف :func:`eval` که عمومی‌تر است، کد پایتون را اجرا نکند. هیچ فضای نامی وجود ندارد، هیچ جست‌وجوی نامی انجام نمی‌شود، و هیچ امکانی برای فراخوانی بیرونی وجود ندارد. اما این تابع از حملات مصون نیست: یک ورودی نسبتاً کوچک می‌تواند به اتمام حافظه یا اتمام پشته C منجر شود و فرایند را از کار بیندازد. همچنین امکان ایجاد منع سرویس ناشی از مصرف بیش‌ازحد CPU در برخی ورودی‌ها وجود دارد. بنابراین فراخوانی آن با داده‌های غیرقابل‌اعتماد توصیه نمی‌شود." msgid "It is possible to crash the Python interpreter due to stack depth limitations in Python's AST compiler." msgstr "ممکن است مفسر پایتون به دلیل محدودیت‌های عمق پشته در کامپایلر AST پایتون از کار بیفتد." msgid "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:`MemoryError` and :exc:`RecursionError` depending on the malformed input." msgstr "ممکن است بسته به ورودی نامعتبر، :exc:`ValueError`، :exc:`TypeError`، :exc:`SyntaxError`، :exc:`MemoryError` و :exc:`RecursionError` پرتاب شوند." msgid "Now allows bytes and set literals." msgstr "اکنون مقادیر لفظی bytes و set را می‌پذیرد." msgid "Now supports creating empty sets with ``'set()'``." msgstr "اکنون از ایجاد مجموعه‌های خالی با ``'set()'`` پشتیبانی می‌شود." msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "برای ورودی‌های رشته‌ای، فاصله‌ها و تب‌های ابتدایی اکنون حذف می‌شوند." 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 "رشته مستندات مربوط به *node* داده‌شده را برمی‌گرداند (که باید یک گره از نوع :class:`FunctionDef`، :class:`AsyncFunctionDef`، :class:`ClassDef` یا :class:`Module` باشد)، یا اگر رشته مستندات نداشته باشد، ``None`` را برمی‌گرداند. اگر *clean* درست باشد، تورفتگی رشته مستندات را با :func:`inspect.cleandoc` مرتب می‌کند." msgid ":class:`AsyncFunctionDef` is now supported." msgstr "اکنون از :class:`AsyncFunctionDef` پشتیبانی می‌شود." 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 "قطعه‌ای از کد منبع *source* را که *node* را تولید کرده است، دریافت کنید. اگر برخی از اطلاعات موقعیت (:attr:`~ast.AST.lineno`، :attr:`~ast.AST.end_lineno`، :attr:`~ast.AST.col_offset`، یا :attr:`~ast.AST.end_col_offset`) موجود نباشد، ``None`` را برگردانید." msgid "If *padded* is ``True``, the first line of a multi-line statement will be padded with spaces to match its original position." msgstr "اگر *padded* برابر ``True`` باشد، نخستین خط از یک دستور چندخطی با فاصله‌ها پر می‌شود تا با موقعیت اصلی خود مطابقت کند." 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 "هنگامی که یک درخت گره را با :func:`compile` کامپایل می‌کنید، کامپایلر انتظار دارد که ویژگی‌های :attr:`~ast.AST.lineno` و :attr:`~ast.AST.col_offset` برای هر گره‌ای که از آن‌ها پشتیبانی می‌کند، وجود داشته باشند. تنظیم این ویژگی‌ها برای گره‌های تولیدشده نسبتاً خسته‌کننده است، بنابراین این کمک‌کننده این ویژگی‌ها را به‌صورت بازگشتی در مواردی که از قبل تنظیم نشده باشند، با تنظیم آن‌ها به مقادیر گره والد اضافه می‌کند. این کمک‌کننده به‌صورت بازگشتی از *node* شروع به کار می‌کند." 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 "شماره خط و شماره خط پایانی هر گره در درختی که از *node* شروع می‌شود را به مقدار *n* افزایش دهید. این کار برای «انتقال کد» به مکانی دیگر در یک پرونده مفید است." 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 "در صورت امکان، موقعیت منبع (:attr:`~ast.AST.lineno`، :attr:`~ast.AST.col_offset`، :attr:`~ast.AST.end_lineno` و :attr:`~ast.AST.end_col_offset`) را از *old_node* به *new_node* کپی کنید و *new_node* را برگردانید." msgid "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` that is present on *node*." msgstr "برای هر فیلد در ``node._fields`` که در *node* موجود است، یک تاپل از ``(fieldname, value)`` تولید می‌کند." 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 "تمام گره‌های فرزند مستقیم *node* را تولید (yield) می‌کند، یعنی تمام فیلدهایی که گره هستند و تمام آیتم‌های فیلدهایی که فهرست‌هایی از گره‌ها هستند." 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 "به‌صورت بازگشتی تمام گره‌های نواده در درختی که از *node* شروع می‌شود (از جمله خود *node*) را، بدون هیچ ترتیب مشخصی، تولید می‌کند. این در صورتی مفید است که فقط بخواهید گره‌ها را درجا تغییر دهید و به زمینه اهمیتی ندهید." 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 "یک کلاس پایه‌ی بازدیدکننده‌ی گره که درخت سینتکس انتزاعی را پیمایش می‌کند و برای هر گره‌ی یافت‌شده، یک تابع بازدیدکننده را فراخوانی می‌کند. این تابع ممکن است مقداری برگرداند که توسط متد :meth:`visit` ارسال می‌شود." msgid "This class is meant to be subclassed, with the subclass adding visitor methods." msgstr "این کلاس برای زیرکلاس‌سازی در نظر گرفته شده است، به‌طوری که زیرکلاس، متدهای بازدیدکننده (visitor) را اضافه می‌کند." 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 "از یک گره بازدید می‌کند. پیاده‌سازی پیش‌فرض، متدی به نام :samp:`self.visit_{classname}` را فراخوانی می‌کند که در آن *classname* نام کلاس گره است، یا اگر آن متد وجود نداشته باشد، :meth:`generic_visit` را فراخوانی می‌کند." msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "این بازدیدکننده، :meth:`visit` را روی تمام فرزندان گره فراخوانی می‌کند." 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 "توجه داشته باشید که گره‌های فرزندِ گره‌هایی که یک متد بازدیدکننده سفارشی دارند، بازدید نخواهند شد، مگر اینکه بازدیدکننده :meth:`generic_visit` را فراخوانی کند یا خودش آن‌ها را بازدید کند." msgid "Handles all constant nodes." msgstr "تمام گره‌های ثابت را مدیریت می‌کند." 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 "اگر می‌خواهید در حین پیمایش تغییراتی را به گره‌ها اعمال کنید، از :class:`NodeVisitor` استفاده نکنید. برای این منظور یک بازدیدکننده ویژه وجود دارد (:class:`NodeTransformer`) که امکان اصلاح را فراهم می‌کند." 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 "متدهای :meth:`!visit_Num`، :meth:`!visit_Str`، :meth:`!visit_Bytes`، :meth:`!visit_NameConstant` و :meth:`!visit_Ellipsis` در Python 3.14+ فراخوانی نخواهند شد. برای مدیریت همه گره‌های ثابت، در عوض متد :meth:`visit_Constant` را اضافه کنید." msgid "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and allows modification of nodes." msgstr "یک زیرکلاس از :class:`NodeVisitor` که درخت سینتکس انتزاعی را پیمایش می‌کند و امکان تغییر گره‌ها را فراهم می‌کند." 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 ":class:`NodeTransformer` درخت سینتکس انتزاعی (AST) را پیمایش می‌کند و از مقدار بازگشتی متدهای بازدیدکننده برای جایگزینی یا حذف گره قدیمی استفاده می‌کند. اگر مقدار بازگشتی متد بازدیدکننده ``None`` باشد، گره از موقعیت خود حذف می‌شود، در غیر این صورت با مقدار بازگشتی جایگزین می‌شود. ممکن است مقدار بازگشتی همان گره اصلی باشد که در این صورت هیچ جایگزینی انجام نمی‌شود." msgid "Here is an example transformer that rewrites all occurrences of name lookups (``foo``) to ``data['foo']``::" msgstr "در اینجا یک تبدیل‌کننده (transformer) مثال آمده است که همه‌ی موارد جست‌وجوی نام (``foo``) را به ``data['foo']`` بازنویسی می‌کند::" msgid "" "class RewriteName(NodeTransformer):\n" "\n" " def visit_Name(self, node):\n" " return Subscript(\n" " value=Name(id='data'),\n" " slice=Constant(value=node.id),\n" " ctx=node.ctx\n" " )" msgstr "" "class RewriteName(NodeTransformer):\n" "\n" " def visit_Name(self, node):\n" " return Subscript(\n" " value=Name(id='data'),\n" " slice=Constant(value=node.id),\n" " ctx=node.ctx\n" " )" 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 "به خاطر داشته باشید که اگر گره‌ای که روی آن کار می‌کنید گره‌های فرزند داشته باشد، باید یا گره‌های فرزند را خودتان تبدیل کنید یا ابتدا متد :meth:`~ast.NodeVisitor.generic_visit` را برای آن گره فراخوانی کنید." 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 "برای گره‌هایی که بخشی از مجموعه‌ای از دستورها بودند (این موضوع درباره همه گره‌های دستور صدق می‌کند)، بازدیدکننده همچنین می‌تواند به‌جای فقط یک گره واحد، فهرستی از گره‌ها را برگرداند." 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 "اگر :class:`NodeTransformer` گره‌های جدیدی را (که بخشی از درخت اصلی نبودند) بدون دادن اطلاعات مکان به آن‌ها (مانند :attr:`~ast.AST.lineno`) وارد کند، باید :func:`fix_missing_locations` با زیردرخت جدید فراخوانی شود تا اطلاعات مکان دوباره محاسبه شود::" msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" msgstr "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" msgid "Usually you use the transformer like this::" msgstr "معمولاً از تبدیل‌کننده (transformer) به این صورت استفاده می‌کنید::" msgid "node = YourTransformer().visit(node)" msgstr "node = YourTransformer().visit(node)" 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 "یک برون‌ریزی قالب‌بندی‌شده از درخت درون *node* برمی‌گرداند. این عمدتاً برای اهداف اشکال‌زدایی مفید است. اگر *annotate_fields* برابر true باشد (به‌طور پیش‌فرض)، رشته‌ی برگردانده‌شده نام‌ها و مقدارهای فیلدها را نشان می‌دهد. اگر *annotate_fields* برابر false باشد، رشته‌ی حاصل با حذف نام فیلدهای غیرمبهم فشرده‌تر خواهد بود. ویژگی‌هایی مانند شماره‌های خط و آفست‌های ستون به‌طور پیش‌فرض در خروجی آورده نمی‌شوند. اگر این مورد نظر باشد، می‌توان *include_attributes* را روی true تنظیم کرد." msgid "If *color* is ``True``, the returned string is syntax highlighted using ANSI escape sequences. If ``False`` (the default), colored output is always disabled." msgstr "اگر مقدار *color* برابر با ``True`` باشد، رشته‌ی خروجی با استفاده از دنباله‌های گریز ANSI برجسته‌سازی نحوی می‌شود. اگر ``False`` باشد (پیش‌فرض)، خروجی رنگی همیشه غیرفعال است." 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 "اگر *indent* یک عدد صحیح نامنفی یا رشته باشد، درخت با آن سطح تورفتگی به‌صورت خوانا چاپ می‌شود. سطح تورفتگی ۰، منفی، یا ``\"\"`` فقط سطرهای جدید درج می‌کند. ``None`` (پیش‌فرض) نمایش تک‌سطری را انتخاب می‌کند. استفاده از تورفتگی عدد صحیح مثبت، در هر سطح به همان تعداد فاصله تورفتگی ایجاد می‌کند. اگر *indent* یک رشته باشد (مانند ``\"\\t\"``)، از آن رشته برای تورفتگی هر سطح استفاده می‌شود." msgid "If *show_empty* is false (the default), optional empty lists and ``Load()`` values will be omitted from the output. Optional ``None`` values are always omitted." msgstr "اگر *show_empty* نادرست (پیش‌فرض) باشد، فهرست‌های خالی اختیاری و مقادیر ``Load()`` از خروجی حذف خواهند شد. مقادیر اختیاری ``None`` همیشه حذف می‌شوند." msgid "" ">>> tree = ast.parse('print(None)', '?', 'eval')\n" ">>> print(ast.dump(tree, indent=4))\n" "Expression(\n" " body=Call(\n" " func=Name(id='print'),\n" " args=[\n" " Constant(value=None)]))\n" ">>> print(ast.dump(tree, indent=4, show_empty=True))\n" "Expression(\n" " body=Call(\n" " func=Name(id='print', ctx=Load()),\n" " args=[\n" " Constant(value=None)],\n" " keywords=[]))" msgstr "" ">>> tree = ast.parse('print(None)', '?', 'eval')\n" ">>> print(ast.dump(tree, indent=4))\n" "Expression(\n" " body=Call(\n" " func=Name(id='print'),\n" " args=[\n" " Constant(value=None)]))\n" ">>> print(ast.dump(tree, indent=4, show_empty=True))\n" "Expression(\n" " body=Call(\n" " func=Name(id='print', ctx=Load()),\n" " args=[\n" " Constant(value=None)],\n" " keywords=[]))" msgid "Added the *indent* option." msgstr "گزینه‌ی *indent* افزوده شد." msgid "Added the *show_empty* option." msgstr "گزینه‌ی *show_empty* اضافه شد." msgid "Omit optional ``Load()`` values by default." msgstr "مقادیر اختیاری ``Load()`` را به‌طور پیش‌فرض حذف کنید." msgid "Added the *color* parameter." msgstr "پارامتر *color* اضافه شد." msgid "Recursively compares two ASTs." msgstr "دو AST را به‌صورت بازگشتی مقایسه می‌کند." 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 "*compare_attributes* بر اینکه آیا ویژگی‌های AST در مقایسه در نظر گرفته شوند یا خیر، تأثیر می‌گذارد. اگر *compare_attributes* برابر ``False`` (پیش‌فرض) باشد، ویژگی‌ها نادیده گرفته می‌شوند. در غیر این صورت، همه‌ی آن‌ها باید برابر باشند. این گزینه برای بررسی اینکه آیا ASTها از نظر ساختاری برابرند اما در فضای سفید یا جزئیات مشابه تفاوت دارند، مفید است. ویژگی‌ها شامل شماره‌ی سطرها و آفست‌های ستونی هستند." msgid "Compiler flags" msgstr "پرچم‌های کامپایلر" msgid "The following flags may be passed to :func:`compile` in order to change effects on the compilation of a program:" msgstr "پرچم‌های زیر را می‌توان برای تغییر اثرات بر کامپایل یک برنامه به :func:`compile` ارسال کرد:" msgid "Enables support for top-level ``await``, ``async for``, ``async with`` and async comprehensions." msgstr "پشتیبانی از ``await``، ``async for`` و ``async with`` در سطح بالا و درک‌های ناهمگام را فعال می‌کند." msgid "Generates and returns an abstract syntax tree instead of returning a compiled code object." msgstr "به‌جای برگرداندن یک شیء کد کامپایل‌شده، یک درخت سینتکس انتزاعی را تولید می‌کند و برمی‌گرداند." msgid "The returned AST is optimized according to the *optimize* argument in :func:`compile` or :func:`ast.parse`." msgstr "درخت سینتکس انتزاعی (AST) برگردانده‌شده بر اساس آرگومان *optimize* در :func:`compile` یا :func:`ast.parse` بهینه‌سازی شده است." msgid "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: ``, ``# type: ignore ``)." msgstr "پشتیبانی از کامنت‌های نوع به سبک :pep:`484` و :pep:`526` را فعال می‌کند (``# type: ``، ``# type: ignore ``)." msgid "Command-line usage" msgstr "استفاده از خط فرمان" msgid "The output is now syntax highlighted by default. This can be :ref:`controlled using environment variables `." msgstr "خروجی اکنون به‌طور پیش‌فرض دارای برجسته‌سازی نحوی است. این کار را می‌توان با :ref:`استفاده از متغیرهای محیطی ` کنترل کرد." msgid "The :mod:`!ast` module can be executed as a script from the command line. It is as simple as:" msgstr "ماژول :mod:`!ast` می‌تواند به‌عنوان یک اسکریپت از خط فرمان اجرا شود. این کار به سادگی زیر است:" msgid "python -m ast [-m ] [-a] [infile]" msgstr "python -m ast [-m ] [-a] [infile]" msgid "The following options are accepted:" msgstr "گزینه‌های زیر پذیرفته می‌شوند:" msgid "Show the help message and exit." msgstr "نمایش پیام راهنما و خروج." msgid "Specify what kind of code must be compiled, like the *mode* argument in :func:`parse`." msgstr "مشخص کنید که چه نوع کدی باید کامپایل شود، مانند آرگومان *mode* در :func:`parse`." msgid "Don't parse type comments." msgstr "کامنت‌های نوع را تجزیه نکنید." msgid "Include attributes such as line numbers and column offsets." msgstr "شامل ویژگی‌هایی مانند شماره سطرها و آفست‌های ستون (column offsets) باشد." msgid "Indentation of nodes in AST (number of spaces)." msgstr "تورفتگی گره‌ها در AST (تعداد فاصله‌ها)." msgid "Python version in the format 3.x (for example, 3.10). Defaults to the current version of the interpreter." msgstr "نسخه پایتون در قالب 3.x (برای مثال، 3.10). پیش‌فرض آن، نسخه فعلی مفسر است." msgid "Optimization level for parser. Defaults to no optimization." msgstr "سطح بهینه‌سازی برای پارسر . به‌طور پیش‌فرض بدون بهینه‌سازی است." msgid "Show empty lists and fields that are ``None``. Defaults to not showing empty objects." msgstr "نمایش فهرست‌های خالی و فیلدهایی که ``None`` هستند. به‌طور پیش‌فرض، اشیاء خالی نمایش داده نمی‌شوند." msgid "If :file:`infile` is specified its contents are parsed to AST and dumped to stdout. Otherwise, the content is read from stdin." msgstr "اگر :file:`infile` مشخص شده باشد، محتوای آن به AST تجزیه می‌شود و در stdout نوشته می‌شود. در غیر این صورت، محتوا از stdin خوانده می‌شود." msgid "`Green Tree Snakes `_, an external documentation resource, has good details on working with Python ASTs." msgstr "`Green Tree Snakes `_، یک منبع خارجی مستندات، جزئیات خوبی درباره‌ی کار با ASTهای پایتون دارد." 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 "`ASTTokens `_ ASTهای پایتون را با موقعیت‌های توکن‌ها و متن در کد منبعی که آن‌ها را تولید کرده است، حاشیه‌نویسی می‌کند. این موضوع برای ابزارهایی که تبدیل‌هایی روی کد منبع انجام می‌دهند، مفید است." 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 "`leoAst.py `_ نمایش‌های مبتنی بر توکن و مبتنی بر درخت تجزیه از برنامه‌های پایتون را با درج پیوندهای دوطرفه میان توکن‌ها و گره‌های AST یکپارچه می‌کند." 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 "`LibCST `_ کد را به‌صورت یک درخت سینتکس عینی (Concrete Syntax Tree) تجزیه می‌کند که شبیه به یک درخت ast است و تمام جزئیات قالب‌بندی را حفظ می‌کند. این برای ساخت برنامه‌های بازسازی خودکار (codemod) و لینترها مفید است." 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 "`Parso `_ یک پارسر پایتون است که از بازیابی خطا و تجزیه‌ی رفت‌وبرگشتی برای نسخه‌های مختلف پایتون (در چندین نسخه‌ی پایتون) پشتیبانی می‌کند. Parso همچنین می‌تواند چندین خطای سینتکسی را در پرونده پایتون شما فهرست کند." msgid "? (question mark)" msgstr "? (علامت سؤال)" msgid "in AST grammar" msgstr "در دستور زبان AST" msgid "* (asterisk)" msgstr "* (ستاره)" #~ 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 "" #~ ">>> 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=[])"