From 7de92543645c1603b08dbe2ec6bf7faf1cb43149 Mon Sep 17 00:00:00 2001 From: tlento Date: Thu, 16 May 2024 18:26:09 -0700 Subject: [PATCH] Make helper method static --- metricflow/dataflow/dataflow_plan.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/metricflow/dataflow/dataflow_plan.py b/metricflow/dataflow/dataflow_plan.py index 8ec255e038..2f8bdb2094 100644 --- a/metricflow/dataflow/dataflow_plan.py +++ b/metricflow/dataflow/dataflow_plan.py @@ -209,13 +209,16 @@ def __init__(self, sink_nodes: Sequence[DataflowPlanNode], plan_id: Optional[Dag def sink_node(self) -> DataflowPlanNode: # noqa: D102 return self._sink_nodes[0] - def __all_nodes_in_subgraph(self, node: DataflowPlanNode) -> Sequence[DataflowPlanNode]: + @staticmethod + def __all_nodes_in_subgraph(node: DataflowPlanNode) -> Sequence[DataflowPlanNode]: """Node accessor for retrieving a flattened sequence of all nodes in the subgraph upstream of the input node. Useful for gathering nodes for subtype-agnostic operations, such as common property access or simple counts. """ flattened_parent_subgraphs = tuple( - more_itertools.collapse(self.__all_nodes_in_subgraph(parent_node) for parent_node in node.parent_nodes) + more_itertools.collapse( + DataflowPlan.__all_nodes_in_subgraph(parent_node) for parent_node in node.parent_nodes + ) ) return (node,) + flattened_parent_subgraphs @@ -225,7 +228,7 @@ def source_semantic_models(self) -> FrozenSet[SemanticModelReference]: return frozenset( [ node._input_semantic_model - for node in self.__all_nodes_in_subgraph(self.sink_node) + for node in DataflowPlan.__all_nodes_in_subgraph(self.sink_node) if node._input_semantic_model is not None ] )