def close(self):
total = sum(len(lineset) for lineset in self.linesets)<EOL>duplicated = <NUM_LIT:0><EOL>stats = self.stats<EOL>for num, couples in self._compute_sims():<EOL><INDENT>msg = []<EOL>for lineset, idx in couples:<EOL><INDENT>msg.append("<STR_LIT>" % (lineset.name, idx))<EOL><DEDENT>msg.sort()<EOL>for line in lineset._real_lines[idx : idx + num]:<EOL><INDENT>msg.append(line.rstrip())<EOL><DEDENT>self.add_message("<STR_LIT>", args=(len(couples), "<STR_LIT:\n>".join(msg)))<EOL>duplicated += num * (len(couples) - <NUM_LIT:1>)<EOL><DEDENT>stats["<STR_LIT>"] = duplicated<EOL>stats["<STR_LIT>"] = total and duplicated * <NUM_LIT> / total<EOL>
compute and display similarities on closing (i.e. end of parsing)