epublib.package.properties module

class WithProperties(
soup: S,
tag: ~bs4.element.Tag = <sentinel/>,
*,
properties: ~typing.Annotated[list[str] | None,
~epublib.xml_element.XMLAttribute(init_name=None,
sync=<SyncType.ATTR: 1>,
get=None,
create=None,
prefix=)] = None,
)

Bases: XMLElement

Mixin for XMLElements with a properties attribute.

add_property(prop: str) None

Add a property to this item, if not already present.

Parameters:

prop – The property to add.

has_property(prop: str) bool

Returns whether this item has the given property.

Parameters:

prop – The property to check for.

remove_property(prop: str) None

Remove the given property from this item, if present.

Parameters:

prop – The property to remove.