From 97dea73aa42d6e015644678ff11a6bf212dccb03 Mon Sep 17 00:00:00 2001 From: Eduardo Lauer Date: Wed, 4 Sep 2024 20:02:52 -0300 Subject: [PATCH] remove ensure_list function (solved with pydantic) --- src/dou_dag_generator.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/dou_dag_generator.py b/src/dou_dag_generator.py index 4182169..7de77f4 100755 --- a/src/dou_dag_generator.py +++ b/src/dou_dag_generator.py @@ -343,18 +343,6 @@ def perform_searches( return search_dict - def _ensure_list_of_searches(self, specs: DAGConfig) -> list: - """Ensure that the search attribute is returned as a list, - whether it's originally a single element or a list.""" - - # is it a single search or a list of searchers? - if isinstance(specs.search, list): - searches = specs.search - else: - searches = [specs.search] - - return searches - def get_xcom_pull_tasks(self, num_searches, **context): """Retrieve XCom values from multiple tasks and append them to a new list. Function required for Airflow version 2.10.0 or later @@ -455,7 +443,7 @@ def create_dag(self, specs: DAGConfig, config_file: str) -> DAG: with TaskGroup(group_id="exec_searchs") as tg_exec_searchs: - searches = self._ensure_list_of_searches(specs=specs) + searches = specs.search for counter, subsearch in enumerate(searches, 1):