U
    ËZj-  ã                   @   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   úf/var/www/html/TRUCKING_PROJECT/venv/lib/python3.8/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)ÚwarnedÚ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r |jD ],}|jt	jkrp| j|td� | t|ƒ¡ qpn(|jt	jkrÈ| j|td� | t|ƒ¡ dS )zK
        This just strips annotations from the funcdef completely.
        ÚparamsÚretNzInvalid return annotationr   )ÚgetZprev_siblingÚtyper   ÚRARROWÚAssertionErrorr   Úwarning_textÚremover   Ztypedargslistr   ZtnameÚreplacer	   )r   r   Úresultsr   r   Ú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   