Append `leaf` to current line or to new line if appending impossible.
(leaf: Leaf)
| 1394 | trailing_comma_safe = True |
| 1395 | |
| 1396 | def append_to_line(leaf: Leaf) -> Iterator[Line]: |
| 1397 | """Append `leaf` to current line or to new line if appending impossible.""" |
| 1398 | nonlocal current_line |
| 1399 | try: |
| 1400 | current_line.append_safe(leaf, preformatted=True) |
| 1401 | except ValueError: |
| 1402 | yield current_line |
| 1403 | |
| 1404 | current_line = Line( |
| 1405 | mode=line.mode, depth=line.depth, inside_brackets=line.inside_brackets |
| 1406 | ) |
| 1407 | current_line.append(leaf) |
| 1408 | |
| 1409 | def append_comments(leaf: Leaf) -> Iterator[Line]: |
| 1410 | for comment_after in line.comments_after(leaf): |
no test coverage detected