ó m”þfc@sôdZddlZddlZddgZdejfd„ƒYZdeejfd„ƒYZedkrðddl Z e j j ej dƒ\Z Ze j jeƒ\ZZd ej krÙdd lmZde_ned ejƒƒndS( sŽA user-defined wrapper around string objects Note: string objects have grown methods in Python 1.6 This module requires Python 1.6 or later. iÿÿÿÿNt UserStringt MutableStringcBsoeZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„ZeZd„Zd„Zd„Zdejd„Zd;d;d„Zd;d;d„Zdejd„Zdd„Zdejd„Zdejd„Zd„Z d„Z!d„Z"d„Z#d „Z$d!„Z%d"„Z&d#„Z'd$„Z(d%„Z)d&„Z*d'„Z+d;d(„Z,d)„Z-d*d+„Z.dejd,„Z/dejd-„Z0d.„Z1d/„Z2d;d0„Z3d;d*d1„Z4d;d*d2„Z5dd3„Z6dejd4„Z7d;d5„Z8d6„Z9d7„Z:d8„Z;d9„Z<d:„Z=RS(<cCsMt|tƒr||_n.t|tƒr:|j|_nt|ƒ|_dS(N(t isinstancet basestringtdataRtstr(tselftseq((s"/usr/lib64/python2.7/UserString.pyt__init__s  cCs t|jƒS(N(RR(R((s"/usr/lib64/python2.7/UserString.pyt__str__scCs t|jƒS(N(treprR(R((s"/usr/lib64/python2.7/UserString.pyt__repr__scCs t|jƒS(N(tintR(R((s"/usr/lib64/python2.7/UserString.pyt__int__scCs t|jƒS(N(tlongR(R((s"/usr/lib64/python2.7/UserString.pyt__long__scCs t|jƒS(N(tfloatR(R((s"/usr/lib64/python2.7/UserString.pyt __float__scCs t|jƒS(N(tcomplexR(R((s"/usr/lib64/python2.7/UserString.pyt __complex__scCs t|jƒS(N(thashR(R((s"/usr/lib64/python2.7/UserString.pyt__hash__scCs6t|tƒr"t|j|jƒSt|j|ƒSdS(N(RRtcmpR(Rtstring((s"/usr/lib64/python2.7/UserString.pyt__cmp__scCs ||jkS(N(R(Rtchar((s"/usr/lib64/python2.7/UserString.pyt __contains__"scCs t|jƒS(N(tlenR(R((s"/usr/lib64/python2.7/UserString.pyt__len__%scCs|j|j|ƒS(N(t __class__R(Rtindex((s"/usr/lib64/python2.7/UserString.pyt __getitem__&scCs5t|dƒ}t|dƒ}|j|j||!ƒS(Ni(tmaxRR(Rtstarttend((s"/usr/lib64/python2.7/UserString.pyt __getslice__'scCsgt|tƒr&|j|j|jƒSt|tƒrI|j|j|ƒS|j|jt|ƒƒSdS(N(RRRRRR(Rtother((s"/usr/lib64/python2.7/UserString.pyt__add__+s cCsAt|tƒr#|j||jƒS|jt|ƒ|jƒSdS(N(RRRRR(RR$((s"/usr/lib64/python2.7/UserString.pyt__radd__2scCs|j|j|ƒS(N(RR(Rtn((s"/usr/lib64/python2.7/UserString.pyt__mul__7scCs|j|j|ƒS(N(RR(Rtargs((s"/usr/lib64/python2.7/UserString.pyt__mod__:scCs|j|jjƒƒS(N(RRt capitalize(R((s"/usr/lib64/python2.7/UserString.pyR+>scGs|j|jj||ŒƒS(N(RRtcenter(RtwidthR)((s"/usr/lib64/python2.7/UserString.pyR,?sicCs|jj|||ƒS(N(Rtcount(RtsubR!R"((s"/usr/lib64/python2.7/UserString.pyR.AscCs^|rD|r(|j|jj||ƒƒS|j|jj|ƒƒSn|j|jjƒƒSdS(N(RRtdecode(Rtencodingterrors((s"/usr/lib64/python2.7/UserString.pyR0Cs cCs^|rD|r(|j|jj||ƒƒS|j|jj|ƒƒSn|j|jjƒƒSdS(N(RRtencode(RR1R2((s"/usr/lib64/python2.7/UserString.pyR3Ks cCs|jj|||ƒS(N(Rtendswith(RtsuffixR!R"((s"/usr/lib64/python2.7/UserString.pyR4SsicCs|j|jj|ƒƒS(N(RRt expandtabs(Rttabsize((s"/usr/lib64/python2.7/UserString.pyR6UscCs|jj|||ƒS(N(Rtfind(RR/R!R"((s"/usr/lib64/python2.7/UserString.pyR8WscCs|jj|||ƒS(N(RR(RR/R!R"((s"/usr/lib64/python2.7/UserString.pyRYscCs |jjƒS(N(Rtisalpha(R((s"/usr/lib64/python2.7/UserString.pyR9[scCs |jjƒS(N(Rtisalnum(R((s"/usr/lib64/python2.7/UserString.pyR:\scCs |jjƒS(N(Rt isdecimal(R((s"/usr/lib64/python2.7/UserString.pyR;]scCs |jjƒS(N(Rtisdigit(R((s"/usr/lib64/python2.7/UserString.pyR<^scCs |jjƒS(N(Rtislower(R((s"/usr/lib64/python2.7/UserString.pyR=_scCs |jjƒS(N(Rt isnumeric(R((s"/usr/lib64/python2.7/UserString.pyR>`scCs |jjƒS(N(Rtisspace(R((s"/usr/lib64/python2.7/UserString.pyR?ascCs |jjƒS(N(Rtistitle(R((s"/usr/lib64/python2.7/UserString.pyR@bscCs |jjƒS(N(Rtisupper(R((s"/usr/lib64/python2.7/UserString.pyRAcscCs|jj|ƒS(N(Rtjoin(RR((s"/usr/lib64/python2.7/UserString.pyRBdscGs|j|jj||ŒƒS(N(RRtljust(RR-R)((s"/usr/lib64/python2.7/UserString.pyRCescCs|j|jjƒƒS(N(RRtlower(R((s"/usr/lib64/python2.7/UserString.pyRDgscCs|j|jj|ƒƒS(N(RRtlstrip(Rtchars((s"/usr/lib64/python2.7/UserString.pyREhscCs|jj|ƒS(N(Rt partition(Rtsep((s"/usr/lib64/python2.7/UserString.pyRGisiÿÿÿÿcCs|j|jj|||ƒƒS(N(RRtreplace(Rtoldtnewtmaxsplit((s"/usr/lib64/python2.7/UserString.pyRIkscCs|jj|||ƒS(N(Rtrfind(RR/R!R"((s"/usr/lib64/python2.7/UserString.pyRMmscCs|jj|||ƒS(N(Rtrindex(RR/R!R"((s"/usr/lib64/python2.7/UserString.pyRNoscGs|j|jj||ŒƒS(N(RRtrjust(RR-R)((s"/usr/lib64/python2.7/UserString.pyROqscCs|jj|ƒS(N(Rt rpartition(RRH((s"/usr/lib64/python2.7/UserString.pyRPsscCs|j|jj|ƒƒS(N(RRtrstrip(RRF((s"/usr/lib64/python2.7/UserString.pyRQuscCs|jj||ƒS(N(Rtsplit(RRHRL((s"/usr/lib64/python2.7/UserString.pyRRvscCs|jj||ƒS(N(Rtrsplit(RRHRL((s"/usr/lib64/python2.7/UserString.pyRSxscCs|jj|ƒS(N(Rt splitlines(Rtkeepends((s"/usr/lib64/python2.7/UserString.pyRTzscCs|jj|||ƒS(N(Rt startswith(RtprefixR!R"((s"/usr/lib64/python2.7/UserString.pyRV{scCs|j|jj|ƒƒS(N(RRtstrip(RRF((s"/usr/lib64/python2.7/UserString.pyRX}scCs|j|jjƒƒS(N(RRtswapcase(R((s"/usr/lib64/python2.7/UserString.pyRY~scCs|j|jjƒƒS(N(RRttitle(R((s"/usr/lib64/python2.7/UserString.pyRZscGs|j|jj|ŒƒS(N(RRt translate(RR)((s"/usr/lib64/python2.7/UserString.pyR[€scCs|j|jjƒƒS(N(RRtupper(R((s"/usr/lib64/python2.7/UserString.pyR\‚scCs|j|jj|ƒƒS(N(RRtzfill(RR-((s"/usr/lib64/python2.7/UserString.pyR]ƒsN(>t__name__t __module__RR R R RRRRRRRRR#R%R&R(t__rmul__R*R+R,tsystmaxintR.tNoneR0R3R4R6R8RR9R:R;R<R=R>R?R@RARBRCRDRERGRIRMRNRORPRQRRRSRTRVRXRYRZR[R\R](((s"/usr/lib64/python2.7/UserString.pyR sr                                            cBsheZdZdd„Zd Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z RS( sœmutable string objects Python strings are immutable objects. This has the advantage, that strings may be used as dictionary keys. If this property isn't needed and you insist on changing string values in place instead, you may cheat and use MutableString. But the purpose of this class is an educational one: to prevent people from inventing their own mutable string class derived from UserString and than forget thereby to remove (override) the __hash__ method inherited from UserString. This would lead to errors that would be very hard to track down. A faster and better solution is to rewrite your program using lists.tcCs-ddlm}|dddƒ||_dS(Niÿÿÿÿ(twarnpy3ksAthe class UserString.MutableString has been removed in Python 3.0t stackleveli(twarningsReR(RRRe((s"/usr/lib64/python2.7/UserString.pyR”s cCs\t|tƒrét|tƒr*|j}nt|tƒsHt|ƒ}n|jt|jƒƒ\}}}|dkr |d|d}}|ddd…}n|dkr¸td‚nt ||ƒ}|j| ||j||_no|dkr |t|jƒ7}n|dks,|t|jƒkr5t ‚n|j| ||j|d|_dS(Niÿÿÿÿis"invalid step in slicing assignmenti( RtsliceRRRRtindicesRt TypeErrortmint IndexError(RRR/R!tstoptstep((s"/usr/lib64/python2.7/UserString.pyt __setitem__s$ !   " ! cCst|tƒr™|jt|jƒƒ\}}}|dkrT|d|d}}n|dkrltd‚nt||ƒ}|j| |j||_nk|dkr»|t|jƒ7}n|dksÜ|t|jƒkråt‚n|j| |j|d|_dS(Niÿÿÿÿis invalid step in slicing deletioni(RRhRiRRRjRkRl(RRR!RmRn((s"/usr/lib64/python2.7/UserString.pyt __delitem__²s!    ! cCs¬t|dƒ}t|dƒ}t|tƒrR|j| |j|j||_nVt|tƒrƒ|j| ||j||_n%|j| t|ƒ|j||_dS(Ni(R RRRRR(RR!R"R/((s"/usr/lib64/python2.7/UserString.pyt __setslice__Ás%"cCs=t|dƒ}t|dƒ}|j| |j||_dS(Ni(R R(RR!R"((s"/usr/lib64/python2.7/UserString.pyt __delslice__ÉscCs t|jƒS(N(RR(R((s"/usr/lib64/python2.7/UserString.pyt immutableÌscCs^t|tƒr$|j|j7_n6t|tƒrE|j|7_n|jt|ƒ7_|S(N(RRRRR(RR$((s"/usr/lib64/python2.7/UserString.pyt__iadd__Îs cCs|j|9_|S(N(R(RR'((s"/usr/lib64/python2.7/UserString.pyt__imul__ÖscCs||||+dS(N((RRtvalue((s"/usr/lib64/python2.7/UserString.pytinsertÙsN(R^R_t__doc__RRcRRoRpRqRrRsRtRuRw(((s"/usr/lib64/python2.7/UserString.pyR…s        t__main__is-q(t test_supports test.test_(RxRat collectionst__all__tSequenceRtMutableSequenceRR^tostpathRRtargvt called_in_dirt called_astsplitexttpyttestRztverboset __import__RD(((s"/usr/lib64/python2.7/UserString.pyts   xW