U
    ?hv                     @   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   |   |  k S Nlowerselfother r   J/var/www/html/venv/lib/python3.8/site-packages/importlib_metadata/_text.py__lt__C   s    zFoldedCase.__lt__c                 C   s   |   |  kS r   r   r   r   r   r   __gt__F   s    zFoldedCase.__gt__c                 C   s   |   |  kS r   r   r   r   r   r   __eq__I   s    zFoldedCase.__eq__c                 C   s   |   |  kS r   r   r   r   r   r   __ne__L   s    zFoldedCase.__ne__c                 C   s   t |  S r   )hashr   r	   r   r   r   __hash__O   s    zFoldedCase.__hash__c                    s   t   | S r   )superr   __contains__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   in_U   s    zFoldedCase.in_c                    s
   t   S r   )r   r   r   r   r   r   r   Z   s    zFoldedCase.lowerc                 C   s   |   |  S r   )r   index)r	   subr   r   r   r   ^   s    zFoldedCase.index r   c                 C   s    t t |t j}|| |S r   )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   