ACC SHELL

Path : /usr/lib/python/
File Upload :
Current File : //usr/lib/python/pprint.pyo

Ñò
oÄMc@sädZddkZddklZdddddd	gZd
iZe	Z
eZe
Zddddd
„Zdddd„Zd„Zd„Zd„Zd	dd„ƒYZd„Zd„Zdd„Zedjoeƒ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
isreadabletisrecursivetsafereprt
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/lib/python2.6/pprint.pyR3scCs"td|d|d|ƒi|ƒS(s<Format a Python object into a pretty-printed representation.RR	R
(RR(RRR	R
((s/usr/lib/python2.6/pprint.pyR9scCst|hddƒdS(s=Version of repr() which can handle recursive data structures.iN(t
_safe_reprtNone(R((s/usr/lib/python2.6/pprint.pyR=scCst|hddƒdS(s4Determine if saferepr(object) is readable by eval().iiN(R
R(R((s/usr/lib/python2.6/pprint.pyRAscCst|hddƒdS(s8Determine if object requires a recursive representation.iiN(R
R(R((s/usr/lib/python2.6/pprint.pyREscBs\eZddd
d
d„Zd„Zd„Zd„Zd„Zd„Zd„Z	d	„Z
RS(iiPcCs]t|ƒ}t|ƒ}||_||_||_|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.

        N(tintt_deptht_indent_per_levelt_widthRt_streamt_syststdout(tselfRR	R
R((s/usr/lib/python2.6/pprint.pyt__init__Js			

cCs3|i||iddhdƒ|iidƒdS(Nis
(t_formatRtwrite(RR((s/usr/lib/python2.6/pprint.pyRiscCs/tƒ}|i||ddhdƒ|iƒS(Ni(t	_StringIORtgetvalue(RRtsio((s/usr/lib/python2.6/pprint.pyRms	cCs|i|hddƒdS(Nii(tformat(RR((s/usr/lib/python2.6/pprint.pyRrscCs-|i|hddƒ\}}}|o|S(Ni(R(RRtstreadablet	recursive((s/usr/lib/python2.6/pprint.pyRus!cCs7|d}t|ƒ}||jo*|it|ƒƒt|_t|_dS|i|||dƒ}t|ƒ}	t	|ƒ|i
d||j}
|i}|io||ijo||ƒdSt|	ddƒ}t|	tƒo±|tijo¡|dƒ|idjo||iddƒnt	|ƒ}
|
oLd||<||i}|iƒ}|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])isfrozenset()sfrozenset([i
t(t)s,
s, t,(t_idRt
_recursiontTruet
_recursivetFalset	_readablet_reprt_typet_lenRRtgetattrRt
issubclasstdictR!RtitemstsortRtlistttupletsett	frozensettsorted(RRRRt	allowancetcontexttleveltobjidtrepttyptsepLinesRtrtlengthR6tkeytenttendchar((s/usr/lib/python2.6/pprint.pyRys¸

		!	
 








    













cCsV|i||iƒ|i|ƒ\}}}|p
t|_n|o
t|_n|S(N(RtcopyRR.R/R,R-(RRR>R?treprRR ((s/usr/lib/python2.6/pprint.pyR0Ý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
(RRR>t	maxlevelsR?((s/usr/lib/python2.6/pprint.pyRæsN(t__name__t
__module__RRRRRRRR0R(((s/usr/lib/python2.6/pprint.pyRIs					d		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!||jodt||jfS||jot|ƒttfSd||<t}
t}g}|i}|d7}t}xœt|iƒƒD]ˆ\}}|||||ƒ\}}}|||||ƒ\}}}|d||fƒ|
o|o|}
|p|o
t}qíqíW||=d
t|ƒ|
|fSt|tƒo|tijp t|tƒoy|tijoit|tƒo|pdttfSd}n9t|ƒdjo
d}n|pdttfSd}t|ƒ}|o%||jo|dt||jfS||jot|ƒttfSd||<t}
t}g}|i}|d7}xX|D]P}t||||ƒ\}}}||ƒ|p
t}
n|o
t}qÎqÎW||=|t|ƒ|
|fSt|ƒ}||o|idƒtfS(Ntlocalet't"s\"s\'iiÿÿÿÿs%s%s%sR!s{}s{...}s%s: %ss{%s}s[]s[%s]s(%s,)s()s(%s)s...t<(R1tstrRtmodulesRJR,R.tgetRRtisalphaRR3RR4R5R!R*R+tappendR
R<R6t
_commajoinR8R9R2t
startswith( RR>RKR?RBtclosuretquotestqgetRRtcharRDR@RR t
componentsRVRtktvtkreprt	kreadabletkrecurtvreprt	vreadabletvrecurRtotoreprt	oreadabletorecurRA((s/usr/lib/python2.6/pprint.pyR
ðsœ

			
$! 

	
  



	


cCsdt|ƒit|ƒfS(Ns<Recursion on %s with id=%s>(R1RLR*(R((s/usr/lib/python2.6/pprint.pyR+DscCsµddk}|djo1ddddghdd6d	d
6fgd}ntƒ}|iƒ}t|hddƒ|iƒ}|i|ƒ|iƒ}d
G||GHdG||GHdS(Niÿÿÿÿtstringiiiiiiiii †is_safe_repr:spformat:(ii(ttimeRRR
R(RRktptt1tt2tt3((s/usr/lib/python2.6/pprint.pyt
_perfcheckIs
1	

t__main__((t__doc__tsysRt	cStringIORRt__all__tjoinRWtidR*tlenR2ttypeR1RRRRRRRR
R+RpRL(((s/usr/lib/python2.6/pprint.pyt<module>#s&					§	T	



ACC SHELL 2018