diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-08-10 16:15:00 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-08-10 16:15:00 -0400 |
commit | 90bb6a77e02cbac6a23723b5907d5f59d1db1b82 (patch) | |
tree | 35fcc2fc1063b0142985ca17149abbe83fdb5d09 /coverage/sqldata.py | |
parent | 02b2bd8afe3cd171e4bd454ccf244f788ccded3c (diff) | |
download | python-coveragepy-git-90bb6a77e02cbac6a23723b5907d5f59d1db1b82.tar.gz |
Move a common method outside the data classes
Diffstat (limited to 'coverage/sqldata.py')
-rw-r--r-- | coverage/sqldata.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/coverage/sqldata.py b/coverage/sqldata.py index 80188fca..25a6d62d 100644 --- a/coverage/sqldata.py +++ b/coverage/sqldata.py @@ -242,6 +242,13 @@ class CoverageSqliteData(SimpleRepr): return "" # TODO def lines(self, filename): + if self.has_arcs(): + arcs = self.arcs(filename) + if arcs is not None: + import itertools + all_lines = itertools.chain.from_iterable(arcs) + return list(set(l for l in all_lines if l > 0)) + with self._connect() as con: file_id = self._file_id(filename) return [lineno for lineno, in con.execute("select lineno from line where file_id = ?", (file_id,))] |