
    עig                        d dl mZ d dlmZ ddlmZ dZ G d de      Zdd	d
edede	de	de
eeeeef   f   ee
eedz  f   ef   f   f
dZdddd
edee   de	de	dee   f
dZd
ededede	de	de
edz  edz  f   fdZdede	fdZy)    )Mapping)
NamedTuple   )
ParseErrorz#;c                   H    e Zd ZU eed<   edz  ed<   edz  ed<   edz  ed<   y)
ParsedLinelinenoNsectionnamevalue)__name__
__module____qualname__int__annotations__str     Q/sites/domain-asset-master/.venv/lib/python3.12/site-packages/iniconfig/_parse.pyr   r   	   s%    K4Z
*:r   r   F)strip_section_whitespacepathdatastrip_inline_commentsr   returnNc                   t        | |j                  d      ||      }i }i }|D ]\  \  }}}	}
|t        | |d      ||||	f<   |	||v rt        | |d|      i ||<   :|	||   v rt        | |d|	      |
J |
||   |	<   ^ ||fS )aO  Parse INI data and return sections and sources mappings.

    Args:
        path: Path for error messages
        data: INI content as string
        strip_inline_comments: Whether to strip inline comments from values
        strip_section_whitespace: Whether to strip whitespace from section and key names
            (default: False). When True, addresses issue #4 by stripping Unicode whitespace.

    Returns:
        Tuple of (sections_data, sources) where:
        - sections_data: mapping of section -> {name -> value}
        - sources: mapping of (section, name) -> line number
    Tr   r   zno section header definedzduplicate section zduplicate name )parse_lines
splitlinesr   )r   r   r   r   tokenssourcessections_datar	   r
   r   r   s              r   parse_ini_datar"      s    * 3!9	F 24G/1M(. 1$u?T6+FGG!'<-' v1CG;/OPP%'M'"}W-- v/IJJ$$$+0M'"4(1 '!!r   r   	line_iterc          	          g }d }t        |      D ]  \  }}t        | ||||      \  }}	| |	|j                  t        ||||	             :|1|	/|st	        | |d      |}|j                  t        ||d d              m|p|	s|st	        | |d      |j                         }
|
j                  t	        | |d      |
j                  r"|
j                  |
j                   d|	       }
n|
j                  |	      }
|j                  |
        |S )Nzempty section namezunexpected value continuation
)r   )		enumerate
_parselineappendr   r   popr   r   _replace)r   r#   r   r   resultr
   r	   liner   r   lasts              r   r   r   @   s)     "FG!),  $ 57O

d  0MM*VWdDAB$, v/CDDGMM*VWdDAB\d. v/NOO::<Dyy  v/NOOzz}}djj\D6+B}C}}4}0MM$3 4 Mr   r,   r	   c                 @   t        |      rd}n|j                         }|sy|d   dk(  rd|}t        D ]$  }|j                  |      d   j                         }& |d   dk(  r|dd }|r|j	                         }|d fS d |j	                         fS |d   j                         sx	 |j                  dd      \  }}	d	|v r
t               	 |j	                         }
|	j	                         }	|r-t        D ]$  }|	j                  |      d   j                         }	& |
|	fS |j	                         }|r-t        D ]$  }|j                  |      d   j                         }& d |fS # t        $ r8 	 |j                  d	d      \  }}	n# t        $ r t        | |d
|      d w xY wY w xY w)N )NNr   []r   =:zunexpected line: )iscommentlinerstripCOMMENTCHARSsplitstripisspace
ValueErrorr   )r   r,   r	   r   r   reallinecsection_namer   r   key_names              r   r'   r'   f   s    T{{}Aw#~ 	-A::a=#**,D	-8s?":L'+113%%X^^%%%!W__	W**S!,KD%d{ l"  ::<  ! 3Aq)0023  zz| ! 1zz!}Q'..01Tz1  	WW"jja0e W v1B4(/KLRVVW 	Ws*   "#E 	F&E<;F<FFFc                 8    | j                         d d }|t        v S )Nr   )lstripr7   )r,   r=   s     r   r5   r5      s    bqAr   )collections.abcr   typingr   
exceptionsr   r7   r   r   booltupler   r"   listr   r'   r5   r   r   r   <module>rH      s4   #  "  &+-"
-"
-"  	-"
 #-" 73S))*GE#sTz/4JC4O,PPQ-"h #(%*#
#Cy#  	#
 ## 
*#L8
8
8 8  	8
 #8 3:sTz!"8v  r   