def __collect_blocks(self): # {{{4
    should_reorganize = False
    for row in self.conn.execute('SELECT hash FROM hashes WHERE id NOT IN (SELECT hash_id FROM "index")'):
      del self.blocks[str(row[0])]
      should_reorganize = True
    if should_reorganize:
      self.__dbmcall('reorganize')
    count = self.conn.execute('DELETE FROM hashes WHERE id NOT IN (SELECT hash_id FROM "index")').rowcount
    if count > 0:
      self.should_vacuum = True
      return "Cleaned up %i unused data block%s in %%s." % (count, count != 1 and 's' or '')
dataset/ETHPy150Open xolox/dedupfs/dedupfs.py/DedupFS.__collect_blocks/original