From 5a1889a7e70114317b96fefa4b1e3f47ae15cc10 Mon Sep 17 00:00:00 2001 From: Hussein Awala Date: Sat, 26 Aug 2023 09:03:55 +0200 Subject: [PATCH] Merge multiple isintance calls for the same object in a single call (#33767) --- airflow/utils/dot_renderer.py | 2 +- airflow/www/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airflow/utils/dot_renderer.py b/airflow/utils/dot_renderer.py index 7b895f739f97e..b6e2cdb7b0944 100644 --- a/airflow/utils/dot_renderer.py +++ b/airflow/utils/dot_renderer.py @@ -120,7 +120,7 @@ def _draw_nodes( node: DependencyMixin, parent_graph: graphviz.Digraph, states_by_task_id: dict[str, str] | None ) -> None: """Draw the node and its children on the given parent_graph recursively.""" - if isinstance(node, BaseOperator) or isinstance(node, MappedOperator): + if isinstance(node, (BaseOperator, MappedOperator)): _draw_task(node, parent_graph, states_by_task_id) else: if not isinstance(node, TaskGroup): diff --git a/airflow/www/views.py b/airflow/www/views.py index 275432f9bcfa5..353ce14f2324e 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -4254,7 +4254,7 @@ def check_dag_edit_acl_for_actions( dag_ids: set[str] = set() elif isinstance(items, list): dag_ids = {item.dag_id for item in items if item is not None} - elif isinstance(items, TaskInstance) or isinstance(items, DagRun): + elif isinstance(items, (TaskInstance, DagRun)): dag_ids = {items.dag_id} else: raise ValueError(