summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-27 22:11:36 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-28 16:30:10 +0200
commitd2db40c08433ca35dc9e5312e1d1b6404db65c33 (patch)
treee6a316c154f5d9f9d66e03b89b66c0402b352dff
parentcd4168366b79a7782287e0b7162fbfe4f67535f8 (diff)
downloadpylint-git-d2db40c08433ca35dc9e5312e1d1b6404db65c33.tar.gz
Redefining __hash__ without redefining __eq__ is suspicious
-rw-r--r--pylint/checkers/similar.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py
index 6b6337d29..b594a032c 100644
--- a/pylint/checkers/similar.py
+++ b/pylint/checkers/similar.py
@@ -257,6 +257,11 @@ class LineSet:
def __hash__(self):
return id(self)
+ def __eq__(self, other):
+ if not isinstance(other, LineSet):
+ return False
+ return self.__dict__ == other.__dict__
+
def enumerate_stripped(self, start_at=0):
"""return an iterator on stripped lines, starting from a given index
if specified, else 0