<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
B
    A[                 @   s   d Z ddlZddlmZ ddlmZmZmZ ddlm	Z	 ddlm
Z
mZ ddlmZmZmZmZ dd Zed	Zd
d Zdd Zdd Zdd ZG dd de	jZdS )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)symsdoes_tree_import)tokenfuture_importtouch_import_topwrap_in_fn_callc             C   s,   t j}| j|ko*| jj|k o*| 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typeZnext_siblingZprev_sibling)nodeZslash r   T/opt/alt/python37/lib/python3.7/site-packages/libfuturize/fixes/fix_division_safe.pymatch_division   s    r   z^[0-9]*[.][0-9]*$c             C   s(   t | jd| p&t | j|d d  S )Nr      )
_is_floatychildren)r   div_idxr   r   r   	is_floaty$   s    r   c             C   sV   t | tr| d } t | tr(t| jS t | trRt | jd trR| jd jdkS dS )Nr   floatF)
isinstancelistr   const_rematchvaluer   r   )exprr   r   r   r   (   s    


r   c             C   s(   x"t | jD ]\}}t|r|S qW dS )NF)	enumerater   r   )r   ichildr   r   r   find_division5   s    r!   c             C   sN   g }x:t | jD ],\}}||kr.|t  q||  qW d|d _|S )N r   )r   r   appendr   Zcloneprefix)r   r   r   r   r    r   r   r   clone_div_operands;   s    
r%   c                   s:   e Zd ZdZejZdZ fddZdd Z	dd Z
  ZS )	FixDivisionSafe   z4
    term<(not('/') any)+ '/' ((not('/') any))>
    c                s"   t t| || d|jk| _dS )zO
        Skip this fixer if "__future__.division" is already imported.
        divisionN)superr&   
start_treeZfuture_featuresskip)selfZtreename)	__class__r   r   r*   R   s    zFixDivisionSafe.start_treec             C   s6   |j | jjkr2t|}|dk	r2t||s2t||S dS )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.
        F)r   r   Ztermr!   r   r%   )r,   r   r   r   r   r   r   Y   s    

zFixDivisionSafe.matchc             C   s0   | j r
d S td| tdd| td||jdS )Nr(   z
past.utilsZold_div)r$   )r+   r	   r
   r   r$   )r,   r   Zresultsr   r   r   	transformh   s
    
zFixDivisionSafe.transform)__name__
__module____qualname__Z	run_orderr   r   Z_accept_typeZPATTERNr*   r   r/   __classcell__r   r   )r.   r   r&   H   s   r&   )__doc__reZlib2to3.pytreeZpytreeZlib2to3.fixer_utilr   r   r   Zlib2to3r   r   r   Zlibfuturize.fixer_utilr   r	   r
   r   r   compiler   r   r   r!   r%   ZBaseFixr&   r   r   r   r   <module>   s   	
