[
https://issues.apache.org/jira/browse/AIRFLOW-4374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17365705#comment-17365705
]
ASF GitHub Bot commented on AIRFLOW-4374:
-----------------------------------------
andrewgodwin edited a comment on pull request #5302:
URL: https://github.com/apache/airflow/pull/5302#issuecomment-863709135
Yes, my related PR is https://github.com/apache/airflow/pull/15285 -
different classes though it looks like?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Inherit from Enum
> -----------------
>
> Key: AIRFLOW-4374
> URL: https://issues.apache.org/jira/browse/AIRFLOW-4374
> Project: Apache Airflow
> Issue Type: Sub-task
> Components: core
> Reporter: Bas Harenslak
> Assignee: Bas Harenslak
> Priority: Minor
>
> 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:java}
> 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.
>
> Edit: not touching the State in this one, since state contains additional
> attributes (e.g. state_color) and in Python Enum all attributes are part of
> the Enum class, which we don't want in this case. Will have to rethink this
> one.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)