
    vKg                         S SK r S SKrS SKJr  S SKJrJr  S SKJr  S SK	J
r
Jr  S SKJrJr  S SKJr  S SKJr  \" \5      r " S	 S
\5      rg)    N)Values)AnyList)Command)ERRORSUCCESS)CommandErrorPipError)
filesystem)	getLoggerc                   L   \ rS rSrSrSrSrSS jrS\S	\	\
   S\4S
 jrS\S	\	\   SS4S jrS\S	\	\   SS4S jrS\S	\	\   SS4S jrS\	\
   SS4S jrS\	\
   SS4S jrS\S	\	\   SS4S jrS\S	\	\   SS4S jrS\S\
S\
4S jrS\S\	\
   4S jrS\S\
S\	\
   4S jrSrg)CacheCommand   aS  
Inspect and manage pip's wheel cache.

Subcommands:

- dir: Show the cache directory.
- info: Show information about the cache.
- list: List filenames of packages stored in the cache.
- remove: Remove one or more package from the cache.
- purge: Remove all items from the cache.

``<pattern>`` can be a glob expression or a package name.
Tz
        %prog dir
        %prog info
        %prog list [<pattern>] [--format=[human, abspath]]
        %prog remove <pattern>
        %prog purge
    returnNc           	          U R                   R                  SSSSSSS9  U R                  R                  SU R                   5        g )	Nz--formatstorelist_formathuman)r   abspathz:Select the output format among: human (default) or abspath)actiondestdefaultchoiceshelpr   )cmd_opts
