HedTypeDefs

class HedTypeDefs(definitions, type_tag='condition-variable')[source]

Manager for definitions associated with a type such as condition-variable.

Properties:

def_map (dict): keys are definition names, values are dict {type_values, description, tags}.

Example: A definition ‘famous-face-cond’ with contents:

‘(Condition-variable/Face-type,Description/A face that should be recognized.,(Image,(Face,Famous)))’

would have type_values [‘face_type’]. All items are strings not objects.

Methods

HedTypeDefs.__init__(definitions[, type_tag])

Create a definition manager for a type of variable.

HedTypeDefs.extract_def_names(item[, no_value])

Return a list of Def values in item.

HedTypeDefs.get_type_values(item)

Return a list of type_tag values in item.

HedTypeDefs.split_name(name[, lowercase])

Split a name/# or name/x into name, x.

Attributes

HedTypeDefs.type_def_names

Return list of names of definition that have this type-variable.

HedTypeDefs.type_names

Return list of names of the type-variables associated with type definitions.

HedTypeDefs.__init__(definitions, type_tag='condition-variable')[source]

Create a definition manager for a type of variable.

Parameters:
  • definitions (dict or DefinitionDict) – A dictionary of DefinitionEntry objects.

  • type_tag (str) – Lower-case HED tag string representing the type managed.

static HedTypeDefs.extract_def_names(item, no_value=True)[source]

Return a list of Def values in item.

Parameters:
  • item (HedTag, HedGroup, or HedString) – An item containing a def tag.

  • no_value (bool) – If True, strip off extra values after the definition name.

Returns:

A list of definition names (as strings).

Return type:

list

HedTypeDefs.get_type_values(item)[source]

Return a list of type_tag values in item.

Parameters:

item (HedTag, HedGroup, or HedString) – An item potentially containing def tags.

Returns:

A list of the unique values associated with this type

Return type:

list

static HedTypeDefs.split_name(name, lowercase=True)[source]

Split a name/# or name/x into name, x.

Parameters:
  • name (str) – The extension or value portion of a tag.

  • lowercase (bool) – If True (default), return values are converted to lowercase.

Returns:

name of the definition. str: value of the definition if it has one.

Return type:

str

HedTypeDefs.type_def_names

Return list of names of definition that have this type-variable.

Returns:

definition names that have this type.

Return type:

list

HedTypeDefs.type_names

Return list of names of the type-variables associated with type definitions.

Returns:

type names associated with the type definitions

Return type:

list