Get the line numbers of text in a file object, grouped by paragraph.
(file_obj: TextIO)
| 101 | |
| 102 | |
| 103 | def get_para_line_numbers(file_obj: TextIO) -> list[list[int]]: |
| 104 | """Get the line numbers of text in a file object, grouped by paragraph.""" |
| 105 | paragraphs = [] |
| 106 | prev_line = None |
| 107 | for lineno, line in enumerate(file_obj): |
| 108 | lineno = lineno + 1 |
| 109 | if prev_line is None or (line.strip() and not prev_line.strip()): |
| 110 | paragraph = [lineno - 1] |
| 111 | paragraphs.append(paragraph) |
| 112 | paragraph.append(lineno) |
| 113 | prev_line = line |
| 114 | return paragraphs |
| 115 | |
| 116 | |
| 117 | def filter_and_parse_warnings( |
no test coverage detected
searching dependent graphs…