utils.format_valid_options()

Format the key-value pairs of a dictionary as a bullet list for error messages.

Usage

Source

utils.format_valid_options(d)

Parameters

d: dict
The dictionary whose items will be formatted as valid options.

Returns

str
A string representing the dictionary items as a bullet list, suitable for inclusion in error messages about valid argument values.

Examples

>>> allowed = {"csv": "Comma-separated values", "json": "JavaScript Object Notation"}
>>> print(format_valid_options(allowed))
  • ‘csv’: Comma-separated values
  • ‘json’: JavaScript Object Notation