diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-03-05 12:09:12 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-03-05 13:31:39 -0700 |
commit | 342f074eb412e4cc19ab31a35a4ca04449e61597 (patch) | |
tree | 78c3e4656d6718c427ea9e9b578ad7f64330a82a /tools/c_coverage/c_coverage_report.py | |
parent | 9311fb7e861e2c8eb686abded01c059b49f0b5e4 (diff) | |
download | numpy-342f074eb412e4cc19ab31a35a4ca04449e61597.tar.gz |
2to3: Remove xreadlines and replace f.readlines() by f where valid.
An open file `f` has been an iterator since python2.3 and
`f.xreadlines()` is no longer needed, so replace it with `f`. Also
replace `f.readlines()` with `f` where an iterator will do. The
replacement of `f.readlines()` is not critical because it is a list in
both python2 and python3, but the code is a bit cleaner.
Closes #3093
Diffstat (limited to 'tools/c_coverage/c_coverage_report.py')
-rwxr-xr-x | tools/c_coverage/c_coverage_report.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/c_coverage/c_coverage_report.py b/tools/c_coverage/c_coverage_report.py index 48f1eb8dc..e4522bd92 100755 --- a/tools/c_coverage/c_coverage_report.py +++ b/tools/c_coverage/c_coverage_report.py @@ -58,7 +58,7 @@ class SourceFile: def write_text(self, fd): source = open(self.path, "r") - for i, line in enumerate(source.readlines()): + for i, line in enumerate(source): if i + 1 in self.lines: fd.write("> ") else: @@ -128,7 +128,7 @@ def collect_stats(files, fd, pattern): current_file = None current_function = None - for i, line in enumerate(fd.readlines()): + for i, line in enumerate(fd): if re.match("f[lie]=.+", line): path = line.split('=', 2)[1].strip() if os.path.exists(path) and re.search(pattern, path): |