B
    	Q[-                 @   sJ   d Z ddlmZ ddlmZ ddlmZ dZdd ZG dd	 d	ej	Z
d
S )z&
Fixer to remove function annotations
    )
fixer_base)token)symsz)Removing function annotations completely.c             C   s
   | j d S )Nr   )children)node r   Blib/python3.7/site-packages/libpasteurize/fixes/fix_annotations.pyparam_without_annotations   s    r	   c               @   s$   e Zd ZdZdd ZdZdd ZdS )FixAnnotationsFc             C   s   | j sd| _ | j||d d S )NT)reason)warnedZwarning)selfr   r   r   r   r   	warn_once   s    zFixAnnotations.warn_oncezm
              funcdef< 'def' any parameters< '(' [params=any] ')' > ['->' ret=any] ':' any* >
              c             C   s   | d}| d}|dk	rR|jjtjks2td| j|td |j  |  |dkr^dS |jt	j
krx`|jD ],}|jt	jkrr| j|td |t| qrW n(|jt	jkr| j|td |t| dS )zK
        This just strips annotations from the funcdef completely.
        paramsretNzInvalid return annotation)r   )getZprev_siblingtyper   RARROWAssertionErrorr   warning_textremover   Ztypedargslistr   Ztnamereplacer	   )r   r   Zresultsr   r   Zparamr   r   r   	transform   s"    


 zFixAnnotations.transformN)__name__
__module____qualname__r   r   ZPATTERNr   r   r   r   r   r
      s   r
   N)__doc__Zlib2to3r   Zlib2to3.pgen2r   Zlib2to3.fixer_utilr   r   r	   ZBaseFixr
   r   r   r   r   <module>   s   