ó
è¾bc           @   sO   d  Z  d d l m Z m Z d d l m Z m Z d e j f d „  ƒ  YZ d S(   s:   
Optional fixer to transform set() calls to set literals.
iÿÿÿÿ(   t
   fixer_baset   pytree(   t   tokent   symst   FixSetLiteralc           B   s#   e  Z e Z e Z d  Z d „  Z RS(   sj  power< 'set' trailer< '('
                     (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) >
                                |
                                single=any) ']' >
                     |
                     atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' >
                     )
                     ')' > >
              c   	      C   s  | j  d ƒ } | rI t j t j | j ƒ  g ƒ } | j | ƒ | } n
 | d } t j t j	 d ƒ g } | j
 d „  | j Dƒ ƒ | j t j t j d ƒ ƒ | j j | d _ t j t j | ƒ } | j | _ t | j ƒ d k r| j d } | j ƒ  | j | j d _ n  | S(	   Nt   singlet   itemsu   {c         s   s   |  ] } | j  ƒ  Vq d  S(   N(   t   clone(   t   .0t   n(    (    s3   /usr/lib/python2.7/lib2to3/fixes/fix_set_literal.pys	   <genexpr>'   s    u   }iÿÿÿÿi   i   (   t   getR   t   NodeR   t	   listmakerR   t   replacet   LeafR   t   LBRACEt   extendt   childrent   appendt   RBRACEt   next_siblingt   prefixt   dictsetmakert   lent   remove(	   t   selft   nodet   resultsR   t   fakeR   t   literalt   makerR	   (    (    s3   /usr/lib/python2.7/lib2to3/fixes/fix_set_literal.pyt	   transform   s"    	

(   t   __name__t
   __module__t   Truet   BM_compatiblet   explicitt   PATTERNR   (    (    (    s3   /usr/lib/python2.7/lib2to3/fixes/fix_set_literal.pyR      s   
N(	   t   __doc__t   lib2to3R    R   t   lib2to3.fixer_utilR   R   t   BaseFixR   (    (    (    s3   /usr/lib/python2.7/lib2to3/fixes/fix_set_literal.pyt   <module>   s   