§
    ÖŽ’j¸3  ã                  ó\  — U 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Zd dl	m
Z
 d dlZd dlmZ 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  ed¬¦  «         G d„ d¦  «        ¦   «         Zeeef         Zded<   d5d„Zd6d„Zd7d"„Zd8d$„Z d9d'„Z!d:d*„Z"d+Z#d;d1„Z$d<d4„Z%dS )=é    )Úannotations)ÚIterable)ÚSequence)Ú	dataclass)ÚKW_ONLYN)ÚPath)ÚLiteral)Ú	TypeAliasé   )Ú
UsageError)Úfail©Úabsolutepath)Ú
commonpath©Úsafe_existsT)Úfrozenc                  ó<   — e Zd ZU dZded<   ded<   ded<   ded	<   d
S )ÚConfigValuea8  Represents a configuration value with its origin and parsing mode.

    This allows tracking whether a value came from a configuration file
    or from a CLI override (--override-ini), which is important for
    determining precedence when dealing with ini option aliases.

    The mode tracks the parsing mode/data model used for the value:
    - "ini": from INI files or [tool.pytest.ini_options], where the only
      supported value types are `str` or `list[str]`.
    - "toml": from TOML files (not in INI mode), where native TOML types
       are preserved.
    ÚobjectÚvaluer   Ú_zLiteral['file', 'override']ÚoriginzLiteral['ini', 'toml']ÚmodeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__© ó    úFC:\Projects\DSCons\.venv\Lib\site-packages\_pytest\config\findpaths.pyr   r      sH   € € € € € € ðð ð €M€M�MØ€J€J�JØ'Ð'Ð'Ñ'Ø Ð Ð Ñ Ð Ð r!   r   r
   Ú
ConfigDictÚpathr   Úreturnúiniconfig.IniConfigc                ó®   — 	 t          j        t          | ¦  «        ¦  «        S # t           j        $ r"}t	          t          |¦  «        ¦  «        |‚d}~ww xY w)zœParse the given generic '.ini' file using legacy IniConfig parser, returning
    the parsed object.

    Raise UsageError if the file cannot be parsed.
    N)Ú	iniconfigÚ	IniConfigÚstrÚ
ParseErrorr   )r$   Úexcs     r"   Ú_parse_ini_configr-   .   sV   € ð,ÝÔ"¥3 t¡9¤9Ñ-Ô-Ð-øÝÔð ,ð ,ð ,Ý�˜S™œÑ"Ô"¨Ð+øøøøð,øøøs   ‚ # £A²AÁAÚfilepathúConfigDict | Nonec                ó†  ‡
— | j         dk    rDt          | ¦  «        }d|v r$d„ |d                              ¦   «         D ¦   «         S | j        dv ri S �nð| j         dk    rqt          | ¦  «        }d|j        v r$d„ |d                              ¦   «         D ¦   «         S d|j        v r*t          t                               d¬	¦  «        d
¬¦  «         �nt| j         dk    �rht          j	        dk    rddl
}nddl}|                      d¬¦  «        }	 |                     |¦  «        }n'# |j        $ r}t          | › d|› �¦  «        |‚d}~ww xY w| j        dv r8|                     di ¦  «        }|rd„ |                     ¦   «         D ¦   «         S i S |                     di ¦  «                             di ¦  «        }d„ |                     ¦   «         D ¦   «         }|                     dd¦  «        }	|r|	rt          | › d�¦  «        ‚|rd„ |                     ¦   «         D ¦   «         S |	�$d d„Š
ˆ
fd„|	                     ¦   «         D ¦   «         S dS )!z�Load pytest configuration from the given file path, if supported.

    Return None if the file does not contain valid pytest configuration.
    z.iniÚpytestc                ó:   — i | ]\  }}|t          |d d¬¦  «        “ŒS ©ÚfileÚini©r   r   ©r   ©Ú.0ÚkÚvs      r"   ú
