in scripts/create-api.py [0:0]
def read_annotation(filename, annotation_type, valid_tags=None):
annotation_md = frontmatter.load(filename)
# use everything in the YAML frontmatter
annotation = copy.copy(annotation_md.metadata)
# only specify commentary if we actually have some
if annotation_md.content.strip():
annotation["commentary"] = linkify(annotation_md.content)
tags = annotation_md.get("tags")
if tags and annotation_type != "app":
invalid_tags = [tag for tag in tags if tag not in valid_tags]
if invalid_tags:
sys.stderr.write(
f"Invalid tags found in {filename}: {invalid_tags}; "
f" if these should be accepted values, update annotations/{app}/metadata.yaml"
)
sys.exit(1)
return annotation