j7iN2zUddlmZddlmZddlmZddlmZddlmZddlZddl m Z ddl Z ddl m Z dd l mZddlZd d lmZdd lmZdd lmZddlmZddlmZedGddZeeefZded<ddZ d dZ d!dZ d"dZ d#dZ!d$dZ"dZ# d%dZ$d&dZ%y)') annotations)Iterable)Sequence) dataclass)KW_ONLYN)Path)Literal) TypeAlias) UsageError)fail absolutepath) commonpath safe_existsT)frozenc:eZdZUdZded<ded<ded<ded <y ) ConfigValuea8Represents 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. objectvaluer_zLiteral['file', 'override']originzLiteral['ini', 'toml']modeN)__name__ __module__ __qualname____doc____annotations__a/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/_pytest/config/findpaths.pyrrs  MJ ''  r!rr ConfigDictc tjt|S#tj$r}t t||d}~wwxYw)zParse the given generic '.ini' file using legacy IniConfig parser, returning the parsed object. Raise UsageError if the file cannot be parsed. N) iniconfig IniConfigstr ParseErrorr )pathexcs r"_parse_ini_configr+.sC ,""3t9--   ,S"+,s A AA c x|jdk(rSt|}d|vr3|djDcic]\}}|t|ddc}}S|jdvriSy|jdk(r|t|}d|j vr3|djDcic]\}}|t|ddc}}Sd|j vr!t tjd d y|jd k(rqtjdk\rddl }nddl }|jd} |j|}|jdvrF|j#di}|r0|jDcic]\}}|t|ddc}}SiS|j#dij#di} | jDcic]\}}|dk7s ||} }}| j#dd} | r| rt!|d| r0| jDcic]\}}|t|ddc}}S| :dd} | jDcic]\}}|t| |ddc}}Sycc}}wcc}}w#|j$r}t!|d||d}~wwxYwcc}}wcc}}wcc}}wcc}}w)zLoad pytest configuration from the given file path, if supported. Return None if the file does not contain valid pytest configuration. z.inipytestfileinirr> pytest.ini .pytest.iniz.cfgz tool:pytest setup.cfg)filenameF)pytracez.toml) rNzutf-8)encodingz: ) pytest.toml .pytest.tomltomltool 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|tr|St|SN) isinstancelistr')vs r" make_scalarz/load_config_dict_from_file..make_scalars *1d 31?Q?r!)rBrreturnzstr | list[str])suffixr+itemsrnamesectionsr CFG_PYTEST_SECTIONformatsys version_infotomllibtomli read_textloadsTOMLDecodeErrorr get) filepathr%krBrM toml_textconfigr* pytest_config tool_pytest toml_config ini_configrCs r"load_config_dict_from_filer[:s& %h/ y &h/557Aq;qe<<  }} == \ W F "%h/ I.. .&m4::<Aq;qe<< ++ + #**K*@% P@ w G #   w &  #&&&8  <]]9-F ==; ;"JJx4M!. 3 3 51{1V&AA I!**VR044XrBK-8,=,=,?VDAq1 CU1a4VKV$=Jz j!PP!, 1 1 31{1V&AA '@ !+ 0 0 21{;q>&uMM k*&& <zC512 ; <WsAI0!I6-I<3J$ J*J*J0 J6<J! JJ!c,gd}|Dcgc]}t|jdr|!}}|s|g}d}g}|D]}t|}|g|jD]}|D]} || z } | j s| j dk(r|| }t | } | :|j| } || dzdD]5} || z }|j st |%|j| 7|| | |fcccS||j|igfSddigfScc}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.)r9r:r1r2pyproject.tomlztox.inir3-Nr]r ) r' startswithrparentsis_filerGr[indexappendparent)invocation_dirargs config_namesxfound_pyproject_tomlignored_config_filesargargpathbase config_nameprZrb remainderp2s r" locate_configrrsgL :!3q6#4#4S#9A :D : (,&(Is#/w/ ID+ I ;&99;vv!116J6R/0,!;A!>J!- , 2 2; ?)5eaik)BGI!% !1B " $>r$B$N 4 ; ;I F G $Q 4HHH I II&'#**,@"bHH r2 7 ;s DDcd}|D]N}|js||}||jvs||k(r-||jvr|}>t||}|M|}P||}|S|jr |j}|Sr?)existsr`rrard)repathscommon_ancestorr)shareds r"get_common_ancestorrxs$(O -{{}   ""O$,,.$/2I000"&#D/:%&,O -(   ")00 r!cdddddd}fd|D}|Dcgc]}t|s||c}Scc}w)Nc$|jdS)Nr^)r_rhs r" is_optionz%get_dirs_from_args..is_options||C  r!c*|jddS)Nz::r)splitr{s r"get_file_part_from_node_idz6get_dirs_from_args..get_file_part_from_node_idswwt}Qr!c>|jr|S|jSr?)is_dirrd)r)s r"get_dir_from_pathz-get_dirs_from_args..get_dir_from_paths ;;=K{{r!c3PK|]}|st|ywr?r).0rkrr|s r" z%get_dirs_from_args..s+ ~ /45s#&)rhr'rDbool)rhr'rDr')r)rrDrr)rfrpossible_pathsr)rr|s @@r"get_dirs_from_argsrsD!  N 1? T+dBS d # TT Ts= =ci}|xsdD])} |jdd\}}t|dd||<+|S#t$r}td|d|d }~wwxYw) zParse the -o/--override-ini command line arguments and return the overrides. :raises UsageError: If one of the values is malformed. r =r overrider/r0z3-o/--override-ini expects option=value style (got: z).N)r~r ValueErrorr ) override_ini overridesrZkeyuser_ini_valuees r"parse_override_inirs I#(bX  X","2"23": C ) QVWIcNX   Ej^SUV  s7 AAAz][pytest] section in {filename} files is no longer supported, change to [tool:pytest] instead.c\d}t|}g}|r+t|}|} t|xsi} ||j}nt ||} t || g\}} } }|b|`| g| j D]} | dz js| }n5|| gk7rt ||\}} } } |t ||| g}t|r| }|rGttjj|}|jstd|dt|}| j||J|| | |fS)aDetermine 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: Nzsetup.pyz Directory 'z+' not found. Check your '--rootdir' option.)rrr[rdrxrrr`ra is_fs_rootosr) expandvarsrr rupdate)inifilerrfrootdir_cmd_argrerootdirdirsrjinipath_inipathinicfgancestorpossible_rootdirr ini_overridess r"determine_setuprsq0G d #D*,('+H5;  "ooG&~t<9F XJ: 6&"6 ?6%-$A0@0@$A + $z1::<.G + H:%2?PT2U/GWfa?1&(BG"'*"*rww11/BC~~gY&QR '|4M MM-    GV%9 99r!cztjjt|dtjk(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 )rr) splitdriver'sep)ros r"rrYs+ 77  c!f %a (BFF 22r!)r)rrDziniconfig.IniConfig)rSrrDzConfigDict | None)rerrfIterable[Path]rDz:tuple[Path | None, Path | None, ConfigDict, Sequence[str]])rerrurrDr)rfz Iterable[str]rDz list[Path])rSequence[str] | NonerDr#) r str | Nonerrrfz Sequence[str]rrrerrDz3tuple[Path, Path | None, ConfigDict, Sequence[str]])rorrDr)& __future__rcollections.abcrr dataclassesrrrpathlibrrKtypingr r r% exceptionsr _pytest.outcomesr _pytest.pathlibrrrrdictr'r#rr+r[rrrxrrrIrrr r!r"rs'"$$!  "!(&' $!!!(S+-. I. ,aaaH,, ,@,^  4U,,u@: @:'@:  @:  @:  @:9@:F3r!