ó
     “,j³D  ã                   ó  • S SK r S SKrS SKrS SKJrJrJrJrJrJ	r	J
r
JrJr  S SKJrJrJr  SSKJr  SSKJr  SSKJrJrJr  S0 S	.S
\S\S\\\4   S\\\4   4S jjrS\\\4   S\\\4   SS4S jrS\" 5       S.S\\\4   S\S\\   S\4S jjrS%S\S\4S jjr S\S\!\   4S jr"S\S\\\4   S\!\   4S jr#S\S\4S jr$ S&S\\\4   S\\\4   S\SS4S jjr%/ S.S\\\4   S\S\\   S\4S  jjr& " S! S"\5      r'S#S$/r(g)'é    N)	ÚMAX_INTERPOLATION_DEPTHÚConfigParserÚExtendedInterpolationÚInterpolationDepthErrorÚInterpolationMissingOptionErrorÚInterpolationSyntaxErrorÚNoOptionErrorÚNoSectionErrorÚParsingError)ÚAnyÚDictÚListé   ©ÚSECTION_PREFIX)ÚConfigValidationError)ÚVARIABLE_REÚtry_dump_jsonÚtry_load_jsonT)ÚinterpolateÚ	overridesÚtextr   r   Úreturnc                óú  • [        U=(       a    U(       + S9n UR                  U 5        [	        U5      nU(       a  US   e[        X25      nU(       a  US   e0 nUR                  5        Vs/ s H  oˆR                  S5      PM     n	nU	 HB  n
UnU
SS  H  nUS:X  a  UR                  U0 5      OX¼   nM!     UR                  U
S   0 5        MD     [        UR                  5       S	 S
9 HR  u  p�US:X  a  M  UR                  S5      n
UnU
 H  nX¼   nM	     U H  n[        UR                  XŽ5      5      X¾'   M!     MT     [        Xr5        [        Xw5        U$ ! [         a  nSU 3n[        US9SeSnAff = fs  snf )a;  Parse a config string into a nested dict.

Handles the full pipeline: parse with ConfigParser, validate structure,
apply overrides, interpret values, and resolve section references.

Returns the nested dict and whether a second interpolation pass is needed
(when overrides were applied with interpolation enabled).
©r   z<Make sure the sections and values are formatted correctly.

)ÚdescNr   Ú.éÿÿÿÿÚ*c                 ó<   • [        U S   R                  S5      5      $ )Nr   r   )ÚlenÚsplit)Úxs    Ú C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\confection/_parser.pyÚ<lambda>Úparse_config.<locals>.<lambda>:   s   € ¬S°°1±·±¸C³Ô-Aó    )ÚkeyÚDEFAULT)Ú_get_configparserÚread_stringr   r   Ú_validate_configparserÚ_validate_overridesÚsectionsr"   Ú
setdefaultÚsortedÚitemsÚ_interpret_valueÚgetÚ_apply_overridesÚ_replace_section_refs)r   r   r   Úconfig_parserÚer   ÚerrorsÚresultÚsectionÚsection_partsÚpartsÚnodeÚpartÚvaluesr(   s                  r$   Úparse_configr@      s‰  € ô &°+×2OÀiÄ-ÑP€Mð9Ø×!Ñ! $Ô'ô $ MÓ2€FÞØ�Q‰iˆÜ  Ó:€FÞØ�Q‰iˆØ€FØ7D×7MÑ7MÔ7OÓPÒ7O¨G—]‘] 3Ö'Ñ7O€MÐPãˆØˆØ˜#˜2“JˆDØ04¸³�4—?‘? 4¨Ô,ÀÁŠDñ à�‰˜˜b™	 2Ö&ñ	 ô "Ø×ÑÓÑ#Aô‰ˆð �iÓÙØ—‘˜cÓ"ˆØˆÛˆDØ‘:ŠDñ ãˆCÜ(¨×):Ñ):¸7Ó)HÓIˆD‹Ió ñô �VÔ'ä˜&Ô)Ø€MøôC ó 9ØOÐPQÈsÐSˆÜ#¨Ñ.°DÐ8ûð9üò Qs   ™E Á,E8Å
E5Å!E0Å0E5r9   c                 óŠ   • UR                  5        H/  u  p#UR                  S5      nU nUSS  H  nXV   nM	     X5US   '   M1     g)zsApply dot-notation overrides to a nested dict.

Override paths have already been validated by _validate_overrides.
r   Nr   )r1   r"   )r9   r   r(   ÚvalueÚpathr=   r>   s          r$   r4   r4   K   sK   € ð
  —o‘oÖ'‰
