o
    DDiN                     @   sH   d dl Z d dlmZmZ d dlmZmZ d dlmZ G dd deZ	dS )    N)	GeneratorType)CodemodMagicArgsCodemodCommand)AddImportsVisitorc                   @   sN   e Zd ZU dZeed< edejddfddZ	de
ee ddf fdd	ZdS )
EnsureImportPresentCommandzjGiven a module and possibly an entity in that module, add an import as long as one does not already exist.DESCRIPTION
arg_parserreturnNc                 C   sF   | j ddddtdd | j ddd	d
td d | j ddddtd d d S )Nz--modulemoduleMODULEzModule that should be imported.T)destmetavarhelptyperequiredz--entityentityENTITYz[Entity that should be imported from module. If left empty, entire  module will be imported.)r   r   r   r   defaultz--aliasaliasALIASzcAlias that will be used for the imported module or entity. If left empty, no alias will be applied.)add_argumentstr)r	    r   f/var/www/Datamplify/venv/lib/python3.10/site-packages/libcst/codemod/commands/ensure_import_present.pyadd_args   s0   
z#EnsureImportPresentCommand.add_argsc                 c   s6    t | j| jjd | jjd | jjd  t V  d S )Nr   r   r   )r   add_needed_importcontextscratch)selfr   r   r   get_transforms4   s   



z)EnsureImportPresentCommand.get_transforms)__name__
__module____qualname__r   r   __annotations__staticmethodargparseArgumentParserr   r   r   r   r    r   r   r   r   r      s   
 
  r   )
r&   typingr   r   libcst.codemodr   r   libcst.codemod.visitorsr   r   r   r   r   r   <module>   s
   