U
    ‰d¼  ã                	   @   sÎ   d Z dZdddddddd	d
g	ZeeeedeeƒƒƒƒZed Zdd„ Z	G dd„ de
ƒZd
ZdZdZdZdZdZdZd	ZdZeeeehƒZeeeeeehƒZeeeehƒZeeehƒZeeeeeeeehƒZdS )aº  Built-in task states.

.. _states:

States
------

See :ref:`task-states`.

.. _statesets:

Sets
----

.. state:: READY_STATES

READY_STATES
~~~~~~~~~~~~

Set of states meaning the task result is ready (has been executed).

.. state:: UNREADY_STATES

UNREADY_STATES
~~~~~~~~~~~~~~

Set of states meaning the task result is not ready (hasn't been executed).

.. state:: EXCEPTION_STATES

EXCEPTION_STATES
~~~~~~~~~~~~~~~~

Set of states meaning the task returned an exception.

.. state:: PROPAGATE_STATES

PROPAGATE_STATES
~~~~~~~~~~~~~~~~

Set of exception states that should propagate exceptions to the user.

.. state:: ALL_STATES

ALL_STATES
~~~~~~~~~~

Set of all possible states.

Misc
----

)ÚPENDINGÚRECEIVEDÚSTARTEDÚSUCCESSÚFAILUREÚREVOKEDÚRETRYÚIGNOREDÚREADY_STATESÚUNREADY_STATESÚEXCEPTION_STATESÚPROPAGATE_STATESÚ
precedenceÚstater   r   Nr   r   r   ÚREJECTEDr   r   é    c                 C   s(   z
t |  W S  tk
r"   t Y S X dS )zRGet the precedence index for state.

    Lower index means higher precedence.
    N)ÚPRECEDENCE_LOOKUPÚKeyErrorÚNONE_PRECEDENCE)r   © r   ú1/tmp/pip-unpacked-wheel-mu1yl971/celery/states.pyr   Q   s    
r   c                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )r   a  Task state.

    State is a subclass of :class:`str`, implementing comparison
    methods adhering to state precedence rules::

        >>> from celery.states import state, PENDING, SUCCESS

        >>> state(PENDING) < state(SUCCESS)
        True

    Any custom state is considered to be lower than :state:`FAILURE` and
    :state:`SUCCESS`, but higher than any of the other built-in states::

        >>> state('PROGRESS') > state(STARTED)
        True

        >>> state('PROGRESS') > state('SUCCESS')
        False
    c                 C   s   t | ƒt |ƒk S ©N©r   ©ÚselfÚotherr   r   r   Ú__gt__q   s    zstate.__gt__c                 C   s   t | ƒt |ƒkS r   r   r   r   r   r   Ú__ge__t   s    zstate.__ge__c                 C   s   t | ƒt |ƒkS r   r   r   r   r   r   Ú__lt__w   s    zstate.__lt__c                 C   s   t | ƒt |ƒkS r   r   r   r   r   r   Ú__le__z   s    zstate.__le__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   \   s
   r   r   )r"   Ú__all__Z
PRECEDENCEÚdictÚzipÚrangeÚlenr   r   r   Ústrr   r   r   r   r   r   r   r   r   r   Ú	frozensetr	   r
   r   r   Z
ALL_STATESr   r   r   r   Ú<module>   sJ   6
÷#      ÿ