o
    /h                     @   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   j/var/www/html/env_mimamsha/lib/python3.10/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 }|std|d r"dp#d}t|D ]$\}}}t||D ]}	t||	}
|dkrG| j	
d	|
  t|
 q4q)d S )
Nr   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options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   django.confr   django.core.management.baser   r   "django_extensions.management.utilsr   r   r   r   r   r   <module>   s   