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

    Function fixMissingLocations

    Parser entry points and location-manipulation helpers.

    • parse / parseFile — parse Python source (or a file on disk) into an AST.
    • literalEval — safely evaluate a literal expression node, mirroring ast.literal_eval.
    • fixMissingLocations — fill in missing lineno/col_offset info on a hand-built tree by copying it from parent nodes.
    • copyLocation — copy location info from one node to another.
    • incrementLineno — shift every line number in a tree by an offset.
    • ParseOptions — options accepted by parse.
    • Recursively fills in missing lineno/col_offset/end_lineno/ end_col_offset fields on node and all its descendants by inheriting them from the nearest ancestor that has them (or (1, 0, 1, 0) at the root), mirroring CPython's ast.fix_missing_locations. Useful after hand-constructing or transforming AST nodes that lack location info.

      Parameters

      • node: ASTNode

        The AST node (typically a Module) to fix in place.

      Returns ASTNode

      node, mutated in place.