summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-07-30 15:35:00 -0400
committerNed Batchelder <ned@nedbatchelder.com>2019-07-31 10:24:39 -0400
commitcb4080d565ddb1232674affb051944522ca37aee (patch)
treea762e082f6dc773dc7508de6d9c73477f5fcf0f5 /coverage
parent41cddfc4a8399292a6f1ebee10ce7f9ade2193f6 (diff)
downloadpython-coveragepy-git-cb4080d565ddb1232674affb051944522ca37aee.tar.gz
A little more discipline for blob converters
Diffstat (limited to 'coverage')
-rw-r--r--coverage/sqldata.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/coverage/sqldata.py b/coverage/sqldata.py
index a37c9ae5..4a00414d 100644
--- a/coverage/sqldata.py
+++ b/coverage/sqldata.py
@@ -86,14 +86,20 @@ CREATE TABLE tracer (
"""
if env.PY2:
- def to_blob(bytes):
- return buffer(bytes)
+ def to_blob(b):
+ """Convert a bytestring into a type SQLite will accept for a blob."""
+ return buffer(b) # pylint: disable=undefined-variable
+
def from_blob(blob):
+ """Convert a blob read from SQLite into a bytestring."""
return bytes(blob)
else:
- def to_blob(bytes):
- return bytes
+ def to_blob(b):
+ """Convert a bytestring into a type SQLite will accept for a blob."""
+ return b
+
def from_blob(blob):
+ """Convert a blob read from SQLite into a bytestring."""
return blob
@@ -507,7 +513,8 @@ class CoverageData(SimpleReprMixin):
'inner join context on context.id = line_map.context_id'
)
lines = {
- (files[path], context): from_blob(numbits) for (path, context, numbits) in cur
+ (files[path], context): from_blob(numbits)
+ for (path, context, numbits) in cur
}
cur.close()