î
\á[\Ë  ã               @   sI   d  Z  d d l m Z d d l m Z m Z Gd 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   sL   | d } t  ƒ  } | j | _ d | _ | j d | ƒ | j t ƒ  ƒ d  S)NÚtargetÚ é    )r   ÚprefixZinsert_childZappend_childr   )ÚselfZnodeZresultsr   Zlparen© r   ú-/usr/lib/python3.4/lib2to3/fixes/fix_paren.pyÚ	transform%   s    
		zFixParen.transformN)Ú__name__Ú
__module__Ú__qualname__ZBM_compatibleZPATTERNr   r   r   r   r   r      s   r   N)Ú__doc__r   r   Z
fixer_utilr   r   ZBaseFixr   r   r   r   r   Ú<module>   s   