diff options
-rw-r--r-- | coverage/html.py | 3 | ||||
-rw-r--r-- | coverage/parser.py | 4 | ||||
-rw-r--r-- | igor.py | 6 | ||||
-rw-r--r-- | lab/parser.py | 3 |
4 files changed, 7 insertions, 9 deletions
diff --git a/coverage/html.py b/coverage/html.py index d8779233..e1966bfb 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -186,8 +186,7 @@ class HtmlReporter(Reporter): lines = [] - for lineno, line in enumerate(source_token_lines(source)): - lineno += 1 # 1-based line numbers. + for lineno, line in enumerate(source_token_lines(source), start=1): # Figure out how to mark this line. line_class = [] annotate_html = "" diff --git a/coverage/parser.py b/coverage/parser.py index 7e194705..f2885c07 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -79,9 +79,9 @@ class CodeParser(object): """ regex_c = re.compile(join_regex(regexes)) matches = set() - for i, ltext in enumerate(self.lines): + for i, ltext in enumerate(self.lines, start=1): if regex_c.search(ltext): - matches.add(i+1) + matches.add(i) return matches def _raw_parse(self): @@ -158,17 +158,17 @@ def do_check_eol(): checked.add(fname) line = None - for n, line in enumerate(open(fname, "rb")): + for n, line in enumerate(open(fname, "rb"), start=1): if crlf: if "\r" in line: - print("%s@%d: CR found" % (fname, n+1)) + print("%s@%d: CR found" % (fname, n)) return if trail_white: line = line[:-1] if not crlf: line = line.rstrip('\r') if line.rstrip() != line: - print("%s@%d: trailing whitespace found" % (fname, n+1)) + print("%s@%d: trailing whitespace found" % (fname, n)) return if line is not None and not line.strip(): diff --git a/lab/parser.py b/lab/parser.py index 4e19d411..a8e03eec 100644 --- a/lab/parser.py +++ b/lab/parser.py @@ -86,8 +86,7 @@ class ParserMain(object): exit_counts = cp.exit_counts() - for i, ltext in enumerate(cp.lines): - lineno = i+1 + for lineno, ltext in enumerate(cp.lines, start=1): m0 = m1 = m2 = m3 = a = ' ' if lineno in cp.statement_starts: m0 = '-' |