summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Abramowitz <marc@marc-abramowitz.com>2015-03-06 09:11:39 -0800
committerMarc Abramowitz <marc@marc-abramowitz.com>2015-03-06 09:11:39 -0800
commit01e38bed190a1278f231f101431e2d09071de678 (patch)
tree18f00cc4dfdc749c3b26e743f9a0121cc9c929ea
parentcbc3c959feecae75c1ce7864543c7f3a14b65ab0 (diff)
downloadpython-setuptools-git-01e38bed190a1278f231f101431e2d09071de678.tar.gz
Add __ne__ method to Requirement class
It seems like if it has an `__eq__` method, it should probably have a `__ne__` method. I ran into this while working on pip -- see https://github.com/pypa/pip/pull/2493#discussion_r25955295
-rw-r--r--pkg_resources/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 2ce663d2..7701292b 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2907,6 +2907,9 @@ class Requirement:
self.hashCmp == other.hashCmp
)
+ def __ne__(self, other):
+ return not self == other
+
def __contains__(self, item):
if isinstance(item, Distribution):
if item.key != self.key: