HedTypeDefs

class HedTypeDefs(definitions, type_tag='condition-variable')[source]
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 by the

participants,(Image,(Face,Famous)))`

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

Methods

hed.tools.analysis.hed_type_defs.HedTypeDefs.__init__(...)

Create a definition manager for a type of variable.

hed.tools.analysis.hed_type_defs.HedTypeDefs.extract_def_names(item)

Return a list of Def values in item.

hed.tools.analysis.hed_type_defs.HedTypeDefs.get_type_values(item)

Return a list of type_tag values in item.

hed.tools.analysis.hed_type_defs.HedTypeDefs.split_name(name)

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

Attributes

hed.tools.analysis.hed_type_defs.HedTypeDefs.type_def_names

List of names of definition that have this type-variable.

hed.tools.analysis.hed_type_defs.HedTypeDefs.type_names

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

Returns:

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

Return type:

str

HedTypeDefs.type_def_names

List of names of definition that have this type-variable.

Returns:

definition names that have this type.

Return type:

list

HedTypeDefs.type_names

List of names of the type-variables associated with type definitions.

Returns:

type names associated with the type definitions

Return type:

list