3
€»ev  ã               @   s(   d dl Z ddlmZ G dd„ deƒZdS )é    Né   )Úmethod_cachec                   sr   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Z‡ fdd„Z	dd„ Z
e‡ fdd„ƒZdd„ Zddd„Z‡  ZS )Ú
FoldedCasea{  
    A case insensitive string class; behaves just like str
    except compares equal when the only variation is case.

    >>> s = FoldedCase('hello world')

    >>> s == 'Hello World'
    True

    >>> 'Hello World' == s
    True

    >>> s != 'Hello World'
    False

    >>> s.index('O')
    4

    >>> s.split('O')
    ['hell', ' w', 'rld']

    >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
    ['alpha', 'Beta', 'GAMMA']

    Sequence membership is straightforward.

    >>> "Hello World" in [s]
    True
    >>> s in ["Hello World"]
    True

    You may test for set inclusion, but candidate and elements
    must both be folded.

    >>> FoldedCase("Hello World") in {s}
    True
    >>> s in {FoldedCase("Hello World")}
    True

    String inclusion works as long as the FoldedCase object
    is on the right.

    >>> "hello" in FoldedCase("Hello World")
    True

    But not if the FoldedCase object is on the left:

    >>> FoldedCase('hello') in 'Hello World'
    False

    In that case, use in_:

    >>> FoldedCase('hello').in_('Hello World')
    True

    >>> FoldedCase('hello') > FoldedCase('Hello')
    False
    c             C   s   | j ƒ |j ƒ k S )N)Úlower)ÚselfÚother© r   úF/tmp/pip-build-3irwxpxt/importlib-metadata/importlib_metadata/_text.pyÚ__lt__C   s    zFoldedCase.__lt__c             C   s   | j ƒ |j ƒ kS )N)r   )r   r   r   r   r	   Ú__gt__F   s    zFoldedCase.__gt__c             C   s   | j ƒ |j ƒ kS )N)r   )r   r   r   r   r	   Ú__eq__I   s    zFoldedCase.__eq__c             C   s   | j ƒ |j ƒ kS )N)r   )r   r   r   r   r	   Ú__ne__L   s    zFoldedCase.__ne__c             C   s   t | jƒ ƒS )N)Úhashr   )r   r   r   r	   Ú__hash__O   s    zFoldedCase.__hash__c                s   t ƒ jƒ j|jƒ ƒS )N)Úsuperr   Ú__contains__)r   r   )Ú	__class__r   r	   r   R   s    zFoldedCase.__contains__c             C   s   | t |ƒkS )zDoes self appear in other?)r   )r   r   r   r   r	   Úin_U   s    zFoldedCase.in_c                s
   t ƒ jƒ S )N)r   r   )r   )r   r   r	   r   Z   s    zFoldedCase.lowerc             C   s   | j ƒ j|j ƒ ƒS )N)r   Úindex)r   Úsubr   r   r	   r   ^   s    zFoldedCase.indexú r   c             C   s    t jt j|ƒt jƒ}|j| |ƒS )N)ÚreÚcompileÚescapeÚIÚsplit)r   ZsplitterÚmaxsplitÚpatternr   r   r	   r   a   s    zFoldedCase.split)r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   r   r   r   r   r   r   r   r   r   r   Ú__classcell__r   r   )r   r	   r      s   :r   )r   Ú
_functoolsr   Ústrr   r   r   r   r	   Ú<module>   s   