add_optionparserinsert_option_group)selfs    \/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/pip/_internal/commands/cache.pyadd_optionsCacheCommand.add_options'   sE      (M 	! 	
 	''4==9    optionsargsc                    U R                   U R                  U R                  U R                  U R                  S.nUR
                  (       d  [        R                  S5        [        $ U(       a	  US   U;  a4  [        R                  SSR                  [        U5      5      5        [        $ US   n X4   " XSS  5        [        $ ! [         a2  n[        R                  UR                  S   5        [        s S nA$ S nAff = f)N)dirinfolistremovepurgez<pip cache commands can not function since cache is disabled.r   zNeed an action (%s) to perform.z,    )get_cache_dirget_cache_infolist_cache_itemsremove_cache_itemspurge_cache	cache_dirloggererrorr   joinsortedr
   r%   r   )r   r$   r%   handlersr   es         r    runCacheCommand.run3   s    %%''))--%%
   LLWXL tAwh.LL1		&*+ La	W12h/
 	  	LL#L	s   1C 
D 'C;5D ;D c                 f    U(       a  [        S5      e[        R                  UR                  5        g )NToo many arguments)r	   r3   r(   r2   r   r$   r%   s      r    r-   CacheCommand.get_cache_dirS   s#    344G%%&r#   c           
      D   U(       a  [        S5      e[        U R                  U5      5      n[        U R                  US5      5      nU R	                  US5      nU R	                  US5      nU R	                  US5      n[
        R                  " [
        R                  " U5      [
        R                  " U5      -   5      n[
        R                  " U5      n	[        R                  " S5      R                  UUUUUUU	S9R                  5       n
[        R                  U
5        g )Nr<   *http-v2httpwheelsa  
                    Package index page cache location (pip v23.3+): {http_cache_location}
                    Package index page cache location (older pips): {old_http_cache_location}
                    Package index page cache size: {http_cache_size}
                    Number of HTTP files: {num_http_files}
                    Locally built wheels location: {wheels_cache_location}
                    Locally built wheels size: {wheels_cache_size}
                    Number of locally built wheels: {package_count}
                )http_cache_locationold_http_cache_locationhttp_cache_sizenum_http_fileswheels_cache_locationpackage_countwheels_cache_size)r	   len_find_http_files_find_wheels
_cache_dirr   format_sizedirectory_sizeformat_directory_sizetextwrapdedentformatstripr3   r(   )r   r$   r%   rG   num_packagesrD   rE   rH   rF   rJ   messages              r    r.   CacheCommand.get_cache_infoY   s   344T227;<4,,Wc:;"oogyA"&//'6"B $ B$00%%&9:''(?@A
 '<<=RS OO
 V$7(? /-&;*"3   UW+ 	0 	Gr#   c                     [        U5      S:  a  [        S5      eU(       a  US   nOSnU R                  X5      nUR                  S:X  a  U R	                  U5        g U R                  U5        g )Nr,   r<   r   r@   r   )rK   r	   rM   r   format_for_humanformat_for_abspath)r   r$   r%   patternfiless        r    r/   CacheCommand.list_cache_items   sd    t9q=3441gGG!!'3')!!%(##E*r#   r]   c                 r   U(       d  [         R                  S5        g / nU HP  n[        R                  R	                  U5      n[
        R                  " U5      nUR                  SU SU S35        MR     [         R                  S5        [         R                  SR                  [        U5      5      5        g )NzNo locally built wheels cached.z - z ()zCache contents:

)
r3   r(   ospathbasenamer   format_file_sizeappendr5   r6   )r   r]   resultsfilenamewheelsizes         r    rZ   CacheCommand.format_for_human   s    KK9:HGG$$X.E..x8DNNSr$q12  	'(DIIfWo./r#   c                 n    U(       a.  [         R                  SR                  [        U5      5      5        g g )Nra   )r3   r(   r5   r6   )r   r]   s     r    r[   CacheCommand.format_for_abspath   s#    KK		&-01 r#   c                    [        U5      S:  a  [        S5      eU(       d  [        S5      eU R                  XS   5      nSnUS   S:X  a  X0R                  U5      -  nOUSUS    S3-  nU(       d  [        R                  U5        U H/  n[        R                  " U5        [        R                  S	U5        M1     [        R                  S
[        U5      5        g )Nr,   r<   zPlease provide a patternr   zNo matching packagesr@   z for pattern ""z
Removed %szFiles removed: %s)
rK   r	   rM   rL   r3   warningrb   unlinkverboser(   )r   r$   r%   r]   no_matching_msgrh   s         r    r0   CacheCommand.remove_cache_items   s    t9q=3449::!!'7307c>**733E Qy::ONN?+HIIhNN<2  	'U4r#   c                 L    U(       a  [        S5      eU R                  US/5      $ )Nr<   r@   )r	   r0   r=   s      r    r1   CacheCommand.purge_cache   s&    344&&w66r#   subdirc                 V    [         R                  R                  UR                  U5      $ )N)rb   rc   r5   r2   )r   r$   rw   s      r    rN   CacheCommand._cache_dir   s    ww||G--v66r#   c                     U R                  US5      nU R                  US5      n[        R                  " US5      [        R                  " US5      -   $ )NrB   rA   r@   rN   r   
find_files)r   r$   old_http_dirnew_http_dirs       r    rL   CacheCommand._find_http_files   sN    w7w	:$$\37*:O:O#;
 
 	
r#   r\   c                 l    U R                  US5      nUSU;   a  SOS-   n[        R                  " X25      $ )NrC   -z*.whlz-*.whlr{   )r   r$   r\   	wheel_dirs       r    rM   CacheCommand._find_wheels   s7    OOGX6	$ wWHE$$Y88r#    )r   N)__name__
__module____qualname____firstlineno____doc__ignore_require_venvusager!   r   r   strintr9   r   r-   r.   r/   rZ   r[   r0   r1   rN   rL   rM   __static_attributes__r   r#   r    r   r      sN    E
:6 c s @'V '49 ' '(f (DI ($ (T+ +d3i +D +0d3i 0D 02S	 2d 25& 5S	 5d 5276 7c 7t 77& 7# 7# 7
 
49 
9F 9S 9T#Y 9r#   r   )rb   rR   optparser   typingr   r   pip._internal.cli.base_commandr   pip._internal.cli.status_codesr   r   pip._internal.exceptionsr	   r
   pip._internal.utilsr   pip._internal.utils.loggingr   r   r3   r   r   r#   r    <module>r      s8    	    2 9 ; * 1	8	R97 R9r#   