HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/libfuturize/fixes/__pycache__/fix_division_safe.cpython-310.pyc
o

,�]��@s|dZddlZddlmZmZmZddlmZddlm	Z	m
Z
mZmZdd�Z
e�d�Zd	d
�Zdd�ZGd
d�dej�ZdS)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_callcCs,tj}|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.
    )r�SLASH�type�next_sibling�prev_sibling)�node�slash�r�E/usr/lib/python3/dist-packages/libfuturize/fixes/fix_division_safe.py�match_divisions�rz^[0-9]*[.][0-9]*$cCst|j�p	t|j�S)N)�
_is_floatyr
r)rrrr�	is_floaty"srcCsVt|t�r	|d}t|t�rt�|j�St|t�r)t|jdt�r)|jdjdkSdS)Nr�floatF)�
isinstance�listr�const_re�match�valuer�children)�exprrrrr&s


rcs:eZdZdZejZdZ�fdd�Zdd�Z	dd�Z
�ZS)	�FixDivisionSafe�z4
    term<(not('/') any)+ '/' ((not('/') any))>
    cs"tt|��||�d|jv|_dS)zO
        Skip this fixer if "__future__.division" is already imported.
        �divisionN)�superr�
start_tree�future_features�skip)�self�tree�name��	__class__rrr!>szFixDivisionSafe.start_treecCs�|j|jjkrMd}d}g}|jD]1}|rd}qt|�r:t|�s:d}d|d_td|t�|j	�
�g|jd�g}d}q|�|�
��q|rMt|j||j
d�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.
        FT�r�old_div)�prefix)�fixers_applied)r�syms�termrrrr+r	rr�clone�appendrr,)r$r�matchedr#r�childrrrrEs(

�zFixDivisionSafe.matchcCs$|jrdStd|�tdd|�|S)Nrz
past.utilsr*)r#rr)r$r�resultsrrr�	transformcs

zFixDivisionSafe.transform)�__name__�
__module__�__qualname__�	run_orderrr
�_accept_type�PATTERNr!rr4�
__classcell__rrr'rr4sr)�__doc__�re�lib2to3.fixer_utilrrr�lib2to3r�libfuturize.fixer_utilrrrr	r�compilerrr�BaseFixrrrrr�<module>s