MCPcopy
hub / github.com/psf/black / maybe_append_string_operators

Method maybe_append_string_operators

src/black/trans.py:1548–1559  ·  view source on GitHub ↗

Side Effects: If @line starts with a string operator and this is the first line we are constructing, this function appends the string operator to @new_line and replaces the old string operator leaf in the node structure. Ot

(new_line: Line)

Source from the content-addressed store, hash-verified

1546 )
1547
1548 def maybe_append_string_operators(new_line: Line) -> None:
1549 """
1550 Side Effects:
1551 If @line starts with a string operator and this is the first
1552 line we are constructing, this function appends the string
1553 operator to @new_line and replaces the old string operator leaf
1554 in the node structure. Otherwise this function does nothing.
1555 """
1556 maybe_prefix_leaves = string_op_leaves if first_string_line else []
1557 for i, prefix_leaf in enumerate(maybe_prefix_leaves):
1558 replace_child(LL[i], prefix_leaf)
1559 new_line.append(prefix_leaf)
1560
1561 ends_with_comma = (
1562 is_valid_index(string_idx + 1) and LL[string_idx + 1].type == token.COMMA

Callers

nothing calls this directly

Calls 2

replace_childFunction · 0.90
appendMethod · 0.45

Tested by

no test coverage detected