Ë
    æØjjZ2  ã                  óz  — 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<   dd„Z	 	 	 	 d d„Z	 	 	 	 	 	 d!d„Z	 	 	 	 	 	 d"d„Z d#d„Z!d$d„Z"dZ#	 	 	 	 	 	 	 	 	 	 	 	 d%d„Z$d&d„Z%y)'é    )Ú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	<   y
)Ú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__© ó    úZ/opt/eval-harness/bench_task/venv/lib/python3.12/site-packages/_pytest/config/findpaths.pyr   r      s   … ñð ƒMØƒJØ'Ó'Ø
 Ô r!   r   r
   Ú
ConfigDictc                ó    — 	 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   )ÚpathÚexcs     r"   Ú_parse_ini_configr+   .   sC   € ð,Ü×"Ñ"¤3 t£9Ó-Ð-øÜ×Ñò ,Üœ˜S›Ó"¨Ð+ûð,ús   ‚   A³AÁAc           
     óx  — | j                   dk(  rSt        | «      }d|v r3|d   j                  «       D ��ci c]  \  }}|t        |dd¬«      “Œ c}}S | j                  dv ri S y| j                   dk(  r|t        | «      }d|j
                  v r3|d   j                  «       D ��ci c]  \  }}|t        |dd¬«      “Œ c}}S d|j
                  v r!t        t        j                  d	¬
«      d¬«       y| j                   dk(  �rqt        j                  dk\  rddl}nddl}| j                  d¬«      }	 |j                  |«      }| j                  dv rF|j#                  di «      }|r0|j                  «       D ��ci c]  \  }}|t        |dd¬«      “Œ c}}S i S |j#                  di «      j#                  di «      }	|	j                  «       D ��ci c]  \  }}|dk7  sŒ||“Œ }
}}|	j#                  dd«      }|
r|rt!        | › d�«      ‚|
r0|
j                  «       D ��ci c]  \  }}|t        |dd¬«      “Œ c}}S |�:dd„}|j                  «       D ��ci c]  \  }}|t         ||«      dd¬«      “Œ c}}S yc c}}w c c}}w # |j                  $ r}t!        | › d|› �«      |‚d}~ww xY wc c}}w c c}}w c c}}w c c}}w )z�Load 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                ó<   — t        | t        «      r| S t        | «      S ©N)Ú
isinstanceÚlistr'   )Úvs    r"   Úmake_scalarz/load_config_dict_from_file.<locals>.make_scalar“   s   € Ü *¨1¬dÔ 3˜1Ð?¼¸Q»Ð?r!   )rB   r   Úreturnzstr | list[str])Úsuffixr+   Úitemsr   ÚnameÚsectionsr   ÚCFG_PYTEST_SECTIONÚformatÚsysÚversion_infoÚtomllibÚtomliÚ	read_textÚloadsÚTOMLDecodeErrorr   Úget)Úfilepathr%   ÚkrB   rM   Ú	toml_textÚconfigr*   Úpytest_configÚtool_pytestÚtoml_configÚ
ini_configrC   s                r"   Úload_config_dict_from_filer[   :   s  € ð ‡�˜&Ò Ü% hÓ/ˆ	à�yÑ ð & hÑ/×5Ñ5Ó7÷á�A�qð ”;˜q¨°eÔ<Ñ<óð ð �}‰}Ð =Ñ=Ø�	ð\ ðW 
�‰˜FÒ	"Ü% hÓ/ˆ	à˜I×.Ñ.Ñ.ð & mÑ4×:Ñ:Ó<÷á�A�qð ”;˜q¨°eÔ<Ñ<óð ð ˜×+Ñ+Ñ+ô Ô#×*Ñ*°KÐ*Ó@È%ÕPð@ ðw 
�‰˜GÓ	#Ü×Ñ˜wÒ&Üã#à×&Ñ&°Ð&Ó8ˆ	ð	<Ø—]‘] 9Ó-ˆFð
 �=‰=Ð;Ñ;Ø"ŸJ™J x°Ó4ˆMÙð !.× 3Ñ 3Ó 5÷á˜˜1ð ”{ 1¨V¸&ÔAÑAóð ð
 ˆIð !Ÿ*™* V¨RÓ0×4Ñ4°X¸rÓBˆKð -8×,=Ñ,=Ó,?×V¡D A qÀ1ÈÓCU˜1˜a™4ÐVˆKÑVà$Ÿ™¨¸Ó=ˆJá™zÜ Ø�jð !Pð Póð ñ ð !,× 1Ñ 1Ó 3÷á˜˜1ð ”{ 1¨V¸&ÔAÑAóð ð
 Ð'ó@ð
 !+× 0Ñ 0Ó 2÷á˜˜1ð ”{¡;¨q£>¸&ÀuÔMÑMóð ð
 ùókùóøð* ×&Ñ&ò 	<Ü ˜z¨¨C¨5Ð1Ó2¸Ð;ûð	<üóùó WùóùósA   µI0Â!I6Ä-I< Å3J$ÇJ*ÇJ*ÈJ0ÉJ6É<J!ÊJÊJ!c                ó,  — g d¢}|D �cg c]  }t        |«      j                  d«      rŒ|‘Œ! }}|s| g}d}g }|D ]¼  }t        |«      }|g|j                  ¢­D ]œ  }|D ]•  }	||	z  }
