Return a stripped copy of l. Strip whitespace at the end of all lines, and strip all empty lines from the end of the array.
(l: list[str])
| 502 | |
| 503 | |
| 504 | def strip_list(l: list[str]) -> list[str]: |
| 505 | """Return a stripped copy of l. |
| 506 | |
| 507 | Strip whitespace at the end of all lines, and strip all empty |
| 508 | lines from the end of the array. |
| 509 | """ |
| 510 | |
| 511 | r: list[str] = [] |
| 512 | for s in l: |
| 513 | # Strip spaces at end of line |
| 514 | r.append(re.sub(r"\s+$", "", s)) |
| 515 | |
| 516 | while r and r[-1] == "": |
| 517 | r.pop() |
| 518 | |
| 519 | return r |
| 520 | |
| 521 | |
| 522 | def collapse_line_continuation(l: list[str]) -> list[str]: |
no test coverage detected
searching dependent graphs…