B
    ©rŠfú  ã               @   s   G d d„ dƒZ dS )c               @   sH   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
dS )Ú
Comparablea¸  Customise how your Enum acts when compared to other objects.

    Your Enum must implement a ``_cmp_values`` method which takes the Enum
    member's value and the other value and manipulates them into the actual
    values that can be compared.

    A case-insensitive StrEnum might look like this::

        class HttpHeader(Comparable, KebabCaseStrEnum):
            ContentType = auto()
            Host = auto()
            Accept = auto()
            XForwardedFor = auto()

            def _cmp_values(self, other):
                return self.value.lower(), str(other).lower()

    You could then use these headers in case-insensitive comparisons::

        assert "Content-Type" == HttpHeader.ContentType
        assert "content-type" == HttpHeader.ContentType
        assert "coNtEnt-tyPe" == HttpHeader.ContentType

    .. note::
        Your ``_cmp_values`` method *must not* return ``self`` as one of the
        values to be compared -- that would result in infinite recursion.
        Instead, perform operations on ``self.value`` and return that.

    .. warning::
        A bug in Python prior to 3.7.1 prevents mix-ins working with Enum
        subclasses.

    .. versionadded:: 0.4.6
    c             C   s   |   |¡\}}||kS )N)Ú_cmp_values)ÚselfÚotherÚvalue© r   úQ/home/ankuromar296_gmail_com/.local/lib/python3.7/site-packages/strenum/mixins.pyÚ__eq__%   s    zComparable.__eq__c             C   s   |   |¡\}}||kS )N)r   )r   r   r   r   r   r   Ú__ne__)   s    zComparable.__ne__c             C   s   |   |¡\}}||k S )N)r   )r   r   r   r   r   r   Ú__lt__-   s    zComparable.__lt__c             C   s   |   |¡\}}||kS )N)r   )r   r   r   r   r   r   Ú__le__1   s    zComparable.__le__c             C   s   |   |¡\}}||kS )N)r   )r   r   r   r   r   r   Ú__gt__5   s    zComparable.__gt__c             C   s   |   |¡\}}||kS )N)r   )r   r   r   r   r   r   Ú__ge__9   s    zComparable.__ge__c             C   s   t dƒ‚d S )NzFEnum's using Comparable must implement their own _cmp_values function.)ÚNotImplementedError)r   r   r   r   r   r   =   s    zComparable._cmp_valuesN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r	   r
   r   r   r   r   r   r   r   r   r      s   "r   N)r   r   r   r   r   Ú<module>   ó    