Skip to content

Commit

Permalink
Simplify RuleSpec declaration
Browse files Browse the repository at this point in the history
CMK-14467

Change-Id: Ib0e5cc1e441f706f6650af90caca969bca83f40b
  • Loading branch information
Synss committed Oct 25, 2023
1 parent f0451d5 commit 25f63f6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmk/utils/rulesets/ruleset_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import dataclasses
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from re import Pattern
from typing import Any, cast, Generic, Literal, NamedTuple, Required, TypeAlias, TypeVar
from typing import Any, cast, Generic, Literal, NamedTuple, NotRequired, TypeAlias, TypeVar

from typing_extensions import TypedDict

Expand Down Expand Up @@ -93,11 +93,11 @@ class RuleConditionsSpec(TypedDict, total=False):
host_folder: str


class RuleSpec(Generic[TRuleValue], TypedDict, total=False):
value: Required[TRuleValue]
condition: Required[RuleConditionsSpec]
id: Required[str] # a UUID if provided by either the GUI or the REST API
options: RuleOptionsSpec
class RuleSpec(Generic[TRuleValue], TypedDict):
value: TRuleValue
condition: RuleConditionsSpec
id: str # a UUID if provided by either the GUI or the REST API
options: NotRequired[RuleOptionsSpec]


def is_disabled(rule: RuleSpec[TRuleValue]) -> bool:
Expand Down

0 comments on commit 25f63f6

Please sign in to comment.