TagValidator¶
- class TagValidator[source]
Validation for individual HED tags.
Methods
|
Report warning if incorrect tag capitalization. |
|
Report invalid placeholder characters. |
Report invalid tag or doesn't take a value. |
|
Report if tag is a leaf with 'requiredTag' attribute. |
|
Runs the validators on the individual tags. |
Attributes
- TagValidator.__init__()¶
- TagValidator.check_capitalization(original_tag)[source]¶
Report warning if incorrect tag capitalization.
- Parameters:
original_tag (HedTag) – The original tag used to report the warning.
- Returns:
Validation issues. Each issue is a dictionary.
- Return type:
list
- static TagValidator.check_for_placeholder(original_tag, is_definition=False)[source]¶
Report invalid placeholder characters.
- Parameters:
original_tag (HedTag) – The HedTag to be checked
is_definition (bool) – If True, placeholders are allowed.
- Returns:
Validation issues. Each issue is a dictionary.
- Return type:
list
Notes
Invalid placeholder may appear in the extension/value portion of a tag.
- static TagValidator.check_tag_exists_in_schema(original_tag)[source]¶
Report invalid tag or doesn’t take a value.
- Parameters:
original_tag (HedTag) – The original tag that is used to report the error.
- Returns:
Validation issues. Each issue is a dictionary.
- Return type:
list
- static TagValidator.check_tag_requires_child(original_tag)[source]¶
Report if tag is a leaf with ‘requiredTag’ attribute.
- Parameters:
original_tag (HedTag) – The original tag that is used to report the error.
- Returns:
Validation issues. Each issue is a dictionary.
- Return type:
list
- TagValidator.run_individual_tag_validators(original_tag, allow_placeholders=False, is_definition=False)[source]¶
Runs the validators on the individual tags.
This ignores most illegal characters except in extensions.
- Parameters:
original_tag (HedTag) – A original tag.
allow_placeholders (bool) – Allow value class or extensions to be placeholders rather than a specific value.
is_definition (bool) – This tag is part of a Definition, not a normal line.
- Returns:
The validation issues associated with the tags. Each issue is dictionary.
- Return type:
list
- TagValidator.CAMEL_CASE_EXPRESSION = '([A-Z]+\\s*[a-z-]*)+'¶