ó
    óýj^(  ã                  ó"  • S SK Jr  S SKrS SK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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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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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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,J-r-  S S"K.J/r/  \(       a  S S#KJ0r0  \" S$\0S%9r1SDS& jr2SESFS( jjr3SGS) jr4S'S*.SHS+ jjr5SDS, jr6SIS- jr7\Rp                  " S.5      r9 SJS/ jr:SKS0 jr;SLS1 jr<S'S'S2S3.         SMS4 jjr=SNS5 jr>SOS6 jr?SPS7 jrSQSRS8 jjr@SSSTS9 jjrASUS: jrBSVS; jrCSWS< jrDSXS= jrESYS> jrFSZS? jrGS[S@ jrHS\SA jrIS]SB jrJS^SC jrKg)_é    )ÚannotationsN)ÚIterable)ÚMapping)ÚIO)ÚTYPE_CHECKING)ÚAny)ÚTypeVar)Úparse_rfc3339)Ú	Container)ÚUnexpectedCharError)ÚCUSTOM_ENCODERS©ÚAoT)ÚArray)ÚBool)ÚComment)ÚDate)ÚDateTime)Ú	DottedKey)ÚFloat)ÚInlineTable)ÚInteger)ÚItem)ÚKey)Ú	SingleKey)ÚString)Ú
StringType)ÚTable)ÚTime)ÚTrivia©Ú
Whitespace)Úitem)ÚParser©ÚTOMLDocument)ÚEncoderÚE)Úboundc                ó   • [        U 5      $ )z:
Parses a string into a TOMLDocument.

