From 84205876af6416c9ec77173bb0398a1cd0a870e3 Mon Sep 17 00:00:00 2001 From: "Benjamin W. Portner" <52913510+BenPortner@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:36:53 +0200 Subject: [PATCH] add __hash__ to class Finding --- teamscale_client/data.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/teamscale_client/data.py b/teamscale_client/data.py index fc86b69..80e4afa 100644 --- a/teamscale_client/data.py +++ b/teamscale_client/data.py @@ -88,7 +88,24 @@ def __lt__(self, other): """Checks if this finding is less than the given finding.""" return (self.uniformPath, self.startLine, self.endLine) < (other.uniformPath, other.startLine, other.endLine) - + def __hash__(self) -> int: + if self.finding_id: + return hash(self.finding_id) + else: + return hash( + ( + self.uniformPath, + self.startLine, + self.assessment, + self.message, + self.endLine, + self.endOffset, + self.findingTypeId, + self.identifier, + self.startOffset, + ) + ) + @auto_str class FileFindings: """Representation of a file and its findings.