Ë
    	š„j/  ã                   ó¨   — d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	m
Z
mZmZ d„ Z ej                  d«      Zd„ Zd	„ Z G d
„ dej$                  «      Zy)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)ÚLeafÚNodeÚComma)Ú
fixer_base)ÚtokenÚfuture_importÚtouch_import_topÚwrap_in_fn_callc                 ó°   — t         j                  }| j                  |k(  xr6 | j                  j                  |k(   xr | j                  j                  |k(   S )zw
    __future__.division redefines the meaning of a single slash for division,
    so we match that and only that.
    )r   ÚSLASHÚtypeÚnext_siblingÚprev_sibling)ÚnodeÚslashs     úZ/var/www/html/GAP/venv/lib/python3.12/site-packages/libfuturize/fixes/fix_division_safe.pyÚmatch_divisionr      sX   € ô
 �K‰K€EØ�9‰9˜Ñò F d×&7Ñ&7×&<Ñ&<ÀÑ&EÐ"Eò FØ&*×&7Ñ&7×&<Ñ&<ÀÑ&EÐ"EðFó    z^[0-9]*[.][0-9]*$c                 óZ   — t        | j                  «      xs t        | j                  «      S )N)Ú
_is_floatyr   r   )r   s    r   Ú	is_floatyr   "   s#   € Ü�d×'Ñ'Ó(ÒI¬J°t×7HÑ7HÓ,IÐIr   c                 ó  — t        | t        «      r| d   } t        | t        «      rt        j	                  | j
                  «      S t        | t        «      r9t        | j                  d   t        «      r| j                  d   j
                  dk(  S y)Nr   ÚfloatF)Ú
isinstanceÚlistr   Úconst_reÚmatchÚvaluer   Úchildren)Úexprs    r   r   r   &   sl   € Ü�$œÔØ�A‰wˆä�$œÔä�~‰~˜dŸj™jÓ)Ð)Ü	�Dœ$Ô	ä�d—m‘m AÑ&¬Ô-Ø—=‘= Ñ#×)Ñ)¨XÑ5Ð5Ør   c                   óJ   ‡ — e Zd ZdZej
                  ZdZˆ fd„Zd„ Z	d„ Z
ˆ xZS )ÚFixDivisionSafeé   z4
    term<(not('/') any)+ '/' ((not('/') any))>
    c                 óT   •— t         t        | �  ||«       d|j                  v | _        y)zO
        Skip this fixer if "__future__.division" is already imported.
        ÚdivisionN)Úsuperr"   Ú
start_treeÚfuture_featuresÚskip)ÚselfÚtreeÚnameÚ	__class__s      €r   r'   zFixDivisionSafe.start_tree>   s(   ø€ ô 	Œo˜tÑ/°°dÔ;Ø $×"6Ñ"6Ð6ˆ�	r   c                 ó  — |j                   | j                  j                  k(  rèd}d}g }|j                  D ]‰  }|rd}Œt	        |«      rXt        |«      sMd}d|d   _        t        d|t        «       |j                  j                  «       gz   |j                  ¬«      g}d}Œk|j                  |j                  «       «       Œ‹ |rHt        t        d«      r"t        |j                   ||j                  ¬«      S t        |j                   |«      S y)	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.
        FTÚ r   Úold_div)ÚprefixÚfixers_applied)r2   )r   ÚsymsÚtermr   r   r   r1   r
   r   r   ÚcloneÚappendÚhasattrr   r2   )r*   r   Úmatchedr)   r   Úchilds         r   r   zFixDivisionSafe.matchE   s÷   € ð
 �9‰9˜Ÿ	™	Ÿ™Ò&ØˆGØˆDØˆHØŸ™ò 3�ÙØ �DØÜ! %Ô(´¸5Ô1AØ"�Gð *-�H˜Q‘KÔ&ä /°	Ø08¼E»GÀU×EWÑEW×E]ÑE]ÓE_Ð;`Ñ0`Ø7;·{±{ô!Dð  E�Hð  ‘Dà—O‘O E§K¡K£MÕ2ð3ñ  ô œ4Ð!1Ô2Ü §	¡	¨8ÀD×DWÑDWÔXÐXä §	¡	¨8Ó4Ð4àr   c                 óR   — | j                   ry t        d|«       t        dd|«       |S )Nr%   z
past.utilsr0   )r)   r   r	   )r*   r   Úresultss      r   Ú	transformzFixDivisionSafe.transformh   s'   € Ø�9Š9ØÜ�k 4Ô(Ü˜¨
°DÔ9Øˆr   )Ú__name__Ú
__module__Ú__qualname__Ú	run_orderr   r   Ú_accept_typeÚPATTERNr'   r   r<   Ú__classcell__)r-   s   @r   r"   r"   4   s(   ø„ à€Ià—;‘;€Lð€Gô7ò!öFr   r"   )Ú__doc__ÚreÚlib2to3.fixer_utilr   r   r   Úlib2to3r   Úlibfuturize.fixer_utilr   r   r	   r
   r   Úcompiler   r   r   ÚBaseFixr"   © r   r   ú<module>rL      sX   ðñó 
ß 0Ñ 0Ý ÷5ó 5òFð ˆ2�:‰:Ð)Ó*€òJòô9�j×(Ñ(õ 9r   