
    5i                       S SK J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-  SAS" jr.SBSCS$ jjr/SDS% jr0S#S&.SES' jjr1SAS( jr2SFS) jr3SGS* jr4SHS+ jr5SIS, jr6S#S#S-S..         SJS/ jjr7SKS0 jr8SLS1 jr9SMS2 jrSNSOS3 jjr:SPSQS4 jjr;SRS5 jr<SSS6 jr=STS7 jr>SUS8 jr?SVS9 jr@SWS: jrASXS; jrBSYS< jrC\
" S=\S>9rDSZS? jrES[S@ jrFg)\    )annotationsN)Mapping)IO)Iterable)TypeVar)parse_rfc3339)	Container)UnexpectedCharError)CUSTOM_ENCODERSAoT)Array)Bool)Comment)Date)DateTime)	DottedKey)Encoder)Float)InlineTable)Integer)Item)Key)	SingleKey)String)
StringType)Table)Time)Trivia
Whitespaceitem)ParserTOMLDocumentc                    [        U 5      $ )z:
Parses a string into a TOMLDocument.

Alias for parse().
)parsestrings    +lib/python3.13/site-packages/tomlkit/api.pyloadsr,   (   s     =    Fc                   [        U [        [        [        45      (       d(  [        U [        5      (       a  [        [        U 5      US9n  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.
)
_sort_keysz.Expecting Mapping or TOML Table or Container, z givenN)
isinstancer   r   r	   r   r#   dict	as_stringAttributeErrortype	TypeError)data	sort_keysexmsgs       r+   dumpsr:   1   s     dUK;<<gB B DJ95% ~~ %>tDzl&Qn"$%s   
A 
B$A??Bc                4    [        U R                  5       5      $ )z-
Load toml document from a file-like object.
)r(   read)fps    r+   loadr>   C   s     r-   r7   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)
r?   N)writer:   )r6   r=   r7   s      r+   dumprB   J   s     HHU4-.r-   c                4    [        U 5      R                  5       $ )z/
Parses a string or bytes into a TOMLDocument.
)r$   r(   r)   s    r+   r(   r(   Y   s     &>!!r-   c                     [        5       $ )z&
Returns a new TOMLDocument instance.
r%    r-   r+   documentrF   `   s     >r-   c                *    [        [        U 5      5      $ )z/Create an integer item from a number or string.)r#   intraws    r+   integerrK   h   s    C>r-   c                *    [        [        U 5      5      $ )z-Create an float item from a number or string.)r#   floatrI   s    r+   float_rN   m   s    c
r-   c                    [        U S:H  5      $ )z+Turn `true` or `false` into a boolean item.truer"   rI   s    r+   booleanrQ   r   s    vr-   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)rJ   rR   rS   rT   type_s        r+   r*   r*   w   s%    ( w2E??3v..r-   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   r0   	_datetimedate
ValueErrorr#   rJ   values     r+   r\   r\      3    #EeY^^,,<==;r-   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   r0   r[   timer]   r#   r^   s     r+   rb   rb      r`   r-   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   r0   r[   datetimer]   r#   r^   s     r+   rd   rd      s5    #EeY//00DEE;r-   c                    [        U 5      $ )zCreate 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]
)r_   rI   s    r+   arrayrf      s     :r-   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+   tableri      s    " fh~>>r-   c                 8    [        [        5       [        5       SS9$ )zCreate 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   rE   r-   r+   inline_tablerl      s     y{FH$77r-   c                     [        / 5      $ )zCreate 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   rE   r-   r+   aotrn      s     r7Nr-   c                    [        U [        5      (       a  [        U 5      $ [        U  Vs/ s H  n[	        U5      PM     sn5      $ s  snf )zCreate 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
)r0   strr   r   key)k_ks     r+   rq   rq      s<     !S|*"c"g*++*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)rJ   parservs      r+   r_   r_      sF     C[FA::<<  !46?? KKHr-   c                4    [        U 5      R                  5       $ )z[Parse a key-value pair from a string.

:Example:

>>> key_value("foo = 1")
(Key('foo'), 1)
)r$   _parse_key_valuesrcs    r+   	key_valuer     s     #;''))r-   c                    [        U SS9$ )z"Create a whitespace from a string.T)fixedr    r~   s    r+   wsr     s    c&&r-   c                     [        S5      $ )zCreate a newline item.
)r   rE   r-   r+   nlr     s    d8Or-   c                .    [        [        SSU -   S95      $ )zCreate a comment item.z  z# )
comment_wscomment)r   r   r)   s    r+   r   r   $  s    6T4&=ABBr-   E)boundc                2    [         R                  " U 5        U $ )zAdd a custom encoder, which should be a function that will be called
if the value can't otherwise be converted. It should takes a single value
and return a TOMLKit item or raise a ``ConvertError``.
)r   appendencoders    r+   register_encoderr   ,  s    
 7#Nr-   c                    [         R                  " [        5         [        R                  " U 5        SSS5        g! , (       d  f       g= f)zUnregister a custom encoder.N)
contextlibsuppressr]   r   remover   s    r+   unregister_encoderr   5  s*    			Z	(w' 
)	(	(s	   ;
A	)r*   zstr | bytesreturnr&   )F)r6   r   r7   boolr   rp   )r=   zIO[str] | IO[bytes]r   r&   )r6   r   r=   zIO[str]r7   r   r   None)r   r&   )rJ   z	str | intr   r   )rJ   zstr | floatr   r   )rJ   rp   r   r   )
rJ   rp   rR   r   rS   r   rT   r   r   r   )rJ   rp   r   r   )rJ   rp   r   r   )rJ   rp   r   r   )z[])rJ   rp   r   r   )N)rh   zbool | Noner   r   )r   r   )r   r   )rr   zstr | Iterable[str]r   r   )rJ   rp   r   _Item)r   rp   r   ztuple[Key, _Item])r   rp   r   r!   )r   r!   )r*   rp   r   r   )r   r   r   r   )r   r   r   r   )G
__future__r   r   rd   r[   collections.abcr   typingr   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   rV   r   r   r   r!   r#   tomlkit.parserr$   tomlkit.toml_documentr&   r,   r:   r>   rB   r(   rF   rK   rN   rQ   r*   r\   rb   rf   ri   rl   rn   rq   r_   r   r   r   r   r   r   r   rE   r-   r+   <module>r      s8   "   #    ( ' 2 )    !  " # !  % ! '  #   3     $  ! .%$ ;@ /"

 /	/ / 	/
 / /0?(
8 ,$&*'

C
 Cw(r-   