This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch metric-macro-expansion
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/metric-macro-expansion by this
push:
new 687e63fd5c --amend
687e63fd5c is described below
commit 687e63fd5c672eb3efe4ac8638b102bef9502f65
Author: Beto Dealmeida <[email protected]>
AuthorDate: Fri Feb 21 08:04:28 2025 -0600
--amend
---
superset/jinja_context.py | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/superset/jinja_context.py b/superset/jinja_context.py
index cb6da2e983..7bb7b58dbf 100644
--- a/superset/jinja_context.py
+++ b/superset/jinja_context.py
@@ -899,26 +899,6 @@ def get_dataset_id_from_context(metric_key: str) -> int:
raise SupersetTemplateException(exc_message)
-def has_metric_macro(template_string: str, env: Environment) -> bool:
- """
- Checks if a template string contains a metric macro.
-
- >>> has_metric_macro("{{ metric('my_metric') }}")
- True
-
- """
- ast = env.parse(template_string)
-
- def visit_node(node: Node) -> bool:
- return (
- isinstance(node, Call)
- and isinstance(node.node, nodes.Name)
- and node.node.name == "metric"
- ) or any(visit_node(child) for child in node.iter_child_nodes())
-
- return visit_node(ast)
-
-
def metric_macro(
env: Environment,
context: dict[str, Any],