
    ?g~                       S SK Jr  S SKrS SKJr  S SKrS SKJr  S SKJr  S SK	r	SSK
Jr  S SKJr  S S	KJr  S S
KJr  S SKJr  SS jr    SS jr      SS jr      SS jrSS jrSr          SS jrSS jrg)    )annotationsN)Path)Iterable)Sequence   )
UsageError)failabsolutepath)
commonpathsafe_existsc                     [         R                  " [        U 5      5      $ ! [         R                   a  n[	        [        U5      5      UeSnAff = f)zParse 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   )pathexcs     :/usr/lib/python3/dist-packages/_pytest/config/findpaths.py_parse_ini_configr      sC    ,""3t9-- ,S"+,s   ! AA

Ac                P   U R                   S:X  aA  [        U 5      nSU;   a  [        US   R                  5       5      $ U R                  S:X  a  0 $  gU R                   S:X  ac  [        U 5      nSUR
                  ;   a  [        US   R                  5       5      $ SUR
                  ;   a  [        [        R                  SS9SS	9  gU R                   S
:X  a  [        R                  S:  a  SSKnOSSKnU R                  SS9n UR                  U5      nUR#                  S0 5      R#                  S0 5      R#                  SS5      nUb0  SS jnUR                  5        VV	s0 s H  u  pX" U	5      _M     sn	n$ g! UR                   a  n[!        U  SU 35      UeSnAff = fs  sn	nf )zLoad pytest configuration from the given file path, if supported.

Return None if the file does not contain valid pytest configuration.
z.inipytest
pytest.iniz.cfgztool:pytest	setup.cfg)filenameF)pytracez.toml)      r   Nzutf-8)encodingz: toolini_optionsc                F    [        U [        5      (       a  U $ [        U 5      $ N)
isinstancelistr   )vs    r   make_scalar/load_config_dict_from_file.<locals>.make_scalarM   s    &q$//q;SV;    )r'   objectreturnzstr | list[str])suffixr   dictitemsnamesectionsr	   CFG_PYTEST_SECTIONformatsysversion_infotomllibtomli	read_textloadsTOMLDecodeErrorr   get)
filepathr   r6   	toml_textconfigr   resultr(   kr'   s
             r   load_config_dict_from_filerA      s    & %h/	y 	(+11344 }},	 -J C 
F	"%h/	I...	-066899+++ #**K*@%P2 - 
G	#w&#&&&8		<]]9-F FB'++Hb9==mTR< 39,,.A.$!A{1~%.AA && 	<zC512;	< Bs   E9  F"9F	FFc                   / SQnU Vs/ s H&  n[        U5      R                  S5      (       a  M$  UPM(     nnU(       d  U /nSnU Hv  n[        U5      nU/UR                  Q7 HT  nU HK  nXx-  n	U	R	                  5       (       d  M  U	R
                  S:X  a  Uc  U	n[        U	5      n
U
c  MC  XyU
4s  s  s  $    MV     Mx     Ub  UR                  U0 4$ SS0 4$ s  snf )ztSearch in the list of arguments for a valid ini-file for pytest,
and return a tuple of (rootdir, inifile, cfg-dict).)r   z.pytest.inipyproject.tomlztox.inir   -NrC   )r   
startswithr   parentsis_filer0   rA   parent)invocation_dirargsconfig_namesxfound_pyproject_tomlargargpathbaseconfig_namep
ini_configs              r   locate_configrT   U   s    L :t!3q6#4#4S#9AtD:(,s#/w/D+&99;;vv!116J6R/0,!;A!>J!-#
22  , 0  '#**,@"DDr># ;s
   #CCc                   S nU H\  nUR                  5       (       d  M  Uc  UnM!  X#R                  ;   d  X2:X  a  M7  X2R                  ;   a  UnMJ  [        X25      nUc  MZ  UnM^     Uc  U nU$ UR                  5       (       a  UR                  nU$ r$   )existsrF   r   rG   rH   )rI   pathscommon_ancestorr   shareds        r   get_common_ancestorrZ   v   s     $(O{{}}""O,,.$2I000"&#D:%&,O  (  
	 	 	"	")00r*   c                   ^^ SS jmSS jmSS jnUU4S jU  5       nU Vs/ s H  n[        U5      (       d  M  U" U5      PM     sn$ s  snf )Nc                $    U R                  S5      $ )NrD   )rE   rL   s    r   	is_option%get_dirs_from_args.<locals>.is_option   s    ||C  r*   c                *    U R                  S5      S   $ )Nz::r   )splitr]   s    r   get_file_part_from_node_id6get_dirs_from_args.<locals>.get_file_part_from_node_id   s    wwt}Qr*   c                H    U R                  5       (       a  U $ U R                  $ r$   )is_dirrH   )r   s    r   get_dir_from_path-get_dirs_from_args.<locals>.get_dir_from_path   s    ;;==K{{r*   c              3  d   >#    U  H%  nT" U5      (       a  M  [        T" U5      5      v   M'     g 7fr$   r
   ).0rN   rb   r^   s     r   	<genexpr>%get_dirs_from_args.<locals>.<genexpr>   s/      C~ 	6/455s   00)rL   r   r,   bool)rL   r   r,   r   )r   r   r,   r   r   )rJ   rf   possible_pathsr   rb   r^   s       @@r   get_dirs_from_argsrn      sK    ! N 1?T+dBS#d#TTTs
   A
A
z][pytest] section in {filename} files is no longer supported, change to [tool:pytest] instead.c                h   Sn[        U5      nU (       a1  [        U 5      nUn[        U5      =(       d    0 nUc  UR                  nO[	        X55      n	[        X9/5      u  pGnUcl  Uci  U	/U	R                  Q7 H  n
U
S-  R                  5       (       d  M  U
n  O8   XY/:w  a  [        X55      u  pGnUc  [	        X3U	/5      n[        U5      (       a  U	nU(       aL  [        [        R                  R                  U5      5      nUR                  5       (       d  [        SU S35      eUc   eXGU=(       d    0 4$ )al  Determine the rootdir, inifile and ini configuration values from the
command line arguments.

:param inifile:
    The `--inifile` command line argument, 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.
Nzsetup.pyzDirectory 'z+' not found. Check your '--rootdir' option.)rn   r   rA   rH   rZ   rT   rF   rG   
is_fs_rootosr   
expandvarsre   r   )inifilerJ   rootdir_cmd_argrI   rootdirdirsinipath_inipathinicfgancestorpossible_rootdirs              r   determine_setupr|      sA   & Gd#D('+H5;"ooG&~<#0#L &?6%-$A0@0@$A $z1::<<.G %B
 :%/<^/R,Gf?1&(BG "'**"*rww11/BC~~gY&QR  V\r))r*   c                z    [         R                  R                  [        U 5      5      S   [         R                  :H  $ )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   )rq   r   
splitdriver   sep)rR   s    r   rp   rp      s+    
 77c!f%a(BFF22r*   )r   r   r,   ziniconfig.IniConfig)r<   r   r,   z!dict[str, str | list[str]] | None)rI   r   rJ   Iterable[Path]r,   z;tuple[Path | None, Path | None, dict[str, str | list[str]]])rI   r   rW   r   r,   r   )rJ   zIterable[str]r,   z
list[Path])
rs   
str | NonerJ   zSequence[str]rt   r   rI   r   r,   z4tuple[Path, Path | None, dict[str, str | list[str]]])rR   r   r,   rl   )
__future__r   rq   pathlibr   r4   typingr   r   r   
exceptionsr   _pytest.outcomesr	   _pytest.pathlibr   r   r   r   rA   rT   rZ   rn   r2   r|   rp    r*   r   <module>r      s    " 	  
    " ! ( & '	,44&4n
 AB 
4U, u 3*3* 3*  	3*
 3* :3*l3r*   