
    עiI                         d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 g d	Z
d
dlmZ d
dlmZ d
dlmZ d
dlmZ  ed      Z ed      Z G d d      Z G d d      Zy)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                      e Zd ZU ed   ed<   ee   ed<   dddeddfdZdededz  fdZe	dededz  fd	       Z
e	ded
eegef   dedz  fd       Z
e	deddd
eegef   dedz  fd       Z
e	ddeded
ddeez  fd       Z
e	deded
eegef   deez  fd       Z
	 	 ddededz  d
eegef   dz  deez  ez  dz  fdZ
dedefdZdee   fdZdeeeef      fdZy)SectionWrapperr	   confignamereturnNc                      || _         || _        y N)r   r   )selfr   r   s      S/sites/domain-asset-master/.venv/lib/python3.12/site-packages/iniconfig/__init__.py__init__zSectionWrapper.__init__   s    	    c                 N    | j                   j                  | j                  |      S r   r   lineofr   r   r   s     r   r   zSectionWrapper.lineof    s    {{!!$))T22r   keyc                      y r    r   r    s     r   getzSectionWrapper.get#   s    +.r   convertc                      y r   r"   )r   r    r%   s      r   r$   zSectionWrapper.get&   s    
 r   defaultc                      y r   r"   r   r    r'   r%   s       r   r$   zSectionWrapper.get-        r   c                      y r   r"   r)   s       r   r$   zSectionWrapper.get5   s    LOr   c                      y r   r"   r)   s       r   r$   zSectionWrapper.get8   s     r   c                 T    | j                   j                  | j                  |||      S )N)r%   r'   )r   r$   r   r)   s       r   r$   zSectionWrapper.getA   s#     {{tyy#wPPr   c                 N    | j                   j                  | j                     |   S r   )r   sectionsr   r#   s     r   __getitem__zSectionWrapper.__getitem__I   s     {{##DII.s33r   c              #       K    j                   j                  j                   j                  i       }dt        dt
        f fd}t        ||      E d {    y 7 w)Nr    r   c                 P    j                   j                  j                  |       S r   r   )r    r   s    r   r   z'SectionWrapper.__iter__.<locals>.lineofO   s    ;;%%dii55r   r    )r   r/   r$   r   strintsorted)r   sectionr   s   `  r   __iter__zSectionWrapper.__iter__L   sL     %)[[%9%9%=%=dii%L	6 	6 	6 'v...s   AAAAc              #   ,   K   | D ]  }|| |   f  y wr   r"   r   s     r   itemszSectionWrapper.itemsT   s$      	#DT
""	#s   r   NN)__name__
__module____qualname__r   __annotations__r4   r   r5   r   r   r$   r   r   r   r0   r   r8   tupler:   r"   r   r   r   r      s   +
*{ # $ 33 33: 3 .s.sTz. . 3%)$ 
d	    3%)$	
 
d  OsORO$O#(O O  3%)$	
 
b  ".2	QQ dQ 3%)$t+	Q
 
b3	Q4s 4s 4/(3- /#xc3h0 #r   r   c                      e Zd ZU ee   ed<   eeeeeef   f      ed<   eeeeedz  f   ef      ed<   	 	 d ddddee	j                  e   z  dedz  dedeeeeef   f   dz  deeeedz  f   ef   dz  d	dfd
Ze	 	 d ddddee	j                  e   z  dedz  dededed	d fd       Zd!dededz  d	edz  fdZededed	edz  fd       Zedededeegef   d	edz  fd       Zedededddeegef   d	edz  f
d       Ze	 d!dedededdd	eez  f
d       Zededededeegef   d	eez  f
d       Z	 	 d"dedededz  deegef   dz  d	eez  ez  dz  f
dZded	efdZd	ee   fdZded	efdZy)#r	   pathr/   N_sources)	_sectionsrC   dataencodingrD   r   c                ,   t        j                  |      | _        |||}|}nW|0t        | j                  |      5 }|j	                         }d d d        t        j                  | j                  |d      \  }}|| _        || _        y # 1 sw Y   =xY w)NrF   F)strip_inline_comments)	osfspathrB   openreadr   parse_ini_datarC   r/   )	r   rB   rE   rF   rD   rC   sections_datasourcesfps	            r   r   zIniConfig.__init__^   s     IIdO	  X%9%MG |$))h7 %2779D% &,%:%:		4u&"M7
  %% %s   B

BTFrI   strip_section_whitespacerI   rS   c                    t        j                  |      }|&t        ||      5 }|j                         }ddd       t	        j
                  ||||      \  }}	 | |||	      S # 1 sw Y   0xY w)a  Parse 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
        NrH   rR   )rB   rD   rC   )rJ   rK   rL   rM   r   rN   )
clsrB   rE   rF   rI   rS   rK   rQ   rO   rP   s
             r   parsezIniConfig.parse}   sw    N 4<fx0 !Bwwy! "(!6!6"7%=	"
w -'JJ! !s   A%%A.r7   r   c                 N    | j                   j                  ||f      }|d S |dz   S )Nr   )rC   r$   )r   r7   r   linenos       r   r   zIniConfig.lineof   s-    ""GT?3~t56A:5r   c                      y r   r"   )r   r7   r   s      r   r$   zIniConfig.get   s    
 r   r%   c                      y r   r"   )r   r7   r   r%   s       r   r$   zIniConfig.get   r*   r   r'   c                      y r   r"   r   r7   r   r'   r%   s        r   r$   zIniConfig.get   s     r   c                      y r   r"   r\   s        r   r$   zIniConfig.get   s     r   c                      y r   r"   r\   s        r   r$   zIniConfig.get   s     r   c                 b    	 | j                   |   |   }| ||      S |S # t        $ r |cY S w xY wr   )r/   KeyError)r   r7   r   r'   r%   values         r   r$   zIniConfig.get   sG    	w/5E "u~%  	N	s     ..c                 L    || j                   vrt        |      t        | |      S r   )r/   r`   r   r   s     r   r0   zIniConfig.__getitem__   s%    t}}$4. dD))r   c              #   t   K   t        | j                  | j                        D ]  }t        | |        y w)Nr3   )r6   r/   r   r   r   s     r   r8   zIniConfig.__iter__   s1     4==dkk: 	-D t,,	-s   68argc                     || j                   v S r   )r/   )r   rd   s     r   __contains__zIniConfig.__contains__   s    dmm##r   )Nzutf-8r   r;   )r<   r=   r>   r   r4   r?   r   r@   r5   rJ   PathLiker   classmethodboolrV   r   r   r$   r   r   r   r   r0   r   r8   rf   r"   r   r   r	   r	   Y   s   
*GCc!22344GE#sTz/2C7899
  	& =A@D&BKK$$& Dj& 	& 3S 112T9& %S4Z0#56=& 
&>   	4K '+).4KBKK$$4K Dj4K 	4K  $4K #'4K 
4K 4Kl6c 6t 6sTz 6   
t	    3%)$	
 
d    	
 3%)$ 
d  DH"%02=A	r    	
 3%)$ 
b  ".2  d	
 3%)$t+ 
b3	"* * *
-(>2 -$ $ $r   r	   )__doc__rJ   collections.abcr   r   r   typingr   r   r   __all__ r   r   r   
exceptionsr
   r   r   r   r	   r"   r   r   <module>rp      s[    
 $ $ #   
F    ! "T]T]># >#B`$ `$r   