;ň ř1eBc@sOdd„Zdddd„Zdd„Zddd „Zd „Zd „Zd S( s%-25s %scCs:x3|iƒD]%\}}|t|ƒd|fGHq WdS(Ns:(sdisitemsskeysvalsformatsstr(sdisformatsvalskey((s'/www/b/brendan/phy/project/code/dump.pys printDicts iMiiXcCsĐdk}d}ttƒiƒ}t}t}d}g}g} g}g}xt|ƒD] } t|| ƒ}| djo |i}qX| djo |}qX| djo |}qXt||iƒp t||ƒo| i| ƒqXt||iƒpt||iƒo|i| |fƒqXt||iƒo|i| |fƒqX|i| |fƒqXW|iƒ| iƒ|iƒ|iƒ|||g}||||||g}d„}|djot|ƒi}nd ||t |ƒf}d i"t#||ƒƒGH|tjot$|ƒ}nd |i%ƒd }Ht&d |||ƒf|d ƒGH| oGt(t$| ƒdƒp t$tƒ} Ht&d|| |ƒf|dƒGHn|o HdGHnxP|D]H\}}t|dtƒpd} t&d||| |ƒf|d ƒGHqËW|o HdGHnxP|D]H\}}t|dtƒpd}t&d||||ƒf|d ƒGHq/W|o HdGHnx=|D]5\}} t&d||t$| ƒ|ƒf|d ƒGHq“WdS(s“Print a nicely formatted overview of an object. The output lines will be wrapped at maxlen, with lindent of space for names of attributes. A maximum of maxspew characters will be printed for each attribute value. You can hand dumpObj any data type -- a module, class, instance, new class. Note that in reformatting for compactness the routine trashes any formatting in the docstrings it prints. Example: >>> class Foo(object): a = 30 def bar(self, b): "A silly method" return a*b ... ... ... ... >>> foo = Foo() >>> dumpObj(foo) Instance of class 'Foo' as defined in module __main__ with id 136863308 Documentation string: None Built-in Methods: __delattr__, __getattribute__, __hash__, __init__ __new__, __reduce__, __repr__, __setattr__, __str__ Methods: bar "A silly method" Attributes: __dict__ {} __weakref__ None a 30 Niss __class__s__doc__s __module__cCs<t|ƒ|jo!|d|!dt|ƒ|Sn|SdS(Nis ...(%d more chars)...(slensssmaxlen(sssmaxlen((s'/www/b/brendan/phy/project/code/dump.pys truncstring\s!ss9Instance of class '%s' as defined in module %s with id %ds s"""sDocumentation string:s s[']sBuilt-in Methods:s, sClasses:ssMethods:s Attributes:(1stypessltabstypesobjects__hash__sMethodWrapperTypesNonesobjclasssobjdocs objmodulesmethodssbuiltinssclassessattrssdirsobjsslotsgetattrsattrs__name__s isinstancesBuiltinMethodTypesappends MethodTypes FunctionTypesTypeTypessortslindentsmaxlens normalwidthss tabbedwidthss truncstringsidsintrosjoins prettyPrintsstrsstripsprettyPrintColssmaxspewsdelcharssbi_strs classnames classtypesclassdocs methodnamesmethods methoddocsval(sobjsmaxlenslindentsmaxspewsmethodss tabbedwidthss classnamesintrosattrssvalsslotsbuiltinssbi_strsclassdocsobjclasssobjdocs truncstringsmethodsMethodWrapperTypes normalwidthss objmodules methodnames methoddocstypessattrs classtypesclassessltab((s'/www/b/brendan/phy/project/code/dump.pysdumpObjs!        #&        "      s c sât|ƒt|ƒjpt‚tt|ƒ}dgt|ƒ}x8tt|ƒƒD]$}t |||||ƒ||­s(sformatstuplesmapscols(scols(sformat(s'/www/b/brendan/phy/project/code/dump.pys formatlineŹss N(slensstringsswidthssAssertionErrorsmaps nukenewlinesscolssrangesis prettyPrintssplitsjoinsappends_[1]swidthsformats formatline( sstringsswidthsssplitsformatsiscolss_[1]swidths formatline((sformats'/www/b/brendan/phy/project/code/dump.pysprettyPrintCols›s "? iKcCs˜||7}g}d}d}xq|djp|t|ƒdj oK|i||||t|ƒƒ}|i|||!ƒ|t|ƒ}qW|SdS(sËPretty prints the given string to break at an occurrence of split where necessary to avoid lines longer than maxlen. This will overflow the line if no convenient occurrence of split is foundii˙˙˙˙iN( sstringssplitslinessoldeolseolslensrfindsmaxlensappend(sstringsmaxlenssplitslinesseolsoldeol((s'/www/b/brendan/phy/project/code/dump.pys prettyPrint˛s %#cCsT| odSn|iƒ}digi}|D]}||iƒƒq0~ƒSdS(sĂStrip newlines and any trailing/following whitespace; rejoin with a single space where the newlines were. Bug: This routine will completely butcher any whitespace-formatted text.ss N(sstrings splitlinesslinessjoinsappends_[1]slinesstrip(sstrings_[1]slineslines((s'/www/b/brendan/phy/project/code/dump.pys nukenewlinesĆs  cCsPdigi}tdƒD]}|t|ƒƒq~ƒ}|i||ƒSdS(sXReturns a string for which all occurrences of characters in chars have been removed.siN( sjoinsappends_[1]srangesxschrsidentitysstrs translateschars(sstrscharss_[1]sxsidentity((s'/www/b/brendan/phy/project/code/dump.pysdelcharsŃs<N(s printDictsdumpObjsprettyPrintColss prettyPrints nukenewlinessdelchars(s nukenewlinessdumpObjs prettyPrintsprettyPrintColssdelcharss printDict((s'/www/b/brendan/phy/project/code/dump.pys?s –