
    ig                        S SK Jr  S SKJr  SSKJr  Sr " S S\5      rSS	.S
\S\S\	S\	S\
\\\\\4   4   \\
\\S-  4   \4   4   4
S jjrSSS.S
\S\\   S\	S\	S\\   4
S jjrS
\S\S\S\	S\	S\
\S-  \S-  4   4S jrS\S\	4S jrg)    )Mapping)
NamedTuple   )
ParseErrorz#;c                   P    \ rS rSr% \\S'   \S-  \S'   \S-  \S'   \S-  \S'   Srg)
ParsedLine	   linenoNsectionnamevalue )__name__
__module____qualname____firstlineno__int__annotations__str__static_attributes__r       J/home/james-whalen/.local/lib/python3.13/site-packages/iniconfig/_parse.pyr   r   	   s%    K4Z
*:r   r   F)strip_section_whitespacepathdatastrip_inline_commentsr   returnNc                
   [        U UR                  S5      UUS9n0 n0 nU H\  u  pxpUc  [        XS5      eXuX4'   U	c  X;   a  [        XSU< 35      e0 Xh'   M8  XU   ;   a  [        XSU	< 35      eU
c   eXU   U	'   M^     Xe4$ )a#  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(.$?T+FGG!'<' 1CG;/OPP%'M"W-- /IJJ$$$+0'"4( )/ !!r   r   	line_iterc          	      <   / nS n[        U5       GH  u  pg[        XXbU5      u  pUb   U	b  UR                  [        XeX5      5        M8  Ub6  U	c3  U(       d  [	        XS5      eUnUR                  [        XeS S 5      5        Mq  Ub  Mv  U	c  M{  U(       d  [	        XS5      eUR                  5       n
U
R                  c  [	        XS5      eU
R                  (       a  U
R                  U
R                   SU	 3S9n
OU
R                  U	S9n
UR                  U
5        GM
     U$ )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!),7O

  0MM*VdAB$, /CDDGMM*VdDAB\d. /NOO::<Dyy  /NOOzz}}djj\D6+B}C}}4}0MM$3 -4 Mr   r/   r
   c                    [        U5      (       a  SnOUR                  5       nU(       d  gUS   S:X  al  Un[         H%  nUR                  U5      S   R                  5       nM'     US   S:X  a   USS nU(       a  UR	                  5       nUS 4$ S UR	                  5       4$ US   R                  5       (       d   UR                  SS5      u  pS	U;   a
  [        5       e UR	                  5       n
U	R	                  5       n	U(       a/  [         H%  nU	R                  U5      S   R                  5       n	M'     X4$ UR	                  5       nU(       a/  [         H%  nUR                  U5      S   R                  5       nM'     S U4$ ! [         a7     UR                  S	S5      u  p N! [         a    [        XS
U< 35      S ef = ff = f)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"  ::<  !Aq)002 "  zz| !zz!}Q'..0 "Tz1  	WW"jja0e W 1B4(/KLRVVW	Ws   :$F 
GF##F??Gc                 :    U R                  5       S S nU[        ;   $ )Nr   )lstripr:   )r/   r@   s     r   r8   r8      s    bqAr   )collections.abcr   typingr   
exceptionsr   r:   r   r   booltupler   r%   listr    r*   r8   r   r   r   <module>rK      s4   #  "  &+-"
-"
-"  	-"
 #-" 73S))*GE#sTz/4JC4O,PPQ-"h #(%*#
#Cy#  	#
 ## 
*#L8
8
8 8  	8
 #8 3:sTz!"8v  r   