ó
    T=Œj#$  ã                   ó¢   • S SK r S SKrS SKJr  S SK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  S S	KJr  \" \5      r " S
 S\5      rg)é    N)ÚCallable)ÚValues)ÚCommand)ÚERRORÚSUCCESS)ÚCommandErrorÚPipError)Ú
filesystem)Ú	getLogger)Úformat_sizec                   óx  • \ rS rSrSrSrSrSS jrS\\	\
\\\	   /S4   4   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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    Ú`/Users/stevendouglas/BidBrain/.venv/lib/python3.13/site-packages/pip/_internal/commands/cache.pyÚadd_optionsÚCacheCommand.add_options(   sE   € Ø�‰× Ñ ØØØØØ(ØMð 	!ñ 	
ð 	�‰×'Ñ'¨¨4¯=©=Õ9ó    c                 óv   • U R                   U R                  U R                  U R                  U R                  S.$ )N)ÚdirÚinfoÚlistÚremoveÚpurge)Úget_cache_dirÚget_cache_infoÚlist_cache_itemsÚremove_cache_itemsÚpurge_cacher   s    r!   Úhandler_mapÚCacheCommand.handler_map4   s9   € à×%Ñ%Ø×'Ñ'Ø×)Ñ)Ø×-Ñ-Ø×%Ñ%ñ
ð 	
r$   ÚoptionsÚargsc                 ó²  • U R                  5       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)Nz<pip cache commands can not function since cache is disabled.r   zNeed an action (%s) to perform.z, é   )
r0   Ú	cache_dirÚloggerÚerrorr   ÚjoinÚsortedr	   r3   r   )r    r2   r3   r0   r   Úes         r!   ÚrunÚCacheCommand.run=   s³   € Ø×&Ñ&Ó(ˆà× × Ü�L‰LÐWÔXÜˆLö �t˜A‘w kÓ1Ü�L‰LØ1Ø—	‘	œ& Ó-Ó.ôô ˆLà�a‘ˆð	ØÒ ¨a¨b¨Ô2ô
 ˆøô	 ó 	Ü�L‰L˜Ÿ™ ™Ô#Ü�Lûð	ús   ÂB Â
CÂ$'CÃCÃCc                 óf   • U(       a  [        S5      e[        R                  UR                  5        g )NúToo many arguments)r   r7   r'   r6   ©r    r2   r3   s      r!   r+   ÚCacheCommand.get_cache_dirW   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
   r   Údirectory_sizeÚformat_directory_sizeÚtextwrapÚdedentÚformatÚstripr7   r'   )r    r2   r3   rJ   Únum_packagesrG   rH   rK   rI   rM   Úmessages              r!   r,   ÚCacheCommand.get_cache_info]   s  € ÞÜÐ3Ó4Ð4ä˜T×2Ñ2°7Ó;Ó<ˆÜ˜4×,Ñ,¨W°cÓ:Ó;ˆà"Ÿo™o¨g°yÓAÐØ"&§/¡/°'¸6Ó"BÐØ $§¡°¸Ó BÐÜ$×0Ò0Ü×%Ò%Ð&9Ó:Ü×'Ò'Ð(?Ó@ñAó
ˆô '×<Ò<Ð=RÓSÐô �OŠOð ó ÷ ‰VØ$7Ø(?Ø /Ø-Ø&;Ø*Ø"3ð ð ÷ ‰U‹Wð' 	ô, 	�‰�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 )Nr5   r?   r   rC   r   )rN   r   rP   r   Úformat_for_humanÚformat_for_abspath)r    r2   r3   ÚpatternÚfiless        r!   r-   ÚCacheCommand.list_cache_items…   sd   € Üˆt‹9�q‹=ÜÐ3Ó4Ð4æØ˜1‘g‰Gàˆ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:
Ú
)
r7   r'   ÚosÚpathÚbasenamer
   Úformat_file_sizeÚappendr9   r:   )r    r_   ÚresultsÚfilenameÚwheelÚsizes         r!   r\   ÚCacheCommand.format_for_human”   s‹   € ÞÜ�K‰KÐ9Ô:ØàˆÛˆHÜ—G‘G×$Ñ$ XÓ.ˆEÜ×.Ò.¨xÓ8ˆDØ�N‰N˜S   r¨$¨¨qÐ1Ö2ñ ô 	�‰Ð'Ô(Ü�‰�D—I‘Iœf W›oÓ.Õ/r$   c                 ón   • U(       a.  [         R                  SR                  [        U5      5      5        g g )Nrc   )r7   r'   r9   r:   )r    r_   s     r!   r]   ÚCacheCommand.format_for_abspath¡   s#   € ÞÜ�K‰K˜Ÿ	™	¤&¨£-Ó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        SnU HR  nU[        R                  " U5      R                  -  n[        R                  " U5        [        R                  S	U5        MT     [        R                  " U R                  US
5      5      n[        R                  " U R                  US5      5      n[        R                  " U R                  US5      5      n	/ UQUQU	Qn
U
 HP  n UR                  5        H  nUR                  SS9  M     UR!                  5         [        R                  S	U5        MR     U R                  US5      n[        R$                  R'                  U5      (       a+  [        R(                  " U5        [        R                  S5        [        R+                  S[        U5      [-        U5      5        [        R+                  S[        U
5      5        g ! ["         a     NÐf = f)Nr5   r?   zPlease provide a patternr   zNo matching packagesrC   z for pattern "Ú"z
Removed %srE   rD   rF   T)Ú
missing_okzselfcheck.jsonz"Removed legacy selfcheck.json filezFiles removed: %s (%s)zDirectories removed: %s)rN   r   rP   rO   r7   Úwarningrd   ÚstatÚst_sizeÚunlinkÚverboser
   Úsubdirs_without_filesrQ   Úsubdirs_without_wheelsÚiterdirÚrmdirÚFileNotFoundErrorre   Úisfiler)   r'   r   )r    r2   r3   r_   Úno_matching_msgÚbytes_removedrj   Ú	http_dirsÚhttp_v2_dirsÚ
wheel_dirsÚdirsÚsubdirÚfileÚselfcheck_jsons                 r!   r.   ÚCacheCommand.remove_cache_items¥   s  € Üˆt‹9�q‹=ÜÐ3Ó4Ð4æÜÐ9Ó:Ð:à×!Ñ! '°©7Ó3ˆà0ˆØ�‰7�c‹>à×*Ñ*¨7Ó3Ñ3‰Eð  °°Q±¨y¸Ð:Ñ:ˆOæÜ�N‰N˜?Ô+àˆÛˆHØœRŸWšW XÓ.×6Ñ6Ñ6ˆMÜ�IŠI�hÔÜ�N‰N˜<¨Ö2ñ ô
 ×4Ò4°T·_±_ÀWÈfÓ5UÓVˆ	Ü!×7Ò7Ø�O‰O˜G YÓ/ó
ˆô  ×6Ò6Ø�O‰O˜G XÓ.ó
ˆ
ð 8�Ð7˜\Ð7¨JÐ7ˆãˆFðØ"ŸN™NÖ,�DØ—K‘K¨4�KÓ0ñ -à—‘”ô �N‰N˜<¨Ö0ñ ð Ÿ™¨Ð2BÓCˆÜ�7‰7�>‰>˜.×)Ñ)Ü�IŠI�nÔ%Ü�N‰NÐ?Ô@ä�‰Ð,¬c°%«j¼+ÀmÓ:TÔUÜ�‰Ð-¬s°4«yÕ9øô %ó áðús   Å"6IÉ
I)É(I)c                 óL   • U(       a  [        S5      eU R                  US/5      $ )Nr?   rC   )r   r.   r@   s      r!   r/   ÚCacheCommand.purge_cacheÛ   s&   € ÞÜÐ3Ó4Ð4à×&Ñ& w°°Ó6Ð6r$   r„   c                 óV   • [         R                  R                  UR                  U5      $ )N)rd   re   r9   r6   )r    r2   r„   s      r!   rQ   ÚCacheCommand._cache_dirá   s   € Ü�w‰w�|‰|˜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      -   $ )NrE   rD   rC   ©rQ   r
   Ú
find_files)r    r2   Úold_http_dirÚnew_http_dirs       r!   rO   Ú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      $ )NrF   Ú-z*.whlz-*.whlr�   )r    r2   r^   Ú	wheel_dirs       r!   rP   ÚCacheCommand._find_wheelsë   s7   € Ø—O‘O G¨XÓ6ˆ	ð$ ¨¨w«™W¸HÑEˆä×$Ò$ YÓ8Ð8r$   © )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úignore_require_venvÚusager"   ÚdictÚstrr   r   r(   r0   Úintr<   r+   r,   r-   r\   r]   r.   r/   rQ   rO   rP   Ú__static_attributes__r–   r$   r!   r   r      sw  † ñð Ðð€Eô
:ð
˜T # x°¸¸c¹Ð0CÀTÐ0IÑ'JÐ"JÑKô 
ð˜6ð ¨¨c©ð °sô ð4' Vð '°4¸±9ð 'Àô 'ð& fð &°D¸±Ið &À$ô &ðP+¨ð +°d¸3±ið +ÀDô +ð0 d¨3¡ið 0°Dô 0ð2¨¨S©	ð 2°dô 2ð4:¨&ð 4:¸¸S¹	ð 4:Àdô 4:ðl7 6ð 7°°c±ð 7¸tô 7ð7 &ð 7°#ð 7¸#ô 7ð
¨ð 
°4¸±9ô 
ð9 Fð 9°Sð 9¸TÀ#¹Y÷ 9r$   r   )rd   rT   Úcollections.abcr   Úoptparser   Úpip._internal.cli.base_commandr   Úpip._internal.cli.status_codesr   r   Úpip._internal.exceptionsr   r	   Úpip._internal.utilsr
   Úpip._internal.utils.loggingr   Úpip._internal.utils.miscr   r—   r7   r   r–   r$   r!   Ú<module>rª      s;   ðÛ 	Û Ý $Ý å 2ß 9ß ;Ý *Ý 1Ý 0á	�8Ó	€ôp9�7õ p9r$   