pylint/checkers/similar.py
def close(self):
        """compute and display similarities on closing (i.e. end of parsing)"""
        total = sum(len(lineset) for lineset in self.linesets)
        duplicated = 0
        stats = self.stats
        for num, couples in self._compute_sims():
            msg = []
            for lineset, idx in couples:
                msg.append("==%s:%s" % (lineset.name, idx))
            msg.sort()
            # pylint: disable=W0631
            for line in lineset._real_lines[idx : idx + num]:
                msg.append(line.rstrip())
            self.add_message("R0801", args=(len(couples), "\n".join(msg)))
            duplicated += num * (len(couples) - 1)
        stats["nb_duplicated_lines"] = duplicated
        stats["percent_duplicated_lines"] = total and duplicated * 100.0 / total
def close(self):
        """compute and display similarities on closing (i.e. end of parsing)"""
        total = sum(len(lineset) for lineset in self.linesets)
        duplicated = 0
        stats = self.stats
        for num, couples in self._compute_sims():
            msg = []
            for lineset, idx in couples:
                msg.append("==%s:%s" % (lineset.name, idx))
            msg.sort()
            # pylint: disable=W0631
            for line in lineset._real_lines[idx : idx + num]:
                msg.append(line.rstrip())
            self.add_message("R0801", args=(len(couples), "\n".join(msg)))
            duplicated += num * (len(couples) - 1)
        stats["nb_duplicated_lines"] = duplicated
        stats["percent_duplicated_lines"] = total and duplicated * 100.0 / total
def close ( self ) : total = sum ( len ( lineset ) for lineset in self . linesets ) duplicated = 0 stats = self . stats for num , couples in self . _compute_sims ( ) : msg = [ ] for lineset , idx in couples : msg . append ( "==%s:%s" % ( lineset . name , idx ) ) msg . sort ( ) # pylint: disable=W0631 for line in lineset . _real_lines [ idx : idx + num ] : msg . append ( line . rstrip ( ) ) self . add_message ( "R0801" , args = ( len ( couples ) , "\n" . join ( msg ) ) ) duplicated += num * ( len ( couples ) - 1 ) stats [ "nb_duplicated_lines" ] = duplicated stats [ "percent_duplicated_lines" ] = total and duplicated * 100.0 / total
compute and display similarities on closing (i.e. end of parsing)
compute and display similarities on closing ( i . e . end of parsing )