
    yIf                       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
mZmZmZmZmZmZmZmZmZmZmZ d dlmZmZ  e            Z ed          Z ed          Zeeegef                  Z G d	 d
eee                   Zd
dgZdS )    )annotations)ABCabstractmethod)OrderedDict)Path)AnyCallableDictGenericIteratorListLiteralOptionalSetTypeVarUnioncast)CommandEnvListTVc                  b   e Zd ZdZdd
ZddZeed d                        Zeed!d                        Z	eed"d                        Z
eed"d                        Zeed#d                        Zeed$d                        Zeed%d                        Zeed&d                        ZdS )'Convertz>A class that converts a raw type to a given tox (python) type.rawr   of_typetype[V]factory
Factory[V]returnr   c                R   t          |dd          }|dv r|                     |||          S t          |t                    r|                     |          S t          |t
                    r|                     |          S t          |t                    r|                     |          S t          |t                    r| 
                    |          S t          |t                    r|                     |          S t          ||          r|S |r ||          S  ||          S )z
        Convert given raw type to python type.

        :param raw: the raw type
        :param of_type: python type
        :param factory: factory method to build the object
        :return: the converted type
        
__module__N>   typingtyping_extensions)getattr
_to_typing
issubclassr   to_pathboolto_boolr   
to_commandr   to_env_liststrto_str
isinstance)selfr   r   r   from_modules        M/var/www/piapp/venv/lib/python3.11/site-packages/tox/config/loader/convert.pytoz
Convert.to   s(    g|T::999??3999gt$$ 	%<<$$$gt$$ 	%<<$$$gw'' 	(??3'''gw'' 	)##C(((gs## 	$;;s###c7## 	J 	 73<<ws||    c                .   
 t          |d|j                  }t          }|t          t          hv r3|j        d         

 fd                     |
          D             }n||t          t          hv r3|j        d         

 fd 	                    |
          D             }n9|t          t          hv rP|j        d         |j        d         ct           fd                     |f          D                       }n|t          k    r|j        }t          d           t!          |          dk    rd|v r`t#          |t$                    r|                                }|sd }nst)          fd|D                       }                     ||          }n@|t,          t          t,                    hv r#|j        }||vr| d	| }	t/          |	          |}|t          urt1          t2          |          S | d
|}	t5          |	          )N
__origin__r   c                >    g | ]}                     |          S  r2   .0i
entry_typer   r/   s     r1   
<listcomp>z&Convert._to_typing.<locals>.<listcomp>6   s)    ]]]!dggaW55]]]r3   c                >    h | ]}                     |          S r7   r8   r9   s     r1   	<setcomp>z%Convert._to_typing.<locals>.<setcomp>9   s)    \\\!dggaW55\\\r3      c              3  z   K   | ]5\  }}                     |                               |          fV  6d S Nr8   )r:   kvr   key_typer/   
value_types      r1   	<genexpr>z%Convert._to_typing.<locals>.<genexpr><   s`       ! !Aq Hg..:w0O0OP! ! ! ! ! !r3      c              3  (   K   | ]}|k    |V  d S rB   r7   )r:   r;   nones     r1   rG   z%Convert._to_typing.<locals>.<genexpr>I   s'      #A#A!qDyyAyyyy#A#Ar3   z must be one of z cannot cast to )r$   	__class___NO_MAPPINGlistr   __args__to_listsetr   to_setdictr
   r   to_dictr   typelenr.   r,   stripnextr2   r   
ValueErrorr   r   	TypeError)r/   r   r   r   originresultargsnew_typechoicemsgr<   rE   rJ   rF   s   `  `      @@@@r1   r%   zConvert._to_typing1   s]   ,0ABB!dD\!! )!,J]]]]]]t||CQ[?\?\]]]FFSz!! )!,J\\\\\\t{{3PZ?[?[\\\FFd|###*#3A#68H8K Hj  ! ! ! ! ! ! ! LLx.DEE! ! !  FF u__$+$4D::D4yyA~~$$,,c3'' &))++C =!FF##A#A#A#At#A#A#AAAH!WWS(G<<Fg///%F&  66f66 oo%F$$6??"11g11nnr3   valuer,   c                    t           )z
        Convert to string.

        :param value: the value to convert
        :returns: a string representation of the value
        NotImplementedErrorr`   s    r1   r-   zConvert.to_strV   
     "!r3   r(   c                    t           )z
        Convert to boolean.

        :param value: the value to convert
        :returns: a boolean representation of the value
        rb   rd   s    r1   r)   zConvert.to_boola   re   r3   	type[Any]Iterator[T]c                    t           )z
        Convert to list.

        :param value: the value to convert
        :param of_type: the type of elements in the list
        :returns: a list representation of the value
        rb   r`   r   s     r1   rO   zConvert.to_listl   
     "!r3   c                    t           )z
        Convert to set.

        :param value: the value to convert
        :param of_type: the type of elements in the set
        :returns: a set representation of the value
        rb   rj   s     r1   rQ   zConvert.to_setx   rk   r3   tuple[type[Any], type[Any]]Iterator[tuple[T, T]]c                    t           )z
        Convert to dictionary.

        :param value: the value to convert
        :param of_type: a tuple indicating the type of the key and the value
        :returns: a iteration of key-value pairs that gets populated into a dict
        rb   rj   s     r1   rS   zConvert.to_dict   rk   r3   r   c                    t           )z
        Convert to path.

        :param value: the value to convert
        :returns: path representation of the value
        rb   rd   s    r1   r'   zConvert.to_path   re   r3   r   c                    t           )z
        Convert to a command to execute.

        :param value: the value to convert
        :returns: command representation of the value
        rb   rd   s    r1   r*   zConvert.to_command   re   r3   r   c                    t           )z
        Convert to a tox EnvList.

        :param value: the value to convert
        :returns: a list of tox environments from the value
        rb   rd   s    r1   r+   zConvert.to_env_list   re   r3   N)r   r   r   r   r   r   r   r   )r`   r   r   r,   )r`   r   r   r(   )r`   r   r   rg   r   rh   )r`   r   r   rm   r   rn   )r`   r   r   r   )r`   r   r   r   )r`   r   r   r   )__name__r!   __qualname____doc__r2   r%   staticmethodr   r-   r)   rO   rQ   rS   r'   r*   r+   r7   r3   r1   r   r      s       HH   :# # # #J " " " ^ \" " " " ^ \" " " " ^ \" " " " ^ \" " " " ^ \" " " " ^ \" " " " ^ \" " " " ^ \" " "r3   r   FactoryN) 
__future__r   abcr   r   collectionsr   pathlibr   r"   r   r	   r
   r   r   r   r   r   r   r   r   r   tox.config.typesr   r   objectrL   r   r   rw   r   __all__r7   r3   r1   <module>r      sE   " " " " " " # # # # # # # # # # # # # #       m m m m m m m m m m m m m m m m m m m m m m m m m m m m - - - - - - - -fhhGCLLGCLL
8VHaK(
)^" ^" ^" ^" ^"c71: ^" ^" ^"D r3   