a
    ÆZEg  ã                   @   sd   d dl Z d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
mZ d dlmZ G dd„ de
ƒZdS )	é    N)Újoin)ÚList)Úsettings)ÚBaseCommandÚCommandError)Úsignalcommandc                   @   s6   e Zd ZU dZg Zee ed< dd„ Ze	dd„ ƒZ
dS )ÚCommandz<Removes all python bytecode compiled files from the project.Úrequires_system_checksc              	   C   s0   |j dddddddd� |j d	d
dddd� d S )Nz
--optimizez-oz-OÚ
store_trueÚoptimizeFz&Remove optimized python bytecode files)ÚactionÚdestÚdefaultÚhelpz--pathz-pÚstoreÚpathzSpecify path to recurse into)r   r   r   )Úadd_argument)ÚselfÚparser© r   úh/var/www/sistema_ama/venv/lib/python3.9/site-packages/django_extensions/management/commands/clean_pyc.pyÚadd_arguments   s    ýþzCommand.add_argumentsc                 O   s    |  dttdd ƒ¡}|s$ttdd ƒ}|d }|s8tdƒ‚|d rDdpFd}t |¡D ]H\}}}t ||¡D ]0}	t||	ƒ}
|dkrŽ| j	 
d	|
 ¡ t |
¡ qhqRd S )
Nr   ZBASE_DIRÚ	verbosityz=No --path specified and settings.py does not contain BASE_DIRr   z*.py[co]z*.pycé   z%s
)ÚgetÚgetattrr   r   ÚosÚwalkÚfnmatchÚfilterÚ_jÚstdoutÚwriteÚremove)r   ÚargsÚoptionsZproject_rootr   ÚextsÚrootÚdirsÚ	filenamesÚfilenameÚ	full_pathr   r   r   Úhandle   s    
zCommand.handleN)Ú__name__Ú
__module__Ú__qualname__r   r	   r   ÚstrÚ__annotations__r   r   r,   r   r   r   r   r      s
   
r   )r   r   Úos.pathr   r    Útypingr   Zdjango.confr   Zdjango.core.management.baser   r   Z"django_extensions.management.utilsr   r   r   r   r   r   Ú<module>   s   