AlkantarClanX12
Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/ |
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/fixes/__pycache__/fix_print.cpython-310.opt-1.pyc |
o 6��f � @ sl d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZm Z m Z mZ e�d�Z G dd � d ej�Zd S )a Fixer for print. Change: 'print' into 'print()' 'print ...' into 'print(...)' 'print ... ,' into 'print(..., end=" ")' 'print >>x, ...' into 'print(..., file=x)' No changes are applied if print_function is imported from __future__ � )�patcomp)�pytree)�token)� fixer_base)�Name�Call�Comma�Stringz"atom< '(' [atom|STRING|NAME] ')' >c @ s$ e Zd ZdZdZdd� Zdd� ZdS )�FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c C sX |� d�}|r|�ttd�g |jd�� d S |jdd � }t|�dkr,t�|d �r,d S d } }}|rC|d t � krC|d d� }d}|r\|d t �tj d�kr\|d �� }|d d � }d d� |D �}|rjd|d _|d usv|d usv|d ur�|d ur�| �|d tt|��� |d ur�| �|dtt|��� |d ur�| �|d|� ttd�|�} |j| _| S )NZbare�print)�prefix� � ���� z>>� c S s g | ]}|� � �qS � )�clone)�.0�argr r �>/opt/alt/python310/lib64/python3.10/lib2to3/fixes/fix_print.py� <listcomp>? s z&FixPrint.transform.<locals>.<listcomp>� �sep�end�file)�get�replacer r r �children�len�parend_expr�matchr r �Leafr � RIGHTSHIFTr � add_kwargr �repr) �selfZnodeZresultsZ bare_print�argsr r r Zl_argsZn_stmtr r r � transform% s: � zFixPrint.transformc C sN d|_ t�| jjt|�t�tjd�|f�}|r |� t � � d|_ |� |� d S )Nr �=r )r r ZNodeZsymsZargumentr r"