Skip to content

Commit

Permalink
linting cleanup and comment
Browse files Browse the repository at this point in the history
removal
  • Loading branch information
pyth0n1c committed Feb 4, 2025
1 parent 1af9f3a commit bc9d2ab
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions contentctl/objects/rba.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from abc import ABC
from enum import Enum
from typing import Annotated, Any, Set
from typing import Annotated, Set

from pydantic import BaseModel, Field, computed_field, model_serializer

Expand Down Expand Up @@ -45,7 +45,6 @@ class ThreatObjectType(str, Enum):
TLS_HASH = "tls_hash"
URL = "url"

#[{"risk_object_field": "dest", "risk_object_type": "system", "risk_score": 64}, {"threat_object_field": "src_ip", "threat_object_type": "ip_address"}]

class RiskObject(BaseModel):
field: str
Expand All @@ -62,19 +61,19 @@ def __lt__(self, other: RiskObject) -> bool:
):
return True
return False

@model_serializer
def serialize_risk_object(self) -> dict[str, str | int]:
'''
We define this explicitly for two reasons, even though the automatic
serialization works correctly. First we want to enforce a specific
field order for reasons of readability. Second, some of the fields
"""
We define this explicitly for two reasons, even though the automatic
serialization works correctly. First we want to enforce a specific
field order for reasons of readability. Second, some of the fields
actually have different names than they do in the object.
'''
return{
"""
return {
"risk_object_field": self.field,
"risk_object_type": self.type,
"risk_score": self.score
"risk_score": self.score,
}


Expand All @@ -89,16 +88,16 @@ def __lt__(self, other: ThreatObject) -> bool:
if f"{self.field}{self.type}" < f"{other.field}{other.type}":
return True
return False

@model_serializer
def serialize_threat_object(self) -> dict[str, str]:
'''
We define this explicitly for two reasons, even though the automatic
serialization works correctly. First we want to enforce a specific
field order for reasons of readability. Second, some of the fields
"""
We define this explicitly for two reasons, even though the automatic
serialization works correctly. First we want to enforce a specific
field order for reasons of readability. Second, some of the fields
actually have different names than they do in the object.
'''
return{
"""
return {
"threat_object_field": self.field,
"threat_object_type": self.type,
}
Expand Down

0 comments on commit bc9d2ab

Please sign in to comment.