ó žòœMc@s«ddlZeedeƒp*ejd!kZejd"koHejd#kZejjdƒZejjd ƒZ erˆdd l m Z n.ydd l m Z Wndd l m Z nXddl Z ddlZddlZddlZddlZddlZddlZyddlZddlZWn)ek rQddlZddlZnXe s^erjejZn ejZd „Zydd lmZWnd „ZnXerµd„Zn d„Zd„Zdd„Z!de"fd„ƒYZ#de$fd„ƒYZ%de"fd„ƒYZ&de$fd„ƒYZ'ej(dej)ƒZ*d„Z+d„Z,d„Z-y#ddl.m/Z/m0Z0d„Z1Wn&ek r¦ddl.Z.d „Z1nXdS($iÿÿÿÿNt py3kwarningiiiiitjavatwin(tStringIOcCs ||_|S(sÈReturn a function with a given __name__. Will assign to __name__ and return the original function if possible on the Python implementation, otherwise a new function will be constructed. (t__name__(tfntname((s//usr/lib/python2.7/vendor-packages/mako/util.pytfunction_named&s (tpartialcs‡‡‡fd†}|S(Ncs*ˆjƒ}|j|ƒˆˆ||ŽS(N(tcopytupdate(tfargst fkeywordst newkeywords(targstfunctkeywords(s//usr/lib/python2.7/vendor-packages/mako/util.pytnewfunc4s  ((RRRR((RRRs//usr/lib/python2.7/vendor-packages/mako/util.pyR3scCs*y|jjSWntk r%|jSXdS(N(t __class__RtAttributeError(texc((s//usr/lib/python2.7/vendor-packages/mako/util.pytexception_name;s cCs |jjS(N(RR(R((s//usr/lib/python2.7/vendor-packages/mako/util.pyRAscCs]d}xPtjj|ƒsXy|d7}tj|dƒWq |dkrU‚qUq Xq WdS(s,create and/or verify a filesystem directory.iiiýiN(tostpathtexiststmakedirs(tdirttries((s//usr/lib/python2.7/vendor-packages/mako/util.pytverify_directoryDs  cCs4|dkr|St|ttfƒs,|gS|SdS(N(tNonet isinstancetlistttuple(txtdefault((s//usr/lib/python2.7/vendor-packages/mako/util.pytto_listQs  tmemoized_propertycBs#eZdZdd„Zd„ZRS(s2A read-only @property that is only evaluated once.cCs+||_|p|j|_|j|_dS(N(tfgett__doc__R(tselfR%tdoc((s//usr/lib/python2.7/vendor-packages/mako/util.pyt__init__\s cCs1|dkr|S|j|ƒ|j|j<}|S(N(RR%t__dict__R(R'tobjtclstresult((s//usr/lib/python2.7/vendor-packages/mako/util.pyt__get__as N(Rt __module__R&RR)R.(((s//usr/lib/python2.7/vendor-packages/mako/util.pyR$Zs t SetLikeDictcBseZdZd„ZRS(s0a dictionary that has some setlike methods on itcCst|}|j|ƒ|S(s‰produce a 'union' of this dict and another (at the key level). values in the second dict take precedence over that of the first(R0R (R'totherR!((s//usr/lib/python2.7/vendor-packages/mako/util.pytunionis  (RR/R&R2(((s//usr/lib/python2.7/vendor-packages/mako/util.pyR0gstFastEncodingBuffercBs2eZdZdded„Zd„Zd„ZRS(sna very rudimentary buffer that is faster than StringIO, but doesn't crash on unicode data like cStringIO.tstrictcCsXtjƒ|_||_|r*d|_n d|_||_||_|jj|_dS(Nut( t collectionstdequetdatatencodingtdelimtunicodeterrorstappendtwrite(R'R9R<R;((s//usr/lib/python2.7/vendor-packages/mako/util.pyR)us     cCs"tjƒ|_|jj|_dS(N(R6R7R8R=R>(R'((s//usr/lib/python2.7/vendor-packages/mako/util.pyttruncate€scCsE|jr.|jj|jƒj|j|jƒS|jj|jƒSdS(N(R9R:tjoinR8tencodeR<(R'((s//usr/lib/python2.7/vendor-packages/mako/util.pytgetvalue„s %N(RR/R&RtFalseR)R?RB(((s//usr/lib/python2.7/vendor-packages/mako/util.pyR3qs tLRUCachecBs]eZdZdefd„ƒYZdd„Zd„Zd„Zd„Zd„Z d „Z RS( s&A dictionary-like object that stores a limited number of items, discarding lesser used items periodically. this is a rewrite of LRUCache from Myghty to use a periodic timestamp-based paradigm so that synchronization is not really needed. the size management is inexact. t_ItemcBseZd„Zd„ZRS(cCs"||_||_tƒ|_dS(N(tkeytvaluet time_funct timestamp(R'RFRG((s//usr/lib/python2.7/vendor-packages/mako/util.pyR)”s  cCs t|jƒS(N(treprRG(R'((s//usr/lib/python2.7/vendor-packages/mako/util.pyt__repr__˜s(RR/R)RK(((s//usr/lib/python2.7/vendor-packages/mako/util.pyRE“s gà?cCs||_||_dS(N(tcapacityt threshold(R'RLRM((s//usr/lib/python2.7/vendor-packages/mako/util.pyR)›s cCs%tj||ƒ}tƒ|_|jS(N(tdictt __getitem__RHRIRG(R'RFtitem((s//usr/lib/python2.7/vendor-packages/mako/util.pyROŸs cCs#gtj|ƒD]}|j^qS(N(RNtvaluesRG(R'ti((s//usr/lib/python2.7/vendor-packages/mako/util.pyRQ¤scCs&||kr||S|||<|SdS(N((R'RFRG((s//usr/lib/python2.7/vendor-packages/mako/util.pyt setdefault§s  cCs]tj||ƒ}|dkrF|j||ƒ}tj|||ƒn ||_|jƒdS(N(RNtgetRREt __setitem__RGt _manage_size(R'RFRGRP((s//usr/lib/python2.7/vendor-packages/mako/util.pyRU®s   cCs“xŒt|ƒ|j|j|jkrŽttj|ƒdtjdƒdtƒ}x8||jD])}y||j =Wq^t k r†Pq^Xq^WqWdS(NRFRItreverse( tlenRLRMtsortedRNRQtoperatort attrgettertTrueRFtKeyError(R'tbytimeRP((s//usr/lib/python2.7/vendor-packages/mako/util.pyRV·s& ( RR/R&tobjectRER)RORQRSRURV(((s//usr/lib/python2.7/vendor-packages/mako/util.pyRDŠs     s([ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)cCs-|jƒ}|jdƒzÿ|jƒ}|jtjƒ}|rV|ttjƒ}ntj|j ddƒƒ}|säy)ddl }|j |j ddƒƒWnt t fk r¹qäX|jƒ}tj|j ddƒƒ}n|r|rüt d‚ndS|r|jdƒSdSWd|j|ƒXdS( sDeduce the encoding of a Python source file (binary mode) from magic comment. It does this in the same way as the `Python interpreter`__ .. __: http://docs.python.org/ref/encodings.html The ``fp`` argument should be a seekable file object in binary mode. itasciitignoreiÿÿÿÿNs\python refuses to compile code with both a UTF8 byte-order-mark and a magic encoding commenttutf_8i(ttelltseektreadlinet startswithtcodecstBOM_UTF8RXt_PYTHON_MAGIC_COMMENT_retmatchtdecodetparsertsuitet ImportErrort SyntaxErrortgroupR(tfptpostline1thas_bomtmRltline2((s//usr/lib/python2.7/vendor-packages/mako/util.pytparse_encodingÈs2       cCsL|jƒ}|jƒddjg|D]}d|||f^q&ƒdS(s}repr() a dictionary with the keys in order. Used by the lexer unit test to compare parse trees based on strings. t{s, s%r: %rt}(tkeystsortR@(tdRztk((s//usr/lib/python2.7/vendor-packages/mako/util.pytsorted_dict_reprõs  cCsÓt|dƒrdSd|_tddd|jƒ}t|ƒ|_xJ|jjD]<}|jdkrq||_qP|jdkrP||_qPqPWt|j d ƒ|_ t|j d ƒ|_ t|j dƒ|_ t|j d j d ƒ|_t|j d j d jƒ|_t|j d jƒ|_t|j d jjƒ|_t|j d jjjƒ|_t|j d jjjƒ|_t|j d jjjjƒ|_t|j d jjƒ|_t|j d jjjƒ|_t|j d jjjjƒ|_t|j d jjjjjƒ|_t|j djjƒ|_t|j djjjƒ|_t|j djjjjƒ|_ t|j djjƒ|_!t|j djj"d jƒ|_#t|j djjjƒ|_$t|j djjjjƒ|_%t|j djjjj&jƒ|_'t|j djjjjƒ|_(t|j djjƒ|_!t|j djj"d jƒ|_#t|j djj)d ƒ|_*t|j djj)d ƒ|_+t|j djjj)d ƒ|_,t|j djjj)d ƒ|_-t|j djj)d ƒ|_.t|j djj)d ƒ|_/t|j djj)dƒ|_0t|j djj)d ƒ|_1t|j djj)d ƒ|_2t|j djj)d ƒ|_3dS(sdAttempt to restore the required classes to the _ast module if it appears to be missing them tASTNii sdef foo(): pass class Bar(object): pass if False: pass baz = 'mako' 1 + 2 - 3 * 4 / 5 6 // 7 % 8 << 9 >> 10 11 & 12 ^ 13 | 14 15 and 16 or 17 -baz + (not +18) - ~17 baz and 'foo' or 'bar' (mako is baz == baz) is not baz != mako mako > baz < mako >= baz <= mako mako in baz not in makos texectmodiiiiiiiii i i i(4thasattrt PyCF_ONLY_ASTtcompilettypetModulet__mro__RRRtbodyt FunctionDeftClassDeftIfttargetstNametctxtStoreRGtStrtoptSubtlefttAddtrighttDivtMulttRShifttLShifttModtFloorDivtBitOrtBitXortBitAndtOrRQtAndtInverttNottoperandtUAddtUSubtopstIsNottNotEqtIstEqtGttLttGtEtLtEtIntNotIn(t_astRuR,((s//usr/lib/python2.7/vendor-packages/mako/util.pyt restore__astÿs\    ""%"#"%"#  ##     (tCO_VARKEYWORDSt CO_VARARGScCsŽ|j}|j}|j}t|| ƒ}d}|jt@rX|j|}|d}nd}|jt@r{|j|}n||||jfS(Ni( t func_codet co_argcountt co_varnamesRRtco_flagsR´R³t func_defaults(RtcotnargstnamesRtvarargstvarkw((s//usr/lib/python2.7/vendor-packages/mako/util.pytinspect_func_argsMs       cCs tj|ƒS(N(tinspectt getargspec(R((s//usr/lib/python2.7/vendor-packages/mako/util.pyR¿_s(ii(ii(ii(2tsystgetattrRCt version_infotpy3ktpy24tplatformRftjythontwin32tioRt cStringIORgtretweakrefRttimeRZR6t threadingtthreadRntdummy_threadingt dummy_threadtclockRHRt functoolsRRRRR#R_R$RNR0R3RDR„tVERBOSERiRwR~R²RÀR³R´R¿(((s//usr/lib/python2.7/vendor-packages/mako/util.pyts^ !H              :  - L