module documentation

Helpers for AST (Abstract Syntax Tree).

Unknown Field: copyright
Copyright 2007-2022 by the Sphinx team, see AUTHORS.
Unknown Field: license
BSD, see LICENSE for details.
Constant OPERATORS Undocumented
Class _​Unparse​Visitor No class docstring; 0/1 instance variable, 1/25 method documented
Function parse Parse the code using the built-in ast or typed_ast libraries.
Function unparse Unparse an AST to string.
OPERATORS: Dict[Type[ast.AST], str] =

Undocumented

Value
{ast.Add: '+',
 ast.And: 'and',
 ast.BitAnd: '&',
 ast.BitOr: '|',
 ast.BitXor: '^',
 ast.Div: '/',
 ast.FloorDiv: '//',
...
def parse(code, mode='exec'):

Parse the code using the built-in ast or typed_ast libraries.

This enables "type_comments" feature if possible.

Parameters
code:strUndocumented
mode:strUndocumented
Returns
ast.ASTUndocumented
def unparse(node, code=''):
Unparse an AST to string.
Parameters
node:Optional[ast.AST]Undocumented
code:strUndocumented
Returns
Optional[str]Undocumented