fdutils/bpf.py
def _remove_range(self, list_to_remove, remove_this):
        """ compares and compresses ranges

        :param list of Range:

        """
        if not list_to_remove or not remove_this:
            return
        j = 0
        new_list = []
        current_list = sorted(list_to_remove, key=itemgetter(1))
        removal_list = sorted(remove_this)
        for current_to, current_range in current_list:
            while j < len(removal_list) and removal_list[j] << current_range:
                j += 1
            if j < len(removal_list) and not removal_list[j] >> current_range:
                diff = current_range.difference(removal_list[j], split_if_needed=True)
                if type(diff) is tuple:
                    new_list.append((current_to, diff[0]))
                    new_list.append((current_to, diff[1]))
                elif diff is not None:
                    new_list.append((current_to, diff))
                continue
            new_list.append((current_to, current_range))

        for i, v in enumerate(new_list):
            if i < len(list_to_remove):
                list_to_remove[i] = v
            else:
                list_to_remove.append(v)

        del list_to_remove[i + 1:]
 compares and compresses ranges

        :param list of Range:

        
compares and compresses ranges
:param list of Range.
compares and compresses ranges : param list of Range .
def _remove_range(self, list_to_remove, remove_this):
        if not list_to_remove or not remove_this:
            return
        j = 0
        new_list = []
        current_list = sorted(list_to_remove, key=itemgetter(1))
        removal_list = sorted(remove_this)
        for current_to, current_range in current_list:
            while j < len(removal_list) and removal_list[j] << current_range:
                j += 1
            if j < len(removal_list) and not removal_list[j] >> current_range:
                diff = current_range.difference(removal_list[j], split_if_needed=True)
                if type(diff) is tuple:
                    new_list.append((current_to, diff[0]))
                    new_list.append((current_to, diff[1]))
                elif diff is not None:
                    new_list.append((current_to, diff))
                continue
            new_list.append((current_to, current_range))
        for i, v in enumerate(new_list):
            if i < len(list_to_remove):
                list_to_remove[i] = v
            else:
                list_to_remove.append(v)
        del list_to_remove[i + 1:]
def _remove_range ( self , list_to_remove , remove_this ) : if not list_to_remove or not remove_this : return j = 0 new_list = [ ] current_list = sorted ( list_to_remove , key = itemgetter ( 1 ) ) removal_list = sorted ( remove_this ) for current_to , current_range in current_list : while j < len ( removal_list ) and removal_list [ j ] << current_range : j += 1 if j < len ( removal_list ) and not removal_list [ j ] >> current_range : diff = current_range . difference ( removal_list [ j ] , split_if_needed = True ) if type ( diff ) is tuple : new_list . append ( ( current_to , diff [ 0 ] ) ) new_list . append ( ( current_to , diff [ 1 ] ) ) elif diff is not None : new_list . append ( ( current_to , diff ) ) continue new_list . append ( ( current_to , current_range ) ) for i , v in enumerate ( new_list ) : if i < len ( list_to_remove ) : list_to_remove [ i ] = v else : list_to_remove . append ( v ) del list_to_remove [ i + 1 : ]
compares and compresses ranges
:param list of Range:
compares and compresses ranges : param list of Range :
""" compares and compresses ranges

        :param list of Range:

        """
self
list_to_remove
remove_this