Hacked By AnonymousFox
��Yf� � @ 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/python35/lib64/python3.5/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 s- 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� | | � nZ | j t j k r.xE t | j � D]4 \ } } | j t j
k r� | | d | d k �q� W� s8d Sx � D] }
| d |
_
q?W| } | d k rxd
� d _ n. t | d j | � r�| � d _ | d } x � D] }
| d |
_
q�W� | d j | | � <x= t | d | t � � d � D] } | | d j | _ q�W| d j � d S)N�lambda�suite�argsr � r z; � Fc s� t � j � � } | j � } d | _ t | | j � � } | rK d | _ | 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"