Skip to content

Commit 062f0e5

Browse files
authored
Merge pull request pypa#9401 from jdufresne/ne
Remove unnecessary __ne__ definitions
2 parents 35604e5 + a49f173 commit 062f0e5

File tree

5 files changed

+1
-24
lines changed

5 files changed

+1
-24
lines changed

news/4a85b5f1-5f9a-4f6b-8960-3334570ae591.trivial.rst

Whitespace-only changes.

src/pip/_internal/models/format_control.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ def __eq__(self, other):
3636
for k in self.__slots__
3737
)
3838

39-
def __ne__(self, other):
40-
# type: (object) -> bool
41-
return not self.__eq__(other)
42-
4339
def __repr__(self):
4440
# type: () -> str
4541
return "{}({}, {})".format(

src/pip/_internal/resolution/resolvelib/candidates.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,6 @@ def __eq__(self, other):
164164
return self._link == other._link
165165
return False
166166

167-
# Needed for Python 2, which does not implement this by default
168-
def __ne__(self, other):
169-
# type: (Any) -> bool
170-
return not self.__eq__(other)
171-
172167
@property
173168
def source_link(self):
174169
# type: () -> Optional[Link]
@@ -378,11 +373,6 @@ def __eq__(self, other):
378373
return self.name == other.name and self.version == other.version
379374
return False
380375

381-
# Needed for Python 2, which does not implement this by default
382-
def __ne__(self, other):
383-
# type: (Any) -> bool
384-
return not self.__eq__(other)
385-
386376
@property
387377
def project_name(self):
388378
# type: () -> str
@@ -475,11 +465,6 @@ def __eq__(self, other):
475465
return self.base == other.base and self.extras == other.extras
476466
return False
477467

478-
# Needed for Python 2, which does not implement this by default
479-
def __ne__(self, other):
480-
# type: (Any) -> bool
481-
return not self.__eq__(other)
482-
483468
@property
484469
def project_name(self):
485470
# type: () -> str

src/pip/_internal/utils/models.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ def __ge__(self, other):
3434
def __eq__(self, other):
3535
return self._compare(other, operator.__eq__)
3636

37-
def __ne__(self, other):
38-
return self._compare(other, operator.__ne__)
39-
4037
def _compare(self, other, method):
4138
if not isinstance(other, self._defining_class):
4239
return NotImplemented

tests/unit/test_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,7 @@ def test_equality_same_secret(self):
847847
hidden2 = HiddenText('secret', redacted='####')
848848

849849
assert hidden1 == hidden2
850-
# Also test __ne__. This assertion fails in Python 2 without
851-
# defining HiddenText.__ne__.
850+
# Also test __ne__.
852851
assert not hidden1 != hidden2
853852

854853
def test_equality_different_secret(self):

0 commit comments

Comments
 (0)