TagValidator

class TagValidator[source]

Validation for individual HED tags.

Methods

TagValidator.__init__()

TagValidator.check_capitalization(original_tag)

Report warning if incorrect tag capitalization.

TagValidator.check_for_placeholder(original_tag)

Report invalid placeholder characters.

TagValidator.check_tag_exists_in_schema(...)

Report invalid tag or doesn't take a value.

TagValidator.check_tag_is_deprecated(...)

TagValidator.check_tag_requires_child(...)

Report if tag is a leaf with 'requiredTag' attribute.

TagValidator.run_individual_tag_validators(...)

Runs the validators on the individual tags.

Attributes

TagValidator.CAMEL_CASE_EXPRESSION

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

TagValidator.check_tag_is_deprecated(original_tag)[source]
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-]*)+'