← Back
Editing: fix_annotations.cpython-38.pyc
U ,�]- � @ sJ d Z ddlmZ ddlmZ ddlmZ dZdd� ZG dd � d ej �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 �E/usr/lib/python3/dist-packages/libpasteurize/fixes/fix_annotations.py�param_without_annotations s r c @ s$ e Zd ZdZdd� ZdZdd� ZdS )�FixAnnotationsFc C s | j sd| _ | j||d� d S )NT��reason)�warnedZwarning)�selfr r r r r � warn_once s zFixAnnotations.warn_oncezm funcdef< 'def' any parameters< '(' [params=any] ')' > ['->' ret=any] ':' any* > c C s� |� d�}|� d�}|dk rR|jjtjks2td��| j|td� |j�� |�� |dkr^dS |jt j kr�|jD ],}|jt jkrp| j|td� |� t|�� qpn(|jt jkr�| j|td� |� t|�� dS )zK This just strips annotations from the funcdef completely. �params�retNzInvalid return annotationr )�getZprev_sibling�typer �RARROW�AssertionErrorr �warning_text�remover Z typedargslistr Ztname�replacer )r r Zresultsr r Zparamr r r � transform s"