def load_templates()

in dagify/converter/engine.py [0:0]


def load_templates(object):
    # This will load all templates from the provide path into a universal
    # HashMap for Direct Referencing

    # Validate Template Path Provided
    if object.templates_path is None:
        raise ValueError("dagify: Templates path not provided")
    if is_directory(object.templates_path) is False:
        raise NotADirectoryError(
            "dagify: Templates path is not a directory")

    # Load Templates
    for root, dirs, files in os.walk(object.templates_path):
        for file in files:
            if file.endswith(".yaml"):
                # Loads a Single Template into a Dictionary from .yaml file
                template = read_yaml_to_dict(os.path.join(root, file))
                if template is not None:
                    # if the dict it not empty
                    object.templates_count += 1
                    object.templates[template["metadata"]["name"]] = template
    return