
    3iv                        d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZ e	rddlmZ ddlmZ dd	lmZ  G d
 de      Z G d de      ZddgZy)z&Application data stored by virtualenv.    )annotations)ABCabstractmethod)contextmanager)TYPE_CHECKING)	IS_ZIPAPP)	Generator)Path)Anyc                      e Zd ZdZedd       Zedd       Zedd       Zedd       Ze	dd       Z
edd       Ze	dd       Ze	dd	       Zedd
       Zeddd       Zeedd              Zeedd              Zy)AppDataz:Abstract storage interface for the virtualenv application.c                     y)zCalled before virtualenv exits.N selfs    K/var/www/opsc/venv/lib/python3.12/site-packages/virtualenv/app_data/base.pyclosezAppData.close           c                     y)z2Called when the user passes in the reset app data.Nr   r   s    r   resetzAppData.reset   r   r   c                    t         )zReturn a content store for cached interpreter information at the given path.

        :param path: the interpreter executable path

        :returns: a content store for the cached data

        NotImplementedErrorr   paths     r   py_infozAppData.py_info   s
     "!r   c                    t         )z)Clear all cached interpreter information.r   r   s    r   py_info_clearzAppData.py_info_clear'   
     "!r   c                    t         )zA``True`` if this app data store supports updating cached content.r   r   s    r   
can_updatezAppData.can_update,   r    r   c                    t         )a   Return a content store for the embed update log of a distribution.

        :param distribution: the package name (e.g. ``pip``)
        :param for_py_version: the target Python version string

        :returns: a content store for the update log

        r   )r   distributionfor_py_versions      r   embed_update_logzAppData.embed_update_log1   
     "!r   c                    t         )z1The root directory of the application data store.r   r   s    r   housezAppData.house=   r    r   c                    t         )zN``True`` if this app data store is transient and does not persist across runs.r   r   s    r   	transientzAppData.transientB   r    r   c                    t         )zReturn the path to a cached wheel image.

        :param for_py_version: the target Python version string
        :param name: the package name

        :returns: the path to the cached wheel

        r   )r   r%   names      r   wheel_imagezAppData.wheel_imageG   r'   r   Nc              #  x   K   t         r | j                  ||      5 }| ddd       y| y# 1 sw Y   yxY ww)zEnsure a path is available on disk, extracting from zipapp if needed.

        :param path: the path to ensure is available
        :param to_folder: optional target directory for extraction

        :returns: yields the usable path on disk

        N)r   extract)r   r   	to_folderresults       r   ensure_extractedzAppData.ensure_extractedS   s@      dI. &  J s   :.:7:c                    t         )zExtract a path from the zipapp to a location on disk.

        :param path: the path to extract
        :param to_folder: optional target directory

        :returns: yields the extracted path

        r   )r   r   r1   s      r   r0   zAppData.extractc   s
     "!r   c                    t         )z]Acquire an exclusive lock on the given path.

        :param path: the path to lock

        r   r   s     r   lockedzAppData.lockedp   s
     "!r   returnNone)r   r
   r8   ContentStorer8   bool)r$   strr%   r=   r8   r:   )r8   r
   )r%   r=   r-   r=   r8   r
   )N)r   r
   r1   zPath | Noner8   zGenerator[Path])r   r
   r8   Generator[None])__name__
__module____qualname____doc__r   r   r   r   r   propertyr"   r&   r)   r+   r.   r   r3   r0   r6   r   r   r   r   r      s   D. . A A " " " " " " 	" 	" " " " " 	" 	"   	"  	" "  "r   r   c                  t    e Zd ZdZedd       Zed	d       Zed
d       Zedd       Zee	dd              Z
y)r:   z/A store for reading and writing cached content.c                    t         )z[Check if the stored content exists.

        :returns: ``True`` if content exists

        r   r   s    r   existszContentStore.exists~   
     "!r   c                    t         )zHRead the stored content.

        :returns: the stored content

        r   r   s    r   readzContentStore.read   rG   r   c                    t         )zSWrite content to the store.

        :param content: the content to write

        r   )r   contents     r   writezContentStore.write   rG   r   c                    t         )zRemove the stored content.r   r   s    r   removezContentStore.remove   r    r   c                     y)z0Acquire an exclusive lock on this content store.Nr   r   s    r   r6   zContentStore.locked   r   r   Nr;   )r8   r   )rK   r   r8   r9   r7   )r8   r>   )r?   r@   rA   rB   r   rF   rI   rL   rN   r   r6   r   r   r   r:   r:   {   so    9" " " " " " " " ?  ?r   r:   N)rB   
__future__r   abcr   r   
contextlibr   typingr   virtualenv.infor   collections.abcr	   pathlibr
   r   r   r:   __all__r   r   r   <module>rX      sN    , " # %   %)g"c g"T&?3 &?T r   