관리-도구
편집 파일: fix_division_safe.cpython-37.opt-1.pyc
B �A�[� � @ s� d Z ddlZddlmZ ddlmZmZmZ ddlm Z ddlm Z mZ ddlm Z mZmZmZ dd� Ze�d �Zd d� Zdd � Zdd� Zdd� ZG dd� de j�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)�syms�does_tree_import)�token� future_import�touch_import_top�wrap_in_fn_callc C s, t j}| 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�typeZnext_siblingZprev_sibling)�nodeZslash� 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 | jd|� �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 | jd t�rR| jd jdkS dS )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 qW dS )NF)� enumerater r )r �i�childr r r � find_division5 s r! c C sN g }x:t | j�D ],\}}||kr.|�t� � q|�|�� � qW d|d _|S )N� r )r r �appendr Zclone�prefix)r r r r r r r r �clone_div_operands; s r% c s: e Zd ZdZejZdZ� fdd�Zdd� Z dd� Z � ZS ) �FixDivisionSafe� z4 term<(not('/') any)+ '/' ((not('/') any))> c s"