class documentation

Mixin for Label classes that have an attributes field that contains a dict of Attribute instances.

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.
Class Variable attributes Undocumented
def delete_attribute(self, name): (source)

Deletes the attribute with the given name.

The specified attribute may either exist in the attributes dict or as a dynamic attribute.

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.

The specified attribute may either exist in the attributes dict or as a dynamic attribute.

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.

The specified attribute may either exist in the attributes dict or as a dynamic attribute.

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

Returns an iterator over the custom attributes of the label.

Attribute may either exist in the attributes dict or as dynamic attributes.

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.

If the specified attribute already exists in the attributes dict, its value is updated there. Otherwise, the attribute is set (or created) as a dynamic attribute.

Parameters
namethe attribute name
valuethe value