bgddlmZddlmZddlmZddlmZddlmZddlm Z GddZ Gd d Z Gd d e Z d S)) annotations)copy)Any) ParseError)UnexpectedCharErrorTOMLCharc*eZdZ d dd Zdd Zd Zd S)_StateFsourceSource save_marker bool | NonerestorereturnNonec0||_||_||_dSN)_source _save_markerr)selfr rrs _/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/tomlkit/source.py__init__z_State.__init__ s  ' ct|jj|_|jj|_|jj|_|jj|_|Sr)rr_chars_idx_current_markerrs r __enter__z_State.__enter__s?4<.// L%  - |+  rc|js|rO|j|j_|j|j_|j|j_|jr|j|j_dSdSdSr)rrrrrrr)rexception_type exception_valtraces r__exit__z_State.__exit__sh < 4> 4"&+DL  $ DL $(MDL !  4'+| $$$ 4 4  4 4rN)FF)r r rrrrrr)rr )__name__ __module__ __qualname__rr!r&rrr r sX$)$ 44444rr c.eZdZdZd dZdZd dZd Zd S) _StateHandlerz) State preserver for the Parser. r r rrc"||_g|_dSr)r_states)rr s rrz_StateHandler.__init__.s  rc,t|jg|Ri|Sr)r r)rargskwargss r__call__z_StateHandler.__call__2s"dl4T444V444rcr|}|j||Sr)r.appendr!)rstates rr!z_StateHandler.__enter__5s3 E"""   rcb|j}||||Sr)r.popr&)rr#r$r%r5s rr&z_StateHandler.__exit__:s+   ""~~nmUCCCrN)r r rrrr)r'r(r)__doc__rr2r!r&r*rrr,r,)si555!!!! DDDDDrr,ceZdZedZd$fd ZdZed%d Zed&d Z ed'd Z ed&dZ d(dZ d)d*dZ d)d+dZd,dZd-dZd.dZefd/d!Zd0d#ZxZS)1r _strrrc2ttdt|D|_d|_d|_td|_t||_ | dS)Nc6g|]\}}|t|fSr*r).0ics r z#Source.__init__..Fs'IIIAQ ,IIIrr) superriter enumeraterrrr rr,_stateinc)rr< __class__s rrzSource.__init__Bsz II4IIIJJ      #D))   rcV||dSr)rImarkr s rresetz Source.resetPs"   rr,c|jSr)rHr s rr5z Source.stateWs {rintc|jSr)rr s ridxz Source.idx[s yrr c|jSr)rr s rcurrentzSource.current_s }rc|jSr)rr s rmarkerz Source.markercs |rc*||j|jS)z= Extracts the value between marker and index )rrr s rextractzSource.extractgsDL49,--rN exceptiontype[ParseError] | Noneboolc t|j\|_|_dS#t$r;t ||_|j|_|r||YdSwxYw)z Increments the parser if the end of the input has not been reached. Returns whether or not it was able to advance. TF)nextrrr StopIterationlenEOF parse_error)rrXs rrIz Source.incmsx '+DK'8'8 $DIt}4   D DI HDM 2&&y11155  s!%AA*)A*ncXtfdt|DS)zm Increments the parser by n characters if the end of the input has not been reached. c3DK|]}VdS))rXN)rI)r@r<rXrs r zSource.inc_n..s1CCQ488i800CCCCCCr)allrange)rrarXs` `rinc_nz Source.inc_n~s2 CCCCC%((CCCCCCrrc|j|vr4|dkr.|dz}|dz}|sn|j|vr|dk.|dkr |t|jdS)zD Consume chars until min/max is satisfied is valid. rN)rSrIr`r)rcharsminmaxs rconsumezSource.consumesle##q 1HC 1HC88::  le##q 77""#6 EE E 7rc|j|juS)zN Returns True if the parser has reached the end of the input. )rr_r s rendz Source.ends}((rc|j|_dS)zA Sets the marker to the index's current position N)rrr s rrLz Source.marksy rtype[ParseError]r0rr1rcJ|\}}|||g|Ri|S)zJ Creates a generic "parse error" at the current position. ) _to_linecol)rrXr0r1linecols rr`zSource.parse_errors;$$&& cys4T444V444rtuple[int, int]c"d}t|D]I\}}|t|zdz|jkr|dz|j|z fcS|t|dzz }Jt|dfS)Nrrj)rG splitlinesr^rQ)rcurrArus rrtzSource._to_linecols !2!233 ! !GAtSYY"TX--Atx#~.... 3t99q= CC4??$$%%q((r)r<r=rr)rr,)rrO)rr )rr=r)rXrYrrZ)rarOrXrYrrZ)rrh)rrZr8)rXrrr0rr1rrr)rrw)r'r(r)r r_rrMpropertyr5rQrSrUrWrIrgrnrprLrr`rt __classcell__)rJs@rr r ?s (4..C      XXXX.... "DDDDD F F F F)))) !!!!'1 5 5 5 5 5))))))))rr N) __future__rrtypingrtomlkit.exceptionsrrtomlkit.toml_charr r r,r=r r*rrrs""""""))))))222222&&&&&&44444444<DDDDDDDD,u)u)u)u)u)Su)u)u)u)u)r