def render_name(source_text, source_path, variables):
    if source_path:
        source_text = open(source_path).read()

    def sub(match):
        token = match.group(1)
        if token[0] == '\\':
            return token[1:]  # strip escape
        if token[1] == '{' and token[-1] == '}':
            token = token[2:-1]  # strip ${}
        else:
            token = token[1:]  # strip $
        node = variables
        tpath, _, targs = token.partition("(")
        for part in tpath.split("."):
            if isinstance(node, dict) and part in node:
                node = node[part]
            else:
                node = getattr(node, part)
        if callable(node):
            node = node(*eval("(" + targs)) if targs else node()  # pylint: disable=W0123
        if not isinstance(node, string_types):
            node = str(node)
        return node
    return _name_re.sub(sub, source_text)
simplified filename rendering with dollar-variable substitution only
dataset/ETHPy150Open ohmu/poni/poni/template.py/render_name