From 0a93630dc92de59194794f5f0b9ae1987157f327 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 19 Jul 2019 21:41:58 -0400 Subject: z-compressed dumps and loads --- coverage/backward.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index 720cd3e1..0df2a41e 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -106,6 +106,10 @@ if env.PY3: """Convert string `s` to bytes.""" return s.encode('utf8') + def to_string(b): + """Convert bytes `b` to string.""" + return b.decode('utf8') + def binary_bytes(byte_values): """Produce a byte string with the ints from `byte_values`.""" return bytes(byte_values) @@ -120,6 +124,10 @@ else: """Convert string `s` to bytes (no-op in 2.x).""" return s + def to_string(b): + """Convert bytes `b` to string.""" + return b + def binary_bytes(byte_values): """Produce a byte string with the ints from `byte_values`.""" return "".join(chr(b) for b in byte_values) -- cgit v1.2.1