<dictcomp>z.load_config_dict_from_file.<locals>.<dictcomp>F   ó=   € ð ð ð á�A�qð •;˜q¨°eÐ<Ñ<Ô<ðð ð r!   >   ú
pytest.iniú.pytest.iniz.cfgztool:pytestc                ó:   — i | ]\  }}|t          |d d¬¦  «        “ŒS r3   r7   r8   s      r"   r<   z.load_config_dict_from_file.<locals>.<dictcomp>T   r=   r!   ú	setup.cfg)ÚfilenameF)Úpytracez.toml)é   é   r   Nzutf-8)Úencodingz: )úpytest.tomlú.pytest.tomlc                ó:   — i | ]\  }}|t          |d d¬¦  «        “ŒS ©r4   Útomlr6   r7   r8   s      r"   r<   z.load_config_dict_from_file.<locals>.<dictcomp>q   ó=   € ð ð ð á˜˜1ð •{ 1¨V¸&ÐAÑAÔAðð ð r!   Útoolc                ó&   — i | ]\  }}|d k    ¯||“ŒS )Úini_optionsr    r8   s      r"   r<   z.load_config_dict_from_file.<locals>.<dictcomp>}   s(   € ÐVÐVÐV¡D A qÀ1ÈÒCUÐCU˜1˜aÐCUÐCUÐCUr!   rO   zó: Cannot use both [tool.pytest] (native TOML types) and [tool.pytest.ini_options] (string-based INI format) simultaneously. Please use [tool.pytest] with native TOML types (recommended) or [tool.pytest.ini_options] for backwards compatibility.c                ó:   — i | ]\  }}|t          |d d¬¦  «        “ŒS rJ   r7   r8   s      r"   r<   z.load_config_dict_from_file.<locals>.<dictcomp>‹   rL   r!   r;   r   r%   ústr | list[str]c                óN   — t          | t          ¦  «        r| nt          | ¦  «        S ©N)Ú
isinstanceÚlistr*   )r;   s    r"   Úmake_scalarz/load_config_dict_from_file.<locals>.make_scalar“   s!   € Ý *¨1­dÑ 3Ô 3Ð?˜1˜1½¸Q¹¼Ð?r!   c                óN   •— i | ]!\  }}|t           ‰|¦  «        d d¬¦  «        “Œ"S r3   r7   )r9   r:   r;   rV   s      €r"   r<   z.load_config_dict_from_file.<locals>.<dictcomp>–   sF   ø€ ð ð ð á˜˜1ð •{ ; ;¨q¡>¤>¸&ÀuÐMÑMÔMðð ð r!   )r;   r   r%   rQ   )Úsuffixr-   ÚitemsÚnameÚsectionsr   ÚCFG_PYTEST_SECTIONÚformatÚsysÚversion_infoÚtomllibÚtomliÚ	read_textÚloadsÚTOMLDecodeErrorr   Úget)r.   r(   r`   Ú	toml_textÚconfigr,   Úpytest_configÚtool_pytestÚtoml_configÚ
ini_configrV   s             @r"   Úload_config_dict_from_filerl   :   s0  ø€ ð „˜&Ò Ð Ý% hÑ/Ô/ˆ	à�yÐ Ð ðð à% hÔ/×5Ò5Ñ7Ô7ðñ ô ð ð Œ}Ð =Ð=Ð=Ø�	ñ >ð 
Œ˜FÒ	"Ð	"Ý% hÑ/Ô/ˆ	à˜IÔ.Ð.Ð.ðð à% mÔ4×:Ò:Ñ<Ô<ðñ ô ð ð ˜Ô+Ð+Ð+õ Õ#×*Ò*°KÐ*Ñ@Ô@È%ÐPÑPÔPÐPùð
 
Œ˜GÒ	#Ñ	#ÝÔ˜wÒ&Ð&ØˆNˆNˆNˆNà#Ð#Ð#Ð#à×&Ò&°Ð&Ñ8Ô8ˆ	ð	<Ø—]’] 9Ñ-Ô-ˆFˆFøØÔ&ð 	<ð 	<ð 	<Ý Ð1Ð1¨CÐ1Ð1Ñ2Ô2¸Ð;øøøøð	<øøøð Œ=Ð;Ð;Ð;Ø"ŸJšJ x°Ñ4Ô4ˆMØð ðð à -× 3Ò 3Ñ 5Ô 5ðñ ô ð ð
 ˆIð !Ÿ*š* V¨RÑ0Ô0×4Ò4°X¸rÑBÔBˆKð WÐV¨K×,=Ò,=Ñ,?Ô,?ÐVÑVÔVˆKà$Ÿš¨¸Ñ=Ô=ˆJàð ˜zð Ý Øð Pð Pð Pñô ð ð ð ðð à +× 1Ò 1Ñ 3Ô 3ðñ ô ð ð
 Ð'ð@ð @ð @ð @ðð ð ð à *× 0Ò 0Ñ 2Ô 2ðñ ô ð ð
 ˆ4s   Ä	D Ä
