(cls, rule)
return deduplicate_action_definition
There can only ever be one CaseDeduplicationActionDefinition for any AutomaticUpdateRule
        Given the rule, return that action
There can only ever be one CaseDeduplicationActionDefinition for any AutomaticUpdateRule
        Given the rule, return that action
There can only ever be one CaseDeduplicationActionDefinition for any AutomaticUpdateRule Given the rule return that action
def from_rule(cls, rule):
        """There can only ever be one CaseDeduplicationActionDefinition for any AutomaticUpdateRule
        Given the rule, return that action
        """
        if not rule.workflow == AutomaticUpdateRule.WORKFLOW_DEDUPLICATE:
            raise ValueError(
                f"Rule must have workflow {AutomaticUpdateRule.WORKFLOW_DEDUPLICATE}, but we got {rule.workflow}"
            )
        try:
            deduplicate_action_definition = rule.memoized_actions[0].definition
        except IndexError:
            raise ValueError("Rule has no actions")

        if not isinstance(deduplicate_action_definition, cls):
            raise ValueError(f"The action from rule {rule.pk} is not a {cls.__name__}")

        return deduplicate_action_definition
def from_rule ( cls , rule ) : if not rule . workflow == AutomaticUpdateRule . WORKFLOW_DEDUPLICATE : raise ValueError ( f"Rule must have workflow {AutomaticUpdateRule.WORKFLOW_DEDUPLICATE}, but we got {rule.workflow}" ) try : deduplicate_action_definition = rule . memoized_actions [ 0 ] . definition except IndexError : raise ValueError ( "Rule has no actions" ) if not isinstance ( deduplicate_action_definition , cls ) : raise ValueError ( f"The action from rule {rule.pk} is not a {cls.__name__}" ) return deduplicate_action_definition