Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #66 from BenPortner/patch-1
Browse files Browse the repository at this point in the history
add __hash__ to class Finding
  • Loading branch information
M8is authored Sep 15, 2023
2 parents 6c5f701 + 8420587 commit 09da8b6
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion teamscale_client/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 09da8b6

Please sign in to comment.