From 9bc794ff41df93c9d467813b4398fe1c04551805 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sat, 27 Mar 2021 22:11:36 +0100 Subject: Redefining __hash__ without redefining __eq__ is suspicious --- pylint/checkers/similar.py | 5 +++++ 1 file changed, 5 insertions(+) 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 -- cgit v1.2.1