diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-01 13:02:31 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-01 13:30:39 -0400 |
commit | 9df434550a499c16e9fd26cfb9627837bfdc02a5 (patch) | |
tree | 5619ea3c3bec05d04363a66ced9c7ebffcefb1df /coverage/numbits.py | |
parent | 3fe17c1f2244c07cf9d0f9e3609392c2ad441db1 (diff) | |
download | python-coveragepy-git-9df434550a499c16e9fd26cfb9627837bfdc02a5.tar.gz |
refactor: remove code explicitly choosing between py2 and py3
Diffstat (limited to 'coverage/numbits.py')
-rw-r--r-- | coverage/numbits.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/coverage/numbits.py b/coverage/numbits.py index 6ca96fbc..7205b9f1 100644 --- a/coverage/numbits.py +++ b/coverage/numbits.py @@ -15,22 +15,14 @@ the future. Use these functions to work with those binary blobs of data. """ import json -from coverage import env from coverage.backward import byte_to_int, bytes_to_ints, binary_bytes, zip_longest from coverage.misc import contract, new_contract -if env.PY3: - def _to_blob(b): - """Convert a bytestring into a type SQLite will accept for a blob.""" - return b +def _to_blob(b): + """Convert a bytestring into a type SQLite will accept for a blob.""" + return b - new_contract('blob', lambda v: isinstance(v, bytes)) -else: - def _to_blob(b): - """Convert a bytestring into a type SQLite will accept for a blob.""" - return buffer(b) # pylint: disable=undefined-variable - - new_contract('blob', lambda v: isinstance(v, buffer)) # pylint: disable=undefined-variable +new_contract('blob', lambda v: isinstance(v, bytes)) @contract(nums='Iterable', returns='blob') |