exopy.utils.transformers module

Utility functions to perform string transformations.


Basic formmater turning ‘_’ in ‘ ‘ and capitalising.

exopy.utils.transformers.ids_to_unique_names(ids, name_formatter=<function basic_name_formatter>, separator='.', preformatter=None, reverse=False)[source]

Make the easiest to read names from ids without duplicate.

  • ids (iterable[unicode]) – Iterable of ids from which to build the names.

  • name_formatter (callable, optional) – Callable making a name more human readdable. It is applied only to the last part of the id (after last separator occurence).

  • separator (unicode, optional) – Character used as separator between the different parts of an id.

  • preformatter (callable, optional) – Preformat ids before looking for shorter names.

  • reverse (bool, optional) – If False the mapping returned map the names to the ids, otherwise it maps the ids to the names.


names – Dictionary mapping the unique names to their original ids.

Return type