EÄ)D>Ä>EÚinvocation_dirÚargsúIterable[Path]ú:tuple[Path | None, Path | None, ConfigDict, Sequence[str]]c                óö  — g d¢}d„ |D ¦   «         }|s| g}d}g }|D ]Ë}t          |¦  «        }|g|j        ¢R D ]®}|D ]©}||z  }	|	                     ¦   «         rŽ|	j        dk    r|€|	}t	          |	¦  «        }
|
�n|                     |¦  «        }||dz   d…         D ]?}||z  }|                     ¦   «         r$t	          |¦  «        �|                     |¦  «         Œ@||	|
|fc c c S ŒªŒ¯ŒÌ|�|j        |i g fS ddi g fS )a	  Search in the list of arguments for a valid ini-file for pytest,
    and return a tuple of (rootdir, inifile, cfg-dict, ignored-config-files), where
    ignored-config-files is a list of config basenames found that contain
    pytest configuration but were ignored.)rG   rH   r>   r?   úpyproject.tomlztox.inirA   c                óV   — g | ]&}t          |¦  «                             d ¦  «        °$|‘Œ'S )ú-)r*   Ú
startswith)r9   Úxs     r"   ú
<listcomp>z!locate_config.<locals>.<listcomp>¯   s1   € Ð:Ð:Ð:�!¥3 q¡6¤6×#4Ò#4°SÑ#9Ô#9Ð:ˆAÐ:Ð:Ð:r!   Nrr   r   )r   ÚparentsÚis_filerZ   rl   ÚindexÚappendÚparent)rm   rn   Úconfig_namesÚfound_pyproject_tomlÚignored_config_filesÚargÚargpathÚbaseÚconfig_nameÚprk   rz   Ú	remainderÚp2s                 r"   Úlocate_configr‡   ž   s¡  € ðð ð €Lð ;Ð:�tÐ:Ñ:Ô:€DØð  ØÐˆØ(,ÐØ&(Ðàð Ið IˆÝ˜sÑ#Ô#ˆØÐ/˜wœÐ/Ð/ð 	Ið 	IˆDØ+ð Ið I�Ø˜;Ñ&�Ø—9’9‘;”;ð IØ”vÐ!1Ò1Ð1Ð6JÐ6RØ/0Ð,Ý!;¸AÑ!>Ô!>�JØ!Ð-Ø ,× 2Ò 2°;Ñ ?Ô ?˜Ø)5°e¸a±i°k°kÔ)Bð Gð G˜IØ!%¨	Ñ!1˜Bà "§
¢
¡¤ðGå$>¸rÑ$BÔ$BÐ$Nà 4× ;Ò ;¸IÑ FÔ FÐ FøØ# Q¨
Ð4HÐHÐHÐHÐHÐHÐHÐHÐHøðIð	Ið" Ð'Ø#Ô*Ð,@À"ÀbÐHÐHØ��r˜2ÐÐr!   Úpathsc                óè   — d }|D ]L}|                      ¦   «         sŒ|€|}Œ||j        v s||k    rŒ,||j        v r|}Œ8t          ||¦  «        }|�|}ŒM|€| }n|                     ¦   «         r|j        }|S rS   )Úexistsrx   r   ry   r|   )rm   rˆ   Úcommon_ancestorr$   Úshareds        r"   Úget_common_ancestorr�   Í   s±   € ð $(€OØð -ð -ˆØ�{Š{‰}Œ}ð 	ØØÐ"Ø"ˆOˆOà $¤,Ð.Ð.°$¸/Ò2IÐ2IØØ˜Ô0Ð0Ð0Ø"&��å# D¨/Ñ:Ô:�ØÐ%Ø&,�OøØÐØ(ˆˆØ	×	 Ò	 Ñ	"Ô	"ð 1Ø)Ô0ˆØÐr!   úIterable[str]ú
list[Path]c                óZ   ‡‡‡— dd„Šdd„Šdd	„Šˆˆfd
„| D ¦   «         }ˆfd„|D ¦   «         S )Nrv   r*   r%   Úboolc                ó,   — |                       d¦  «        S )Nrt   )ru   ©rv   s    r"   Ú	is_optionz%get_dirs_from_args.<locals>.is_optionè   s   € Ø�|Š|˜CÑ Ô Ð r!   c                ó<   — |                       dd¬¦  «        d         S )Nz::r   )Úmaxsplitr   )Úsplitr“   s    r"   Úget_file_part_from_node_idz6get_dirs_from_args.<locals>.get_file_part_from_node_idë   s   € Ø�wŠw�t aˆwÑ(Ô(¨Ô+Ð+r!   r$   r   c                ó<   — |                       ¦   «         r| S | j        S rS   )Úis_dirr|   )r$   s    r"   Úget_dir_from_pathz-get_dirs_from_args.<locals>.get_dir_from_pathî   s   € Ø�;Š;‰=Œ=ð 	ØˆKØŒ{Ðr!   c              3  ó^   •K  — | ]'} ‰|¦  «        °t           ‰|¦  «        ¦  «        V — Œ(d S rS   r   )r9   r€   r˜   r”   s     €€r"   ú	<genexpr>z%get_dirs_from_args.<locals>.<genexpr>ô   sY   øè è € ð ð àØˆy˜‰~Œ~ðÝÐ/Ð/°Ñ4Ô4Ñ5Ô5ðð ð ð ð ð r!   c                óD   •— g | ]}t          |¦  «        ¯ ‰|¦  «        ‘ŒS r    r   )r9   r$   r›   s     €r"   rw   z&get_dirs_from_args.<locals>.<listcomp>ú   s2   ø€ ÐTÐTÐT¨Å+ÈdÑBSÔBSÐTÐÐ˜dÑ#Ô#ÐTÐTÐTr!   )rv   r*   r%   r‘   )rv   r*   r%   r*   )r$   r   r%   r   r    )rn   Úpossible_pathsr›   r˜   r”   s     @@@r"   Úget_dirs_from_argsr    ç   s‹   øøø€ ð!ð !ð !ð !ð,ð ,ð ,ð ,ðð ð ð ðð ð ð ð àðñ ô €Nð UÐTÐTÐT°ÐTÑTÔTÐTr!   Úoverride_iniúSequence[str] | Nonec                óÂ   — i }| pdD ]W}	 |                      dd¦  «        \  }}t          |dd¬¦  «        ||<   Œ2# t          $ r}t          d|›d�¦  «        |‚d	}~ww xY w|S )
z•Parse the -o/--override-ini command line arguments and return the overrides.

    :raises UsageError:
        If one of the values is malformed.
    r    ú=r   Úoverrider5   r6   z3-o/--override-ini expects option=value style (got: z).N)r—   r   Ú
