????

Your IP : 3.135.209.235


Current Path : /usr/lib/python3.6/site-packages/libpasteurize/fixes/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/libpasteurize/fixes/__pycache__/fix_annotations.cpython-36.pyc

3

�c-�@sJdZddlmZddlmZddlmZdZdd�ZGdd	�d	ej	�Z
d
S)z&
Fixer to remove function annotations
�)�
fixer_base)�token)�symsz)Removing function annotations completely.cCs
|jdS)Nr)�children)�node�r�%/usr/lib/python3.6/fix_annotations.py�param_without_annotationssr	c@s$eZdZdZdd�ZdZdd�ZdS)�FixAnnotationsFcCs|jsd|_|j||d�dS)NT)�reason)�warnedZwarning)�selfrrrrr�	warn_onceszFixAnnotations.warn_oncezm
              funcdef< 'def' any parameters< '(' [params=any] ')' > ['->' ret=any] ':' any* >
              cCs�|jd�}|jd�}|dk	rR|jjtjks2td��|j|td�|jj�|j�|dkr^dS|jt	j
kr�x`|jD],}|jt	jkrr|j|td�|j
t|��qrWn(|jt	jkr�|j|td�|j
t|��dS)zK
        This just strips annotations from the funcdef completely.
        �params�retNzInvalid return annotation)r)�getZprev_sibling�typer�RARROW�AssertionErrorr�warning_text�removerZ
typedargslistrZtname�replacer	)r
r�resultsrrZparamrrr�	transforms"


zFixAnnotations.transformN)�__name__�
__module__�__qualname__rrZPATTERNrrrrrr
sr
N)�__doc__Zlib2to3rZ
lib2to3.pgen2rZlib2to3.fixer_utilrrr	ZBaseFixr
rrrr�<module>s