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
commitdfe0dd768cd114eb30d332e628c0affade065523 (patch)
tree8cc5480b1642115ba82fb9ed60c892152d64d812
parent285ba021b959a206d03f007f32681e8fe8feaec8 (diff)
downloadpython-setuptools-bitbucket-dfe0dd768cd114eb30d332e628c0affade065523.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: