Skip to content

Commit

Permalink
Simplify if/else and keep mypy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
BasPH committed Nov 7, 2022
1 parent d289217 commit 4df4406
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions airflow/api_connexion/schemas/dag_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 4df4406

Please sign in to comment.