def _remove_duplicates(self):
        """
        Remove every maximal rectangle contained by another one.
        """
        contained = set()
        for m1, m2 in itertools.combinations(self._max_rects, 2):
            if m1.contains(m2):
                contained.add(m2)
            elif m2.contains(m1):
                contained.add(m1)
        
        # Remove from max_rects
        self._max_rects = [m for m in self._max_rects if m not in contained]
def _remove_duplicates ( self ) : contained = set ( ) for m1 , m2 in itertools . combinations ( self . _max_rects , 2 ) : if m1 . contains ( m2 ) : contained . add ( m2 ) elif m2 . contains ( m1 ) : contained . add ( m1 ) self . _max_rects = [ m for m in self . _max_rects if m not in contained ]
Remove every maximal rectangle contained by another one.