parselglossy.check_template module#
Facilities for checking input templates
- parselglossy.check_template.is_template_valid(template: Dict[str, Any]) Dict[str, Any] [source]#
Checks a template
dict
is well-formed.A template
dict
is well-formed if:All keywords have:
An allowed type.
A non-empty docstring.
A default callable that is valid Python, if present.
Predicates that are valid Python, if present.
Note that the latter two criteria can only be checked later on.
No sections are nested under keywords.
All sections have a non-empty docstring.
Reorders keywords according to their dependencies.
- Parameters
template (JSONDict) –
- Returns
ordered
- Return type
JSONDict
- Raises
Notes
This is porcelain over the recursive
_rec_is_template_valid()
.