in rostran/core/conditions.py [0:0]
def validate(self):
if not isinstance(self.name, str):
raise InvalidTemplateCondition(
name=self.name,
reason=f"The type should be str",
)
if not isinstance(self.value, dict):
raise InvalidTemplateCondition(
name=self.name,
reason=f"The type of value ({self.value}) should be dict",
)
# validate value key
for key, value in self.value.items():
if not isinstance(key, str):
raise InvalidTemplateCondition(
name=f"{self.name}.{key}",
reason=f"The type should be str",
)
if key not in self.CONDITION_FUNCS:
raise InvalidTemplateCondition(
name=self.name,
reason=f"Condition function {key} is not supported. Allowed functions: {self.CONDITION_FUNCS}",
)
if not isinstance(value, (dict, list)):
raise InvalidTemplateCondition(
name=f"{self.name}.{key}",
reason=f"The type of value ({self.value}) should be dict or list",
)