Skip to content

Commit

Permalink
chore: Clean up optionals in RuleConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
niliayu committed Oct 14, 2024
1 parent 2cc161d commit 98631a5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions python/lib/sift_py/ingestion/rule/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class RuleConfig(AsJson):
"""

name: str
description: Optional[str]
expression: Optional[str]
description: str
expression: str
action: Optional[RuleAction]
channel_references: List[ExpressionChannelReference]

Expand All @@ -35,12 +35,12 @@ def __init__(
channel_references: List[
Union[ExpressionChannelReference, ExpressionChannelReferenceChannelConfig]
],
description: Optional[str] = "",
expression: Optional[str] = "",
description: str = "",
expression: str = "",
action: Optional[RuleAction] = None,
sub_expressions: Optional[Dict[str, Any]] = {},
namespace: Optional[str] = "",
namespace_rules: Optional[Dict[str, List[Dict]]] = {},
sub_expressions: Dict[str, Any] = {},
namespace: str = "",
namespace_rules: Dict[str, List[Dict]] = {},
):
self.channel_references = []

Expand Down Expand Up @@ -113,9 +113,9 @@ def as_json(self) -> Any:

@staticmethod
def interpolate_sub_expressions(
expression: Optional[str], sub_expressions: Optional[Dict[str, str]]
) -> Optional[str]:
if expression and sub_expressions:
expression: str, sub_expressions: Optional[Dict[str, str]]
) -> str:
if sub_expressions:
for ref, expr in sub_expressions.items():
if ref not in expression:
raise ValueError(f"Couldn't find '{ref}' in expression '{expression}'.")
Expand Down

0 comments on commit 98631a5

Please sign in to comment.