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

Method _check_prompt_blank

IPython/testing/plugin/ipdoctest.py:544–561  ·  view source on GitHub ↗

Given the lines of a source string (including prompts and leading indentation), check to make sure that every prompt is followed by a space character. If any line is not followed by a space character, then raise ValueError. Note: IPython-modified version wh

(self, lines, indent, name, lineno, ps1_len)

Source from the content-addressed store, hash-verified

542 return source, options, want, exc_msg
543
544 def _check_prompt_blank(self, lines, indent, name, lineno, ps1_len):
545 """
546 Given the lines of a source string (including prompts and
547 leading indentation), check to make sure that every prompt is
548 followed by a space character. If any line is not followed by
549 a space character, then raise ValueError.
550
551 Note: IPython-modified version which takes the input prompt length as a
552 parameter, so that prompts of variable length can be dealt with.
553 """
554 space_idx = indent+ps1_len
555 min_len = space_idx+1
556 for i, line in enumerate(lines):
557 if len(line) >= min_len and line[space_idx] != ' ':
558 raise ValueError('line %r of the docstring for %s '
559 'lacks blank after %s: %r' %
560 (lineno+i+1, name,
561 line[indent:space_idx], line))
562
563
564SKIP = doctest.register_optionflag('SKIP')

Callers 1

_parse_exampleMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected