MCPcopy Index your code
hub / github.com/python/mypy / set_block_lines

Method set_block_lines

mypy/fastparse.py:584–597  ·  view source on GitHub ↗
(self, b: Block, stmts: Sequence[ast3.stmt])

Source from the content-addressed store, hash-verified

582 return op_name
583
584 def set_block_lines(self, b: Block, stmts: Sequence[ast3.stmt]) -> None:
585 first, last = stmts[0], stmts[-1]
586 b.line = first.lineno
587 b.column = first.col_offset
588 b.end_line = last.end_lineno
589 b.end_column = last.end_col_offset
590 if not b.body:
591 return
592 new_first = b.body[0]
593 if isinstance(new_first, (Decorator, OverloadedFuncDef)):
594 # Decorated function lines are different between Python versions.
595 # copy the normalization we do for them to block first lines.
596 b.line = new_first.line
597 b.column = new_first.column
598
599 def as_block(self, stmts: list[ast3.stmt]) -> Block | None:
600 b = None

Callers 3

translate_stmt_listMethod · 0.95
as_blockMethod · 0.95
as_required_blockMethod · 0.95

Calls 1

isinstanceFunction · 0.85

Tested by

no test coverage detected