|
j	                  «       sŒ|
j
                  dk(  r|€|
}t        |
«      }|€Œ:|j                  |	«      }||dz   d D ]5  }||z  }|j	                  «       sŒt        |«      €Œ%|j                  |«       Œ7 ||
||fc c c S  Œž Œ¾ |�|j                  |i g fS ddi g fS c c}w )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.)r9   r:   r1   r2   úpyproject.tomlztox.inir3   ú-Nr]   r   )
r'   Ú
startswithr   ÚparentsÚis_filerG   r[   ÚindexÚappendÚparent)Úinvocation_dirÚargsÚconfig_namesÚxÚfound_pyproject_tomlÚignored_config_filesÚargÚargpathÚbaseÚconfig_nameÚprZ   rb   Ú	remainderÚp2s                  r"   Úlocate_configrr   ž   sg  € ò€Lð Ö:�!¤3 q£6×#4Ñ#4°SÕ#9ŠAÐ:€DÐ:ÙØÐˆØ(,ÐØ&(Ðàò IˆÜ˜sÓ#ˆØÐ/˜wŸ™Ñ/ò 	IˆDØ+ò I�Ø˜;Ñ&�Ø—9‘9•;Ø—v‘vÐ!1Ò1Ð6JÐ6RØ/0Ð,Ü!;¸AÓ!>�JØ!Ñ-Ø ,× 2Ñ 2°;Ó ?˜Ø)5°e¸a±i°kÐ)Bò G˜IØ!%¨	Ñ!1˜Bà "§
¡
¥Ü$>¸rÓ$BÑ$Nà 4× ;Ñ ;¸IÕ FðGð  $ Q¨
Ð4HÐHÖHñIñ	IðIð& Ð'Ø#×*Ñ*Ð,@À"ÀbÐHÐHØ��r˜2ÐÐùò7 ;s
   ‰D©Dc                óô   — d }|D ]N  }|j                  «       sŒ|€|}Œ||j                  v s||k(  rŒ-||j                  v r|}Œ>t        ||«      }|€ŒM|}ŒP |€| }|S |j                  «       r|j                  }|S r?   )Úexistsr`   r   ra   rd   )re   ÚpathsÚcommon_ancestorr)   Úshareds        r"   Úget_common_ancestorrx   Í   s£   € ð $(€OØò -ˆØ�{‰{Œ}ØØÐ"Ø"‰Oà $§,¡,Ñ.°$¸/Ò2IØØ˜×0Ñ0Ñ0Ø"&‘ä# D¨/Ó:�ØÑ%Ø&,‘Oð-ð ÐØ(ˆð Ðð 
×	 Ñ	 Ô	"Ø)×0Ñ0ˆØÐr!   c                ó„   ‡‡— dd„Šdd„Šdd„}ˆˆfd„| D «       }|D �cg c]  }t        |«      sŒ ||«      ‘Œ c}S c c}w )Nc                ó$   — | j                  d«      S )Nr^   )r_   ©rh   s    r"   Ú	is_optionz%get_dirs_from_args.<locals>.is_optionè   s   € Ø�|‰|˜CÓ Ð r!   c                ó.   — | j                  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!   c                ó>   — | j                  «       r| S | j                  S r?   )Úis_dirrd   )r)   s    r"   Úget_dir_from_pathz-get_dirs_from_args.<locals>.get_dir_from_pathî   s   € Ø�;‰;Œ=ØˆKØ�{‰{Ðr!   c              3  óP   •K  — | ]  } ‰|«      st         ‰|«      «      –— Œ y ­wr?   r   )Ú.0rk   r€   r|   s     €€r"   ú	<genexpr>z%get_dirs_from_args.<locals>.<genexpr>ô   s+   øè ø€ ò àÙ˜Œ~ô 	Ñ/°Ó4×5ñùs   ƒ#&)rh   r'   rD   Úbool)rh   r'   rD   r'   )r)   r   rD   r   r   )rf   rƒ   Úpossible_pathsr)   r€   r|   s       @@r"   Úget_dirs_from_argsr‰   ç   sD   ù€ ó!ó,óôàô€Nð 1?ÖT¨Ä+ÈdÕBSÑ˜dÕ#ÒTÐTùÒTs   Ÿ=°
=c                ó°   — i }| xs dD ])  }	 |j                  dd«      \  }}t        |dd¬«      ||<   Œ+ |S # t        $ r}t        d|›d�«      |‚d	}~ww xY w)
z•Parse the -o/--override-ini command line arguments and return the overrides.

    :raises UsageError:
        If one of the values is malformed.
    r    ú=r   Úoverrider/   r0   z3-o/--override-ini expects option=value style (got: z).N)r   r   Ú
ValueErrorr   )Úoverride_iniÚ	overridesrZ   ÚkeyÚuser_ini_valueÚes         r"   Úparse_override_inir“   ý   sŠ   € ð €Ið #Ò( bò Xˆ
ð	XØ",×"2Ñ"2°3¸Ó":ÑˆC�ô )¨À
ÐQVÔWˆI�cŠNðXð Ðøô ò 	ÜØEÀjÀ^ÐSUÐVóàðûð	ús   �7·	AÁ AÁAz][pytest] section in {filename} files is no longer supported, change to [tool:pytest] instead.c                ó\  — d}t        |«      }g }| r+t        | «      }|}	t        |«      xs i }
|€�|j                  }n‚t	        ||«      }t        ||g«      \  }}	}
}|€b|€`|g|j                  ¢­D ]  }|dz  j                  «       sŒ|} n5 ||gk7  rt        ||«      \  }}	}
}|€t	        |||g«      }t        |«      r|}|rGt        t        j                  j                  |«      «      }|j                  «       st        d|› d�«      ‚t        |«      }|
j                  |«       |€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   r[   rd   rx   rr   r`   ra   Ú
is_fs_rootÚosr)   Ú
expandvarsr‚   r   r“   Úupdate)ÚinifilerŽ   rf   Úrootdir_cmd_argre   ÚrootdirÚdirsrj   Úinipath_ÚinipathÚinicfgÚancestorÚpossible_rootdirr   Úini_overridess                  r"   Údetermine_setupr£     sq  € ð0 €GÜ˜dÓ#€DØ*,ÐáÜ Ó(ˆØ'ˆÜ+¨HÓ5Ò;¸ˆØÐ"Ø—o‘o‰Gä& ~°tÓ<ˆÜ9FØ˜X˜Jó:
Ñ6ˆ�˜&Ð"6ð ˆ?˜Ð6Ø%-Ð$A°×0@Ñ0@Ñ$Aò +Ð Ø$ zÑ1×:Ñ:Õ<Ø.�GÙð+ð
 ˜H˜:Ò%Ü2?ÀÐPTÓ2UÑ/�G˜W f¨aØ�?Ü1Ø&¨¸Ð(Bó�Gô " 'Ô*Ø"*˜ÙÜœrŸw™w×1Ñ1°/ÓBÓCˆØ�~‰~ÔÜØ˜g˜YÐ&QÐRóð ô ' |Ó4€MØ
‡M�M�-Ô àÐÐÐØ�G˜VÐ%9Ð9Ð9r!   c                óz   — t         j                  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)ro   s    r"   r•   r•   Y  s+   € ô
 �7‰7×Ñœc !›fÓ% aÑ(¬B¯F©FÑ2Ð2r!   )r)   r   rD   ziniconfig.IniConfig)rS   r   rD   zConfigDict | None)re   r   rf   úIterable[Path]rD   z:tuple[Path | None, Path | None, ConfigDict, Sequence[str]])re   r   ru   r§   rD   r   )rf   zIterable[str]rD   z
list[Path])rŽ   úSequence[str] | NonerD   r#   )r™   ú
str | NonerŽ   r¨   rf   zSequence[str]rš   r©   re   r   rD   z3tuple[Path, Path | None, ConfigDict, Sequence[str]])ro   r   rD   r‡   )&Ú
__future__r   Úcollections.abcr   r   Údataclassesr   r   r–   Úpathlibr   rK   Útypingr	   r
   r%   Ú
exceptionsr   Ú_pytest.outcomesr   Ú_pytest.pathlibr   r   r   r   Údictr'   r#   r   r+   r[   rr   rx   r‰   r“   rI   r£   r•   r    r!   r"   ú<module>r³      s'  ðÞ "å $Ý $Ý !Ý Û 	Ý Û 
Ý Ý ã å "Ý !Ý (Ý &Ý 'ñ �$Ô÷!ð !ó ð!ð( ˜S +Ð-Ñ.€
ˆIÓ .ó	,ðaØðaàóaðH,Øð,à
ð,ð @ó,ð^Øðàðð 
óó4Uó,ð, uÐ ð@:àð@:ð 'ð@:ð ð	@:ð
  ð@:ð ð@:ð 9ó@:ôF3r!   