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

    Function incrementLineno

    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 increments the lineno and end_lineno of node and all its descendants by n, mirroring CPython's ast.increment_lineno. Useful when splicing a parsed AST fragment into a larger source file at a known line offset.

      Parameters

      • node: ASTNode

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

      • n: number = 1

        Number of lines to add to every line number (default 1).

      Returns ASTNode

      node, mutated in place.