cachai.utilities.kwargs_as_string

cachai.utilities.kwargs_as_string(keys, aliases={})[source]

Formats keyword argument names as a readable string separated by ,, with optional aliases.

Parameters
keyslist or array-like

A list with the name of the key arguments you want to format as string.

aliasesdict, optional

A python dictionary with alternative aliases for the key arguments ().

Returns

str

Examples

import cachai.utilities as chu

params  = {'name': 'Fabian', 'age': 21, 'favorite_color': 'blue'}
aliases = {'favorite_color': 'favc'}

my_kwargs = chu.kwargs_as_string(params.keys(),aliases)

print(f"The arguments of my function are {my_kwargs}.")
"The arguments of my function are name, age, favorite_color / favc."