bg/dZddlZddlmZmZmZddlmZddlm Z m Z m Z m Z dZ ejdZdZd ZGd d ejZdS) aL For the ``future`` package. Adds this import line: from __future__ import division at the top and changes any old-style divisions to be calls to past.utils.old_div so the code runs as before on Py2.6/2.7 and has the same behaviour on Py3. If "from __future__ import division" is already in effect, this fixer does nothing. N)LeafNodeComma) fixer_base)token future_importtouch_import_topwrap_in_fn_callcttj}|j|ko!|jj|k o|jj|k S)zw __future__.division redefines the meaning of a single slash for division, so we match that and only that. )rSLASHtype next_sibling prev_sibling)nodeslashs t/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/libfuturize/fixes/fix_division_safe.pymatch_divisionrsH KE 9  Fd&7&<&E"E F&*&7&<&E"EFz^[0-9]*[.][0-9]*$cRt|jpt|jS)N) _is_floatyrr)rs r is_floatyr"s# d' ( ( IJt7H,I,IIrc>t|tr|d}t|trt|jSt|t r6t|jdtr|jdjdkSdS)NrfloatF) isinstancelistrconst_rematchvaluerchildren)exprs rrr&s$Aw$6~~dj))) D$  6 dmA& - - 6=#)X5 5 5rc@eZdZdZejZdZfdZdZ dZ xZ S)FixDivisionSafez4 term<(not('/') any)+ '/' ((not('/') any))> cvtt|||d|jv|_dS)zO Skip this fixer if "__future__.division" is already imported. divisionN)superr" start_treefuture_featuresskip)selftreename __class__s rr'zFixDivisionSafe.start_tree>s8 ot$$//d;;;$"66 rc|j|jjkrd}d}g}|jD]}|rd}t |rat |sRd}d|d_td|t|j gz|jg}d}w| | |rFttdrt|j||jSt|j|SdS) z Since the tree needs to be fixed once and only once if and only if it matches, we can start discarding matches after the first. FTrold_div)prefixfixers_applied)r2)r symstermrrrr1r rrcloneappendhasattrrr2)r*rmatchedr)rchilds rrzFixDivisionSafe.matchEs/ 9  & &GDH 3 3 D!%(( 351A1A 3"G*-HQK& / 08EGGUEWE]E]E_E_;`0`7;{!D!D!D EH DDOOEKKMM2222 54!1225 8DDWXXXX 8444urcZ|jrdStd|tdd||S)Nr%z past.utilsr0)r)rr )r*rresultss r transformzFixDivisionSafe.transformhs8 9  Fk4((( D999r) __name__ __module__ __qualname__ run_orderrr _accept_typePATTERNr'rr< __classcell__)r-s@rr"r"4sjI;LG77777!!!Frr")__doc__relib2to3.fixer_utilrrrlib2to3rlibfuturize.fixer_utilrrr r rcompilerrrBaseFixr"rrrLs   0000000000555555555555FFF 2:) * *JJJ   99999j(99999r