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

Function build_fstring_join

mypy/nativeparse.py:1578–1592  ·  view source on GitHub ↗
(data: ReadBuffer, items: list[Expression])

Source from the content-addressed store, hash-verified

1576
1577
1578def build_fstring_join(data: ReadBuffer, items: list[Expression]) -> Expression:
1579 items = collapse_consecutive_str_items(items)
1580 if len(items) == 1:
1581 expr = items[0]
1582 read_loc(data, expr)
1583 return expr
1584 args = ListExpr(items)
1585 str_expr = StrExpr("")
1586 member = MemberExpr(str_expr, "join")
1587 call = CallExpr(member, [args], [ARG_POS], [None])
1588 read_loc(data, call)
1589 set_line_column(args, call)
1590 set_line_column(str_expr, call)
1591 set_line_column(member, call)
1592 return call
1593
1594
1595def collapse_consecutive_str_items(items: list[Expression]) -> list[Expression]:

Callers 2

read_expressionFunction · 0.85
read_fstring_itemsFunction · 0.85

Calls 8

ListExprClass · 0.90
StrExprClass · 0.90
MemberExprClass · 0.90
CallExprClass · 0.90
lenFunction · 0.85
read_locFunction · 0.85
set_line_columnFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…