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

Function collapse_consecutive_str_items

mypy/nativeparse.py:1595–1608  ·  view source on GitHub ↗
(items: list[Expression])

Source from the content-addressed store, hash-verified

1593
1594
1595def collapse_consecutive_str_items(items: list[Expression]) -> list[Expression]:
1596 if len(items) <= 1:
1597 return items
1598 last = items[0]
1599 new_items = [last]
1600 for item in items[1:]:
1601 if isinstance(last, StrExpr) and isinstance(item, StrExpr):
1602 last.value += item.value
1603 last.end_line = item.end_line
1604 last.end_column = item.end_column
1605 else:
1606 new_items.append(item)
1607 last = item
1608 return new_items
1609
1610
1611def read_fstring_item(state: State, data: ReadBuffer) -> Expression:

Callers 1

build_fstring_joinFunction · 0.85

Calls 3

lenFunction · 0.85
isinstanceFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…