rasa/core/domain.py
def collect_templates(
        yml_templates: Dict[Text, List[Any]]
    ) -> Dict[Text, List[Dict[Text, Any]]]:
        """Go through the templates and make sure they are all in dict format
        """
        templates = {}
        for template_key, template_variations in yml_templates.items():
            validated_variations = []
            for t in template_variations:
                # templates can either directly be strings or a dict with
                # options we will always create a dict out of them
                if isinstance(t, str):
                    validated_variations.append({"text": t})
                elif "text" not in t:
                    raise InvalidDomain("Utter template '{}' needs to contain"
                                        "'- text: ' attribute to be a proper"
                                        "template".format(template_key))
                else:
                    validated_variations.append(t)
            templates[template_key] = validated_variations
        return templates
Go through the templates and make sure they are all in dict format
        
Go through the templates and make sure they are all in dict format
Go through the templates and make sure they are all in dict format
def collect_templates(
        yml_templates: Dict[Text, List[Any]]
    ) -> Dict[Text, List[Dict[Text, Any]]]:
        templates = {}
        for template_key, template_variations in yml_templates.items():
            validated_variations = []
            for t in template_variations:
                if isinstance(t, str):
                    validated_variations.append({"text": t})
                elif "text" not in t:
                    raise InvalidDomain("Utter template '{}' needs to contain"
                                        "'- text: ' attribute to be a proper"
                                        "template".format(template_key))
                else:
                    validated_variations.append(t)
            templates[template_key] = validated_variations
        return templates
def collect_templates ( yml_templates : Dict [ Text , List [ Any ] ] ) -> Dict [ Text , List [ Dict [ Text , Any ] ] ] : templates = { } for template_key , template_variations in yml_templates . items ( ) : validated_variations = [ ] for t in template_variations : if isinstance ( t , str ) : validated_variations . append ( { "text" : t } ) elif "text" not in t : raise InvalidDomain ( "Utter template '{}' needs to contain" "'- text: ' attribute to be a proper" "template" . format ( template_key ) ) else : validated_variations . append ( t ) templates [ template_key ] = validated_variations return templates
Go through the templates and make sure they are all in dict format
Go through the templates and make sure they are all in dict format
"""Go through the templates and make sure they are all in dict format
        """ # templates can either directly be strings or a dict with # options we will always create a dict out of them
yml_templates
Dict[Text, List[Any]]