Validation facilities.
parselglossy.validation.
check_predicates
(incoming: Dict[str, Any], *, predicates: Dict[str, Any]) → None[source]¶Run predicates on input tree with fixed defaults.
Parameters: |
|
---|---|
Raises: |
|
Notes
This is porcelain over recursive function rec_check_predicates()
.
parselglossy.validation.
fix_defaults
(incoming: Dict[str, Any], *, types: Dict[str, Any]) → Dict[str, Any][source]¶Fixes defaults from a merge input dict
.
Parameters: | incoming (JSONDict) – The input dict. This is supposed to be the one obtained by merging user and template dict-s. |
---|---|
Returns: | outgoing – A dictionary with all default values fixed. |
Return type: | JSONDict |
Raises: | ParselglossyError |
Notes
This is porcelain over recursive function rec_fix_defaults()
.
parselglossy.validation.
is_template_valid
(template: Dict[str, Any]) → None[source]¶Checks a template dict is well-formed.
Parameters: | template (JSONDict) – |
---|---|
Raises: | ParselglossyError |
Notes
This is porcelain over the recursive rec_is_template_valid()
.
parselglossy.validation.
merge_ours
(*, theirs: Dict[str, Any], ours: Dict[str, Any]) → Dict[str, Any][source]¶Recursively merge two dict-s with “ours” strategy.
Parameters: |
|
---|---|
Returns: | outgoing |
Return type: | JSONDict |
Raises: |
|
Notes
This is porcelain over the recursive function rec_merge_ours()
.
parselglossy.validation.
validate_from_dicts
(*, ir: Dict[str, Any], template: Dict[str, Any], fr_file: Union[str, pathlib.Path] = None) → Dict[str, Any][source]¶Validate intermediate representation into final representation.
Parameters: |
|
---|---|
Returns: | fr – The validated input. |
Return type: | JSONDict |
Raises: |
|