(self, other)
return op1(self.left, other.right) and op2(other.left, self.right)
Check whether two :cls:`Interval` objects intersect. Two
        intervals intersect if they share a common point, including closed
        endpoints. Intervals that only have an open endpoint in common do not
        intersect.

        Parameters
        ----------
        other : Interval object
            Interval to check against for an overlap.

        Returns
        -------
        bool
            ``True`` if the two intervals overlap.
Check whether two :cls:`Interval` objects intersect. Two
        intervals intersect if they share a common point, including closed
        endpoints. Intervals that only have an open endpoint in common do not
        intersect.
Check whether two : cls : Interval objects intersect . Two intervals intersect if they share a common point including closed endpoints . Intervals that only have an open endpoint in common do not intersect .
def intersects(self, other):
        """Check whether two :cls:`Interval` objects intersect. Two
        intervals intersect if they share a common point, including closed
        endpoints. Intervals that only have an open endpoint in common do not
        intersect.

        Parameters
        ----------
        other : Interval object
            Interval to check against for an overlap.

        Returns
        -------
        bool
            ``True`` if the two intervals overlap.

        """
        if not isinstance(other, Interval):
            raise TypeError("`other` must be an Interval, "
                            f"got {type(other).__name__}")

        # equality is okay if both endpoints are closed (overlap at a point)
        op1 = le if (self.closed_left and other.closed_right) else lt
        op2 = le if (other.closed_left and self.closed_right) else lt

        # overlaps is equivalent negation of two interval being disjoint:
        # disjoint = (A.left > B.right) or (B.left > A.right)
        # (simplifying the negation allows this to be done in fewer operations)
        return op1(self.left, other.right) and op2(other.left, self.right)
def intersects ( self , other ) : if not isinstance ( other , Interval ) : raise TypeError ( "`other` must be an Interval, " f"got {type(other).__name__}" ) # equality is okay if both endpoints are closed (overlap at a point) op1 = le if ( self . closed_left and other . closed_right ) else lt op2 = le if ( other . closed_left and self . closed_right ) else lt # overlaps is equivalent negation of two interval being disjoint: # disjoint = (A.left > B.right) or (B.left > A.right) # (simplifying the negation allows this to be done in fewer operations) return op1 ( self . left , other . right ) and op2 ( other . left , self . right )