
    XiN2                       % 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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9 " S S5      5       r\\\4   rS\S'   SS 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)'    )annotations)Iterable)Sequence)	dataclass)KW_ONLYN)Path)Literal)	TypeAlias   )
UsageError)failabsolutepath)
commonpathsafe_existsT)frozenc                  B    \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   Srg)ConfigValue   a  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']mode N)__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r       K/var/www/html/venv/lib/python3.13/site-packages/_pytest/config/findpaths.pyr   r      s     MJ''
  r$   r   r
   
ConfigDictc                     [         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     r%   _parse_ini_configr.   .   sC    ,""3t9-- ,S"+,s   ! AA

Ac                   U R                   S:X  aW  [        U 5      nSU;   a2  US   R                  5        VVs0 s H  u  p#U[        USSS9_M     snn$ U R                  S;   a  0 $  gU R                   S:X  ay  [        U 5      nSUR
                  ;   a2  US   R                  5        VVs0 s H  u  p#U[        USSS9_M     snn$ SUR
                  ;   a  [        [        R                  S	S
9SS9  gU R                   S:X  G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;   aJ  UR#                  S0 5      nU(       a/  UR                  5        VVs0 s H  u  p#U[        USSS9_M     snn$ 0 $ UR#                  S0 5      R#                  S0 5      n	U	R                  5        VVs0 s H  u  p#US:w  d  M  X#_M     n
nnU	R#                  SS5      nU
(       a  U(       a  [!        U  S35      eU
(       a/  U
R                  5        VVs0 s H  u  p#U[        USSS9_M     snn$ Ub:  SS jnUR                  5        VVs0 s H  u  p#U[        U" U5      SSS9_M     snn$ gs  snnf s  snnf ! UR                   a  n[!        U  SU 35      UeSnAff = fs  snnf s  snnf s  snn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fileinir   r   >   
pytest.ini.pytest.iniz.cfgztool:pytest	setup.cfg)filenameF)pytracez.toml)      r   Nzutf-8)encodingz: )pytest.toml.pytest.tomltomltoolini_optionsz: 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                F    [        U [        5      (       a  U $ [        U 5      $ N)
isinstancelistr*   )vs    r%   make_scalar/load_config_dict_from_file.<locals>.make_scalar   s     *1d 3 31?Q?r$   )rE   r   returnzstr | list[str])suffixr.   itemsr   namesectionsr   CFG_PYTEST_SECTIONformatsysversion_infotomllibtomli	read_textloadsTOMLDecodeErrorr   get)filepathr(   krE   rQ   	toml_textconfigr-   pytest_configtool_pytesttoml_config
ini_configrF   s                r%   load_config_dict_from_filer_   :   s'    & %h/	y  &h/5577DA ;qe<<7  }} ==	 >^ W 
F	"%h/	I... &m4::<<DA ;qe<<<  +++ #**K*@%P@ w 
G	#w&#&&&8		<]]9-F
 ==;;"JJx4M !. 3 3 5 5 {1V&AA 5 
 I !**VR044XrBK -8,=,=,?V,?DA1CU414,?KV$=Jz j !P P   !, 1 1 3 3 {1V&AA 3 
 '@
 !+ 0 0 2 2 {;q>&uMM 2 
 k* && 	<zC512;	< WsA   J
)J/J <J?KK0K'KJ<&J77J<c                r   / 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/ nU H  n[        U5      nU/UR                  Q7 H  nU H  n	X-  n
U
R	                  5       (       d  M  U
R
                  S:X  a  Uc  U
n[        U
5      nUc  MC  UR                  U	5      nX,S-   S  H=  nX-  nUR	                  5       (       d  M  [        U5      c  M,  UR                  U5        M?     XX4s  s  s  $    M     M     Ub  UR                  U0 / 4$ SS0 / 4$ s  snf )zSearch 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.)r<   r=   r4   r5   pyproject.tomlztox.inir6   -Nra   r   )
r*   
startswithr   parentsis_filerK   r_   indexappendparent)invocation_dirargsconfig_namesxfound_pyproject_tomlignored_config_filesargargpathbaseconfig_namepr^   rf   	remainderp2s                  r%   locate_configrv      sF   L :t!3q6#4#4S#9AtD:(,&(s#/w/D+&99;;vv!116J6R/0,!;A!>J!- , 2 2; ?)5aik)BI!%!1B "

$>r$B$N 4 ; ;I F *C  $
HH  , 0 & '#**,@"bHHr27 ;s
   #D4D4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$ rB   )existsrd   r   re   rh   )ri   pathscommon_ancestorr,   shareds        r%   get_common_ancestorr|      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      $ )Nrb   )rc   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                  $ rB   )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rB   r   ).0ro   r   r   s     r%   	<genexpr>%get_dirs_from_args.<locals>.<genexpr>   s/      C~ 	6/455s   00)rl   r*   rH   bool)rl   r*   rH   r*   )r,   r   rH   r   r   )rj   r   possible_pathsr,   r   r   s       @@r%   get_dirs_from_argsr      sK    ! N 1?T+dBS#d#TTTs
   A
A
c                    0 nU =(       d    S H%  n UR                  SS5      u  p4[        USSS9X'   M'     U$ ! [         a  n[        SU< S35      UeS	nAff = f)
zParse the -o/--override-ini command line arguments and return the overrides.

:raises UsageError:
    If one of the values is malformed.
r   =r   overrider2   r3   z3-o/--override-ini expects option=value style (got: z).N)r   r   
ValueErrorr   )override_ini	overridesr^   keyuser_ini_valuees         r%   parse_override_inir      s     I #(b(
	X","2"23":C )
QVWIN )   	Ej^SUV	s   9
AAAz][pytest] section in {filename} files is no longer supported, change to [tool:pytest] instead.c                   Sn[        U5      n/ nU (       a1  [        U 5      nUn	[        U5      =(       d    0 n
Uc  UR                  nO[	        XF5      n[        XK/5      u  pYpUcl  Uci  U/UR                  Q7 H  nUS-  R                  5       (       d  M  Un  O8   Xk/:w  a  [        XF5      u  pYpUc  [	        XDU/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5      nU
R                  U5        Uc   eXYX4$ )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   r_   rh   r|   rv   rd   re   
is_fs_rootosr,   
expandvarsr   r   r   update)inifiler   rj   rootdir_cmd_argri   rootdirdirsrn   inipath_inipathinicfgancestorpossible_rootdirr   ini_overridess                  r%   determine_setupr     s^   0 Gd#D*,('+H5;"ooG&~<9FJ:
6& ?6%-$A0@0@$A $z1::<<.G %B
 :%2?2U/Gf?1&(BG "'**"*rww11/BC~~gY&QR  '|4M
MM- V99r$   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   )r   r,   
splitdriver*   sep)rs   s    r%   r   r   Y  s+    
 77c!f%a(BFF22r$   )r,   r   rH   ziniconfig.IniConfig)rW   r   rH   zConfigDict | None)ri   r   rj   Iterable[Path]rH   z:tuple[Path | None, Path | None, ConfigDict, Sequence[str]])ri   r   ry   r   rH   r   )rj   zIterable[str]rH   z
list[Path])r   Sequence[str] | NonerH   r&   )r   
str | Noner   r   rj   zSequence[str]r   r   ri   r   rH   z3tuple[Path, Path | None, ConfigDict, Sequence[str]])rs   r   rH   r   )&
__future__r   collections.abcr   r   dataclassesr   r   r   pathlibr   rO   typingr	   r
   r(   
exceptionsr   _pytest.outcomesr   _pytest.pathlibr   r   r   r   dictr*   r&   r"   r.   r_   rv   r|   r   r   rM   r   r   r   r$   r%   <module>r      s'   " $ $ !  	  
    " ! ( & ' $! ! !( S+-.
I .	,aaaH,,
, @,^ 
4U,, u @:@: '@: 	@:
  @: @: 9@:F3r$   