fdutils/structures.py
def difference(self, other, split_if_needed=False):
        """ removes a range given by other from self

        """
        if not self.step == other.step:
            raise AttributeError('We have not implemented a function where ranges have different step')
        if not self.overlaps(other):    # no overlap return copy of self
            return self.copy()
        if self.is_subrange(other):     # complete coverage return none
            return None
        if other.end >= self.end:    # remove right piece
            return Range(self.start, other.start - self.step)
        if other.start <= self.start:  # remove left piece
            return Range(other.end + self.step, self.end)
        if split_if_needed:
            return Range(self.start, other.start - self.step), Range(other.end + self.step, self.end)
        raise ValueError("the flag split_if_needed was not set and the difference between "
                         "these two ranges would create two new ranges")
 removes a range given by other from self

        
removes a range given by other from self
removes a range given by other from self
def difference(self, other, split_if_needed=False):
        if not self.step == other.step:
            raise AttributeError('We have not implemented a function where ranges have different step')
        if not self.overlaps(other):    
            return self.copy()
        if self.is_subrange(other):     
            return None
        if other.end >= self.end:    
            return Range(self.start, other.start - self.step)
        if other.start <= self.start:  
            return Range(other.end + self.step, self.end)
        if split_if_needed:
            return Range(self.start, other.start - self.step), Range(other.end + self.step, self.end)
        raise ValueError("the flag split_if_needed was not set and the difference between "
                         "these two ranges would create two new ranges")
def difference ( self , other , split_if_needed = False ) : if not self . step == other . step : raise AttributeError ( 'We have not implemented a function where ranges have different step' ) if not self . overlaps ( other ) : return self . copy ( ) if self . is_subrange ( other ) : return None if other . end >= self . end : return Range ( self . start , other . start - self . step ) if other . start <= self . start : return Range ( other . end + self . step , self . end ) if split_if_needed : return Range ( self . start , other . start - self . step ) , Range ( other . end + self . step , self . end ) raise ValueError ( "the flag split_if_needed was not set and the difference between " "these two ranges would create two new ranges" )
removes a range given by other from self
removes a range given by other from self
""" removes a range given by other from self

        """ # no overlap return copy of self # complete coverage return none # remove right piece # remove left piece
self
other
split_if_needed