mò %U²Ic@s%dZdkZdkZdkZdddddgZgZdZhZddd „Z ddd „Z dd „Z d „Z d e d ddd„Ze ddd„Zd„Zdefd„ƒYZd„Zd„Zd„Zd„ZeeiƒeddeddƒeddeddƒdS(s&Python part of the warnings subsystem.Ntwarnt showwarningt formatwarningtfilterwarningst resetwarningstdefaultic Csˆt|tƒo |i}n|d jo t}nt|tƒpt‚yt i |ƒ}Wn"t j ot i}d}nX|i}|i}d|jo|d}nd}|idƒ}|o>|iƒ}|idƒp|idƒo|d }qYnP|djo1yt id }WqHtj o d}qHXn|p |}n|id hƒ} t|||||| ƒd S( s:Issue a warning, or maybe ignore it or raise an exception.it__name__st__file__s.pycs.pyoiÿÿÿÿt__main__it__warningregistry__N(t isinstancetmessagetWarningt __class__tcategorytNonet UserWarningt issubclasstAssertionErrortsyst _getframet stackleveltcallert ValueErrort__dict__tglobalstlinenot f_globalstf_linenotmoduletgettfilenametlowertfnltendswithtargvtAttributeErrort setdefaulttregistryt warn_explicit( R RRR!RRRRRR&((t%/data/zmath/lib/python2.4/warnings.pyRs<            cCsu|djo6|pd}|diƒdjo|d }qCn|djo h}nt|tƒot|ƒ}|i }n|}||ƒ}|||f} |i| ƒodSnx’tD]„} | \}}} } }|djp|i|ƒoLt|| ƒo<| djp| i|ƒo|djp ||joPqÃqÃWt}|djod|| iýÿÿÿs.pyitignoreiterrortoncetalwaysRRs1Unrecognized action (%r) in warnings.filters: %s(RRRR R&R R R tstrttextR RRtkeyRtfilterstitemtactiontmsgtcattmodtlntmatchRt defaultactiontoncekeyt onceregistrytaltkeyt RuntimeErrorR(R RRRRR&R.R6R3R/R5R4R;R1R2R9((R(R'?sV       d            cCsT|djo ti}ny |it||||ƒƒWnt j onXdS(s7Hook to write a warning to a file; replace if you like.N( tfileRRtstderrtwriteRR RRRtIOError(R RRRR=((R(Rzs   cCsRd|||i|f}ti||ƒiƒ}|o|d|d}n|S(s.Function to format a warning the standard way.s%s:%s: %s: %s s s N( RRRRR tst linecachetgetlinetstriptline(R RRRRARE((R(Rƒs ticCsdk}|djptd|f‚t|tƒp td ‚t|tiƒp td ‚t |t ƒp td ‚t|tƒp td ‚t|t ƒo |d jp td‚||i||iƒ||i|ƒ|f}|oti|ƒntid |ƒdS(s†Insert an entry into the list of warnings filters (at the front). Use assertions to check that all arguments have the right type.NR*R)R,RRR+sinvalid action: %rsmessage must be a stringscategory must be a classs#category must be a Warning subclasssmodule must be a stringislineno must be an int >= 0(serrorsignoresalwayssdefaultsmodulesonce(treR2RR R t basestringRttypest ClassTypeRR RRtinttcompiletIR1tappendR0tinsert(R2R RRRRNR1RG((R(R‹s '-cCs†|d jptd|f‚t|tƒo |djp td ‚|d |d |f}|ot i|ƒnt i d|ƒd S( sƒInsert a simple entry into the list of warnings filters (at the front). A simple filter matches all modules and messages. R*R)R,RRR+sinvalid action: %rislineno must be an int >= 0N(serrorsignoresalwayssdefaultsmodulesonce( R2RR RRKRRR1RNR0RO(R2RRRNR1((R(t simplefilter s'cCs gt(dS(sAClear the list of warning filters, so that no filters are active.N(R0(((R(R¯st _OptionErrorcBstZdZRS(s,Exception used by option processing helpers.(Rt __module__t__doc__(((R(RQ³s cCsNxG|D]?}yt|ƒWqtj o}tidI|IJqXqWdS(NsInvalid -W option ignored:(targstargt _setoptionRQR3RR>(RTR3RU((R(t_processoptions¸s c Csldk}|idƒ}t|ƒdjotd|fƒ‚nx%t|ƒdjo|idƒqEWg}|D]}||i ƒqu~\}}}}} t|ƒ}|i|ƒ}t|ƒ}|i|ƒ}|o|d}n| oZy't| ƒ} | djo t‚nWqRttfj otd| fƒ‚qRXnd} t||||| ƒdS(Nt:istoo many fields (max 5): %rRFt$isinvalid lineno %r(RGRUtsplittpartstlenRQRNt_[1]RARDR2R RRRt _getactiontescapet _getcategoryRKRt OverflowErrorR( RURRAR]RGR[RR2R R((R(RVÀs. 6    cCsv|pdSn|djodSnx8ddddddgD]}|i|ƒo|Sq=q=Wtd|fƒ‚dS( NRtallR,R)RR+R*sinvalid action: %r(R2tat startswithRQ(R2Rc((R(R^Ûs  cCsPdk}|ptSn|id|ƒo=yt|ƒ}Wqtj otd|fƒ‚qXn©|idƒ}|| }||d}yt |dd|gƒ}Wn&tj otd|fƒ‚nXyt||ƒ}Wn&tj otd|fƒ‚nXt|tiƒ pt|tƒ otd|fƒ‚n|S(Ns^[a-zA-Z0-9_]+$sunknown warning category: %rt.isinvalid module name: %rsinvalid warning category: %r(RGRR R7tevalR4t NameErrorRQtrfindtiRtklasst __import__Rtmt ImportErrortgetattrR$R RIRJR(RRiRlRR4RGRj((R(R`ås,  %R)RRN(RSRRIRBt__all__R0R8R:RRR'RRR RRPRt ExceptionRQRWRVR^R`t warnoptionstOverflowWarningtPendingDeprecationWarning(RR0RVRRoR:RPR`R8R'RIRRWRRBRQRRR^((R(t?s*  ';