From 4df440688b385192767d6ce8e1188605a2ef81c0 Mon Sep 17 00:00:00 2001 From: Bas Harenslak Date: Mon, 7 Nov 2022 15:13:11 +0100 Subject: [PATCH] Simplify if/else and keep mypy happy --- airflow/api_connexion/schemas/dag_schema.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/airflow/api_connexion/schemas/dag_schema.py b/airflow/api_connexion/schemas/dag_schema.py index 9c3de25c53510..6d64905ed0271 100644 --- a/airflow/api_connexion/schemas/dag_schema.py +++ b/airflow/api_connexion/schemas/dag_schema.py @@ -77,9 +77,10 @@ class Meta: @staticmethod def get_owners(obj: DagModel): """Convert owners attribute to DAG representation""" - if not getattr(obj, 'owners', None): + if obj.owners is None: return [] - return obj.owners.split(",") + else: + return obj.owners.split(",") @staticmethod def get_token(obj: DagModel): @@ -126,9 +127,10 @@ def get_tags(obj: DAG): @staticmethod def get_owners(obj: DAG): """Convert owners attribute to DAG representation""" - if not getattr(obj, 'owner', None): + if obj.owner is None: return [] - return obj.owner.split(",") + else: + return obj.owner.split(",") @staticmethod def get_is_paused(obj: DAG):