bff.kwargs_2_list

bff.kwargs_2_list(**kwargs)

Convert all single values from keyword arguments into lists.

For each argument provided, if the type is not a sequence, convert the single value into a list. Strings are not considered as a sequence in this scenario.

Parameters

**kwargs – Parameters passed to the function.

Returns

Dictionary with the single values put into a list.

Return type

dict

Raises

TypeError – If a non-keyword argument is passed to the function.

Examples

>>> kwargs_2_list(name='John Doe', age=42, children=('Jane Doe', 14))
{'name': ['John Doe'], 'age': [42], 'children': ('Jane Doe', 14)}
>>> kwargs_2_list(countries=['Swiss', 'Spain'])
{'countries': ['Swiss', 'Spain']}