(
    raw_data: Any,
    variables_mapping: VariablesMapping = None,
    functions_mapping: FunctionsMapping = None,
)
parse raw data with evaluated variables mapping.
        Notice: variables_mapping should not contain any variable or function.
parse raw data with evaluated variables mapping.
        Notice: variables_mapping should not contain any variable or function.
parse raw data with evaluated variables mapping . Notice : variables_mapping should not contain any variable or function .
def parse_data(
    raw_data: Any,
    variables_mapping: VariablesMapping = None,
    functions_mapping: FunctionsMapping = None,
) -> Any:
    """ parse raw data with evaluated variables mapping.
        Notice: variables_mapping should not contain any variable or function.
    """
    if isinstance(raw_data, str):
        # content in string format may contains variables and functions
        variables_mapping = variables_mapping or {}
        functions_mapping = functions_mapping or {}
        # only strip whitespaces and tabs, \n\r is left because they maybe used in changeset
        raw_data = raw_data.strip(" \t")
        return parse_string(raw_data, variables_mapping, functions_mapping)

    elif isinstance(raw_data, (list, set, tuple)):
        return [
            parse_data(item, variables_mapping, functions_mapping) for item in raw_data
        ]

    elif isinstance(raw_data, dict):
        parsed_data = {}
        for key, value in raw_data.items():
            parsed_key = parse_data(key, variables_mapping, functions_mapping)
            parsed_value = parse_data(value, variables_mapping, functions_mapping)
            parsed_data[parsed_key] = parsed_value

        return parsed_data

    else:
        # other types, e.g. None, int, float, bool
        return raw_data
def parse_data ( raw_data : Any , variables_mapping : VariablesMapping = None , functions_mapping : FunctionsMapping = None , ) -> Any : if isinstance ( raw_data , str ) : # content in string format may contains variables and functions variables_mapping = variables_mapping or { } functions_mapping = functions_mapping or { } # only strip whitespaces and tabs, \n\r is left because they maybe used in changeset raw_data = raw_data . strip ( " \t" ) return parse_string ( raw_data , variables_mapping , functions_mapping ) elif isinstance ( raw_data , ( list , set , tuple ) ) : return [ parse_data ( item , variables_mapping , functions_mapping ) for item in raw_data ] elif isinstance ( raw_data , dict ) : parsed_data = { } for key , value in raw_data . items ( ) : parsed_key = parse_data ( key , variables_mapping , functions_mapping ) parsed_value = parse_data ( value , variables_mapping , functions_mapping ) parsed_data [ parsed_key ] = parsed_value return parsed_data else : # other types, e.g. None, int, float, bool return raw_data