From d40a92b3f09bcf755c86af59647ffb08c9082870 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Mon, 9 Aug 2004 03:28:45 +0000 Subject: [PATCH] Indent body of _EXAMPLE_RE for readability. _IS_BLANK_OR_COMMENT makes more sense as a callable. --- Lib/doctest.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Lib/doctest.py b/Lib/doctest.py index ccb1592cf16..23e1d843ba3 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -590,18 +590,18 @@ def __init__(self, name, string): self.string = string.expandtabs() _EXAMPLE_RE = re.compile(r''' - # Source consists of a PS1 line followed by zero or more PS2 lines. - (?P - (?:^(?P [ ]*) >>> .*) # PS1 line - (?:\n [ ]* \.\.\. .*)*) # PS2 lines - \n? - # Want consists of any non-blank lines that do not start with PS1. - (?P (?:(?![ ]*$) # Not a blank line - (?![ ]*>>>) # Not a line starting with PS1 - .*$\n? # But any other line - )*) - ''', re.MULTILINE | re.VERBOSE) - _IS_BLANK_OR_COMMENT = re.compile('^[ ]*(#.*)?$') + # Source consists of a PS1 line followed by zero or more PS2 lines. + (?P + (?:^(?P [ ]*) >>> .*) # PS1 line + (?:\n [ ]* \.\.\. .*)*) # PS2 lines + \n? + # Want consists of any non-blank lines that do not start with PS1. + (?P (?:(?![ ]*$) # Not a blank line + (?![ ]*>>>) # Not a line starting with PS1 + .*$\n? # But any other line + )*) + ''', re.MULTILINE | re.VERBOSE) + _IS_BLANK_OR_COMMENT = re.compile('^[ ]*(#.*)?$').match def get_examples(self): """ @@ -638,7 +638,7 @@ def get_examples(self): # Extract source/want from the regexp match. (source, want) = self._parse_example(m, lineno) - if self._IS_BLANK_OR_COMMENT.match(source): + if self._IS_BLANK_OR_COMMENT(source): continue examples.append( Example(source, want, lineno) )