î ½ê[öã @s®dZdddgZddlZddlmZyddlmZWn"ek riddlmZYnXdd d„Z Gd d„dƒZ d d „Z e ƒZ e j Z dS) zGRedo the builtin repr() (representation) but with limits on most sizes.ÚReprÚreprÚrecursive_repréN)Úislice)Ú get_identz...cs‡fdd†}|S)zGDecorator to make a repr function return fillvalue for a recursive callcsptƒ‰‡‡‡fdd†}tˆdƒ|_tˆdƒ|_tˆdƒ|_tˆdiƒ|_|S)Nc sWt|ƒtƒf}|ˆkr%ˆSˆj|ƒzˆ|ƒ}Wdˆj|ƒX|S)N)ÚidrÚaddÚdiscard)ÚselfÚkeyÚresult)Ú fillvalueÚ repr_runningÚ user_function©ú/usr/lib/python3.4/reprlib.pyÚwrappers  z.decorating_function..wrapperÚ __module__Ú__doc__Ú__name__Ú__annotations__)ÚsetÚgetattrrrrr)rr)r )rrrÚdecorating_functions  z+recursive_repr..decorating_functionr)r rr)r rr sc@s»eZdZdd„Zdd„Zdd„Zddd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„ZdS)rcCsgd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ dS)Nééééé() ÚmaxlevelÚmaxtupleÚmaxlistÚmaxarrayÚmaxdictÚmaxsetÚ maxfrozensetÚmaxdequeÚ maxstringÚmaxlongÚmaxother)r rrrÚ__init__(s          z Repr.__init__cCs|j||jƒS)N)Úrepr1r)r Úxrrrr5sz Repr.reprcCszt|ƒj}d|kr9|jƒ}dj|ƒ}nt|d|ƒrft|d|ƒ||ƒS|j||ƒSdS)Nú Ú_Úrepr_)ÚtyperÚsplitÚjoinÚhasattrrÚ repr_instance)r r,ÚlevelÚtypenameÚpartsrrrr+8s  z Repr.repr1Úc sºt|ƒ}|dkr'|r'd}n‚|d‰|j‰‡‡fdd†t||ƒDƒ} ||kr{| jdƒndj| ƒ}|dkr©|r©||}nd|||fS)Nrz...écsg|]}ˆ|ˆƒ‘qSrr)Ú.0Úelem)Únewlevelr+rrú Is z'Repr._repr_iterable..z, z%s%s%s)Úlenr+rÚappendr2) r r,r5ÚleftÚrightÚmaxiterÚtrailÚnÚsÚpiecesr)r<r+rÚ_repr_iterableBs    %  zRepr._repr_iterablecCs|j||dd|jdƒS)Nú(ú)ú,)rGr )r r,r5rrrÚ repr_tupleOszRepr.repr_tuplecCs|j||dd|jƒS)Nú[ú])rGr!)r r,r5rrrÚ repr_listRszRepr.repr_listcCs)d|j}|j|||d|jƒS)Nz array('%s', [z]))ÚtypecoderGr")r r,r5ÚheaderrrrÚ repr_arrayUs zRepr.repr_arraycCs(t|ƒ}|j||dd|jƒS)Nzset([z]))Ú_possibly_sortedrGr$)r r,r5rrrÚrepr_setYs z Repr.repr_setcCs(t|ƒ}|j||dd|jƒS)Nz frozenset([z]))rRrGr%)r r,r5rrrÚrepr_frozenset]s zRepr.repr_frozensetcCs|j||dd|jƒS)Nzdeque([z]))rGr&)r r,r5rrrÚ repr_dequebszRepr.repr_dequec CsÚt|ƒ}|dkrdS|dkr,dS|d}|j}g}xYtt|ƒ|jƒD]?}|||ƒ}||||ƒ} |jd|| fƒq^W||jkrÀ|jdƒndj|ƒ} d| fS) Nrz{}z{...}r9z%s: %sz...z, z{%s})r>r+rrRr#r?r2) r r,r5rDr<r+rFr ÚkeyreprÚvalreprrErrrÚ repr_dictes      zRepr.repr_dictcCsÉtj|d|j…ƒ}t|ƒ|jkrÅtd|jddƒ}td|jd|ƒ}tj|d|…|t|ƒ|d…ƒ}|d|…d|t|ƒ|d…}n|S)Nrééz...)Úbuiltinsrr'r>Úmax)r r,r5rEÚiÚjrrrÚrepr_strts1/z Repr.repr_strcCs‹tj|ƒ}t|ƒ|jkr‡td|jddƒ}td|jd|ƒ}|d|…d|t|ƒ|d…}n|S)NrrYrZz...)r[rr>r(r\)r r,r5rEr]r^rrrÚrepr_int}s /z Repr.repr_intc Cs¾ytj|ƒ}Wn,tk rAd|jjt|ƒfSYnXt|ƒ|jkrºtd|jddƒ}td|jd|ƒ}|d|…d|t|ƒ|d…}n|S)Nz<%s instance at %x>rrYrZz...) r[rÚ ExceptionÚ __class__rrr>r)r\)r r,r5rEr]r^rrrr4…s /zRepr.repr_instanceN)rrÚ __qualname__r*rr+rGrKrNrQrSrTrUrXr_r`r4rrrrr&s           c Cs1yt|ƒSWntk r,t|ƒSYnXdS)N)ÚsortedraÚlist)r,rrrrR“s rR)rÚ__all__r[Ú itertoolsrÚ_threadrÚ ImportErrorZ _dummy_threadrrrRÚaReprrrrrrÚs  m