
    yIf                    v   d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	m
Z
mZ d dlmZ d dlmZ ddlmZ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          Z G d d          Ze
ee	e         f         Z ed          Z ed          Z  G d dee                   Z!edd            Z" e            Z#dS )    )annotations)abstractmethod)ArgumentTypeError)TYPE_CHECKINGAnyListMappingTypeVar)impl)
PythonDeps   )ConvertFactory)
StrConvert)	ToxParser)Config)Sectionc                  :    e Zd ZdZddZddZddZddZddZdS )Overridez#An override for config definitions.valuestrreturnNonec                   |                     d          \  }}| _        |sd| d}t          |          d| _        |                    d          r|d d         }d| _        |                    d          \  | _        }| _        d S )	N=z	override z has no = sign in itF+T.)	partitionr   r   appendendswith
rpartition	namespacekey)selfr   r$   equalmsg_s         I/var/www/piapp/venv/lib/python3.11/site-packages/tox/config/loader/api.py__init__zOverride.__init__   s    !&!5!5UDJ 	)9e999C#C(((<< 	crc(CDK&)nnS&9&9#4888    c                &    | j         j         d|  dS )Nz('z'))	__class____name__r%   s    r)   __repr__zOverride.__repr__$   s    .)55T5555r+   c                H    | j          | j         rdnd | j         d| j         S )Nr    r   )r#   r$   r   r/   s    r)   __str__zOverride.__str__'   s1    .X"?##RXXXDJXXXr+   otherobjectboolc                    t          |           t          |          k    rdS | j        | j        | j        f|j        |j        |j        fk    S )NF)typer#   r$   r   r%   r4   s     r)   __eq__zOverride.__eq__*   sL    ::e$$5$*5OIK:
 
 	
r+   c                    | |k     S N r9   s     r)   __ne__zOverride.__ne__3   s    EM""r+   N)r   r   r   r   r   r   )r4   r5   r   r6   )	r.   
__module____qualname____doc__r*   r0   r3   r:   r>   r=   r+   r)   r   r      s        --: : : :6 6 6 6Y Y Y Y
 
 
 
# # # # # #r+   r   c                  "    e Zd ZdZdd	Zdd
ZdS )ConfigLoadArgsz2Arguments that help loading a configuration value.chainlist[str] | Nonename
str | Noneenv_namer   r   c                4    |pg | _         || _        || _        dS )z
        :param chain: the configuration chain (useful to detect circular references)
        :param name: the name of the configuration
        :param env_name: the tox environment this load is for
        N)rE   rG   rI   )r%   rE   rG   rI   s       r)   r*   zConfigLoadArgs.__init__:   s!     !&
	 r+   c                f    t          | j                                        | j        | j                  S )z$:return: create a copy of the object)rD   rE   copyrG   rI   r/   s    r)   rL   zConfigLoadArgs.copyD   s$    djoo//DMJJJr+   N)rE   rF   rG   rH   rI   rH   r   r   )r   rD   )r.   r@   rA   rB   r*   rL   r=   r+   r)   rD   rD   7   sH        <<! ! ! !K K K K K Kr+   rD   TVc                      e Zd ZdZd#dZed$d	            Zed%d            Zed&d            Z	d'dZ
d(dZd)dZd*d!Zd"S )+Loaderz3Loader loads a configuration value and converts it.sectionr   	overrideslist[Override]r   r   c                    || _         i | _        |D ]5}| j                            |j        g                               |           6d | _        d S r<   )_sectionrR   
setdefaultr$   r    parent)r%   rQ   rR   overrides       r)   r*   zLoader.__init__R   sW    46! 	I 	IHN%%hlB77>>xHHHH*.r+   c                    | j         S r<   )rU   r/   s    r)   rQ   zLoader.sectionY   s
    }r+   r$   r   confConfig | NonerI   rH   rM   c                    t           )z
        Load the raw object from the config store.

        :param key: the key under what we want the configuration
        :param env_name: load for env name
        :param conf: the global config object
        NotImplementedError)r%   r$   rZ   rI   s       r)   load_rawzLoader.load_raw]   s
     "!r+   set[str]c                    t           )z<A list of configuration keys found within the configuration.r]   r/   s    r)   
