def __report_top_blocks(self): # {{{3
    query = """
      SELECT * FROM (
        SELECT *, COUNT(*) AS "count" FROM "index"
        GROUP BY hash_id ORDER BY "count" DESC
      ), hashes WHERE
        "count" > 1 AND
        hash_id = hashes.id
        LIMIT 10 """
    if self.logger.isEnabledFor(logging.DEBUG):
      printed_header = False
      for row in self.conn.execute(query):
        if not printed_header:
          self.logger.debug("A listing of the most used blocks follows:")
          printed_header = True
        msg = "Block #%s of %s has been used %i times: %r"
        preview = row['value']
        max_length = 60
        if len(preview) < max_length:
          preview = str(preview)
        else:
          preview = preview[0 : max_length] + '...'
        nbytes = format_size(len(row['value']))
        self.logger.debug(msg, row['hash_id'], nbytes, row['count'], preview)
dataset/ETHPy150Open xolox/dedupfs/dedupfs.py/DedupFS.__report_top_blocks/original