simplebench.utils.kwargs_variations module🔗

Utility function for generating keyword argument permutations.

simplebench.utils.kwargs_variations.kwargs_variations(
kwargs: dict[str, Sequence[Any]],
) list[dict[str, Any]][source]🔗

Variations of keyword arguments for the benchmark.

This function takes a dictionary where each key is a keyword argument name and the value is a Sequence of possible values for that argument. It returns a list of dictionaries, each dictionary representing a unique combination of keyword arguments and their values.

Example:

kwargs_variations({
    'arg1': [1, 2],
    'arg2': ['a', 'b']
})
# output:
# [
#     {'arg1': 1, 'arg2': 'a'},
#     {'arg1': 1, 'arg2': 'b'},
#     {'arg1': 2, 'arg2': 'a'},
#     {'arg1': 2, 'arg2': 'b'}
# ]
Parameters:

kwargs (dict[str, Sequence[Any]]) – A dictionary of keyword arguments and their possible values. The value must be a Sequence (e.g., list, tuple, set), but not a str or bytes instance.

Returns:

A list of dictionaries, each representing a unique combination of keyword arguments and values.

Return type:

list[dict[str, Any]]