Skip to content

Commit

Permalink
fix: add expected lower-than comparators for OrganizationalEntity a…
Browse files Browse the repository at this point in the history
…nd `VulnerabilityCredits` (#248)

Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck committed Jun 15, 2022
1 parent ddd0144 commit 0046ee1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cyclonedx/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,11 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: Any) -> bool:
if isinstance(other, OrganizationalEntity):
return hash(self) < hash(other)
return NotImplemented

def __hash__(self) -> int:
return hash((self.name, tuple(self.url), tuple(self.contact)))

Expand Down
5 changes: 5 additions & 0 deletions cyclonedx/model/vulnerability.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,11 @@ def __eq__(self, other: object) -> bool:
return hash(other) == hash(self)
return False

def __lt__(self, other: Any) -> bool:
if isinstance(other, VulnerabilityCredits):
return hash(self) < hash(other)
return NotImplemented

def __hash__(self) -> int:
return hash((tuple(self.organizations), tuple(self.individuals)))

Expand Down

0 comments on commit 0046ee1

Please sign in to comment.