Skip to content

Commit

Permalink
take advantage of set intersection
Browse files Browse the repository at this point in the history
  • Loading branch information
fgregg committed Dec 27, 2017
1 parent 8957878 commit 2e14cf7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dedupe/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _blockData(self, data_d):
lambda x: x[1])

for record_id, block in block_groups:
block_keys = [block_key for block_key, _ in block]
block_keys = {block_key for block_key, _ in block}
coverage[record_id] = block_keys
for block_key in block_keys:
if block_key in blocks:
Expand All @@ -290,8 +290,8 @@ def _blockData(self, data_d):
for block_key, block in blocks.items():
processed_block = []
for record_id in block:
smaller_blocks = {key for key in coverage[record_id]
if key in blocks and key < block_key}
smaller_blocks = {key for key in coverage[record_id] & viewkeys(blocks)
if key < block_key}
processed_block.append((record_id, data_d[record_id], smaller_blocks))

yield processed_block
Expand Down

0 comments on commit 2e14cf7

Please sign in to comment.