diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-12-24 17:09:51 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-12-24 17:09:51 -0500 |
commit | dcb07762bfc91dec3782096ab6dae995e7c6631a (patch) | |
tree | 55ccaaba21d983370c8f7f8743d20ebdb80c99e5 /coverage/misc.py | |
parent | 8672eee93fc8e4cf017a133607a371547b5e7812 (diff) | |
download | python-coveragepy-git-dcb07762bfc91dec3782096ab6dae995e7c6631a.tar.gz |
Move code to where it belongs
Diffstat (limited to 'coverage/misc.py')
-rw-r--r-- | coverage/misc.py | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/coverage/misc.py b/coverage/misc.py index c484d61e..c16b6b4a 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -107,44 +107,6 @@ def nice_pair(pair): return "%d-%d" % (start, end) -def format_lines(statements, lines): - """Nicely format a list of line numbers. - - Format a list of line numbers for printing by coalescing groups of lines as - long as the lines represent consecutive statements. This will coalesce - even if there are gaps between statements. - - For example, if `statements` is [1,2,3,4,5,10,11,12,13,14] and - `lines` is [1,2,5,10,11,13,14] then the result will be "1-2, 5-11, 13-14". - - Both `lines` and `statements` can be any iterable. All of the elements of - `lines` must be in `statements`, and all of the values must be positive - integers. - - """ - statements = sorted(statements) - lines = sorted(lines) - - pairs = [] - start = None - lidx = 0 - for stmt in statements: - if lidx >= len(lines): - break - if stmt == lines[lidx]: - lidx += 1 - if not start: - start = stmt - end = stmt - elif start: - pairs.append((start, end)) - start = None - if start: - pairs.append((start, end)) - ret = ', '.join(map(nice_pair, pairs)) - return ret - - def expensive(fn): """A decorator to indicate that a method shouldn't be called more than once. |