AlkantarClanX12
Current Path : /opt/alt/python34/lib64/python3.4/lib2to3/fixes/__pycache__/ |
Current File : //opt/alt/python34/lib64/python3.4/lib2to3/fixes/__pycache__/fix_tuple_params.cpython-34.pyo |
� j f� � @ s� d Z d d l m Z d d l m Z d d l m Z d d l m Z m Z m Z m Z m Z m Z d d � Z Gd d � d e j � Z d d � Z d d � Z g d d d � Z d d � Z d S)a: Fixer for function definitions with tuple parameters. def func(((a, b), c), d): ... -> def func(x, d): ((a, b), c) = x ... It will also support lambdas: lambda (x, y): x + y -> lambda t: t[0] + t[1] # The parens are a syntax error in Python 3 lambda (x): x + y -> lambda x: x + y � )�pytree)�token)� fixer_base)�Assign�Name�Newline�Number� Subscript�symsc C s) t | t j � o( | j d j t j k S)N� )� isinstancer �Node�children�typer �STRING)�stmt� r �C/opt/alt/python34/lib64/python3.4/lib2to3/fixes/fix_tuple_params.py�is_docstring s r c @ s: e Z d Z d Z d Z d Z d d � Z d d � Z d S) �FixTupleParams� Ta funcdef< 'def' any parameters< '(' args=any ')' > ['->' any] ':' suite=any+ > | lambda= lambdef< 'lambda' args=vfpdef< '(' inner=any ')' > ':' body=any > c s6 d | k r � j | | � Sg � | d } | d } | d j d j t j k ry d } | d j d j } t � � n! d } d } t j t j d � � d � � � f d d � } | j t j k r� | | � n` | j t j k r4xK t | j � D]7 \ } } | j t j k r� | | d | d k �q� q� Wn � s>d Sx � D] } | d | _ qEW| } | d k r~d � d _ n1 t | d j | � r�| � d _ | d } n x � D] } | d | _ q�W� | d j | | � <x= t | d | t � � d � D] } | | d j | _ qW| d j � d S)N�lambda�suite�argsr � r z; � Fc s� t � j � � } | j � } d | _ t | | j � � } | rN d | _ n | j | � � j t j t j | � j � g � � d S)Nr � )r �new_name�clone�prefixr �replace�appendr r r Zsimple_stmt)Z tuple_arg� add_prefix�n�argr )�end� new_lines�selfr r �handle_tupleC s z.FixTupleParams.transform.<locals>.handle_tupler"