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)
| 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 | |
| 564 | SKIP = doctest.register_optionflag('SKIP') |