Your IP : 52.14.148.63
o
6��f� � @ s( d dl Z ddlmZ G dd� de�ZdS )� N� )�method_cachec sr e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Z� fdd
�Z dd� Z
e� fdd��Zdd� Z
ddd�Z� ZS )�
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 �?/opt/alt/python310/lib64/python3.10/importlib/metadata/_text.py�__lt__C � zFoldedCase.__lt__c C s | � � |� � kS r r r r r r �__gt__F r zFoldedCase.__gt__c C s | � � |� � kS r r r r r r �__eq__I r zFoldedCase.__eq__c C s | � � |� � kS r r r r r r �__ne__L r zFoldedCase.__ne__c C s t | �� �S r )�hashr �r r r r �__hash__O s zFoldedCase.__hash__c s t t| ��� �|�� �S r )�superr r �__contains__r �� __class__r r r R s zFoldedCase.__contains__c C s | t |�v S )zDoes self appear in other?)r r r r r �in_U s zFoldedCase.in_c s t t| ��� S r )r r r r r r r r Z s zFoldedCase.lowerc C s | � � �|� � �S r )r �index)r �subr r r r ^ s zFoldedCase.index� r c C s t �t �|�t j�}|�| |�S r )�re�compile�escape�I�split)r Zsplitter�maxsplit�patternr r r r! a s zFoldedCase.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