diff options
Diffstat (limited to 'coverage/misc.py')
-rw-r--r-- | coverage/misc.py | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/coverage/misc.py b/coverage/misc.py index f828a7d4..5c4381ab 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -317,76 +317,6 @@ def substitute_variables(text, variables): return text -# Map chars to numbers for arcz_to_arcs -_arcz_map = {'.': -1} -_arcz_map.update(dict((c, ord(c) - ord('0')) for c in '123456789')) -_arcz_map.update(dict( - (c, 10 + ord(c) - ord('A')) for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' -)) - -def arcz_to_arcs(arcz): - """Convert a compact textual representation of arcs to a list of pairs. - - The text has space-separated pairs of letters. Period is -1, 1-9 are - 1-9, A-Z are 10 through 36. The resulting list is sorted regardless of - the order of the input pairs. - - ".1 12 2." --> [(-1,1), (1,2), (2,-1)] - - Minus signs can be included in the pairs: - - "-11, 12, 2-5" --> [(-1,1), (1,2), (2,-5)] - - """ - arcs = [] - for pair in arcz.split(): - asgn = bsgn = 1 - if len(pair) == 2: - a, b = pair - else: - assert len(pair) == 3 - if pair[0] == '-': - _, a, b = pair - asgn = -1 - else: - assert pair[1] == '-' - a, _, b = pair - bsgn = -1 - arcs.append((asgn * _arcz_map[a], bsgn * _arcz_map[b])) - return sorted(arcs) - - -_arcz_unmap = {val: ch for ch, val in _arcz_map.items()} - -def _arcs_to_arcz_repr_one(num): - """Return an arcz form of the number `num`, or "?" if there is none.""" - if num == -1: - return "." - z = "" - if num < 0: - z += "-" - num *= -1 - z += _arcz_unmap.get(num, "?") - return z - - -def arcs_to_arcz_repr(arcs): - """Convert a list of arcs to a readable multi-line form for asserting. - - Each pair is on its own line, with a comment showing the arcz form, - to make it easier to decode when debugging test failures. - - """ - repr_list = [] - for a, b in arcs: - line = repr((a, b)) - line += " # " - line += _arcs_to_arcz_repr_one(a) - line += _arcs_to_arcz_repr_one(b) - repr_list.append(line) - return "\n".join(repr_list) + "\n" - - class BaseCoverageException(Exception): """The base of all Coverage exceptions.""" pass |