summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coverage/html.py3
-rw-r--r--coverage/parser.py4
-rw-r--r--igor.py6
-rw-r--r--lab/parser.py3
4 files changed, 7 insertions, 9 deletions
diff --git a/coverage/html.py b/coverage/html.py
index d877923..e1966bf 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 7e19470..f2885c0 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):
diff --git a/igor.py b/igor.py
index 6c5d56b..f7879d7 100644
--- a/igor.py
+++ b/igor.py
@@ -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 4e19d41..a8e03ee 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 = '-'