Type aliases & semi-public classes

There are internally used classes and type aliases that can be of interest for re-use in applications and extensions.

Filter functions are defined as:

delb.typing.Filter

alias of Callable[[NodeBase], bool]

Loaders are defined as:

delb.typing.Loader

alias of Callable[[Any, SimpleNamespace], LoaderResult]

The order of loaders is defined with help of (read: Loader | Iterable[Loader] | None):

delb.typing.LoaderConstraint

alias of Loader | Iterable[Loader] | None

Loaders may return a string that explains why it wouldn’t successfully process the given input to the user:

delb.typing.LoaderResult

alias of etree._ElementTree | str

Namespace to prefix mappings are formalized as:

delb.typing.NamespaceDeclarations

alias of Mapping[str | None, str]

All node classes inherit from a common class:

class delb.NodeBase

Methods that add nodes to a tree take a variety of input data:

delb.typing.NodeSource

alias of str | NodeBase | _TagDefinition

Definitions that are used for convenient tree building are held in:

class _delb.nodes._TagDefinition(local_name: str, attributes: dict[AttributeAccessor, str] | None = None, children: tuple[NodeSource, ...] = ())[source]

Instances of this class describe tag nodes that are constructed from the context they are used in (commonly additions to a tree) and the properties that this description holds. For the sake of slick code they are not instantiated directly, but with the delb.tag() function.

attributes: dict[AttributeAccessor, str] | None
children: tuple[NodeSource, ...]
local_name: str