<commit_before>"""Strategy variable assumptions provided as parameters to smif
"""
from collections import defaultdict

from energy_demand.read_write import narrative_related

def generate_default_parameter_narratives(
        default_streategy_vars,
        end_yr=2050,
        base_yr=2015):
    """Load default parameters and create default timesteps

    Arguments
    ---------
    default_streategy_vars : dict
        Default parameter values
    end_yr : int
        Simulation end year
    base_yr : int
        Base year

    Returns
    -------

    """
    strategy_vars = defaultdict(dict)
    # ------------------------------------------------------------
    # Create default narrative for every simulation parameter
    # ------------------------------------------------------------
    for var_name, var_entries in default_streategy_vars.items():
        crit_single_dim = narrative_related.crit_dim_var(var_entries)

        if crit_single_dim:

            scenario_value = var_entries['default_value']

            # Create default narrative with only one timestep from simulation base year to simulation end year
            strategy_vars[var_name] = narrative_related.default_narrative(
                end_yr=end_yr,
                value_by=var_entries['default_value'],                # Base year value,
                value_ey=scenario_value,
                diffusion_choice=var_entries['diffusion_type'],       # Sigmoid or linear,
                base_yr=base_yr,
                regional_specific=var_entries['regional_specific'])   # Criteria whether the same for all regions or not

        else:
            # Standard narrative for multidimensional narrative
            for sub_var_name, sub_var_entries in var_entries.items():

                try:
                    scenario_value = sub_var_entries['scenario_value']
                except TypeError:
                    raise TypeError("{}: Var_entries dict: {}".format(var_name, var_entries))
                else:
                    if var_name == 'ss_t_base_heating':
                        print("{}: Var_entries dict: {}".format(var_name, var_entries))
                        raise RuntimeError("Fake error to break code")
                # -----------------------------------
                # Crate single-step default narratives (up to end_year)
                # -----------------------------------
                strategy_vars[var_name][sub_var_name] = narrative_related.default_narrative(
                    end_yr=end_yr,<commit_msg>Removed debug code<commit_after>"""Strategy variable assumptions provided as parameters to smif
"""
from collections import defaultdict

from energy_demand.read_write import narrative_related

def generate_default_parameter_narratives(
        default_streategy_vars,
        end_yr=2050,
        base_yr=2015):
    """Load default parameters and create default timesteps

    Arguments
    ---------
    default_streategy_vars : dict
        Default parameter values
    end_yr : int
        Simulation end year
    base_yr : int
        Base year

    Returns
    -------

    """
    strategy_vars = defaultdict(dict)
    # ------------------------------------------------------------
    # Create default narrative for every simulation parameter
    # ------------------------------------------------------------
    for var_name, var_entries in default_streategy_vars.items():
        crit_single_dim = narrative_related.crit_dim_var(var_entries)

        if crit_single_dim:

            scenario_value = var_entries['default_value']

            # Create default narrative with only one timestep from simulation base year to simulation end year
            strategy_vars[var_name] = narrative_related.default_narrative(
                end_yr=end_yr,
                value_by=var_entries['default_value'],                # Base year value,
                value_ey=scenario_value,
                diffusion_choice=var_entries['diffusion_type'],       # Sigmoid or linear,
                base_yr=base_yr,
                regional_specific=var_entries['regional_specific'])   # Criteria whether the same for all regions or not

        else:
            # Standard narrative for multidimensional narrative
            for sub_var_name, sub_var_entries in var_entries.items():

                try:
                    scenario_value = sub_var_entries['scenario_value']
                except TypeError:
                    raise TypeError("{}: Var_entries dict: {}".format(var_name, var_entries))
                # -----------------------------------
                # Crate single-step default narratives (up to end_year)
                # -----------------------------------
                strategy_vars[var_name][sub_var_name] = narrative_related.default_narrative(
                    end_yr=end_yr,
{'fraction_non_alphanumeric': 0.14138499587798845, 'fraction_numerical': 0.0032976092333058533, 'mean_word_length': 1.6961111111111111, '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': '4546546', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1128, 'n_words': 284}