B
    18™\Ë  ã               @   s6   d Z ddlmZ ddlmZmZ G dd„ dejƒZdS )zuFixer that addes parentheses where they are required

This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``.é   )Ú
fixer_base)ÚLParenÚRParenc               @   s   e Zd ZdZdZdd„ ZdS )ÚFixParenTa  
        atom< ('[' | '(')
            (listmaker< any
                comp_for<
                    'for' NAME 'in'
                    target=testlist_safe< any (',' any)+ [',']
                     >
                    [any]
                >
            >
            |
            testlist_gexp< any
                comp_for<
                    'for' NAME 'in'
                    target=testlist_safe< any (',' any)+ [',']
                     >
                    [any]
                >
            >)
        (']' | ')') >
    c             C   s8   |d }t ƒ }|j|_d|_| d|¡ | tƒ ¡ d S )NÚtargetÚ é    )r   ÚprefixÚinsert_childÚappend_childr   )ÚselfÚnodeÚresultsr   Úlparen© r   ú[/oak/stanford/groups/akundaje/marinovg/programs/Python-3.7.3/Lib/lib2to3/fixes/fix_paren.pyÚ	transform%   s    zFixParen.transformN)Ú__name__Ú
__module__Ú__qualname__ÚBM_compatibleÚPATTERNr   r   r   r   r   r      s   r   N)Ú__doc__r   r   Ú
fixer_utilr   r   ÚBaseFixr   r   r   r   r   Ú<module>   s   