Ñò §ÚêLc @sùdZddkZddkZddklZdddddd gZd iZ e Z e Z eZdd d dd „Zd d dd„Zd„Zd„Zd„Zd„Zd dd„ƒYZd„Zd„Zdd„Zedjo eƒndS(s/Support to pretty-print lists, tuples, & dictionaries recursively. Very simple, but useful, especially in debugging data structures. Classes ------- PrettyPrinter() Handle pretty-printing operations onto a stream using a configured set of formatting parameters. Functions --------- pformat() Format a Python object into a pretty-printed representation. pprint() Pretty-print a Python object to a stream [default is sys.stdout]. saferepr() Generate a 'standard' repr()-like value, but protect against recursive data structures. iÿÿÿÿN(tStringIOtpprinttpformatt isreadablet isrecursivetsafereprt PrettyPrinters, iiPc Cs2td|d|d|d|ƒ}|i|ƒdS(sAPretty-print a Python object to a stream [default is sys.stdout].tstreamtindenttwidthtdepthN(RR(tobjectRRR R tprinter((s/usr/lib64/python2.6/pprint.pyR4scCs"td|d|d|ƒi|ƒS(s<Format a Python object into a pretty-printed representation.RR R (RR(R RR R ((s/usr/lib64/python2.6/pprint.pyR:scCst|hddƒdS(s=Version of repr() which can handle recursive data structures.iN(t _safe_reprtNone(R ((s/usr/lib64/python2.6/pprint.pyR>scCst|hddƒdS(s4Determine if saferepr(object) is readable by eval().iiN(R R(R ((s/usr/lib64/python2.6/pprint.pyRBscCst|hddƒdS(s8Determine if object requires a recursive representation.iiN(R R(R ((s/usr/lib64/python2.6/pprint.pyRFscCsMtiƒiiƒz/tiotiddtƒnt|ƒSWdQXdS(Ntignores%comparing unequal types not supported( twarningstcatch_warningst__exit__t __enter__t_syst py3kwarningtfilterwarningstDeprecationWarningtsorted(titerable((s/usr/lib64/python2.6/pprint.pyt_sortedJs    cBs\eZddd d d„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z RS( iiPcCs©t|ƒ}t|ƒ}|djp td‚|djp|djp td‚|p td‚||_||_||_|dj o ||_n ti|_dS(sòHandle pretty printing operations onto a stream using a set of configured parameters. indent Number of spaces to indent for each level of nesting. width Attempted maximum number of columns in the output. depth The maximum depth to print out nested structures. stream The desired output stream. If omitted (or false), the standard output stream available at construction will be used. isindent must be >= 0sdepth must be > 0swidth must be != 0N( tinttAssertionErrorRt_deptht_indent_per_levelt_widtht_streamRtstdout(tselfRR R R((s/usr/lib64/python2.6/pprint.pyt__init__Rs  $     cCs3|i||iddhdƒ|iidƒdS(Nis (t_formatR twrite(R"R ((s/usr/lib64/python2.6/pprint.pyRqscCs/tƒ}|i||ddhdƒ|iƒS(Ni(t _StringIOR$tgetvalue(R"R tsio((s/usr/lib64/python2.6/pprint.pyRus cCs|i|hddƒdS(Nii(tformat(R"R ((s/usr/lib64/python2.6/pprint.pyRzscCs-|i|hddƒ\}}}|o| S(Ni(R)(R"R tstreadablet recursive((s/usr/lib64/python2.6/pprint.pyR}s!c Cs3|d}t|ƒ}||jo*|it|ƒƒt|_t|_dS|i|||dƒ}t|ƒ} t |ƒ|i d||j} |i} |i o||i jo| |ƒdSt | ddƒ} t| tƒo­| tijo| dƒ|idjo| |iddƒnt |ƒ} | oHd||<||i}t|iƒƒ}|d\}}|i|||ƒ}| |ƒ| dƒ|i|||t |ƒd|d||ƒ| djo“x|dD]€\}}|i|||ƒ}| o| dd||fƒn| d |ƒ|i|||t |ƒd|d||ƒqåWn||i}||=n| d ƒdSt| tƒo| tijp`t| tƒo| tijp@t| tƒo| tijp t| tƒo!| tijot |ƒ} t| tƒo| d ƒd }n±t| tƒo@| p| d ƒdS| dƒd}t|ƒ}|d7}nat| tƒo@| p| dƒdS| dƒd}t|ƒ}|d7}n| dƒd}|idjo | o| |iddƒn| oÀd||<||i}|i|d|||d||ƒ| djo`x]|dD]M}| o| dd|ƒn | dƒ|i||||d||ƒq~Wn||i}||=nt| tƒo| djo| dƒn| |ƒdS| |ƒdS(Nit__repr__t{t is: is, %s%s: s, %s: t}t[t]sset()sset([s])is frozenset()s frozenset([i t(t)s, s, t,(t_idR%t _recursiontTruet _recursivetFalset _readablet_reprt_typet_lenRRtgetattrRt issubclasstdictR-RRtitemsR$tlistttupletsett frozenset(R"R RRt allowancetcontexttleveltobjidtrepttyptsepLinesR%trtlengthRBtkeytenttendchar((s/usr/lib64/python2.6/pprint.pyR$s¶      !                                     cCsV|i||iƒ|i|ƒ\}}}|p t|_n|o t|_n|S(N(R)tcopyRR:R;R8R9(R"R RHRItreprR+R,((s/usr/lib64/python2.6/pprint.pyR<äs  cCst||||ƒS(sÈFormat object for a specific context, returning a string and flags indicating whether the representation is 'readable' and whether the object represents a recursive construct. (R (R"R RHt maxlevelsRI((s/usr/lib64/python2.6/pprint.pyR)ísN( t__name__t __module__RR#RRRRR$R<R)(((s/usr/lib64/python2.6/pprint.pyRQs     c c Cskt|ƒ}|tjoðdtijot|ƒttfSd|jo$d|jod}hdd6}nd}hdd6}|i}tƒ}|i } xI|D]A} | i ƒo| | ƒq£| || t| ƒdd!ƒƒq£Wd||i ƒ|fttfSt |d dƒ} t|tƒom| tijo]|pd ttfSt|ƒ} |o!||jod t| |jfS| |jot|ƒttfSd|| t startswith( R RHRURIRLtclosuretquotestqgetR(R%tcharRNRJR+R,t componentsR`Rtktvtkreprt kreadabletkrecurtvreprt vreadabletvrecurR)totoreprt oreadabletorecurRK((s/usr/lib64/python2.6/pprint.pyR ÷sœ       $!                   cCsdt|ƒit|ƒfS(Ns(R=RVR6(R ((s/usr/lib64/python2.6/pprint.pyR7KscCsµddk}|djo1ddddghdd6d d 6fgd }ntƒ}|iƒ}t|hdd ƒ|iƒ}|i|ƒ|iƒ}d G||GHdG||GHdS(Niÿÿÿÿtstringiiiiiiiii †is _safe_repr:spformat:(ii(ttimeRRR R(R Rutptt1tt2tt3((s/usr/lib64/python2.6/pprint.pyt _perfcheckPs  1      t__main__((t__doc__tsysRRt cStringIORR&t__all__tjoinRatidR6tlenR>ttypeR=RRRRRRRRR R7RzRV(((s/usr/lib64/python2.6/pprint.pyt#s*        ¦ T