f^}[lddlZddlZddlZddlmZddlmZejdkreZ ddZ ddZ dZ dZ d ZGd d eZGd d eZGddeZGddeZGddeZGddeZdS)N)Decimal)InlineTableDictc~|jstdt||}|||S)aWrites out dict as toml to a file Args: o: Object to dump into toml f: File descriptor where the toml should be stored encoder: The ``TomlEncoder`` to use for constructing the output string Returns: String containing the toml corresponding to dictionary Raises: TypeError: When anything other than file descriptor is passed z0You can only dump an object to a file descriptor)encoder)write TypeErrordumps)ofrds /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/toml/encoder.pydumpr sD 7LJKKK a!!!AGGAJJJ Hc d}|t|j}||d\}}||z }t|g}|rd|D}|D]}||vrt d||z }|}|D]d} ||| | \}} |s|s)| s'|r|dddkr|dz }|d| zd zz }|r||z }| D]} | | || d z| z<e|}||S) aStringifies input dict as toml Args: o: Object to dump into toml encoder: The ``TomlEncoder`` to use for constructing the output string Returns: String containing the toml corresponding to dict Examples: ```python >>> import toml >>> output = { ... 'a': "I'm a string", ... 'b': ["I'm", "a", "list"], ... 'c': 2400 ... } >>> toml.dumps(output) 'a = "I'm a string" b = [ "I'm", "a", "list",] c = 2400 ' ``` Nc,g|]}t|S)id).0sections r zdumps..@sDDDwr'{{DDDrzCircular reference detectedz  [] .) TomlEncoder __class__ dump_sectionsrvalues ValueErrorget_empty_table) r rretval addtoretvalsections outer_objs section_ids outer_obj newsectionsr addtosectionsss rr r "s.Fak**#11!R88K kFQ%%J DD(//2C2CDDD # @ @IK'' !>???(k! --//  B BG)0)>)>!7*,*, &K *; *} *#fRSSkV33dNF#-%//*k)F" B B1>q1A GcMA-.. B' ( Mrctjdkr:t|dr*t|tr|d}d|z}|ddkr |dd}|d}|s|d r |dd }|r,|d d}|d d }|d }t|dkrd }|ds |dd}|ddd|d<|d|dk}|dd|r<|d|dkr*| }|dz}|dd|r|d|dk*|rd}nd}|d|z|dzg|ddz}t|dktd |dzd zS)Nrdecodezutf-8z%rru'"z\'z\"z\xz\\\xu00) sys version_infohasattr isinstancestrr/ startswithreplacesplitlenunicode)v singlequoteijoinxjoiners r _dump_strrHVs $71h#7#7Jq#> ! !% . . 6 6ud C CCrc|}||S|ddS)Ni) utcoffset isoformat)rCrOs r _dump_timerQys: I{{}} ;;==" rc8eZdZedfdZdZdZdZdZdZ dS) rFc||_||_ttttt |jtdtdtttttj dtj ttjdi |_dS)NcDt|SN)rBlowerrLs rz&TomlEncoder.__init__..sGAJJ,,..rc|SrUrrLs rrWz&TomlEncoder.__init__..s1rcR|ddS)Nz+00:00Z)rPr?rLs rrWz&TomlEncoder.__init__..s)>)>x)M)Mrc*|SrU)rPrLs rrWz&TomlEncoder.__init__..sQ[[]]r)_dictpreserver=rHrBlist dump_listboolintfloatrMrdatetimetimerQdate dump_funcs)selfr\r]s r__init__zTomlEncoder.__init__sf    Y $. ..  ; [  MM M: M22  rc*|SrU)r\)rgs rr$zTomlEncoder.get_empty_tableszz||rctd}|D]-}|dt||zdzz }.|dz }|S)Nr ,])rB dump_value)rgrCr%r0s rr_zTomlEncoder.dump_listsN > >A cGDOOA$6$6777#= =FF#  rcLd}t|trlg}|D]5\}}||}||dz|z6|dd|zdzz }|St ||S)zPreserve inline table in its compact syntax instead of expanding into subsection. https://github.com/toml-lang/toml#user-content-inline-table r = z{ z, z } )r<dictitemsdump_inline_tableappendjoinrBrn)rgrr%val_listkrCvals rrszTomlEncoder.dump_inline_tables  gt $ $ 5H  1 11,,Q//E C0000 dTYYx00069 9FM4??73344 4rc|jt|}|"t|dr|jt}| ||n|jt |S)N__iter__)rfgettyper;r^r=)rgrCdump_fns rrnzTomlEncoder.dump_valuese/%%d1gg.. ?wq*55?od+G$0wwqzzz6Jdoc6J16M6MMrc dd}|dkr|ddkr|dz }|}d}|D]}t|}|}tjd|st |}t ||t sNd}t ||tr"||D]} t | t rd}|r||D]} d} |d|z|zd zz }|| ||z\} } | r| d d kr| | z } n|| z }| rv|} | D][}|| |||zdz|z\}}|r| d |z|zdz|zd zz } | |z } |D]}||| |dz|z<\| } | v|| z }Őd||4||d zt| ||zdzz }|j rAt ||tr&||d z| ||zz }||||<||z }||fS)Nrr4rz^[A-Za-z0-9_-]+$FTrz[[z]] rrrrp) r\rBrematchrHr<rqr^r!rnr]rrs)rgr supretstrretdictarraystrrqsection arrayoftablesa arraytabstrr-rnewddsecs1d1s rr!zTomlEncoder.dump_sectionss "99RC 3JC**,,+ /+ /Gg&&GH8/99 .$W--aj$//& / % aj$//1wZ11%a..1,0M PwZ00&*  D3J$9F$BB#11!S8^DD1. ts{{ +q 0 (A  %#'::<5?AF5G%HK$/2$5K*,!C!CB<>rFDb$9$9!C $A %!K/-00z-8e#3#*4??1W:+F+F#G#G$HJN$OP /:aj/#J#J /8e+11!G*==>?%&gJ!!(  rN) __name__ __module__ __qualname__rqrhr$r_rsrnr!rrrrrs{!E    555"NNN3!3!3!3!3!rrc"eZdZeffd ZxZS)TomlPreserveInlineDictEncodercZtt||ddS)NT)superrrh)rgr\r s rrhz&TomlPreserveInlineDictEncoder.__init__s* +T22;;E4HHHHHrrrrrqrh __classcell__r s@rrrsJ!IIIIIIIIIIrrc,eZdZeddffd ZdZxZS)TomlArraySeparatorEncoderFrlctt||||dkrd|z}n$|drt d||_dS)Nrrlz ,zInvalid separator for arrays)rrrhstripr# separator)rgr\r]rr s rrhz"TomlArraySeparatorEncoder.__init__sr '..77xHHH ??   " "iII __Z ( ( =;<< <"rc6g}d}|D]*}|||+|gkr\g}|D]O}t|tr|D]}||2|dt |z|jzz }P|}|gk\|dz }|S)Nrrkrm)rtrnr<r^rBr)rgrCtr%r0r-rs rr_z#TomlArraySeparatorEncoder.dump_lists  ) )A HHT__Q'' ( ( ( (2ggA @ @a&&@$$ $cGAJJ.??FFA2gg #  r)rrrrqrhr_rrs@rrrsS!ES######rrc*eZdZedffd ZdZxZS)TomlNumpyEncoderFcRddl}tt|||t|j|j<t|j|j<t|j|j<|j |j|j <|j |j|j <|j |j|j <dS)Nr) numpyrrrhrMrffloat16float32float64 _dump_intint16int32int64)rgr\r]npr s rrhzTomlNumpyEncoder.__init__s %%..uh???&1 #&1 #&1 #$(N!$(N!$(N!!!rcFdt|S)NrJ)rKrargrCs rrzTomlNumpyEncoder._dump_ints{{3q66"""r)rrrrqrhrrrs@rrrsQ!E333333#######rrc$eZdZedffd ZxZS)TomlPreserveCommentEncoderFcddlm}tt||fdj|<dS)Nr) CommentValuec8|jSrU)rrn)rCrgs rrWz5TomlPreserveCommentEncoder.__init__..#s!&&2I2Ir) toml.decoderrrrrhrf)rgr\r]rr s` rrhz#TomlPreserveCommentEncoder.__init__ sR------ ($//88III(I(I(I(I %%%rrrs@rrrsL!EJJJJJJJJJJrrc$eZdZdZfdZxZS)TomlPathlibEncoderc:tt|SrU)rHr=rs r_dump_pathlib_pathz%TomlPathlibEncoder._dump_pathlib_path(sQ   rcdtjkr(ddl}t||jrt |}t t||S)N)rr) r9r:pathlibr<PurePathr=rrrn)rgrCrr s rrnzTomlPathlibEncoder.dump_value+sY S% % % NNN!W-.. FF'..99!<<rs ((((((tG    ,1111h%%%>DDDh!h!h!h!h!&h!h!h!VIIIIIKIII  8 # # # # #{ # # # JJJJJJJJ = = = = = = = = = =r