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

Function last_blank

IPython/core/inputsplitter.py:205–217  ·  view source on GitHub ↗

Determine if the input source ends in a blank. A blank is either a newline or a line consisting of whitespace. Parameters ---------- src : string A single or multiline string.

(src)

Source from the content-addressed store, hash-verified

203
204
205def last_blank(src):
206 """Determine if the input source ends in a blank.
207
208 A blank is either a newline or a line consisting of whitespace.
209
210 Parameters
211 ----------
212 src : string
213 A single or multiline string.
214 """
215 if not src: return False
216 ll = src.splitlines()[-1]
217 return (ll == '') or ll.isspace()
218
219
220last_two_blanks_re = re.compile(r'\n\s*\n\s*$', re.MULTILINE)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected