Skip to content

Commit 0046ee1

Browse files
authored
fix: add expected lower-than comparators for OrganizationalEntity and VulnerabilityCredits (#248)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent ddd0144 commit 0046ee1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cyclonedx/model/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,11 @@ def __eq__(self, other: object) -> bool:
10681068
return hash(other) == hash(self)
10691069
return False
10701070

1071+
def __lt__(self, other: Any) -> bool:
1072+
if isinstance(other, OrganizationalEntity):
1073+
return hash(self) < hash(other)
1074+
return NotImplemented
1075+
10711076
def __hash__(self) -> int:
10721077
return hash((self.name, tuple(self.url), tuple(self.contact)))
10731078

cyclonedx/model/vulnerability.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,11 @@ def __eq__(self, other: object) -> bool:
755755
return hash(other) == hash(self)
756756
return False
757757

758+
def __lt__(self, other: Any) -> bool:
759+
if isinstance(other, VulnerabilityCredits):
760+
return hash(self) < hash(other)
761+
return NotImplemented
762+
758763
def __hash__(self) -> int:
759764
return hash((tuple(self.organizations), tuple(self.individuals)))
760765

0 commit comments

Comments
 (0)