o
    DDi                     @   s4   d dl Z d dlmZ d dlmZ G dd deZdS )    N)VisitorBasedCodemodCommandc                   @   sN   e Zd ZU dZeed< eeje	 fdde
jde
jde
jfddZd	S )
UnnecessaryFormatStringzBConverts f-strings which perform no formatting to regular strings.DESCRIPTION)parts_original_nodeupdated_nodereturnc           	      C   s   t |jd t jj}d|v sd|v r|S |j| |j }|jdddd| |j }t|}t|}||krUd| dd	| d
| d d| d	 }| 	| |S t 
|S )Nr   z{{z}}f FzAttempted to codemod |z| to |z(| but don't eval to the same! First is |z| and zsecond is |)libcstensure_typer   FormattedStringTextvaluestartendreplaceevalwarnSimpleString)	selfr   r   old_string_innerold_string_literalnew_string_literalold_string_evalednew_string_evaledwarn_message r   j/var/www/Datamplify/venv/lib/python3.10/site-packages/libcst/codemod/commands/unnecessary_format_string.py_check_formatted_string   s4   



z/UnnecessaryFormatString._check_formatted_stringN)__name__
__module____qualname__r   str__annotations__mleaveFormattedStringr   r   BaseExpressionr    r   r   r   r   r      s   
 
r   )r   libcst.matchersmatchersr&   libcst.codemodr   r   r   r   r   r   <module>   s   