j7iIdZddlZddlmZddlmZddlmZddlmZddlmZddlm Z gd Z d d l m Z d d l m Z d d l mZd dlmZedZedZGddZGddZy)zdbrain-dead simple parser for ini-style files. (C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed N)Callable)Iterator)Mapping)Final)TypeVar)overload) IniConfig ParseError COMMENTCHARS iscommentline)_parse)r )r )r _D_Tc eZdZUeded<eeed<dddeddfdZdededzfdZe dededzfd Z e ded e ege fde dzfd Z e ded dd e ege fde dzfd Z e dded e d ddee zfdZ e ded e d e ege fde e zfdZ dded e dzd e ege fdzde e zezdzfdZ dedefdZdeefdZdeeeeffdZy)SectionWrapperr confignamereturnNc ||_||_yN)rr)selfrrs [/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/iniconfig/__init__.py__init__zSectionWrapper.__init__s  cN|jj|j|Srrlineofrrrs rrzSectionWrapper.lineof s{{!!$))T22rkeycyrrr s rgetzSectionWrapper.get#s+.rconvertcyrr")rr r%s rr$zSectionWrapper.get&s rdefaultcyrr"rr r'r%s rr$zSectionWrapper.get- rcyrr"r)s rr$zSectionWrapper.get5sLOrcyrr"r)s rr$zSectionWrapper.get8s rcT|jj|j|||S)N)r%r')rr$rr)s rr$zSectionWrapper.getAs# {{tyy#wPPrcN|jj|j|Sr)rsectionsrr#s r __getitem__zSectionWrapper.__getitem__Is {{##DII.s33rc#Kjjjji}dtdt ffd }t ||Ed{y7w)Nr rcPjjj|Srr)r rs rrz'SectionWrapper.__iter__..lineofOs;;%%dii5 5rr )rr/r$rstrintsorted)rsectionrs` r__iter__zSectionWrapper.__iter__LsL%)[[%9%9%=%=dii%L 6 6 6'v...sAAAAc#,K|D] }|||f ywrr"rs ritemszSectionWrapper.itemsTs$ #DT " " #srNN)__name__ __module__ __qualname__r__annotations__r4rr5rrr$rrrr0rr8tupler:r"rrrrs +  *{#$3333:3.s.sTz..  3%)$ d   3%)$  d OsORO$O#(OO  3%)$  b ".2 Q QdQ3%)$t+ Q b3  Q4s4s4/(3-/#xc3h0#rrceZdZUeeed<eeeeeeffed<eeeeedzfefed< d ddddee jezdedzdedeeeeeffdzdeeeedzfefdzd df d Z e d d d d dee jezdedzdede de d df dZd!dededzd edzfdZededed edzfdZedededeegefd edzfdZedededddeegefd edzf dZe d!dedededdd eezf dZededededeegefd eezf dZ d"dedededzdeegefdzd eezezdzf dZded efdZd eefdZded e fdZy)#r pathr/N_sources) _sectionsrCdataencodingrDrc,tj||_|||}|}nW|0t|j|5}|j }dddt j |j|d\}}||_||_y#1swY=xYw)NrFF)strip_inline_comments) osfspathrBopenreadrparse_ini_datarCr/) rrBrErFrDrC sections_datasourcesfps rrzIniConfig.__init__^sIIdO   X%9%MG|$))h7%2779D%&,%:%: 4u& "M7   % %%s B  BTFrIstrip_section_whitespacerIrSctj|}|&t||5}|j}dddt j ||||\}} |||| S#1swY0xYw)aParse an INI file. Args: path: Path to the INI file (used for error messages) data: Optional INI content as string. If None, reads from path. encoding: Encoding to use when reading the file (default: utf-8) strip_inline_comments: Whether to strip inline comments from values (default: True). When True, comments starting with # or ; are removed from values, matching the behavior for section comments. strip_section_whitespace: Whether to strip whitespace from section and key names (default: False). When True, strips Unicode whitespace from section and key names, addressing issue #4. When False, preserves existing behavior for backward compatibility. Returns: IniConfig instance with parsed configuration Example: # With comment stripping (default): config = IniConfig.parse("setup.cfg") # value = "foo" instead of "foo # comment" # Without comment stripping (old behavior): config = IniConfig.parse("setup.cfg", strip_inline_comments=False) # value = "foo # comment" # With section name stripping (opt-in for issue #4): config = IniConfig.parse("setup.cfg", strip_section_whitespace=True) # section names and keys have Unicode whitespace stripped NrHrR)rBrDrC)rJrKrLrMrrN) clsrBrErFrIrSrKrQrOrPs rparsezIniConfig.parse}swN4 <fx0 !Bwwy !"(!6!6  "7%= "  w-'JJ ! !s A%%A.r7rcN|jj||f}|dS|dzS)Nr )rCr$)rr7rlinenos rrzIniConfig.lineofs-""GT?3~t56A:5rcyrr")rr7rs rr$z IniConfig.gets rr%cyrr")rr7rr%s rr$z IniConfig.getr*rr'cyrr"rr7rr'r%s rr$z IniConfig.getsrcyrr"r\s rr$z IniConfig.getsrcyrr"r\s rr$z IniConfig.getsrcb |j||}|||S|S#t$r|cYSwxYwr)r/KeyError)rr7rr'r%values rr$z IniConfig.getsG w/5E"u~%  N s  ..cL||jvr t|t||Sr)r/r`rrs rr0zIniConfig.__getitem__s% t}} $4. dD))rc#tKt|j|jD]}t||yw)Nr3)r6r/rrrs rr8zIniConfig.__iter__s14==dkk: -D t, , -s68argc||jvSr)r/)rrds r __contains__zIniConfig.__contains__sdmm##r)Nzutf-8rr;)r<r=r>rr4r?rr@r5rJPathLiker classmethodboolrVrrr$rrrrr0rr8rfr"rrr r Ys *GCc!22344GE#sTz/2C7899   & =A@D&BKK$$&Dj& & 3S 112T9 &%S4Z0#56=& &>  4K '+).4KBKK$$4KDj4K 4K $ 4K#'4K 4K4Kl6c6t6sTz6 t  3%)$  d   3%)$  d DH"%02=A r  3%)$  b ".2 d  3%)$t+  b3  "*** -(>2-$$$rr )__doc__rJcollections.abcrrrtypingrrr__all__rr r exceptionsr rrrr r"rrrps[ $$# F !" T] T]>#>#B`$`$r