class_docstr: A custom presto template processor for test.
docstr: Processes a sql template with $ style macro using regex.
code: def process_template(self, sql: str, **kwargs) -> str:
      """Processes a sql template with $ style macro using regex."""
      # Add custom macros functions.
      macros = {
          "DATE": partial(DATE, datetime.utcnow())
      }  # type: Dict[str, Any]
      # Update with macros defined in context and kwargs.
      macros.update(self._context)
      macros.update(kwargs)
  
      def replacer(match):
          """Expands $ style macros with corresponding function calls."""
          macro_name, args_str = match.groups()
          args = [a.strip() for a in args_str.split(",")]
          if args == [""]:
              args = []
          f = macros[macro_name[1:]]
          return f(*args)
  
      macro_names = ["$" + name for name in macros.keys()]
      pattern = r"(%s)\s*\(([^()]*)\)" % "|".join(
          map(re.escape, macro_names)
      )
      return re.sub(pattern, replacer, sql)
  
file_path: superset/tests/integration_tests/superset_test_custom_template_processors.py
imports: import re
  from datetime import datetime, timedelta
  from functools import partial
  from typing import Any, Dict, SupportsInt
  from superset.jinja_context import PrestoTemplateProcessor
label_desc: Use image node_id 1 for calling the CustomPrestoTemplateProcessor obj's underlying member method code with example usage: obj.process_template(sql) and returns: re, f