UnitClassEntry

class UnitClassEntry(*args, **kwargs)[source]

A single unit class entry in the HedSchema.

Methods

UnitClassEntry.__init__(*args, **kwargs)

Constructor for HedSchemaEntry.

UnitClassEntry.add_unit(unit_entry)

Add the given unit entry to this unit class.

UnitClassEntry.attribute_has_property(...)

Return True if attribute has property.

UnitClassEntry.finalize_entry(schema)

Called once after schema load to set state.

UnitClassEntry.get_derivative_unit_entry(units)

Gets the (derivative) unit entry if it exists

UnitClassEntry.has_attribute(attribute[, ...])

Checks for the existence of an attribute in this entry.

Attributes

UnitClassEntry.children

Alias to get the units for this class

UnitClassEntry.section_key

UnitClassEntry.__init__(*args, **kwargs)[source]

Constructor for HedSchemaEntry.

Parameters:
  • name (str) – The name of the entry.

  • section (HedSchemaSection) – The section to which it belongs.

UnitClassEntry.add_unit(unit_entry)[source]

Add the given unit entry to this unit class.

Parameters:

unit_entry (HedSchemaEntry) – Unit entry to add.

UnitClassEntry.attribute_has_property(attribute, property_name)

Return True if attribute has property.

Parameters:
  • attribute (str) – Attribute name to check for property_name.

  • property_name (str) – The property value to return.

Returns:

Returns True if this entry has the property.

Return type:

bool

UnitClassEntry.finalize_entry(schema)[source]

Called once after schema load to set state.

Parameters:

schema (HedSchema) – The object with the schema rules.

UnitClassEntry.get_derivative_unit_entry(units)[source]

Gets the (derivative) unit entry if it exists

Parameters:

units (str) – The unit name to check, can be plural or include a modifier.

Returns:

The unit entry if it exists

Return type:

unit_entry(UnitEntry or None)

UnitClassEntry.has_attribute(attribute, return_value=False)

Checks for the existence of an attribute in this entry.

Parameters:
  • attribute (str) – The attribute to check for.

  • return_value (bool) – If True, returns the actual value of the attribute. If False, returns a boolean indicating the presence of the attribute.

Returns:

If return_value is False, returns True if the attribute exists and False otherwise. If return_value is True, returns the value of the attribute if it exists, else returns None.

Return type:

bool or any

Notes

  • The existence of an attribute does not guarantee its validity.

UnitClassEntry.children

Alias to get the units for this class

Returns:

The unit list for this class

Return type:

unit_list(list)

UnitClassEntry.section_key