[ 
https://issues.apache.org/jira/browse/AIRFLOW-4374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17417228#comment-17417228
 ] 

ASF GitHub Bot commented on AIRFLOW-4374:
-----------------------------------------

potiuk closed pull request #5302:
URL: https://github.com/apache/airflow/pull/5302


   


-- 
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.

To unsubscribe, e-mail: [email protected]

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)

Reply via email to