Skip to main content Crate rustpython_ruff_python_ast Copy item path Source pub use operator_precedence ::*;comparable An equivalent object hierarchy to the RustPython AST hierarchy, but with the
ability to compare expressions for equality (via Eq and Hash ). docstrings Utilities for parsing Python docstrings. find_node helpers identifier Extract TextRange information from AST nodes. name operator_precedence parenthesize relocate script statement_visitor Specialized AST visitor trait and walk functions that only visit statements. stmt_if str str_prefix token Token kinds for Python source code created by the lexer and consumed by the ruff_python_parser. traversal Utilities for manually traversing a Python AST. types visitor AST visitor trait and walk functions. whitespace Alias See also alias AnyStringFlags Arguments An AST node used to represent the arguments passed to a function call or class definition. ArgumentsSourceOrder The iterator returned by Arguments::arguments_source_order . AtomicNodeIndex A unique index for a node within an AST. BytesLiteral An AST node that represents a single bytes literal which is part of an
ExprBytesLiteral . BytesLiteralFlags Flags that can be queried to obtain information
regarding the prefixes and quotes used for a bytes literal. BytesLiteralValue The value representing a ExprBytesLiteral . Comprehension See also comprehension DebugText Decorator See also decorator DictItem Represents an item in a dictionary literal display . DictKeyIterator DictValueIterator DisplayFlags ElifElseClause ExceptHandlerExceptHandler See also ExceptHandler ExprAttribute See also Attribute ExprAwait See also Await ExprBinOp See also BinOp ExprBoolOp See also BoolOp ExprBooleanLiteral ExprBytesLiteral An AST node that represents either a single-part bytestring literal
or an implicitly concatenated bytestring literal. ExprCall See also Call ExprCompare See also Compare ExprDict See also Dict ExprDictComp See also DictComp ExprEllipsisLiteral ExprFString An AST node that represents either a single-part f-string literal
or an implicitly concatenated f-string literal. ExprGenerator See also GeneratorExp ExprIf See also IfExp ExprIpyEscapeCommand An AST node used to represent a IPython escape command at the expression level. ExprLambda See also Lambda ExprList See also List ExprListComp See also ListComp ExprName See also Name ExprNamed See also NamedExpr ExprNoneLiteral ExprNumberLiteral ExprSet See also Set ExprSetComp See also SetComp ExprSlice See also Slice ExprStarred See also Starred ExprStringLiteral An AST node that represents either a single-part string literal
or an implicitly concatenated string literal. ExprSubscript See also Subscript ExprTString An AST node that represents either a single-part t-string literal
or an implicitly concatenated t-string literal. ExprTuple See also Tuple ExprUnaryOp See also UnaryOp ExprYield See also Yield ExprYieldFrom See also YieldFrom FString An AST node that represents a single f-string which is part of an ExprFString . FStringFlags Flags that can be queried to obtain information
regarding the prefixes and quotes used for an f-string. FStringValue The value representing an ExprFString . Identifier An Identifier with an empty id is invalid. Int A Python integer literal. Represents both small (fits in an i64) and large integers. InterpolatedElement See also FormattedValue InterpolatedStringElements A newtype wrapper around a list of InterpolatedStringElement . InterpolatedStringFormatSpec InterpolatedStringLiteralElement An FStringLiteralElement with an empty value is an invalid f-string element. IrrefutablePattern Keyword See also keyword MatchCase See also match_case ModExpression See also Module ModModule See also Module NodeIndex A unique index for a node within an AST. Parameter See also arg ParameterWithDefault An alternative type of AST arg. This is used for each function argument that might have a default value.
Used by Arguments original type. Parameters An alternative type of AST arguments. This is ruff_python_parser-friendly and human-friendly definition of function arguments.
This form also has advantage to implement pre-order traverse. ParametersIterator ParametersSourceOrderIterator The iterator returned by Parameters::iter_source_order . PatternArguments An AST node to represent the arguments to a crate::PatternMatchClass , i.e., the
parenthesized contents in case Point(1, x=0, y=0). PatternArgumentsSourceOrder The iterator returned by PatternArguments::patterns_source_order . PatternKeyword An AST node to represent the keyword arguments to a crate::PatternMatchClass , i.e., the
x=0 and y=0 in case Point(x=0, y=0). PatternMatchAs See also MatchAs PatternMatchClass See also MatchClass PatternMatchMapping See also MatchMapping PatternMatchOr See also MatchOr PatternMatchSequence See also MatchSequence PatternMatchSingleton See also MatchSingleton PatternMatchStar See also MatchStar PatternMatchValue See also MatchValue PythonVersion Representation of a Python version. StmtAnnAssign See also AnnAssign StmtAssert See also Assert StmtAssign See also Assign StmtAugAssign See also AugAssign StmtBreak See also Break StmtClassDef See also ClassDef StmtContinue See also Continue StmtDelete See also Delete StmtExpr See also Expr StmtFor See also For
and AsyncFor . StmtFunctionDef See also FunctionDef
and AsyncFunctionDef . StmtGlobal See also Global StmtIf See also If StmtImport See also Import StmtImportFrom See also ImportFrom StmtIpyEscapeCommand An AST node used to represent a IPython escape command at the statement level. StmtMatch See also Match StmtNonlocal See also Nonlocal StmtPass See also Pass StmtRaise See also Raise StmtReturn See also Return StmtTry See also Try
and TryStar StmtTypeAlias See also TypeAlias StmtWhile See also While
and AsyncWhile . StmtWith See also With
and AsyncWith . StringLiteral An AST node that represents a single string literal which is part of an
ExprStringLiteral . StringLiteralFlags Flags that can be queried to obtain information
regarding the prefixes and quotes used for a string literal. StringLiteralValue The value representing a ExprStringLiteral . TString An AST node that represents a single t-string which is part of an ExprTString . TStringFlags Flags that can be queried to obtain information
regarding the prefixes and quotes used for an f-string. TStringValue The value representing an ExprTString . TypeParamParamSpec See also ParamSpec TypeParamTypeVar See also TypeVar TypeParamTypeVarTuple See also TypeVarTuple TypeParams An AST node used to represent a sequence of type parameters. WithItem See also withitem AnyNodeRef A flattened enumeration of all AST nodes. AnyParameterRef Enumeration of the two kinds of parameter AnyRootNodeRef An enumeration of all AST nodes. ArgOrKeyword An entry in the argument list of a function call. BoolOp See also boolop CmpOp See also cmpop ConversionFlag Transforms a value prior to formatting it. ExceptHandler See also excepthandler ExceptHandlerRef See also excepthandler Expr See also expr ExprContext See also expr_context ExprRef See also expr FStringPart An f-string part which is either a string literal or an f-string. InterpolatedStringElement InterpolatedStringElementRef IpyEscapeKind The kind of escape command as defined in IPython Syntax in the IPython codebase. IrrefutablePatternKind LiteralExpressionRef Unowned pendant to all the literal variants of ast::Expr that stores a
reference instead of an owned value. Mod See also mod ModRef See also mod NodeIndexError NodeKind Number Operator See also operator Pattern See also pattern PatternOrKeyword An entry in the argument list of a class pattern. PatternRef See also pattern PySourceType PythonVersionDeserializationError Singleton SourceType The type of a source file. Stmt See also stmt StmtRef See also stmt StringLike An enum that holds a reference to a string-like expression from the AST. This includes string
literals, bytes literals, f-strings, and t-strings. StringLikePart An enum that holds a reference to an individual part of a string-like expression. StringLikePartIter An iterator over all the StringLikePart of a string-like expression. TomlSourceType TypeParam See also type_param TypeParamRef See also type_param UnaryOp See also unaryop MAX_REAL_INDEX HasNodeIndex An AST node that has an index. StringFlags sub_ast_level sub-AST level is stored in the top two bits sub_indices Get the first and last index of the sub-AST of the input Suite A suite represents a Vec of Stmt .