`L ijJddlZGddZGddeZGddZy)Nc:eZdZdZdZdZdZdZdZdZ dZ y ) ComparableMixinz(Implements rich operators for an object.c ||j|jS#ttf$r tcYSwxYwN)_cmpkeyAttributeError TypeErrorNotImplemented)selfothermethods U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/textblob/mixins.py_comparezComparableMixin._compares< "$,,.%--/: : * "" ! "s $'??c(|j|dS)Nc ||kSrsos rz(ComparableMixin.__lt__.. Qrr r s r__lt__zComparableMixin.__lt__}}U$677rc(|j|dS)Nc ||kSrrrs rrz(ComparableMixin.__le__.. arrrs r__le__zComparableMixin.__le__}}U$788rc(|j|dS)Nc ||k(Srrrs rrz(ComparableMixin.__eq__..rrrrs r__eq__zComparableMixin.__eq__r!rc(|j|dS)Nc ||k\Srrrs rrz(ComparableMixin.__ge__..rrrrs r__ge__zComparableMixin.__ge__r!rc(|j|dS)Nc ||kDSrrrs rrz(ComparableMixin.__gt__..rrrrs r__gt__zComparableMixin.__gt__rrc(|j|dS)Nc ||k7Srrrs rrz(ComparableMixin.__ne__..rrrrs r__ne__zComparableMixin.__ne__r!rN) __name__ __module__ __qualname____doc__rrr r$r'r*r-rrrrrs(2"899989rrc"eZdZdZfdZxZS)BlobComparableMixinz@Allow blob objects to be comparable with both strings and blobs.c~t|ttfr||j|St|||Sr) isinstancestrbytesrsuperr)r r r __class__s rrzBlobComparableMixin._compare%s6 ec5\ *$,,.%0 0wv..r)r.r/r0r1r __classcell__)r9s@rr3r3"sJ//rr3c`eZdZdZdZdZdZdZdZdZ de jfd Z de jfd Z de jfd Zde jfd Zde jfd Zde jfdZeZeZdZdZde jfdZddZdZdZdZe jfdZy)StringlikeMixinaMake blob objects behave like Python strings. Expects that classes that use this mixin to have a _strkey() method that returns the string to apply string methods to. Using _strkey() instead of __str__ ensures consistent behavior between Python 2 and 3. cT|jj}t|}|d|dS)z.Returns a string representation for debugging.z("z"))r9r.r6)r class_nametexts r__repr__zStringlikeMixin.__repr__4s-^^,, 4yRvR((rc"|jS)zQReturns a string representation used in print statements or str(my_blob)._strkeyr s r__str__zStringlikeMixin.__str__:s||~rc4t|jS)z#Returns the length of the raw text.)lenrCrDs r__len__zStringlikeMixin.__len__?s4<<>""rc4t|jS)zqMakes the object iterable as if it were a string, iterating through the raw string's characters. )iterrCrDs r__iter__zStringlikeMixin.__iter__CsDLLN##rc&||jvS)z1Implements the `in` keyword like a Python string.rB)r subs r __contains__zStringlikeMixin.__contains__Isdlln$$rct|tr|j|S|j|j|S)zReturns a substring. If index is an integer, returns a Python string of a single character. If a range is given, e.g. `blob[3:5]`, a new instance of the class is returned. )r5intrCr9)r indexs r __getitem__zStringlikeMixin.__getitem__Ms; eS !<<>%( (>>$,,."78 8rrcD|jj|||S)zBehaves like the built-in str.find() method. Returns an integer, the index of the first occurrence of the substring argument sub in the sub-string given by [start:end]. )rCfindr rMstartends rrTzStringlikeMixin.findXs ||~""3s33rcD|jj|||S)zBehaves like the built-in str.rfind() method. Returns an integer, the index of he last (right-most) occurence of the substring argument sub in the sub-sequence given by [start:end]. )rCrfindrUs rrYzStringlikeMixin.rfind_s ||~##C44rcD|jj|||S)zWLike blob.find() but raise ValueError when the substring is not found. )rCrQrUs rrQzStringlikeMixin.indexfs||~##C44rcD|jj|||S)zTLike blob.rfind() but raise ValueError when substring is not found. )rCrindexrUs rr\zStringlikeMixin.rindexls||~$$S%55rcD|jj|||S)z6Returns True if the blob starts with the given prefix.)rC startswith)r prefixrVrWs rr^zStringlikeMixin.startswithrs||~((<rs, 99<///{G{Gr