Hacked By AnonymousFox
3
\� � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZmZm Z m
Z
mZmZ dd� Z
G dd � d ej�Zd
d� Zdd
� Zg dfdd�Zdd� ZdS )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 | tj�o| jd jtjkS )N� )�
isinstancer �Node�children�typer �STRING)�stmt� r �6/usr/lib64/python3.6/lib2to3/fixes/fix_tuple_params.py�is_docstring s r c @ s( e Zd ZdZdZdZdd� Zdd� ZdS ) �FixTupleParams� Ta
funcdef< 'def' any parameters< '(' args=any ')' >
['->' any] ':' suite=any+ >
|
lambda=
lambdef< 'lambda' args=vfpdef< '(' inner=any ')' >
':' body=any
>
c s� d|kr�j ||�S g �|d }|d }|d jd jtjkrZd}|d jd j}t� � nd}d}tjtjd�� d� ��fd
d� }|jt j
kr�||� n@|jt jkr�x2t|j�D ]$\}} | jt j
kr�|| |dkd� q�W �s�d S x�D ]}
|d |
_
q�W |}|dk�rd
�d _n&t|d j| ��r8|�d _|d }x�D ]}
|d |
_
�q>W �|d j||�<