xsdata.utils.collections module

xsdata.utils.collections.unique_sequence(items, key=None)[source]

Return a new list with the unique values from the sequence.

Optionally you can also provide a lambda to generate the unique key of each item in the sequence.

Parameters
Return type

List

xsdata.utils.collections.group_by(items, key)[source]

Group the items of a sequence by the result of the callable.

Parameters
Return type

Dict[Any, List]

xsdata.utils.collections.apply(items, func)[source]

Apply the given function to each item of the sequence.

Parameters
xsdata.utils.collections.find(items, value)[source]

Return the index of the value in the given sequence without raising exception in case of failure.

Parameters
Return type

int