craft_parts.utils.formatting_utils module

Text formatting utilities.

craft_parts.utils.formatting_utils.humanize_list(items, conjunction, item_format='{!r}')[source]

Format a list into a human-readable string.

Parameters:
  • items (Iterable[str]) – List to humanize.

  • conjunction (str) – The conjunction used to join the final element to the rest of the list (e.g. ‘and’).

  • item_format (str) – Format string to use per item.

Return type:

str