Module zut.collection

Parse and convert lists and dicts.

Functions

filter_dict_list(input, keys, *[, sort_key])

get_dict_str(values)

Return a visual string representation of a dict (key1=value1,key2=value2,...), or a JSON string if any key or value contains a comma or equal sign.

get_list_str(values)

Return a visual string representation of a list (value1,value2,...), or a JSON string if any value contains a comma.

get_pgarray_str(values)

Parse an Iterable into an array literal (using PostgreSQL syntax).

parse_dict(value)

Parse a comma-separated string of key=value pairs into a dict, with support for quoted values.

parse_list(value, *, element_type)

Parse a comma-separated string into a list, with support for quoted items.

parse_pgarray(value, *, element_type)

Parse an array literal (using PostgreSQL syntax) into a list.