ValueErrorr   )r¡   Ú	overridesrk   ÚkeyÚuser_ini_valueÚes         r"   Úparse_override_inir«   ý   sª   € ð €Ið #Ð( bð Xð Xˆ
ð	XØ",×"2Ò"2°3¸Ñ":Ô":ÑˆC�õ )¨À
ÐQVÐWÑWÔWˆI�c‰NˆNøõ ð 	ð 	ð 	ÝØVÀjÐVÐVÐVñô àðøøøøð	øøøð Ðs   Š9¹
AÁAÁAz][pytest] section in {filename} files is no longer supported, change to [tool:pytest] instead.Úinifileú
str | NoneúSequence[str]Úrootdir_cmd_argú3tuple[Path, Path | None, ConfigDict, Sequence[str]]c                ó²  — d}t          |¦  «        }g }| r,t          | ¦  «        }|}	t          |¦  «        pi }
|€|j        }n”t	          ||¦  «        }t          ||g¦  «        \  }}	}
}|€l|€j|g|j        ¢R D ]}|dz                       ¦   «         r|} nBŒ||gk    rt          ||¦  «        \  }}	}
}|€#t	          |||g¦  «        }t          |¦  «        r|}|rSt          t          j
                             |¦  «        ¦  «        }|                     ¦   «         st          d|› d�¦  «        ‚t          |¦  «        }|
                     |¦  «         |€J ‚||	|
