MCPcopy
hub / github.com/google/python-fire / _strip_blank_lines

Function _strip_blank_lines

fire/docstrings.py:211–231  ·  view source on GitHub ↗

Removes lines containing only blank characters before and after the text. Args: lines: A list of lines. Returns: A list of lines without trailing or leading blank lines.

(lines)

Source from the content-addressed store, hash-verified

209
210
211def _strip_blank_lines(lines):
212 """Removes lines containing only blank characters before and after the text.
213
214 Args:
215 lines: A list of lines.
216 Returns:
217 A list of lines without trailing or leading blank lines.
218 """
219 # Find the first non-blank line.
220 start = 0
221 num_lines = len(lines)
222 while lines and start < num_lines and _is_blank(lines[start]):
223 start += 1
224
225 lines = lines[start:]
226
227 # Remove trailing blank lines.
228 while lines and _is_blank(lines[-1]):
229 lines.pop()
230
231 return lines
232
233
234def _is_blank(line):

Callers 1

parseFunction · 0.85

Calls 1

_is_blankFunction · 0.85

Tested by

no test coverage detected