o
    DDi                     @   sz   d dl Z d dlmZ d dlmZ d dlZd dlmZmZ d dl	m
Z
 G dd deeZG dd	 d	eZG d
d deZdS )    N)ABC)Pattern)CodemodContextVisitorBasedCodemodCommand)insert_header_commentsc                       s`   e Zd ZU eed< deddf fddZdejddfdd	Z	d
ej
dej
dej
fddZ  ZS )AddPyreDirectiveCommandPYRE_TAGcontextreturnNc                    s,   t  | td| j d| _d| _d S )Nz
^#\s+pyre-z\s*$T)super__init__recompiler   _regex_pattern	needs_add)selfr	   	__class__ c/var/www/Datamplify/venv/lib/python3.10/site-packages/libcst/codemod/commands/add_pyre_directive.pyr      s
   
z AddPyreDirectiveCommand.__init__nodec                 C   s   | j |jrd| _d S d S )NF)r   searchvaluer   )r   r   r   r   r   visit_Comment   s   
z%AddPyreDirectiveCommand.visit_Commentoriginal_nodeupdated_nodec                 C   s   | j s|S t|d| j gS )Nz# pyre-)r   r   r   )r   r   r   r   r   r   leave_Module   s   z$AddPyreDirectiveCommand.leave_Module)__name__
__module____qualname__str__annotations__r   r   libcstCommentr   Moduler   __classcell__r   r   r   r   r      s   
 r   c                   @   *   e Zd ZU dZdZeed< dZeed< dS )AddPyreStrictCommandzc
    Given a source file, we'll add the strict tag if the file doesn't already
    contain it.
    strictr   z&Add the 'pyre-strict' tag to a module.DESCRIPTIONNr   r   r   __doc__r   r    r!   r)   r   r   r   r   r'   '      
 r'   c                   @   r&   )AddPyreUnsafeCommandzc
    Given a source file, we'll add the unsafe tag if the file doesn't already
    contain it.
    unsafer   z&Add the 'pyre-unsafe' tag to a module.r)   Nr*   r   r   r   r   r-   2   r,   r-   )r   abcr   typingr   r"   libcst.codemodr   r   libcst.helpersr   r   r'   r-   r   r   r   r   <module>   s   