|fS )a  Determine the rootdir, inifile and ini configuration values from the
    command line arguments.

    :param inifile:
        The `--inifile` command line argument, if given.
    :param override_ini:
        The -o/--override-ini command line arguments, if given.
    :param args:
        The free command line arguments.
    :param rootdir_cmd_arg:
        The `--rootdir` command line argument, if given.
    :param invocation_dir:
        The working directory when pytest was invoked.

    :raises UsageError:
    Nzsetup.pyzDirectory 'z+' not found. Check your '--rootdir' option.)r    r   rl   r|   r�   r‡   rx   ry   Ú
is_fs_rootÚosr$   Ú
expandvarsrš   r   r«   Úupdate)r¬   r¡   rn   r¯   rm   ÚrootdirÚdirsr   Úinipath_ÚinipathÚinicfgÚancestorÚpossible_rootdirr   Úini_overridess                  r"   Údetermine_setupr¾     sÈ  € ð0 €GÝ˜dÑ#Ô#€DØ*,Ðàð +Ý Ñ(Ô(ˆØ'ˆÝ+¨HÑ5Ô5Ð;¸ˆØÐ"Ø”oˆGøå& ~°tÑ<Ô<ˆÝ9FØ˜X˜Jñ:
ô :
Ñ6ˆ�˜&Ð"6ð ˆ?˜Ð6Ø%-Ð$A°Ô0@Ð$AÐ$Að +ð +Ð Ø$ zÑ1×:Ò:Ñ<Ô<ð Ø.�GØ�Eðð ˜H˜:Ò%Ð%Ý2?ÀÐPTÑ2UÔ2UÑ/�G˜W f¨aØ�?Ý1Ø&¨¸Ð(Bñô �Gõ " 'Ñ*Ô*ð +Ø"*˜Øð Ý�rœw×1Ò1°/ÑBÔBÑCÔCˆØ�~Š~ÑÔð 	ÝØR˜gÐRÐRÐRñô ð õ ' |Ñ4Ô4€MØ
‡M‚M�-Ñ Ô Ð àÐÐÐØ�G˜VÐ%9Ð9Ð9r!   r„   r‘   c                ó‚   — t           j                             t          | ¦  «        ¦  «        d         t           j        k    S )z‡
    Return True if the given path is pointing to the root of the
    file system ("/" on Unix and "C:\\" on Windows for example).
    r   )r³   r$   Ú
splitdriver*   Úsep)r„   s    r"   r²   r²   Y  s,   € õ
 Œ7×Ò�c !™fœfÑ%Ô% aÔ(­B¬FÒ2Ð2r!   )r$   r   r%   r&   )r.   r   r%   r/   )rm   r   rn   ro   r%   rp   )rm   r   rˆ   ro   r%   r   )rn   rŽ   r%   r�   )r¡   r¢   r%   r#   )r¬   r­   r¡   r¢   rn   r®   r¯   r­   rm   r   r%   r°   )r„   r   r%   r‘   )&Ú
__future__r   Úcollections.abcr   r   Údataclassesr   r   r³   Úpathlibr   r^   Útypingr	   r
   r(   Ú
exceptionsr   Ú_pytest.outcomesr   Ú_pytest.pathlibr   r   r   r   Údictr*   r#   r   r-   rl   r‡   r�   r    r«   r\   r¾   r²   r    r!   r"   ú<module>rË      s1  ðØ "Ð "Ð "Ð "Ð "Ð "Ð "à $Ð $Ð $Ð $Ð $Ð $Ø $Ð $Ð $Ð $Ð $Ð $Ø !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø 
€
€
€
Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à Ð Ð Ð à "Ð "Ð "Ð "Ð "Ð "Ø !Ð !Ð !Ð !Ð !Ð !Ø (Ð (Ð (Ð (Ð (Ð (Ø &Ð &Ð &Ð &Ð &Ð &Ø 'Ð 'Ð 'Ð 'Ð 'Ð 'ð €�$ÐÑÔð!ð !ð !ð !ð !ñ !ô !ñ Ôð!ð( ˜S +Ð-Ô.€
Ð .Ð .Ð .Ñ .ð	,ð 	,ð 	,ð 	,ðað að að aðH,ð ,ð ,ð ,ð^ð ð ð ð4Uð Uð Uð Uð,ð ð ð ð, uÐ ð@:ð @:ð @:ð @:ðF3ð 3ð 3ð 3ð 3ð 3r!   