def relation(self, other):  # type: (Term) -> int
        """
        Returns the relationship between the package versions
        allowed by this term and another.
        """
        if self.dependency.name != other.dependency.name:
            raise ValueError(
                "{} should refer to {}".format(other, self.dependency.name)
            )

        other_constraint = other.constraint

        if other.is_positive():
            if self.is_positive():
                if not self._compatible_dependency(other.dependency):
                    return SetRelation.DISJOINT

                # foo ^1.5.0 is a subset of foo ^1.0.0
                if other_constraint.allows_all(self.constraint):
                    return SetRelation.SUBSET

                # foo ^2.0.0 is disjoint with foo ^1.0.0
                if not self.constraint.allows_any(other_constraint):
                    return SetRelation.DISJOINT

                return SetRelation.OVERLAPPING
            else:
                if not self._compatible_dependency(other.dependency):
                    return SetRelation.OVERLAPPING

                # not foo ^1.0.0 is disjoint with foo ^1.5.0
                if self.constraint.allows_all(other_constraint):
                    return SetRelation.DISJOINT

                # not foo ^1.5.0 overlaps foo ^1.0.0
                # not foo ^2.0.0 is a superset of foo ^1.5.0
                return SetRelation.OVERLAPPING
        else:
            if self.is_positive():
                if not self._compatible_dependency(other.dependency):
                    return SetRelation.SUBSET

                # foo ^2.0.0 is a subset of not foo ^1.0.0
                if not other_constraint.allows_any(self.constraint):
                    return SetRelation.SUBSET

                # foo ^1.5.0 is disjoint with not foo ^1.0.0
                if other_constraint.allows_all(self.constraint):
                    return SetRelation.DISJOINT

                # foo ^1.0.0 overlaps not foo ^1.5.0
                return SetRelation.OVERLAPPING
            else:
                if not self._compatible_dependency(other.dependency):
                    return SetRelation.OVERLAPPING

                # not foo ^1.0.0 is a subset of not foo ^1.5.0
                if self.constraint.allows_all(other_constraint):
                    return SetRelation.SUBSET

                # not foo ^2.0.0 overlaps not foo ^1.0.0
                # not foo ^1.5.0 is a superset of not foo ^1.0.0
                return SetRelation.OVERLAPPING
def relation ( self , other ) : if self . dependency . name != other . dependency . name : raise ValueError ( "{} should refer to {}" . format ( other , self . dependency . name ) ) other_constraint = other . constraint if other . is_positive ( ) : if self . is_positive ( ) : if not self . _compatible_dependency ( other . dependency ) : return SetRelation . DISJOINT if other_constraint . allows_all ( self . constraint ) : return SetRelation . SUBSET if not self . constraint . allows_any ( other_constraint ) : return SetRelation . DISJOINT return SetRelation . OVERLAPPING else : if not self . _compatible_dependency ( other . dependency ) : return SetRelation . OVERLAPPING if self . constraint . allows_all ( other_constraint ) : return SetRelation . DISJOINT return SetRelation . OVERLAPPING else : if self . is_positive ( ) : if not self . _compatible_dependency ( other . dependency ) : return SetRelation . SUBSET if not other_constraint . allows_any ( self . constraint ) : return SetRelation . SUBSET if other_constraint . allows_all ( self . constraint ) : return SetRelation . DISJOINT return SetRelation . OVERLAPPING else : if not self . _compatible_dependency ( other . dependency ) : return SetRelation . OVERLAPPING if self . constraint . allows_all ( other_constraint ) : return SetRelation . SUBSET return SetRelation . OVERLAPPING
Returns the relationship between the package versions
        allowed by this term and another.