found_keyszLoader.found_keysh   s
     "!r+   c                ,    t          |           j         S r<   )r8   r.   r/   s    r)   r0   zLoader.__repr__m   s    t**%''r+   itemr6   c                .    ||                                  v S r<   )rb   )r%   rd   s     r)   __contains__zLoader.__contains__p   s    t((((r+   of_typetype[V]factory
Factory[V]argsrD   rN   c                   ddl m} | j                            |g           }	 |                     |||j                  }|                     ||||||          }	n# t          $ r d}	|s Y nw xY w|D ]}
t          	                    |
j
        ||          }|
j        r|	t          |	t                    rt          |t                    r|	|z  }	]t          |	t                    r+t          |t                    r|	                    |           t          |	|          r(t          ||          r|	                    |d           t          |	t                     rt          |t                     r|	|z  }	d}t#          |          |}	|	S )a  
        Load a value (raw and then convert).

        :param key: the key under it lives
        :param of_type: the type to convert to
        :param factory: factory method to build the object
        :param conf: the configuration object of this tox session (needed to manifest the value)
        :param args: the config load arguments
        :return: the converted type
        r   )SetEnvNT)rX   z&Only able to append to lists and dicts)tox.config.set_envrm   rR   getr_   rI   buildKeyError_STR_CONVERTtor   r    
isinstancelistdictupdater   
ValueError)r%   r$   rg   ri   rZ   rk   rm   rR   raw	convertedrX   converted_overrider'   s                r)   loadzLoader.loads   s   $ 	.-----N&&sB//		K--T4=99C 

3$TJJII  	 	 	I  	 " 	/ 	/H!-'!R!R /9#8i.. 
*:>PRV3W3W 
*!33II	400 *Z@RTX5Y5Y *$$%78888	622 *zBTV\7]7] *$$%7$$GGGG	:66 *:FXZd;e;e *!33IIBC$S//).		s   A A,+A,ry   c                0    |                      |||          S )aW  
        Materialize the raw configuration value from the loader.

        :param future: a future which when called will provide the converted config value
        :param key: the config key
        :param of_type: the config type
        :param conf: the global config
        :param raw: the raw value
        :param args: env args
        )rs   )r%   r$   rg   ri   rZ   ry   rk   s          r)   rp   zLoader.build   s    & wwsGW---r+   N)rQ   r   rR   rS   r   r   )r   r   )r$   r   rZ   r[   rI   rH   r   rM   )r   r`   r?   )rd   r   r   r6   )r$   r   rg   rh   ri   rj   rZ   r[   rk   rD   r   rN   )r$   r   rg   rh   ri   rj   rZ   r[   ry   rM   rk   rD   r   rN   )r.   r@   rA   rB   r*   propertyrQ   r   r_   rb   r0   rf   r|   rp   r=   r+   r)   rP   rP   O   s        ==/ / / /    X " " " ^" " " " ^"( ( ( () ) ) )0 0 0 0d. . . . . .r+   rP   parserr   r   r   c                T    d}|                      |ddt          g dd| d           d S )Nz-xz
--overrider    rX   z!configuration override(s), e.g., z! testenv:pypy3.ignore_errors=True)actionr8   defaultdesthelp)add_argumentr   )r   override_short_options     r)   tox_add_optionr      sP     
i1Fiii      r+   N)r   r   r   r   )$
__future__r   abcr   argparser   typingr   r   r   r	   r
   
tox.pluginr   tox.tox_env.python.pip.req_filer   convertr   r   str_convertr   tox.config.cli.parserr   tox.config.mainr   rQ   r   r   rD   r   OverrideMaprM   rN   rP   r   rr   r=   r+   r)   <module>r      s   " " " " " "       & & & & & & = = = = = = = = = = = = = =       6 6 6 6 6 6 % % % % % % % % # # # # # # !//////&&&&&&       #  #  #  #  #  #  #  #FK K K K K K K K$ c4>)*GCLLGCLLi. i. i. i. i.WQZ i. i. i.X 
 
 
 
 z||r+   