MCPcopy Create free account
hub / github.com/ipython/ipython / leading_empty_lines

Function leading_empty_lines

IPython/core/inputtransformer2.py:21–32  ·  view source on GitHub ↗

Remove leading empty lines If the leading lines are empty or contain only whitespace, they will be removed.

(lines)

Source from the content-addressed store, hash-verified

19_indent_re = re.compile(r'^[ \t]+')
20
21def leading_empty_lines(lines):
22 """Remove leading empty lines
23
24 If the leading lines are empty or contain only whitespace, they will be
25 removed.
26 """
27 if not lines:
28 return lines
29 for i, line in enumerate(lines):
30 if line and not line.isspace():
31 return lines[i:]
32 return lines
33
34def leading_indent(lines):
35 """Remove leading indentation.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected