MCPcopy Index your code
hub / github.com/python/cpython / get_para_line_numbers

Function get_para_line_numbers

Doc/tools/check-warnings.py:103–114  ·  view source on GitHub ↗

Get the line numbers of text in a file object, grouped by paragraph.

(file_obj: TextIO)

Source from the content-addressed store, hash-verified

101
102
103def 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
117def filter_and_parse_warnings(

Callers 1

filter_warnings_by_diffFunction · 0.85

Calls 3

enumerateFunction · 0.85
stripMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…