Alias for parse().
)Úparse©Ústrings    Ú6/usr/local/lib/python3.13/site-packages/tomlkit/api.pyÚloadsr/   0   s   € ô �‹=Ðó    Fc                óˆ  • [        U [        [        [        45      (       a/  U(       d  U R	                  5       $ [        U SS9R	                  5       $ [        U [        5      (       a!  [        [        U 5      US9R	                  5       $  U R	                  5       $ ! [         a   nS[        U 5       S3n[        U5      UeSnAff = f)z%
Dumps a TOMLDocument into a string.
T)Ú
_sort_keysz.Expecting Mapping or TOML Table or Container, z givenN)Ú
isinstancer   r   r   Ú	as_stringr#   r   ÚdictÚAttributeErrorÚtypeÚ	TypeError)ÚdataÚ	sort_keysÚexÚmsgs       r.   Údumpsr=   9   s§   € ô �$œ¤¬YÐ7×8Ñ8ÞØ—>‘>Ó#Ð#ä�D TÑ*×4Ñ4Ó6Ð6ä�$œ× Ñ Ü”D˜“J¨9Ñ5×?Ñ?ÓAÐAð%ð
 �~‰~ÓÐøÜó %Ø>¼tÀD»z¸lÈ&ÐQˆÜ˜‹n "Ð$ûð%ús   ÂB Â
CÂ!B<Â<Cc                ó4   • [        U R                  5       5      $ )z-
Load toml document from a file-like object.
)r+   Úread)Úfps    r.   ÚloadrA   Q   s   € ô �—‘“ÓÐr0   ©r:   c               ó4   • UR                  [        XS95        g)zì
Dump a TOMLDocument into a writable file stream.

:param data: a dict-like object to dump
:param sort_keys: if true, sort the keys in alphabetic order

:Example:

>>> with open("output.toml", "w") as fp:
...     tomlkit.dump(data, fp)
rB   N)Úwriter=   )r9   r@   r:   s      r.   ÚdumprE   X   s   € ð ‡H�HŒU�4Ñ-Õ.r0   c                ó4   • [        U 5      R                  5       $ )z/
Parses a string or bytes into a TOMLDocument.
)r$   r+   r,   s    r.   r+   r+   g   s   € ô �&‹>×ÑÓ!Ð!r0   c                 ó   • [        5       $ )z&
Returns a new TOMLDocument instance.
r%   © r0   r.   ÚdocumentrI   n   s   € ô ‹>Ðr0   zf(?:0x[0-9a-fA-F](?:_?[0-9a-fA-F])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|[+-]?(?:0|[1-9](?:_?[0-9])*))c                óä   • [        U [        5      (       aH  [        R                  U 5      (       d  [	        SU < 35      e[        [        U S5      [        5       U 5      $ [        [        U 5      5      $ )a  Create an integer item from a number or string.

When ``raw`` is a string it must be a valid TOML v1.0.0 integer
literal; the original text is then preserved verbatim so grouping
underscores (e.g. ``"1_000"``) survive ``dumps()``. Anything else
raises ``ValueError``.
zInvalid TOML integer: r   )	r3   ÚstrÚ_INTEGER_REÚ	fullmatchÚ
ValueErrorr   Úintr    r#   ©Úraws    r.   ÚintegerrR   …   sZ   € ô �#”s×ÑÜ×$Ñ$ S×)Ñ)ÜÐ5°c±WÐ=Ó>Ð>Ü”s˜3 “{¤F£H¨cÓ2Ð2Ü”�C“‹>Ðr0   c                ó*   • [        [        U 5      5      $ )z-Create an float item from a number or string.)r#   ÚfloatrP   s    r.   Úfloat_rU   ”   s   € ä”�c“
ÓÐr0   c                óT   • [        [        U [        5      (       a	  U S:H  5      $ U 5      $ )z+Turn `true` or `false` into a boolean item.Útrue)r#   r3   rK   rP   s    r.   ÚbooleanrX   ™   s%   € ä¤¨C´×!5Ñ!5��v‘Ó?Ð?¸3Ó?Ð?r0   T)ÚliteralÚ	multilineÚescapec               ó\   • [         R                  " X5      n[        R                  " XU5      $ )a  Create a string item.

By default, this function will create *single line basic* strings, but
boolean flags (e.g. ``literal=True`` and/or ``multiline=True``)
can be used for personalization.

For more information, please check the spec: `<https://toml.io/en/v1.0.0#string>`__.

Common escaping rules will be applied for basic strings.
This can be controlled by explicitly setting ``escape=False``.
Please note that, if you disable escaping, you will have to make sure that
the given strings don't contain any forbidden character or sequence.
)Ú_StringTypeÚselectr   Úfrom_raw)rQ   rY   rZ   r[   Útype_s        r.   r-   r-   ž   s%   € ô( ×Ò˜wÓ2€EÜ�?Š?˜3 vÓ.Ð.r0   c                ó‚   • [        U 5      n[        U[        R                  5      (       d  [	        S5      e[        U5      $ )zCreate a TOML date.z!date() only accepts date strings.)r
   r3   Ú	_datetimeÚdaterN   r#   ©rQ   Úvalues     r.   rc   rc   ¶   ó3   € ä˜#Ó€EÜ�eœYŸ^™^×,Ñ,ÜÐ<Ó=Ð=ä�‹;Ðr0   c                ó‚   • [        U 5      n[        U[        R                  5      (       d  [	        S5      e[        U5      $ )zCreate a TOML time.z!time() only accepts time strings.)r
   r3   rb   ÚtimerN   r#   rd   s     r.   rh   rh   ¿   rf   r0   c                ó‚   • [        U 5      n[        U[        R                  5      (       d  [	        S5      e[        U5      $ )zCreate a TOML datetime.z)datetime() only accepts datetime strings.)r
   r3   rb   ÚdatetimerN   r#   rd   s     r.   rj   rj   È   s5   € ä˜#Ó€EÜ�eœY×/Ñ/×0Ñ0ÜÐDÓEÐEä�‹;Ðr0   c                ót   • [        U 5      n[        U[        5      (       d  [        S[	        U5       35      eU$ )zÇCreate an array item for its string representation.

:Example:

>>> array("[1, 2, 3]")  # Create from a string
[1, 2, 3]
>>> a = array()
>>> a.extend([1, 2, 3])  # Create from a list
>>> a
[1, 2, 3]
zExpected an array, got )re   r3   r   rN   r7   )rQ   Úvs     r.   Úarrayrm   Ñ   s6   € ô 	ˆc‹
€AÜ�aœ×ÑÜÐ2´4¸³7°)Ð<Ó=Ð=Ø€Hr0   c                ó>   • [        [        5       [        5       SU 5      $ )a  Create an empty table.

:param is_super_table: if true, the table is a super table

:Example:

>>> doc = document()
>>> foo = table(True)
>>> bar = table()
>>> bar.update({'x': 1})
>>> foo.append('bar', bar)
>>> doc.append('foo', foo)
>>> print(doc.as_string())
[foo.bar]
x = 1
F)r   r   r    )Úis_super_tables    r.   Útablerp   ã   s   € ô" ”“œf›h¨¨~Ó>Ð>r0   c                 ó8   • [        [        5       [        5       SS9$ )zŽCreate an inline table.

:Example:

>>> table = inline_table()
>>> table.update({'x': 1, 'y': 2})
>>> print(table.as_string())
{x = 1, y = 2}
T)Únew)r   r   r    rH   r0   r.   Úinline_tablers   ÷   s   € ô ”y“{¤F£H°$Ñ7Ð7r0   c                 ó   • [        / 5      $ )z®Create an array of table.

:Example:

>>> doc = document()
>>> aot = aot()
>>> aot.append(item({'x': 1}))
>>> doc.append('foo', aot)
>>> print(doc.as_string())
[[foo]]
x = 1
r   rH   r0   r.   Úaotru     s   € ô ˆr‹7€Nr0   c                óÀ   • [        U [        5      (       a  [        U 5      $ U  Vs/ s H  n[        U5      PM     nn[        U5      S:X  a  US   $ [	        U5      $ s  snf )zîCreate a key from a string. When a list of string is given,
it will create a dotted key.

:Example:

>>> doc = document()
>>> doc.append(key('foo'), 1)
>>> doc.append(key(['bar', 'baz']), 2)
>>> print(doc.as_string())
foo = 1
bar.baz = 2
é   r   )r3   rK   r   Úlenr   )ÚkÚ_kÚkeyss      r.   Úkeyr|     sV   € ô �!”S×ÑÜ˜‹|ÐÙ$%Ó&¢A˜bŒI�bŽM¡A€DÐ&Ü
ˆ4ƒy�Aƒ~Ø�A‰wˆÜ�T‹?Ðùò 's   ¥Ac                ó¢   • [        U 5      nUR                  5       nUR                  5       (       d  UR                  [        UR
                  S9eU$ )zyParse a simple value from a string.

:Example:

>>> value("1")
1
>>> value("true")
True
>>> value("[1, 2, 3]")
[1, 2, 3]
©Úchar)r$   Ú_parse_valueÚendÚparse_errorr   Ú_current)rQ   Úparserrl   s      r.   re   re   )  sF   € ô �C‹[€FØ×ÑÓ€AØ�:‰:�<‰<Ø× Ñ Ô!4¸6¿?¹?Ð ÐKÐKØ€Hr0   c                ó¦   • [        U 5      nUR                  SS9u  p#UR                  5       (       d  UR                  [        UR
                  S9eX#4$ )zÛParse a key-value pair from a string.

Anything other than whitespace or a comment after the pair is an error,
as it is when the same text is given to :func:`parse`.

:Example:

>>> key_value("foo = 1")
(Key('foo'), 1)
T)Úparse_commentr~   )r$   Ú_parse_key_valuer�   r‚   r   rƒ   )Úsrcr„   ry   rl   s       r.   Ú	key_valuer‰   <  sO   € ô �C‹[€FØ×"Ñ"°Ð"Ð6�D€AØ�:‰:�<‰<Ø× Ñ Ô!4¸6¿?¹?Ð ÐKÐKØˆ4€Kr0   c                ó   • [        U SS9$ )z"Create a whitespace from a string.T)Úfixedr!   )rˆ   s    r.   ÚwsrŒ   N  s   € ä�c Ñ&Ð&r0   c                 ó   • [        S5      $ )zCreate a newline item.Ú
)rŒ   rH   r0   r.   Únlr�   S  s   € äˆd‹8€Or0   c                óz   • U R                  S5      nSR                  S U 5       5      n[        [        SUS95      $ )z}Create a comment item.

A multiline string produces one ``#``-prefixed line per line so that the
result is still valid TOML.
rŽ   c              3  ó<   #   • U  H  o(       a  S U 3OSv •  M     g7f)z# Ú#NrH   )Ú.0Úlines     r.   Ú	<genexpr>Úcomment.<locals>.<genexpr>_  s   é € ÐHÂ%¸$­˜2˜d˜V™°#Ô5Â%ùs   ‚z  )Ú
comment_wsÚcomment)ÚsplitÚjoinr   r    )r-   ÚlinesÚrendereds      r.   r˜   r˜   X  s8   € ð �L‰L˜Ó€EØ�y‰yÑHÁ%ÓHÓH€HÜ”6 T°8Ñ<Ó=Ð=r0   c                ó2   • [         R                  " U 5        U $ )aZ  Add a custom encoder, which should be a function that will be called
if the value can't otherwise be converted.

The encoder should return a TOMLKit item or raise a ``ConvertError``.

Example:
    @register_encoder
    def encode_custom_dict(obj, _parent=None, _sort_keys=False):
        if isinstance(obj, CustomDict):
            tbl = table()
            for key, value in obj.items():
                # Pass along parameters when encoding nested values
                tbl[key] = item(value, _parent=tbl, _sort_keys=_sort_keys)
            return tbl
        raise ConvertError("Not a CustomDict")
)r   Úappend©Úencoders    r.   Úregister_encoderr¡   c  s   € ô" ×Ò˜7Ô#Ø€Nr0   c                ó˜   • [         R                  " [        5         [        R                  " U 5        SSS5        g! , (       d  f       g= f)zUnregister a custom encoder.N)Ú
contextlibÚsuppressrN   r   ÚremoverŸ   s    r.   Úunregister_encoderr¦   x  s*   € ä	×	Ò	œZÕ	(Ü×Ò˜wÔ'÷ 
)×	(Ö	(ús	   ›;»
A	)r-   zstr | bytesÚreturnr&   )F)r9   úMapping[str, Any]r:   Úboolr§   rK   )r@   zIO[str] | IO[bytes]r§   r&   )r9   r¨   r@   zIO[str]r:   r©   r§   ÚNone)r§   r&   )rQ   z	str | intr§   r   )rQ   zstr | floatr§   r   )rQ   z
str | boolr§   r   )
rQ   rK   rY   r©   rZ   r©   r[   r©   r§   r   )rQ   rK   r§   r   )rQ   rK   r§   r   )rQ   rK   r§   r   )z[])rQ   rK   r§   r   )N)ro   zbool | Noner§   r   )r§   r   )r§   r   )ry   zstr | Iterable[str]r§   r   )rQ   rK   r§   Ú_Item)rˆ   rK   r§   ztuple[Key, _Item])rˆ   rK   r§   r"   )r§   r"   )r-   rK   r§   r   )r    r(   r§   r(   )r    r'   r§   rª   )LÚ
__future__r   r£   rj   rb   ÚreÚcollections.abcr   r   Útypingr   r   r   r	   Útomlkit._utilsr
   Útomlkit.containerr   Útomlkit.exceptionsr   Útomlkit.itemsr   r   r   r   r   r   r   r   r   r   r   r   r«   r   r   r   r   r]   r   r   r    r"   r#   Útomlkit.parserr$   Útomlkit.toml_documentr&   r'   r(   r/   r=   rA   rE   r+   rI   ÚcompilerL   rR   rU   rX   r-   rc   rh   rm   rp   rs   ru   r|   re   r‰   rŒ   r�   r˜   r¡   r¦   rH   r0   r.   Ú<module>r·      s_  ðÝ "ã Û Û 	å $Ý #Ý Ý  Ý Ý å (Ý 'Ý 2Ý )Ý Ý Ý Ý !Ý Ý "Ý #Ý Ý %Ý !Ý 'Ý Ý #Ý  Ý 3Ý Ý Ý  Ý $Ý &Ý !Ý >ö Ý%á�˜7Ñ#€Aôö%ô0ð EJ÷ /ô"ôð �jŠjð	ó€ðôôô
@ð ØØñ/Ø	ð/ð ð/ð ð	/ð
 ð/ð õ/ô0ôôöö$?ô(
8ôô ô*ô&ô$'ô
ô
>ôõ*(r0   