schema_validation_util¶
Utilities used in HED validation/loading using a HED schema.
Functions
|
This semi-validates rooted tags, raising an exception on major errors |
|
Validate attributes in the dictionary. |
|
Check the validity of the library name. |
|
Validate combinations of attributes |
|
Check the description of a single schema term. |
|
Check short tag for capitalization and illegal characters. |
|
Check validity of the version. |
- find_rooted_entry(tag_entry, schema, loading_merged)[source]¶
This semi-validates rooted tags, raising an exception on major errors
- Parameters:
tag_entry (HedTagEntry) – the possibly rooted tag
schema (HedSchema) – The schema being loaded
loading_merged (bool) – If this schema was already merged before loading
- Returns:
- The base tag entry from the standard schema
Returns None if this tag isn’t rooted
- Return type:
rooted_tag(HedTagEntry or None)
- Raises:
A rooted attribute is found in a non-paired schema
A rooted attribute is not a string
A rooted attribute was found on a non-root node in an unmerged schema.
A rooted attribute is found on a root node in a merged schema.
A rooted attribute indicates a tag that doesn’t exist in the base schema.
- validate_attributes(attrib_dict, filename)[source]¶
Validate attributes in the dictionary.
- Parameters:
attrib_dict (dict) – Dictionary of attributes to be evaluated.
filename (str) – File name to use in reporting errors.
- Returns:
List of issues. Each issue is a dictionary.
- Return type:
list
- Raises:
Invalid library name
Version not present
Invalid combinations of attributes in header
- validate_library_name(library_name)[source]¶
Check the validity of the library name.
- Parameters:
library_name (str) – Name of the library.
- Returns:
If not False, string indicates the issue.
- Return type:
bool or str
- validate_present_attributes(attrib_dict, filename)[source]¶
Validate combinations of attributes
- Parameters:
attrib_dict (dict) – Dictionary of attributes to be evaluated.
filename (str) – File name to use in reporting errors.
- Returns:
List of issues. Each issue is a dictionary.
- Return type:
list
- Raises:
withStandard is found in th header, but a library attribute is not specified
- validate_schema_description(tag_name, hed_description)[source]¶
Check the description of a single schema term.
- Parameters:
tag_name (str) – A single hed tag - not validated here, just used for error messages.
hed_description (str) – The description string to validate.
- Returns:
A list of all formatting issues found in the description.
- Return type:
list