
    yIf~                    l    d Z ddlmZ ddlZddlmZ ddlmZmZm	Z	 erddl
mZ  G d d          Zd	ZdS )
z
Declare and handle the tox env info file (a file at the root of every tox environment that contains information about
the status of the tox environment - python version of the environment, installed packages, etc.).
    )annotationsN)contextmanager)TYPE_CHECKINGAnyIterator)Pathc                  N    e Zd ZdZddZddZe	 ddd            ZddZddZ	d	S )Infoz*Stores metadata about the tox environment.pathr   returnNonec                    |dz  | _         	 t          j        | j                                                   }n# t          t
          f$ r i }Y nw xY w|| _        d S )Nz.tox-info.json)_pathjsonloads	read_text
ValueErrorOSError_content)selfr   values      D/var/www/piapp/venv/lib/python3.11/site-packages/tox/tox_env/info.py__init__zInfo.__init__   sg    ,,
	Jtz335566EEG$ 	 	 	EEE	s   +8 AAstrc                0    | j         j         d| j         dS )Nz(path=))	__class____name__r   r   s    r   __repr__zInfo.__repr__   s     .)>>>>>>    Nr   r   sectionsub_section
str | None!Iterator[tuple[bool, Any | None]]c              #  H  K   | j                             |          }|||                    |          }||k    rd|fV  dS d|fV  ||| j         |<   n7| j                             |          ||i| j         |<   n|| j         |         |<   |                                  dS )aZ  
        Compare new information with the existing one and update if differs.

        :param value: the value stored
        :param section: the primary key of the information
        :param sub_section: the secondary key of the information
        :return: a tuple where the first value is if it differs and the second is the old value
        NTF)r   get_write)r   r   r"   r#   olds        r   comparezInfo.compare   s       m(("s''+&&C%<<)OOOOO*").g&&""7++3*5u)=g&&6;g&{3KKMMMMMr!   c                    i | _         d S N)r   r   s    r   resetz
Info.reset>   s    r!   c                    | j         j                            dd           | j                             t	          j        | j        d                     d S )NT)parentsexist_ok   )indent)r   parentmkdir
write_textr   dumpsr   r   s    r   r(   zInfo._writeA   sM    
t<<<
djqAAABBBBBr!   )r   r   r   r   )r   r   r,   )r   r   r"   r   r#   r$   r   r%   )r   r   )
r   
__module____qualname____doc__r   r    r   r*   r-   r(    r!   r   r
   r
      s        44   ? ? ? ? 
 #'	    ^>   C C C C C Cr!   r
   )r
   )r9   
__future__r   r   
contextlibr   typingr   r   r   pathlibr   r
   __all__r:   r!   r   <module>r@      s    
 # " " " " "  % % % % % % / / / / / / / / / / 3C 3C 3C 3C 3C 3C 3C 3Cl r!   