DefinitionEntry

class DefinitionEntry(name, contents, takes_value, source_context)[source]

A single definition.

Methods

DefinitionEntry.__init__(name, contents, ...)

Initialize info for a single definition.

DefinitionEntry.get_definition(replace_tag)

Return a copy of the definition with the tag expanded and the placeholder plugged in.

Attributes

DefinitionEntry.__init__(name, contents, takes_value, source_context)[source]

Initialize info for a single definition.

Parameters:
  • name (str) – The label portion of this name (not including Definition/).

  • contents (HedGroup) – The contents of this definition.

  • takes_value (bool) – If True, expects ONE tag to have a single # sign in it.

  • source_context (list, None) – List (stack) of dictionaries giving context for reporting errors.

DefinitionEntry.get_definition(replace_tag, placeholder_value=None, return_copy_of_tag=False)[source]

Return a copy of the definition with the tag expanded and the placeholder plugged in.

Returns None if placeholder_value passed when it doesn’t take value, or vice versa.

Parameters:
  • replace_tag (HedTag) – The def HED tag to replace with an expanded version.

  • placeholder_value (str or None) – If present and required, will replace any pound signs in the definition contents.

  • return_copy_of_tag (bool) – Set to True for validation.

Returns:

The contents of this definition(including the def tag itself).

Return type:

HedGroup

Raises:

ValueError

  • Something internally went wrong with finding the placeholder tag. This should not be possible.