DefinitionDict¶
- class DefinitionDict(def_dicts=None, hed_schema=None)[source]
Gathers definitions from a single source.
Methods
Definitions to be considered a single source. |
|
|
Add definitions from dict(s) to this dict. |
|
Check string for definition tags, adding them to self. |
|
Identify def/def-expand tag contents in the given HedTag. |
|
Identify def/def-expand tag contents in the given string. |
Get the definition entry for the definition name. |
|
|
Convert the entries to strings of the contents |
Returns the dictionary of definitions |
Attributes
Returns issues about duplicate definitions. |
- DefinitionDict.__init__(def_dicts=None, hed_schema=None)[source]¶
Definitions to be considered a single source.
- Parameters:
def_dicts (str or list or DefinitionDict) – DefDict or list of DefDicts/strings or a single string whose definitions should be added.
hed_schema (HedSchema or None) – Required if passing strings or lists of strings, unused otherwise.
- Raises:
TypeError –
Bad type passed as def_dicts
- DefinitionDict.add_definitions(def_dicts, hed_schema=None)[source]¶
Add definitions from dict(s) to this dict.
- Parameters:
def_dicts (list, DefinitionDict, or dict) –
- DefinitionDict or list of DefinitionDicts/strings/dicts whose
definitions should be added.
Note dict form expects DefinitionEntries in the same form as a DefinitionDict
hed_schema (HedSchema or None) – Required if passing strings or lists of strings, unused otherwise.
- Raises:
TypeError –
Bad type passed as def_dicts
- DefinitionDict.check_for_definitions(hed_string_obj, error_handler=None)[source]¶
Check string for definition tags, adding them to self.
- Parameters:
hed_string_obj (HedString) – A single hed string to gather definitions from.
error_handler (ErrorHandler or None) – Error context used to identify where definitions are found.
- Returns:
List of issues encountered in checking for definitions. Each issue is a dictionary.
- Return type:
list
- DefinitionDict.construct_def_tag(hed_tag)[source]¶
Identify def/def-expand tag contents in the given HedTag.
- Parameters:
hed_tag (HedTag) – The hed tag to identify definition contents in
- DefinitionDict.construct_def_tags(hed_string_obj)[source]¶
Identify def/def-expand tag contents in the given string.
- Parameters:
hed_string_obj (HedString) – The hed string to identify definition contents in
- DefinitionDict.get(def_name)[source]¶
Get the definition entry for the definition name.
Not case-sensitive
- Parameters:
def_name (str) – Name of the definition to retrieve.
- Returns:
Definition entry for the requested definition.
- Return type:
DefinitionEntry
- static DefinitionDict.get_as_strings(def_dict)[source]¶
Convert the entries to strings of the contents
- Parameters:
def_dict (DefinitionDict or dict) – A dict of definitions
- Returns:
str): definition name and contents
- Return type:
dict(str
- DefinitionDict.items()[source]¶
Returns the dictionary of definitions
Alias for .defs.items()
- Returns:
DefinitionEntry}): A list of definitions
- Return type:
def_entries({str
- DefinitionDict.issues¶
Returns issues about duplicate definitions.