<commit_before>"""Create list of all possible valid resource combinations."""

import itertools
from utils.bool_to_yes_no import bool_to_yes_no


def resource_valid_configurations(valid_options, header_text=True):
    """Return list of all possible valid resource combinations.

    Args:
        valid_options: A dictionary containing all valid resource generation
                       options (dict).
        header_text: If true, add in valid options for header text (bool).

    Returns:
        List of dictionaries of valid combinations (list).
    """
    if header_text:
        valid_options["header_text"] = ["", "Example header"]
    # Change all booleans to text to mimic forms
    for (key, value) in valid_options.items():
        if isinstance(value, bool):
            valid_options[key] = bool_to_yes_no(value)
    valid_option_keys = sorted(valid_options)
    return [dict(zip(valid_option_keys, product)) for product in itertools.product(
        *(valid_options[valid_option_key] for valid_option_key in valid_option_keys)
    )]<commit_msg>Fix bug where boolean combination values were not changed to strings<commit_after>"""Create list of all possible valid resource combinations."""

import itertools
from utils.bool_to_yes_no import bool_to_yes_no


def resource_valid_configurations(valid_options, header_text=True):
    """Return list of all possible valid resource combinations.

    Args:
        valid_options: A dictionary containing all valid resource generation
                       options (dict).
        header_text: If true, add in valid options for header text (bool).

    Returns:
        List of dictionaries of valid combinations (list).
    """
    if header_text:
        valid_options["header_text"] = ["", "Example header"]
    # Change all booleans to text to mimic forms
    for (key, values) in valid_options.items():
        for i in range(0, len(values)):
            if isinstance(values[i], bool):
                values[i] = bool_to_yes_no(values[i])
    valid_option_keys = sorted(valid_options)
    return [dict(zip(valid_option_keys, product)) for product in itertools.product(
        *(valid_options[valid_option_key] for valid_option_key in valid_option_keys)
    )]
{'fraction_non_alphanumeric': 0.08075370121130551, 'fraction_numerical': 0.00044863167339614175, 'mean_word_length': 3.46, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1887969', 'n_tokens_mistral': 604, 'n_tokens_neox': 595, 'n_words': 199}