diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-08-01 09:42:54 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-08-01 09:42:54 -0400 |
commit | a361ff3897736917544da1a4e28d8db6457f0fcc (patch) | |
tree | cdbee5c982a527dd89974ac38feb41fbc063b00f /coverage/backward.py | |
parent | 79111b14cd70bbfd75555bb819c6dbdc25a543aa (diff) | |
download | python-coveragepy-git-a361ff3897736917544da1a4e28d8db6457f0fcc.tar.gz |
Add num_in_numbits
Diffstat (limited to 'coverage/backward.py')
-rw-r--r-- | coverage/backward.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/coverage/backward.py b/coverage/backward.py index 0df2a41e..34ab2f1a 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -114,6 +114,10 @@ if env.PY3: """Produce a byte string with the ints from `byte_values`.""" return bytes(byte_values) + def byte_to_int(byte): + """Turn a byte indexed from a bytes object into an int.""" + return byte + def bytes_to_ints(bytes_value): """Turn a bytes object into a sequence of ints.""" # In Python 3, iterating bytes gives ints. @@ -132,6 +136,10 @@ else: """Produce a byte string with the ints from `byte_values`.""" return "".join(chr(b) for b in byte_values) + def byte_to_int(byte): + """Turn a byte indexed from a bytes object into an int.""" + return ord(byte) + def bytes_to_ints(bytes_value): """Turn a bytes object into a sequence of ints.""" for byte in bytes_value: |