ÿØÿà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@sdZddlmZddlmZddlmZmZmZm Z m Z m Z m Z m Z mZdZdZdZdZd Zd Zd ejfd YZd S(sFixer for __metaclass__ = X -> (future.utils.with_metaclass(X)) methods. The various forms of classef (inherits nothing, inherits once, inherints many) don't parse the same in the CST so we look at ALL classes for a __metaclass__ and if we find one normalize the inherits to all be an arglist. For one-liner classes ('class X: pass') there is no indent/dedent so we normalize those into having a suite. Moving the __metaclass__ into the classdef can also cause the class body to be empty so there is some special casing for that as well. This fixer also tries very hard to keep original indenting and spacing in all those corner cases. i(t fixer_base(ttoken( tNametsymstNodetLeaft touch_importtCalltStringtCommat parenthesizecCsx|jD]}|jtjkr,t|S|jtjkr |jr |jd}|jtjkr|jr|jd}t|tr|j dkrt Sqq q Wt S(s we have to check the cls_node without changing it. There are two possiblities: 1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta') 2) clsdef => simple_stmt => expr_stmt => Leaf('__meta') it __metaclass__( tchildrenttypeRtsuitet has_metaclasst simple_stmtt expr_stmtt isinstanceRtvaluetTruetFalse(tparenttnodet expr_nodet left_side((sP/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_metaclass.pyR&s   cCsx'|jD]}|jtjkr dSq Wx?t|jD]"\}}|jtjkr:Pq:q:Wtdttjg}xC|j|dr|j|d}|j |j |j qW|j ||}dS(sf one-line classes don't get a suite in the parse tree so we add one to normalize the tree NsNo class suite and no ':'!i( R R RRt enumerateRtCOLONt ValueErrorRt append_childtclonetremove(tcls_nodeRtiRt move_node((sP/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_metaclass.pytfixup_parse_tree9s  c Csx7t|jD]"\}}|jtjkrPqqWdS|jttjg}ttj |g}x;|j|r|j|}|j |j |jqnW|j |||jdjd}|jdjd} | j |_ dS(s if there is a semi-colon all the parts count as part of the same simple_stmt. We just want the __metaclass__ part so we move everything efter the semi-colon into its own simple_stmt node Ni(RR R RtSEMIRRRRRRRt insert_childtprefix( RR!t stmt_nodetsemi_indRtnew_exprtnew_stmtR"t new_leaf1t old_leaf1((sP/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_metaclass.pytfixup_simple_stmtSs  cCs:|jr6|jdjtjkr6|jdjndS(Ni(R R RtNEWLINER(R((sP/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_metaclass.pytremove_trailing_newlineks"ccsx3|jD]}|jtjkr Pq q Wtdxtt|jD]\}}|jtjkrL|jrL|jd}|jtjkr|jr|jd}t |t r|j dkrt |||t ||||fVqqqLqLWdS(NsNo class suite!iu __metaclass__(R R RRRtlistRRRRRRR-R/(R RR!t simple_nodeRt left_node((sP/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_metaclass.pyt find_metasps "   cCs|jddd}x,|rD|j}|jtjkrPqqWxm|r|j}t|tr|jtjkr|jrd|_ndS|j |jdddqHWdS(s If an INDENT is followed by a thing with a prefix then nuke the prefix Otherwise we get in trouble when removing __metaclass__ at suite start Niu( R tpopR RtINDENTRRtDEDENTR&textend(RtkidsR((sP/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_metaclass.pyt fixup_indents    !  t FixMetaclasscBseZeZdZdZRS(s classdef c Cst|sdSt|d}x-t|D]\}}}|}|jq-W|jdj}t|jdkr|jdjtj kr|jd}q|jdj } t tj | g}|j d|nt|jdkrt tj g}|j d|n~t|jdkrt tj g}|j dttjd|j d||j dttjdn td |jdjd} d | _| j} td d ||jdjdj } d | _| g} |jrt|jdkr0|jdj }d|_nt|j }d|_ttdtdt|tt tjttjdttjdgddgdd}| jt|gn|jttd d|j| t ||jsM|jt|d}| |_|j!||j!ttj"dnt|jdkr|jdjtj#kr|jdjtj$krt|d}|j d||j dttj"dndS(Niiiiiiu)u(sUnexpected class definitiont metaclassu future.utilsuwith_metaclassuiu R s 'NewBase'u{u}R&upassu ii(%RR#tNoneR3RR R tlenRtarglistRRt set_childR%RRtRPARtLPARRRR&RR RRRR tatomtLBRACEtRBRACER7treplaceR9RR.R5R6(tselfRtresultstlast_metaclassRR!tstmtt text_typeR>Rtmeta_txttorig_meta_prefixR;t argumentstbasetbasest pass_leaf((sP/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_metaclass.pyt transforms~            $         (t__name__t __module__Rt BM_compatibletPATTERNRQ(((sP/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_metaclass.pyR:sN(t__doc__tlib2to3Rtlib2to3.pygramRtlib2to3.fixer_utilRRRRRRRR R RR#R-R/R3R9tBaseFixR:(((sP/opt/alt/python27/lib/python2.7/site-packages/libfuturize/fixes/fix_metaclass.pyts@