B
Ç&Ø`– ã @ 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 úI/opt/alt/python37/lib/python3.7/site-packages/importlib_metadata/_text.pyÚ__lt__C s zFoldedCase.__lt__c C s | ¡ | ¡ kS )N)r )r r r r r Ú__gt__F s zFoldedCase.__gt__c C s | ¡ | ¡ kS )N)r )r r r r r Ú__eq__I s zFoldedCase.__eq__c C s | ¡ | ¡ kS )N)r )r r r r r Ú__ne__L s zFoldedCase.__ne__c C s t | ¡ ƒS )N)Úhashr )r r r r Ú__hash__O s zFoldedCase.__hash__c s t t| ƒ ¡ | ¡ ¡S )N)Úsuperr r Ú__contains__)r r )Ú __class__r r r R s zFoldedCase.__contains__c C s | t |ƒkS )zDoes self appear in other?)r )r r r r r Úin_U s zFoldedCase.in_c s t t| ƒ ¡ S )N)r r r )r )r r r r Z s zFoldedCase.lowerc C s | ¡ | ¡ ¡S )N)r Úindex)r Úsubr r r r ^ s zFoldedCase.indexú r c C s t t |¡t j¡}| | |¡S )N)ÚreÚcompileÚescapeÚIÚsplit)r ÚsplitterÚ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 Ú