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)
| 266 | return source, options, want, exc_msg |
| 267 | |
| 268 | def _check_prompt_blank(self, lines, indent, name, lineno, ps1_len): |
| 269 | """ |
| 270 | Given the lines of a source string (including prompts and |
| 271 | leading indentation), check to make sure that every prompt is |
| 272 | followed by a space character. If any line is not followed by |
| 273 | a space character, then raise ValueError. |
| 274 | |
| 275 | Note: IPython-modified version which takes the input prompt length as a |
| 276 | parameter, so that prompts of variable length can be dealt with. |
| 277 | """ |
| 278 | space_idx = indent+ps1_len |
| 279 | min_len = space_idx+1 |
| 280 | for i, line in enumerate(lines): |
| 281 | if len(line) >= min_len and line[space_idx] != ' ': |
| 282 | raise ValueError('line %r of the docstring for %s ' |
| 283 | 'lacks blank after %s: %r' % |
| 284 | (lineno+i+1, name, |
| 285 | line[indent:space_idx], line)) |
| 286 | |
| 287 | |
| 288 | SKIP = doctest.register_optionflag('SKIP') |