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

Function strip_list

mypy/test/data.py:504–519  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

502
503
504def 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
522def collapse_line_continuation(l: list[str]) -> list[str]:

Callers 1

parse_test_dataFunction · 0.85

Calls 2

appendMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…