mirror of https://github.com/pypa/pip
Merge pull request #9401 from jdufresne/ne
Remove unnecessary __ne__ definitions
This commit is contained in:
commit
062f0e54d9
|
@ -36,10 +36,6 @@ class FormatControl:
|
||||||
for k in self.__slots__
|
for k in self.__slots__
|
||||||
)
|
)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
# type: (object) -> bool
|
|
||||||
return not self.__eq__(other)
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
# type: () -> str
|
# type: () -> str
|
||||||
return "{}({}, {})".format(
|
return "{}({}, {})".format(
|
||||||
|
|
|
@ -164,11 +164,6 @@ class _InstallRequirementBackedCandidate(Candidate):
|
||||||
return self._link == other._link
|
return self._link == other._link
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Needed for Python 2, which does not implement this by default
|
|
||||||
def __ne__(self, other):
|
|
||||||
# type: (Any) -> bool
|
|
||||||
return not self.__eq__(other)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def source_link(self):
|
def source_link(self):
|
||||||
# type: () -> Optional[Link]
|
# type: () -> Optional[Link]
|
||||||
|
@ -378,11 +373,6 @@ class AlreadyInstalledCandidate(Candidate):
|
||||||
return self.name == other.name and self.version == other.version
|
return self.name == other.name and self.version == other.version
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Needed for Python 2, which does not implement this by default
|
|
||||||
def __ne__(self, other):
|
|
||||||
# type: (Any) -> bool
|
|
||||||
return not self.__eq__(other)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def project_name(self):
|
def project_name(self):
|
||||||
# type: () -> str
|
# type: () -> str
|
||||||
|
@ -475,11 +465,6 @@ class ExtrasCandidate(Candidate):
|
||||||
return self.base == other.base and self.extras == other.extras
|
return self.base == other.base and self.extras == other.extras
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Needed for Python 2, which does not implement this by default
|
|
||||||
def __ne__(self, other):
|
|
||||||
# type: (Any) -> bool
|
|
||||||
return not self.__eq__(other)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def project_name(self):
|
def project_name(self):
|
||||||
# type: () -> str
|
# type: () -> str
|
||||||
|
|
|
@ -34,9 +34,6 @@ class KeyBasedCompareMixin:
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self._compare(other, operator.__eq__)
|
return self._compare(other, operator.__eq__)
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
return self._compare(other, operator.__ne__)
|
|
||||||
|
|
||||||
def _compare(self, other, method):
|
def _compare(self, other, method):
|
||||||
if not isinstance(other, self._defining_class):
|
if not isinstance(other, self._defining_class):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|
|
@ -847,8 +847,7 @@ class TestHiddenText:
|
||||||
hidden2 = HiddenText('secret', redacted='####')
|
hidden2 = HiddenText('secret', redacted='####')
|
||||||
|
|
||||||
assert hidden1 == hidden2
|
assert hidden1 == hidden2
|
||||||
# Also test __ne__. This assertion fails in Python 2 without
|
# Also test __ne__.
|
||||||
# defining HiddenText.__ne__.
|
|
||||||
assert not hidden1 != hidden2
|
assert not hidden1 != hidden2
|
||||||
|
|
||||||
def test_equality_different_secret(self):
|
def test_equality_different_secret(self):
|
||||||
|
|
Loading…
Reference in New Issue