Skip to content

Commit b294765

Browse files
committed
Implement hashing
1 parent f6f2999 commit b294765

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

contentctl/objects/rba.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,17 @@ class risk_object(BaseModel):
3939
type: RiskObjectType
4040
score: int
4141

42+
def __hash__(self):
43+
return hash((self.field, self.type, self.score))
44+
4245
class threat_object(BaseModel):
4346
field: str
4447
type: ThreatObjectType
4548

49+
def __hash__(self):
50+
return hash((self.field, self.type))
51+
4652
class rba_object(BaseModel, ABC):
4753
message: str
48-
risk_objects: Set[risk_object]
49-
threat_objects: Set[threat_object] = set()
54+
risk_objects: Set[risk_object]
55+
threat_objects: Set[threat_object]

0 commit comments

Comments
 (0)