From: Jakob Cornell Date: Sat, 6 Nov 2021 02:15:27 +0000 (-0500) Subject: Add more missing `memoryview' to `bytes' conversions X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=25d97ad39e362c2c8229c2b0af0573aa9bda2cb8;p=eros.git Add more missing `memoryview' to `bytes' conversions --- diff --git a/src/disk_jumble/db.py b/src/disk_jumble/db.py index 61bb2fd..b9461de 100644 --- a/src/disk_jumble/db.py +++ b/src/disk_jumble/db.py @@ -57,9 +57,10 @@ class Wrapper: cursor.execute(stmt, (tracker_id,)) for row in cursor: - (info_hash,) = row + (info_hash_mem,) = row + info_hash = bytes(info_hash_mem) assert len(info_hash) == 20 - yield bytes(info_hash) + yield info_hash def insert_swarm_info(self, tracker_id: int, infos: Iterable["disk_jumble.scrape.ScrapeInfo"]) -> None: stmt = """ @@ -128,7 +129,7 @@ class Wrapper: rows = list(rows_iter) [(slab_id, disk_id, sectors_pg, entity_id, entity_off, key)] = {r[:6] for r in rows} sectors = range(sectors_pg.lower, sectors_pg.upper) - slab = Slab(slab_id, disk_id, sectors, entity_id, entity_off, key) + slab = Slab(slab_id, disk_id, sectors, bytes(entity_id), entity_off, key) # `None' if no hasher match in outer join, otherwise earliest match (*_, id_, seq, end_off, state) = min(rows, key = lambda r: r[-2])