bg8ddlmZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZ ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%ddl&m'Z'ddl(m)Z)dbd#Z*dcddd*Z+ded-Z,d$d.dfd1Z-dbd2Z.dgd3Z/dhd7Z0did:Z1djd<Z2d$d$d=d>dkdCZ3dldEZ4dmdGZ5dndIZdodpdKZ6dodqdOZ7drdQZ8dsdSZ9dtdWZ:dudYZ;dvd\ZdydaZ?dS)z) annotationsN)Mapping)IO)Iterable) parse_rfc3339) Container)UnexpectedCharErrorAoT)Array)Bool)Comment)Date)DateTime) DottedKey)Float) InlineTable)Integer)Item)Key) SingleKey)String) StringType)Table)Time)Trivia Whitespaceitem)Parser TOMLDocumentstring str | bytesreturnr#c t|S)zF Parses a string into a TOMLDocument. Alias for parse(). )parser$s \/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/tomlkit/api.pyloadsr+$s ==Fdatar sort_keysboolstrc&t|ts3t|trtt ||} |S#t $r(}dt|d}t||d}~wwxYw)z- Dumps a TOMLDocument into a string. ) _sort_keysz%Expecting Mapping or TOML Container, z givenN) isinstancerrr dict as_stringAttributeErrortype TypeError)r-r.exmsgs r*dumpsr;-s dI & &6:dG+D+D6DJJ9555%~~ %%%Hd4jjHHHnn"$%s A B(#B  BfpIO[str] | IO[bytes]cDt|S)z5 Load toml document from a file-like object. )r(read)r<s r*loadr@=s   r,r.IO[str]NonecN|t||dS)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 rAN)writer;)r-r<r.s r*dumprFDs)HHU49 - - -.....r,cDt|S)z7 Parses a string or bytes into a TOMLDocument. )r!r(r)s r*r(r(Ns &>>   ! !!r,ctS)z. Returns a new TOMLDocument instance. r"r,r*documentrJUs >>r,raw str | intrc:tt|S)z/Create an integer item from a number or string.)r intrKs r*integerrP]s C>>r, str | floatrc:tt|S)z-Create an float item from a number or string.)r floatrOs r*float_rTbs c  r,r c(t|dkS)z+Turn `true` or `false` into a boolean item.truerrOs r*booleanrWgs v  r,T)literal multilineescaperXrYrZrcXtj||}tj|||S)aBCreate 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: ``__. 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. ) _StringTypeselectrfrom_raw)rKrXrYrZtype_s r*r$r$ls*(  w 2 2E ?3v . ..r,rct|}t|tjst dt |S)zCreate a TOML date.z!date() only accepts date strings.)rr3 _datetimedate ValueErrorr rKvalues r*rbrb> #  E eY^ , ,><=== ;;r,rct|}t|tjst dt |S)zCreate a TOML time.z!time() only accepts time strings.)rr3ratimercr rds r*rhrhrfr,rct|}t|tjst dt |S)zCreate a TOML datetime.z)datetime() only accepts datetime strings.)rr3radatetimercr rds r*rjrjs@ #  E eY/ 0 0FDEEE ;;r,r c(|d}t|S)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] Nz[])rerOs r*arrayrls { ::r,is_super_table bool | NonercVtttd|S)aFCreate 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)rrr)rms r*tablerps " fhh~ > >>r,rcVtttdS)zCreate an inline table. :Example: >>> table = inline_table() >>> table.update({'x': 1, 'y': 2}) >>> print(table.as_string()) {x = 1, y = 2} T)new)rrrrIr,r* inline_tablerss! y{{FHH$ 7 7 77r,r c tgS)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 rIr,r*aotrus r77Nr,kstr | Iterable[str]rc|t|trt|Std|DS)aCreate 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 c,g|]}t|SrI)key).0_ks r* zkey..s***"c"gg***r,)r3r0rr)rvs r*rzrzs?!S|| ***** + ++r,_Itemct|}|}|s!|t|j|S)zParse a simple value from a string. :Example: >>> value("1") 1 >>> value("true") True >>> value("[1, 2, 3]") [1, 2, 3] )char)r! _parse_valueend parse_errorr _current)rKparservs r*reresRC[[FA ::<<L  !46? KKK Hr,srctuple[Key, _Item]cDt|S)zkParse a key-value pair from a string. :Example: >>> key_value("foo = 1") (Key('foo'), 1) )r!_parse_key_valuers r* key_valuers #;; ' ' ) ))r,rc$t|dS)z"Create a whitespace from a string.T)fixedrrs r*wsrs c & & &&r,c tdS)zCreate a newline item. )rrIr,r*nlrs d88Or,rcDttdd|zS)zCreate a comment item.z z# ) comment_wscomment)rrr)s r*rrs! 6T4&=AAA B BBr,)r$r%r&r#)F)r-rr.r/r&r0)r<r=r&r#)r-rr<rBr.r/r&rC)r&r#)rKrLr&r)rKrQr&r)rKr0r&r ) rKr0rXr/rYr/rZr/r&r)rKr0r&r)rKr0r&r)rKr0r&r)N)rKr0r&r )rmrnr&r)r&r)r&r )rvrwr&r)rKr0r&r~)rr0r&r)rr0r&r)r&r)r$r0r&r)@ __future__rrjracollections.abcrtypingrrtomlkit._utilsrtomlkit.containerrtomlkit.exceptionsr tomlkit.itemsr r r rrrrrrrrr~rrrrr\rrrrr tomlkit.parserr!tomlkit.toml_documentr#r+r;r@rFr(rJrPrTrWr$rbrhrlrprsrurzrerrrrrIr,r*rs+""""""######((((((''''''222222!!!!!!""""""######%%%%%%!!!!!!''''''###### 333333 $$$$$$!!!!!!...... % % % % % ;@//////""""   //////0$?????( 8 8 8 8     ,,,,$    &****''''  CCCCCCr,