ó
	Q[c           @   sb   d  Z  d d l m Z d d l m Z d d l m Z d Z d   Z d e j	 f d     YZ
 d	 S(
   u&   
Fixer to remove function annotations
iĸĸĸĸ(   t
   fixer_base(   t   token(   t   symsu)   Removing function annotations completely.c         C   s   |  j  d S(   Ni    (   t   children(   t   node(    (    sB   lib/python2.7/site-packages/libpasteurize/fixes/fix_annotations.pyt   param_without_annotations   s    t   FixAnnotationsc           B   s&   e  Z e Z d    Z d Z d   Z RS(   c         C   s,   |  j  s( t |  _  |  j | d | n  d  S(   Nt   reason(   t   warnedt   Truet   warning(   t   selfR   R   (    (    sB   lib/python2.7/site-packages/libpasteurize/fixes/fix_annotations.pyt	   warn_once   s    		um   
              funcdef< 'def' any parameters< '(' [params=any] ')' > ['->' ret=any] ':' any* >
              c         C   s+  | j  d  } | j  d  } | d k	 rx | j j t j k sK t d   |  j | d t | j j	   | j	   n  | d k r d S| j t
 j k rė x | j D]A } | j t
 j k rĪ |  j | d t | j t |   qĪ qĪ Wn; | j t
 j k r'|  j | d t | j t |   n  d S(   uK   
        This just strips annotations from the funcdef completely.
        u   paramsu   retu   Invalid return annotationR   N(   t   gett   Nonet   prev_siblingt   typeR   t   RARROWt   AssertionErrorR   t   warning_textt   removeR   t   typedargslistR   t   tnamet   replaceR   (   R   R   t   resultst   paramst   rett   param(    (    sB   lib/python2.7/site-packages/libpasteurize/fixes/fix_annotations.pyt	   transform   s"    ! (   t   __name__t
   __module__t   FalseR   R   t   PATTERNR   (    (    (    sB   lib/python2.7/site-packages/libpasteurize/fixes/fix_annotations.pyR      s   	N(   t   __doc__t   lib2to3R    t   lib2to3.pgen2R   t   lib2to3.fixer_utilR   R   R   t   BaseFixR   (    (    (    sB   lib/python2.7/site-packages/libpasteurize/fixes/fix_annotations.pyt   <module>   s   	