You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Bas Harenslak (JIRA)" <ji...@apache.org> on 2019/04/21 08:17:00 UTC
[jira] [Created] (AIRFLOW-4374) Inherit from Enum
Bas Harenslak created AIRFLOW-4374:
--------------------------------------
Summary: Inherit from Enum
Key: AIRFLOW-4374
URL: https://issues.apache.org/jira/browse/AIRFLOW-4374
Project: Apache Airflow
Issue Type: Sub-task
Reporter: Bas Harenslak
Python 3.4 introduced the Enum type, which can reduce the complexity of a few enum-style classes. E.g. the TriggerRule could become:
{code}
from enum import Enum
class TriggerRule(Enum):
ALL_SUCCESS = "all_success"
ALL_FAILED = "all_failed"
ALL_DONE = "all_done"
ONE_SUCCESS = "one_success"
ONE_FAILED = "one_failed"
NONE_FAILED = "none_failed"
NONE_SKIPPED = "none_skipped"
DUMMY = "dummy"
@classmethod
def all_triggers(cls):
return [tr.name for tr in TriggerRule]
{code}
A quick scan showed me enum-like class are TriggerRule, WeightRule, State, but there might be more, so search first.
Also, note this is optional and not required for running in Python 3.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)