pg.utils.kvlist_str

Accessible via pg.utils.kvlist_str.

kvlist_str(kvlist, compact=True, verbose=False, root_indent=0, *, label=None, bracket_type=BracketType.ROUND, custom_format=None, memo=None, **kwargs)[source]

Formats a list key/value pairs into a comma delimited string.

Return type:

str

Parameters:
  • kvlist – List of tuples in format of (key, value, default_value or a tuple of default values)

  • compact – If True, format value in kvlist in compact form.

  • verbose – If True, format value in kvlist in verbose.

  • root_indent – The indent should be applied for values in kvlist if they are multi-line.

  • label – (Optional) If not None, add label to brace all kv pairs.

  • bracket_type – Bracket type used for embracing the kv pairs. Applicable only when name is not None.

  • custom_format – An optional custom format function, which will be applied to each value (and child values) in kvlist. If the function returns None, it will fall back to the default pg.format.

  • memo – A set of object ids that have been formatted. Used to avoid infinite recursion in the formatting process.

  • **kwargs – Keyword arguments that will be passed through unto child Formattable objects.

Returns:

A formatted string from a list of key/value pairs delimited by comma.