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

Function read_optional_block

mypy/nativeparse.py:1212–1227  ·  view source on GitHub ↗
(state: State, data: ReadBuffer)

Source from the content-addressed store, hash-verified

1210
1211
1212def read_optional_block(state: State, data: ReadBuffer) -> Block | None:
1213 expect_tag(data, nodes.BLOCK)
1214 expect_tag(data, LIST_GEN)
1215 n = read_int_bare(data)
1216 is_unreachable = read_bool(data)
1217 if n == 0:
1218 b = None
1219 else:
1220 a = [read_statement(state, data) for i in range(n)]
1221 b = Block(a, is_unreachable=is_unreachable)
1222 b.line = a[0].line
1223 b.column = a[0].column
1224 b.end_line = a[-1].end_line
1225 b.end_column = a[-1].end_column
1226 expect_end_tag(data)
1227 return b
1228
1229
1230bin_ops: Final = ["+", "-", "*", "@", "/", "%", "**", "<<", ">>", "|", "^", "&", "//"]

Callers 1

read_statementFunction · 0.85

Calls 5

BlockClass · 0.90
expect_tagFunction · 0.85
read_statementFunction · 0.85
rangeClass · 0.85
expect_end_tagFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…