ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ A[c@sdZddlmZmZmZmZmZmZddlm Z m Z ddl m Z mZddl mZddlm Z mZmZm Z mZmZddlZdZdd Zdd Zdd Zd Zd ZdZdZdddZe je je j e j!e j"fZ#e j$e j%fZ&dZ'ddZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3ddZ4dS(s Utility functions from 2to3, 3to2 and python-modernize (and some home-grown ones). Licences: 2to3: PSF License v2 3to2: Apache Software License (from 3to2/setup.py) python-modernize licence: BSD (from python-modernize/LICENSE) i(t FromImporttNewlinet is_importt find_roottdoes_tree_importtComma(tLeaftNode(tpython_symbolstpython_grammar(ttoken(RtCalltNametsymsRtNumberNcCsd|kr|S|jdr,|d}ng|D]$}|jdj|r3|^q3}t|dkrtddjd|Dn!t|d krtd n|d Sd S( sl Examples: >>> canonical_fix_name('fix_wrap_text_literals') 'libfuturize.fixes.fix_wrap_text_literals' >>> canonical_fix_name('wrap_text_literals') 'libfuturize.fixes.fix_wrap_text_literals' >>> canonical_fix_name('wrap_te') ValueError("unknown fixer name") >>> canonical_fix_name('wrap') ValueError("ambiguous fixer name") s.fix_tfix_isfix_{0}isOAmbiguous fixer name. Choose a fully qualified module name instead from these: s css|]}d|VqdS(s N((t.0tmyf((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pys -sis1Unknown fixer. Use --list-fixes or -l for a list.N(t startswithtendswithtformattlent ValueErrortjoin(tfixt avail_fixestftfound((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pytcanonical_fix_names   $ cCsttjdd|S(Nu*tprefix(RR tSTAR(R((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pytStar6scCsttjdd|S(Nu**R(RR t DOUBLESTAR(R((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pyt DoubleStar9scCsttjdd|S(Nu-R(RR tMINUS(R((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pytMinus<scCs?g}x+|D]#}|j||jtq W|d=|S(s{ Accepts/turns: (Name, Name, ..., Name, Name) Returns/into: (Name, Comma, Name, Comma, ..., Name, Comma, Name) i(tappendR(tleafst new_leafstleaf((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pyt commatize?s   cCsx1|jdk r3|jjtjkr3|j}qW|jdkrGdS|jtjkr`|jS|jdk r|jjtjkr|jjS|jdkrdS|j SdS(sf Returns the indentation for this node Iff a node is in a suite, then it has indentation. uN( tparenttNonettypeR tsuiteR tINDENTtvaluet prev_siblingR(tnode((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pyt indentationKs' $ cCs@t|}td|jD}|s2dSt|SdS(s Dirty little trick to get the difference between each indentation level Implemented by finding the shortest indentation string (technically, the "least" of all of the indentation strings, but tabs and spaces mixed won't get this far, so those are synonymous.) css*|] }|jtjkr|jVqdS(N(R+R R-R.(Rti((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pys isu N(Rtsett pre_ordertmin(R0trt all_indents((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pytindentation_step`s  cCsx'|jD]}|jtjkr dSq Wx?t|jD]"\}}|jtjkr:Pq:q:Wtdttjt t tj t |t |g}|j|d}|jd|_|j||j|dS(sj Turn the stuff after the first colon in parent's children into a suite, if it wasn't already NuNo class suite and no ':'!iu(tchildrenR+R R,t enumerateR tCOLONRRRRR-R1R8tremoveRt append_child(R)R0R2R,tone_node((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pytsuitifyps 7   cCsw|dkrd}ntdd||g}|dk rg|jtdddt|ddgnttj|S(s Accepts a package (Name node), name to import it as (string), and optional prefix and returns a node: import [as ] uuimportRuasu N(R*R textendRR t import_name(tpackagetas_nameRR9((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pyt NameImports   ccsZ|j}xC|jtjkrN|j}|jtjkr=Pn|V|j}q W|j}|j}x|dk r|V|j}qdW|j}|jtkr|}x$|jdk r|jV|j}qW|j}n|j}|dkrdSxg|jtkrU|jtj kr|Vn|j}|dkr|j}|j}|dkrRPqRqqWdS(s Generator yields all nodes for which a node (an import_stmt) has scope The purpose of this is for a call to _find() on each of them N( t next_siblingR+R tSEMItNEWLINER)R*t_compound_stmtsR R,(R0ttesttnxtR)tcontexttctp((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pytimport_binding_scopes>                cCsgt|}tddd}t|dd}ttj|||g}|dk rc||_n|S(NuasRu (R RR timport_as_nameR*R(tnameRCRtnew_nametnew_ast new_as_nametnew_node((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pyt ImportAsNames   cCs>|jtjko=t|jdko=|jdjtjkS(s< Returns True if the node appears to be a docstring i(R+R t simple_stmtRR9R tSTRING(R0((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pyt is_docstringscCs2t|}td||r"dSd}xvt|jD]e\}}t|s\t|re|}nt|rwq8nt|}|sPn||kr8dSq8Wt dt t j |ddg}|dkr|dkr|jdj |_ d|jd_ n|tg}|j|ttj|dS(s This seems to work u __future__NRt iu(RRR*R:R9tis_shebang_commenttis_encoding_commentRXtcheck_future_importRRR tNAMERRt insert_childRR RV(tfeatureR0troottshebang_encoding_idxtidxtnamestimport_R9((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pyt future_imports(     $c Cs6t|}td||r"dSd}x_t|jD]N\}}|jtjkr8|jr8|jdjtjkr8|d}Pq8q8WxP|j|D];}|jtj kr|d7}qn|j }d|_ PqWd}t dt tj |ddg}|tg}|j|ttj|d|dS(sD An alternative to future_import() which might not work ... u __future__NiiuRu (RRR:R9R+R RVR RWRGRRRR]RR^R( R_R0R`t insert_posRbt thing_afterRRdR9((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pytfuture_import2s(     $cCsg|D]}|jtjkr|^q}tg|D]}|df^q5}x}t|D]o\}}|jtjkr|jdjtj kr|jdj }|jd|| -*- # vim: set fileencoding= : (RRRtENCODING_REGEXR(R0((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pyR[s cCsRt|dkr3|\}}|t|g}n|}tt||d|S(s Example: >>> wrap_in_fn_call("oldstr", (arg,)) oldstr(arg) >>> wrap_in_fn_call("olddiv", (arg1, arg2)) olddiv(arg1, arg2) >>> wrap_in_fn_call("olddiv", [arg1, comma, arg2, comma, arg3]) olddiv(arg1, arg2, arg3) iR(RRR R (tfn_nametargsRtexpr1texpr2tnewargs((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pytwrap_in_fn_calls  (5t__doc__tlib2to3.fixer_utilRRRRRRtlib2to3.pytreeRRtlib2to3.pygramRR R R R R RRRR*RR!R#R(R1R8R?RDtif_stmtt while_stmttfor_stmtttry_stmtt with_stmtRHRARt _import_stmtsRNRURXReRhRsRtRR\RRRZR[R(((sG/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixer_util.pyt s>..  "      $ ;  (   c *