class documentation

Base class for labels.

Label instances represent a logical collection of data associated with a particular task for a sample or frame in a dataset.

Method delete_attribute Deletes the attribute with the given name.
Method get_attribute_value Gets the value of the attribute with the given name.
Method has_attribute Determines whether the label has an attribute with the given name.
Method iter_attributes Returns an iterator over the custom attributes of the label.
Method set_attribute_value Sets the value of the attribute with the given name.
def delete_attribute(self, name): (source)

Deletes the attribute with the given name.

Parameters
namethe attribute name
Raises
AttributeErrorif the attribute does not exist
def get_attribute_value(self, name, default=no_default): (source)

Gets the value of the attribute with the given name.

Parameters
namethe attribute name
default:no_defaulta default value to return if the attribute does not exist. Can be None
Returns
the attribute value
Raises
AttributeErrorif the attribute does not exist and no default value was provided
def has_attribute(self, name): (source)

Determines whether the label has an attribute with the given name.

Parameters
namethe attribute name
Returns
True/False
def iter_attributes(self): (source)

Returns an iterator over the custom attributes of the label.

Returns
a generator that emits (name, value) tuples
def set_attribute_value(self, name, value): (source)

Sets the value of the attribute with the given name.

The attribute will be declared if it does not exist.

Parameters
namethe attribute name
valuethe value