py-ast - v1.16.0
    Preparing search index...

    Function unparse

    Convert an AST node back into Python source code.

    ./unparser.js for the implementation.

    • Convert an AST node back into Python source code.

      Parameters

      • node: ASTNodeUnion

        The AST node to unparse (typically a Module, but any node reachable from the visitor is supported).

      • options: { indent?: string } = {}

        Unparsing options.

        • Optionalindent?: string

          Indentation unit to use for nested blocks. If omitted, it is auto-detected from node via detectIndentStyle.

      Returns string

      The generated Python source text.