(content, variables_mapping, functions_mapping)
return content
parse string content with variables mapping.

    Args:
        content (str): string content to be parsed.
        variables_mapping (dict): variables mapping.

    Returns:
        str: parsed string content.

    Examples:
        >>> content = "/api/users/$uid"
        >>> variables_mapping = {"$uid": 1000}
        >>> parse_string_variables(content, variables_mapping, {})
            "/api/users/1000"
parse string content with variables mapping.
parse string content with variables mapping .
def parse_string_variables(content, variables_mapping, functions_mapping):
    """ parse string content with variables mapping.

    Args:
        content (str): string content to be parsed.
        variables_mapping (dict): variables mapping.

    Returns:
        str: parsed string content.

    Examples:
        >>> content = "/api/users/$uid"
        >>> variables_mapping = {"$uid": 1000}
        >>> parse_string_variables(content, variables_mapping, {})
            "/api/users/1000"

    """
    variables_list = extract_variables(content)
    for variable_name in variables_list:
        variable_value = get_mapping_variable(variable_name, variables_mapping)

        if variable_name == "request" and isinstance(variable_value, dict) \
            and "url" in variable_value and "method" in variable_value:
            # call setup_hooks action with $request
            for key, value in variable_value.items():
                variable_value[key] = parse_data(
                    value,
                    variables_mapping,
                    functions_mapping
                )
            parsed_variable_value = variable_value
        elif "${}".format(variable_name) == variable_value:
            # variable_name = "token"
            # variables_mapping = {"token": "$token"}
            parsed_variable_value = variable_value
        else:
            parsed_variable_value = parse_data(
                variable_value,
                variables_mapping,
                functions_mapping,
                raise_if_variable_not_found=False
            )
            variables_mapping[variable_name] = parsed_variable_value
        # TODO: replace variable label from $var to {{var}}
        if "${}".format(variable_name) == content:
            # content is a variable
            content = parsed_variable_value
        else:
            # content contains one or several variables
            if not isinstance(parsed_variable_value, str):
                parsed_variable_value = builtin_str(parsed_variable_value)

            content = content.replace(
                "${}".format(variable_name),
                parsed_variable_value, 1
            )

    return content
def parse_string_variables ( content , variables_mapping , functions_mapping ) : variables_list = extract_variables ( content ) for variable_name in variables_list : variable_value = get_mapping_variable ( variable_name , variables_mapping ) if variable_name == "request" and isinstance ( variable_value , dict ) and "url" in variable_value and "method" in variable_value : # call setup_hooks action with $request for key , value in variable_value . items ( ) : variable_value [ key ] = parse_data ( value , variables_mapping , functions_mapping ) parsed_variable_value = variable_value elif "${}" . format ( variable_name ) == variable_value : # variable_name = "token" # variables_mapping = {"token": "$token"} parsed_variable_value = variable_value else : parsed_variable_value = parse_data ( variable_value , variables_mapping , functions_mapping , raise_if_variable_not_found = False ) variables_mapping [ variable_name ] = parsed_variable_value # TODO: replace variable label from $var to {{var}} if "${}" . format ( variable_name ) == content : # content is a variable content = parsed_variable_value else : # content contains one or several variables if not isinstance ( parsed_variable_value , str ) : parsed_variable_value = builtin_str ( parsed_variable_value ) content = content . replace ( "${}" . format ( variable_name ) , parsed_variable_value , 1 ) return content