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.remove(items, predicate)[source]

Return a new list without the items that match the predicate.

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

xsdata.utils.collections.first(items)[source]

Return the first item of the iterator.

Parameters

items (Iterator) –

Return type

Any

xsdata.utils.collections.concat(*args)[source]

Concatenate iterables into a single iterator.

Parameters

args (Iterable) –

Return type

Iterator

xsdata.utils.collections.map_key(dictionary, search)[source]

Find and return they key for given search value.

Parameters
  • dictionary (Dict) –

  • search (Any) –

Return type

Any

xsdata.utils.collections.prepend(target, *args)[source]

Prepend items to the target list.

Parameters