o
    Vhi
                     @  s   d dl m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 d dl	m
Z
 d dlmZ d d	lmZ d d
lmZ erHd dlmZ d dlmZ G dd deZdS )    )annotationsN)TYPE_CHECKING)ClassVar)argument)option)canonicalize_name)Config)Command)	FileCache)Argument)Optionc                   @  sL   e Zd ZU dZdZedddgZded< edd	dgZ	d
ed< dddZ
dS )CacheClearCommandzcache clearzClears a Poetry cache by name.cachezThe name of the cache to clear.)descriptionzClassVar[list[Argument]]	argumentsallzClear all entries in the cache.zClassVar[list[Option]]optionsreturnintc           
      C  s  |  d}|d}|d }t }|j| }z||j W n ty-   t| dw t|}t|dkry| 	dsGt
d|d  d| sW| d	|d   dS td
d tt|D }| d| dd}|ssdS |  dS t|dkrt
dt|dkrt|d }|d }	|| d|	 s| d	| d|	  dS | d| d|	 d}|sdS || d|	  dS td)Nr   :r   z  is not a valid repository cache   r   z.Add the --all option if you want to clear all z cacheszNo cache entries for c                 s  s    | ]
\}}}t |V  qd S )N)len).0_path_dirsfiles r   w/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/poetry/console/commands/cache/clear.py	<genexpr><   s    
z+CacheClearCommand.handle.<locals>.<genexpr>z<question>Delete z entries?</>T   zVOnly specifying the package name is not yet supported. Add a specific version to clear   zDelete cache entry zInvalid cache key)r   splitr   createrepository_cache_directoryrelative_to
ValueErrorr
   r   r   RuntimeErrorexistslinesumoswalkstrconfirmflushr   hasforget)
selfr   partsrootconfig	cache_direntries_countdeletepackageversionr   r   r   handle!   sV   



zCacheClearCommand.handleN)r   r   )__name__
__module____qualname__namer   r   r   __annotations__r   r   r:   r   r   r   r   r      s   
 

r   )
__future__r   r*   typingr   r   cleo.helpersr   r   packaging.utilsr   poetry.config.configr   poetry.console.commands.commandr	   poetry.utils.cacher
   cleo.io.inputs.argumentr   cleo.io.inputs.optionr   r   r   r   r   r   <module>   s    