Your IP : 216.73.216.172


Current Path : /lib/python3/dist-packages/libpasteurize/fixes/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/libpasteurize/fixes/__pycache__/fix_annotations.cpython-38.pyc

U

,�]-�@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�E/usr/lib/python3/dist-packages/libpasteurize/fixes/fix_annotations.py�param_without_annotationssr	c@s$eZdZdZdd�ZdZdd�ZdS)�FixAnnotationsFcCs|jsd|_|j||d�dS)NT��reason)�warnedZwarning)�selfrrrrr�	warn_onceszFixAnnotations.warn_oncezm
              funcdef< 'def' any parameters< '(' [params=any] ')' > ['->' ret=any] ':' any* >
              cCs�|�d�}|�d�}|dk	rR|jjtjks2td��|j|td�|j��|��|dkr^dS|jt	j
kr�|jD],}|jt	jkrp|j|td�|�
t|��qpn(|jt	jkr�|j|td�|�
t|��dS)zK
        This just strips annotations from the funcdef completely.
        �params�retNzInvalid return annotationr)�getZprev_sibling�typer�RARROW�AssertionErrorr�warning_text�removerZ
typedargslistrZtname�replacer	)rrZresultsrrZparamrrr�	transforms"


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