
    yIf                        U d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
 ddlmZ dd	lmZ dd
lmZ erddlmZ eeefZded<   ddZddZddZddZdZdS )    )annotationsN)chain)Path)TYPE_CHECKING)HandledError   )
LegacyToml)SetupCfg)ToxIni)Sourceztuple[type[Source], ...]SOURCE_TYPESconfig_filePath | Noneroot_dirreturnr   c                $   |  t                      }|t          |          }nm|                                 rJd}t          D ])}| |j        z  }	  ||          } n# t
          $ r Y &w xY w|d|  }t          |          nt          |           }|S )z
    Discover a source for configuration.

    :param config_file: the file storing the source
    :param root_dir: the root directory as set by the user (None means not set)
    :return: the source of the config
    Nz"could not find any config file in )_locate_source_create_default_sourceis_dirr   FILENAME
ValueErrorr   _load_exact_source)r   r   srcsrc_type	candidatemsgs         N/var/www/piapp/venv/lib/python3.11/site-packages/tox/config/source/discover.pydiscover_sourcer      s     ;(22C					 .$ 	 	H)H,==Ihy))   ;D{DDCs###  !--Js   A
A'&A'Source | Nonec                     t          j                    } t          | g| j                  D ]5}t          D ]+}||j        z  }	  ||          c c S # t          $ r Y (w xY w6d S N)r   cwdr   parentsr   r   r   )folderbaser   r   s       r   r   r   1   s    XZZFvh//  $ 	 	H"X%66Ix	*******   		 4s    
A
AAr   c                     t           fdt          D             d           }||fnt          D ]}	  |           c S # t          $ r Y w xY wd  }t          |          )Nc              3  <   K   | ]}j         |j        k    |V  d S r!   )namer   ).0sr   s     r   	<genexpr>z%_load_exact_source.<locals>.<genexpr>?   s2      RRa;3Cqz3Q3Q3Q3Q3Q3QRR    z could not recognize config file )nextr   r   r   )r   exact_matchr   r   s   `   r   r   r   =   s    RRRR<RRRTXYYK&1&=[NN<  	8K((((( 	 	 	D	
:[
:
:C
s

s   
?
AAc                2   | Ht          j                    }t          |g|j                  D ]}|dz                                  r|} nn| }t          j        dd                    d t          D                       |           t          |dz  d          S )Nzpyproject.tomlz)No %s found, assuming empty tox.ini at %sz or c              3  $   K   | ]}|j         V  d S r!   )r   )r)   is     r   r+   z)_create_default_source.<locals>.<genexpr>R   s%      LnLn\]QZLnLnLnLnLnLnr,   ztox.ini )content)
r   r"   r   r#   existsloggingwarningjoinr   r   )r   emptyr%   s      r   r   r   I   s    

5'5=11 	 	D''//11  O?LnLnamLnLnLnAnAnpuvvv%)#R0000r,   )r   )r   r   r   r   r   r   )r   r   )r   r   r   r   )r   r   r   r   )
__future__r   r5   	itertoolsr   pathlibr   typingr   
tox.reportr   legacy_tomlr	   	setup_cfgr
   tox_inir   apir   r   __annotations__r   r   r   r   __all__ r,   r   <module>rE      s.   " " " " " " "                          # # # # # # # # # # # #             *0(J)G G G G G   :	 	 	 		 	 	 	
1 
1 
1 
1 r,   