def _dict_from_template()

in taskcat/_config.py [0:0]


    def _dict_from_template(file_path: Path) -> dict:
        relative_path = str(file_path.relative_to(PROJECT_ROOT))
        config_dict = (
            BaseConfig()
            .from_dict(
                {"project": {"template": relative_path}, "tests": {"default": {}}}
            )
            .to_dict()
        )
        if not file_path.is_file():
            raise TaskCatException(f"invalid template path {file_path}")
        try:
            template = Template(
                str(file_path), template_cache=tcat_template_cache
            ).template
        except Exception as e:
            LOG.warning(f"failed to load template from {file_path}")
            LOG.debug(str(e), exc_info=True)
            raise e
        if not template.get("Metadata"):
            return config_dict
        if not template["Metadata"].get("taskcat"):
            return config_dict
        template_config_dict = template["Metadata"]["taskcat"]
        if not template_config_dict.get("project"):
            template_config_dict["project"] = {}
        template_config_dict["project"]["template"] = relative_path
        if not template_config_dict.get("tests"):
            template_config_dict["tests"] = {"default": {}}
        return template_config_dict