ˆØ�y‰y˜‹~ˆØˆØ˜˜"“IˆDØ‘:ŠDñ àˆT�"‰X‹ò (r'   )r   Úinline_pathsÚdatarD   c          
      ó   • [        US9n[        5       U 4/nU GH  u  pVSR                  U5      nU=(       a    US   S:g  n[        S UR	                  5        5       5      n	U(       a/  U	(       a(  UR                  U5      (       d  UR                  U5        O.U(       a'  UR                  U5      (       d  UR                  U5        UR                  5        H^  u  p«U(       a  U SU
 3OU
n[        US5      (       a  XÂ;  a  UR                  XZ4-   U45        MC  UR                  Xz[        X¶5      5        M`     GM!     [        R                  " 5       nUR                  U5        UR                  5       R!                  5       $ )a<  Serialize a nested config dict to a config string.

inline_paths: dotted paths whose values should be serialized as inline
    JSON rather than expanded into subsections. For example, if "a.b" is
    in inline_paths, data["a"]["b"] (even if it's a dict) will be
    serialized as ``b = {"key": "value"}`` under [a].
r   r   r   r   c              3   óD   #   • U  H  n[        US 5      (       + v •  M     g7f)r1   N)Úhasattr)Ú.0Úvs     r$   Ú	<genexpr>Ú#serialize_config.<locals>.<genexpr>j   s   é € ÐHº-°QœW Q¨Ó0×0Ñ0º-ùs   ‚ r1   )r*   ÚtupleÚjoinÚanyr?   Úhas_sectionÚadd_sectionr1   rH   ÚappendÚsetr   ÚioÚStringIOÚwriteÚgetvalueÚstrip)rE   r   rD   Ú	flattenedÚqueuerC   r=   Úsection_nameÚis_kwargÚ
has_leavesr(   rB   Ú
child_pathÚ	string_ios                 r$   Úserialize_configr`   X   s2  € ô "¨kÑ:€IÜ27³'¸4°Ð0A€EÜ‰
ˆØ—x‘x “~ˆØ×+˜D ™H¨™OˆÜÑH¸$¿+¹+¼-ÓHÓHˆ
Þ–J y×'<Ñ'<¸\×'JÑ'Jà×!Ñ! ,Õ/Þ˜i×3Ñ3°L×AÑAØ×!Ñ! ,Ô/ØŸ*™*ž,‰JˆCÞ4@˜L˜>¨¨3¨%Ñ0ÀcˆJÜ�u˜g×&Ñ&¨:Ó+IØ—‘˜d V™m¨UÐ3Ö4à—‘˜l´¸uÓ1KÖLô 'ñ ô —’“€IØ‡O�O�IÔØ×ÑÓ×%Ñ%Ó'Ð'r'   c                 óP   • [        U (       a
  [        5       OS S9n[        Ul        U$ )N)Úinterpolation)r   Ú_CustomInterpolationÚstrÚoptionxform)r   Úconfigs     r$   r*   r*   {   s"   € ÜÆ+Ô(<Ô(>ÐSWÑX€Fä€FÔØ€Mr'   r6   c           	      ó\  • / nU R                  5       nU(       a1  SnSnU Vs/ s H  oU/US.PM
     nnUR                  [        XcS95        [        U R	                  5       5      nU R	                  5        GH.  nUR                  S5      n	[        S[        U	5      5       Hk  n
XšS-
     S:X  a  M  SR                  U	SU
 5      nX·;  d  M+  SUR                  S5      ;  d  MB  S	nU	S
XšS-
      S3S./nUR                  [        XcS95          O   [        U R                  U5      5      nU Hu  nUR                  US-   5      (       d  M  U[        U5      S-   S R                  S5      S   nXì;   d  MH  UR                  S5      SS./nUR                  [        US95        Mw     GM1     U$ s  snf )aT  Validate a configparser's structure before interpreting it into a Config.

Checks that:
- No values leak into the DEFAULT section (top-level values without a section)
- All parent sections exist for dotted section names (e.g. "a.b" requires "a")
- No key in a section conflicts with a child section name
- No interpolation errors in values
z/Found config values without a top-level sectionznot part of a section©ÚlocÚmsg©r8   Útitler   r   r   Nz>Error parsing config section. Perhaps a section name is wrong?z	Section 'z' is not definedr   zfound conflicting values)r8   )ÚdefaultsrR   r   rS   r.   r"   Úranger!   rN   ÚoptionsÚ
startswith)r6   r8   Údefault_sectionÚ	err_titleÚerr_msgÚkÚerrÚsection_namesr:   rC   ÚiÚparentÚkeysÚotherÚchilds                  r$   r,   r,   ‚   sª  € ð €FØ#×,Ñ,Ó.€OÞØEˆ	Ø)ˆÙ5DÓE²_°�s 7Ô+±_ˆÐEØ�‰Ô+°3ÑHÔIÜ˜×.Ñ.Ó0Ó1€MØ ×)Ñ)×+ˆØ�}‰}˜SÓ!ˆÜ�qœ#˜d›)Ö$ˆAð ˜‘E‰{˜cÓ!ÙØ—X‘X˜d 2 A˜hÓ'ˆFð Õ*¨s¸&¿,¹,ÀsÓ:KÕ/KàTð ð  $¨i¸À¹U¹°}ÐDTÐ,UÑVÐW�Ø—‘Ô3¸3ÑPÔQÙñ %ô �=×(Ñ(¨Ó1Ó2ˆÛ"ˆEØ×Ñ ¨#¡×.Ó.Øœc '›l¨QÑ.Ð0Ð1×7Ñ7¸Ó<¸QÑ?�Ø•=Ø#(§;¡;¨sÓ#3Ð<VÑWÐX�CØ—M‘MÔ"7¸sÑ"CÖDô #ñ% ,ð0 €Mùò7 Fs   ¢F)c                 óô   • / nSnU Hm  nSnUR                  S5      US./nSU;  a  UR                  [        XcS95        M:  UR                  SS5      u  pxXp;  d  MU  UR                  [        XcS95        Mo     U$ )NzError parsing config overridesz*not a section value that can be overriddenr   rh   rk   r   )r"   rR   r   Úrsplit)	r6   r   r8   rr   r(   rs   ru   r:   Ú_s	            r$   r-   r-   ®   s   € ð €FØ0€IÛˆØ>ˆØ—y‘y “~¨gÑ6Ð7ˆØ�c‹>Ø�M‰MÔ/°sÑLÔMÙØ—Z‘Z  QÓ'‰
ˆàÕ'Ø�M‰MÔ/°sÑLÖMñ ð €Mr'   rB   c                 ó€   • [        U 5      n[        U[        5      (       a  [        R                  " U 5      (       a  U nU$ )z Interpret a single config value.)r   Ú
isinstancerd   r   Úsearch)rB   r9   s     r$   r2   r2   Á   s5   € ä˜5Ó!€Fô �&œ#×Ñ¤;×#5Ò#5°e×#<Ñ#<ØˆØ€Mr'   Úrootr=   rx   c           
      ó2  • UR                  5        H~  u  p4U SU 3R                  S5      n[        U[        5      (       a  [	        XUS9  M<  [        U[
        5      (       a   U Vs/ s H  n[        XX#/S9PM     snX'   Mq  [        XX#/S9X'   M€     gs  snf )z9Replace section reference placeholders with actual dicts.r   ©rx   N)r1   rX   r€   Údictr5   ÚlistÚ_get_section_ref)r‚   r=   rx   r(   rB   Ú
key_parentrJ   s          r$   r5   r5   Î   s�   € ð —j‘j–l‰
ˆØ�x˜q  Ð&×,Ñ,¨SÓ1ˆ
Ü�eœT×"Ñ"Ü! $°jÔAÜ˜œt×$Ñ$ÙRWÓXÒRWÈQÔ)¨$¸6¸-ÔHÑRWÑXˆD‹Iä(¨¸f¸]ÑKˆD‹Iò #ùò
 Ys   Á&Br„   c                óÔ  • [        U[        5      (       a(  UR                  S[         35      (       a  [	        U5      n[        U[        5      (       a[  UR                  [        5      (       aA  U[        :w  a7  UR                  [        SS5      R                  S5      nU nU H  nXE   nM	     U$ [        U[        5      (       a%  [        U;   a  U[        :w  a  SnUSS./n[        XvS9eU$ )	zFResolve a single section reference placeholder, or return value as-is.Ú"Ú r   r   ab  Can't reference whole sections or return values of function blocks inside a string or list

You can change your variable to reference a value instead. Keep in mind that it's not possible to interpolate the return value of a registered function, since variables are interpolated when the config is loaded, and registered functions are resolved afterwards.z'uses section variable in string or listrh   )r8   r   )r€   rd   rp   r   r   Úreplacer"   r   )r‚   rB   rx   r<   r9   ÚitemÚerr_descru   s           r$   r‡   r‡   Ü   sÞ   € ô �%œ×Ñ %×"2Ñ"2Ø
ŒNÐÐ÷#ñ #ô ˜eÓ$ˆä�5œ#×ÑØ×Ñœ^×,Ñ,Ø”^Ó#à—‘œn¨b°!Ó4×:Ñ:¸3Ó?ˆØˆÛˆDØ‘\ŠFñ àˆÜ	�Eœ3×	Ñ	¤N°eÓ$;ÀÌÓ@WðKð 	ð Ð&OÑPÐQˆÜ#¨3Ñ>Ð>Ø€Lr'   c                   óÊ   ^ • \ rS rSrS\S\S\S\S\4
U 4S jjrS\S\4S	 jrS\S\S\S\S
\\\4   S\4S jr	S\S\S\
\   S\S\S\\\4   S\SS4S jrS\S\4S jrSrU =r$ )rc   éü   Úparserr:   ÚoptionrB   r   c                 ó’   >• U(       a0  US   US   s=:X  a  S:X  a  O  O[         R                  " SU S35        [        TU ]  XX45      $ )Nr   r   Ú'zThe value [zZ] seems to be single-quoted, but values use JSON formatting, which requires double quotes.)ÚwarningsÚwarnÚsuperÚbefore_read)Úselfr‘   r:   r’   rB   Ú	__class__s        €r$   r˜   Ú _CustomInterpolation.before_readý   sO   ø€ ö �U˜1‘X  r¡Õ1¨cÖ1Ü�MŠMØ˜e˜Wð %Eð Eôô ‰wÑ" 6°FÓBÐBr'   rJ   c                 óú   • [         U;   a  U$  [        R                  " U5      n[	        U[
        5      (       a  U$ [        R                  " U5      R                  SS5      $ ! [        R                   a    Us $ f = f)zBCoerce a raw config value for use in a compound string expression.rŠ   z\")r   ÚjsonÚloadsÚJSONDecodeErrorr€   rd   ÚdumpsrŒ   )r™   rJ   Úparseds      r$   Ú_coerce_for_string_contextÚ/_CustomInterpolation._coerce_for_string_context  sq   € ô ˜QÓØˆHð	Ü—Z’Z “]ˆFô �fœc×"Ñ"ØˆMô �zŠz˜&Ó!×)Ñ)¨#¨uÓ5Ð5øô ×#Ñ#ó 	ØŠHð	ús   ŽA! Á!A:Á9A:rm   c           	      óŽ   ^ • / nT R                  XXdX%S5        [        U5      S:X  a  US   $ SR                  U 4S jU 5       5      $ )Nr   r   r‹   c              3   óF   >#   • U  H  nTR                  U5      v •  M     g 7f)N)r¢   )rI   Úpiecer™   s     €r$   rK   Ú2_CustomInterpolation.before_get.<locals>.<genexpr>)  s   øé € ÐMÊ1À%�t×6Ñ6°u×=Ð=Ê1ùs   ƒ!)r   r!   rN   )r™   r‘   r:   r’   rB   rm   ÚLs   `      r$   Ú
before_getÚ_CustomInterpolation.before_get  sG   ø€ ð ˆØ×Ñ˜¨°7ÀaÔHÜˆq‹6�Q‹;Ø�Q‘4ˆKØ�w‰wÔMÉ1ÓMÓMÐMr'   ÚaccumÚrestÚmapÚdepthNc           
      óh  • UR                  XRSUS9nU[        :”  a  [        X%U5      eU(       Ga]  UR                  S5      n	U	S:  a  UR	                  U5        gU	S:”  a  UR	                  USU	 5        XIS nUSS n
U
S:X  a  UR	                  S5        USS nGOèU
S:X  GaÏ  U R
                  R                  U5      nUc  S	U 3n[        X%U5      eUR                  S5      nUR                  S
S5      R                  SS5      nXKR                  5       S nUnUn [        U5      S:X  a…  UR                  US   5      nUU;  nU(       d&  UU   nUR                  5       UR                  5       :H  nU(       d  UU   nO¨XR                  US   5         R                  nU R!                  U5      nOv[        U5      S:X  aV  US   nUR                  US   5      nSnUR                  UUSUS9nUU:X  a"  U R!                  X SU 3   R                  5      nOSU 3n[        X%U5      eSU;   a4  [+        UR-                  USS95      nU R/                  UUUUUUUS-   5        O$UR	                  U5        OSU< 3n[        X%U5      eU(       a  GM\  gg! ["        [$        [&        4 a    [)        X%X�5      Sef = f)z+Resolve variable references like ${foo.bar}T)ÚrawÚfallbackÚ$r   Nr   é   Ú{z%bad interpolation variable reference Ú:r   Ú__FALLBACK__zMore than one ':' found: )r°   z+'$' must be followed by '$' or '{', found: )r3   r   r   ÚfindrR   Ú_KEYCREÚmatchr   ÚgrouprŒ   r}   Úendr!   re   rX   ÚnameÚ_get_section_nameÚKeyErrorr
   r	   r   r…   r1   r   )r™   r‘   r’   r«   r¬   r:   r­   r®   ÚrawvalÚpÚcÚmru   Úorig_varrC   ÚsectÚoptÚis_section_refr°   rJ   r[   r±   Únew_maps                          r$   r   Ú _CustomInterpolation.interpolate+  sÔ  € ð" —‘˜G°À�ÐEˆØÔ*Ó*Ü)¨&¸6ÓBÐBßØ—	‘	˜#“ˆAØ�1‹uØ—‘˜TÔ"ØØ�1‹uØ—‘˜T " 1˜XÔ&Ø˜B�x�à�Q�q�	ˆAØ�C‹xØ—‘˜SÔ!Ø˜A˜B�x’Ø�c”à—L‘L×&Ñ& tÓ,�Ø‘9ØAÀ$ÀÐH�CÜ2°6ÀCÓHÐHØŸ7™7 1›:�Ø×'Ñ'¨¨SÓ1×8Ñ8¸¸aÓ@�ØŸE™E›G˜I��Ø�Ø�ð# Ü˜4“y A“~Ø$×0Ñ0°°a±Ó9˜ð *-°C©˜Þ-Ø"% c¡(˜CØ-0¯Y©Y«[¸F¿L¹L»NÑ-J˜NÞ-Ø # C¡™Að ,2×2DÑ2DÀTÈ!ÁWÓ2MÑ+N×+SÑ+S˜LØ $× 6Ñ 6°|Ó D™AÜ˜T› a›Ø# A™w˜Ø$×0Ñ0°°a±Ó9˜Ø#1˜Ø"ŸJ™J t¨S°dÀX˜JÐN˜ð  ›=Ø $× 6Ñ 6°vÀÀaÈÀu¸oÑ7N×7SÑ7SÓ T˜Aøð !:¸$¸Ð@˜Ü6°vÈÓLÐLð
 ˜!“8Ü" 6§<¡<°¸$ <Ð#?Ó@�GØ×$Ñ$ V¨S°%¸¸DÀ'È5ÐSTÉ9ÕUà—L‘L •Oðg òj JNÐO�Ü.¨vÀÓDÐD÷G ‹døôp !¤.´-Ð@ó  Ü9Ø¨óàð ð ús    ÄA!J Å<1J Æ.A$J ÈJ Ê#J1r¼   c                 ó   • S[          U S3$ )a$  Generate the name of a section. Note that we use a quoted string here
so we can use section references within lists and load the list as
JSON. Since section references can't be used within strings, we don't
need the quoted vs. unquoted distinction like we do for variables.

Examples (assuming section = {"foo": 1}):
    - value: ${section.foo} -> value: 1
    - value: "hello ${section.foo}" -> value: "hello 1"
    - value: ${section} -> value: {"foo": 1}
    - value: "${section}" -> value: {"foo": 1}
    - value: "hello ${section}" -> invalid
rŠ   r   )r™   r¼   s     r$   r½   Ú&_CustomInterpolation._get_section_name„  s   € ð ”>Ð" 4 &¨Ð*Ð*r'   © )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   rd   r˜   r¢   r   r©   r   Úintr   r½   Ú__static_attributes__Ú__classcell__)rš   s   @r$   rc   rc   ü   s!  ø† ð	CØ"ð	CØ-0ð	CØ:=ð	CØFIð	Cà	÷	Cð6¨Cð 6°Cô 6ðNàðNð ðNð ð	Nð
 ðNð �s˜C�x‘.ðNð 
ôNð(WEàðWEð ðWEð �C‰yð	WEð
 ðWEð ðWEð �#�s�(‰^ðWEð ðWEð 
ôWEðr+ cð +¨c÷ +ò +r'   rc   r@   r`   )T)r‹   ))rT   r�   r•   Úconfigparserr   r   r   r   r   r   r	   r
   r   Útypingr   r   r   Ú
_constantsr   Ú_errorsr   Úutilr   r   r   rd   Úboolr…   r@   r4   Ú	frozensetr`   r*   r†   r,   r-   r2   r5   r‡   rc   Ú__all__rË   r'   r$   Ú<module>rÛ      sá  ðÛ 	Û Û ÷
÷ 
õ 
÷ #Ñ "å &Ý *ß ;Ñ ;ð Ø "ò	2Ø
ð2ð ð2ð �C˜�H‰~ð	2ð
 
ˆ#ˆsˆ(�^õ2ðj
˜T # s (™^ð 
¸¸SÀ#¸X¹ð 
È4ô 
ð  Ù#,£;ò	 (Ø
ˆs�Cˆx‰.ð (ð ð (ð ˜C‘.ð	 (ð
 	õ (ñF 4ð °<õ ð)¨,ð )¸4Ð@UÑ;Vô )ðXØðØ,0°°c°©Nðà	Ð
Ñ ôð&
˜Cð 
 Cô 
ð ?AñLØ
ˆs�Cˆx‰.ðLØ $ S¨# X¡ðLØ8;ðLà	õLð >@òØ
ˆs�Cˆx‰.ðØ!$ðØ15°c±ðàõô@U+Ð0ô U+ðp Ð-Ð
.�r'   