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 22:48:56 +0200
commit9bc794ff41df93c9d467813b4398fe1c04551805 (patch)
treed7226c59e98ae7431fac2d9618c8a89898c13873
parent2f5d44d7bc91bf425fce47802a5e29852a345a34 (diff)
downloadpylint-git-9bc794ff41df93c9d467813b4398fe1c04551805.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