
    iKjQ                    v   U d dl mZ d dlZd dlmZ d dlmZ d dlmZm	Z	 d dl
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z( d dl)m*Z*m+Z+ d dl,m-Z-m.Z. d d	l/m0Z0 erd d
lm1Z1 d dlm2Z2m3Z3 d dl/m4Z4 d dl5m6Z6 i de-jn                  de-jp                  de-jr                  de-jt                  de-jv                  de-jx                  de-jz                  de-j|                  de-j~                  de-j                  de-j                  de-j                  de-j                  de-j                  de-j                  de-j                  ZFd\dZGd\d ZHd!d"	 	 	 	 	 	 	 	 	 d]d#ZId^d$ZJd%ZKdeLd&<   d'ZMdeLd(<   d)ZNdeLd*<   d+ZOdeLd,<    ej                  d-eN d.eO d/eN d0eO d1	ej                  ej                  z        ZSd2eLd3<   eSZTd2eLd4<   eSZUd2eLd5<    ej                  d6eN d7eN d8eK d9eM d:eO d;ej                  ej                  z        ZVd2eLd<<    ej                  d=      ZWd2eLd><    ej                  d?      ZXd2eLd@<   d!d!d!dA	 	 	 	 	 	 	 	 	 	 	 	 	 d_dBZYd!d"	 	 	 	 	 	 	 	 	 d`dCZZd!d!dD	 	 	 	 	 	 	 	 	 	 	 dadEZ[d!dF	 	 	 	 	 	 	 	 	 dbdGZ\d!d"	 	 	 	 	 	 	 	 	 dcdHZ]d!d"	 	 	 	 	 	 	 	 	 dddIZ^d!d"	 	 	 	 	 	 	 	 	 dedJZ_d!d"	 	 	 	 	 	 	 	 	 dfdKZ`d!d"	 	 	 	 	 	 	 	 	 dgdLZad!d"	 	 	 	 	 	 	 	 	 dhdMZbd!d"	 	 	 	 	 	 	 	 	 didNZcd!d"	 	 	 	 	 	 	 	 	 djdOZdd!d"	 	 	 	 	 	 	 	 	 dkdPZe	 	 	 	 	 	 	 	 dldQZfd!d"	 	 	 	 	 	 	 	 	 dmdRZgd!d!dS	 	 	 	 	 	 	 	 	 	 	 dndTZhdodUZie-jp                  eZe-jr                  e[e-jt                  e\e-jn                  e]e-j|                  eae-j~                  ebe-j                  ehe-j                  ece-j                  ede-j                  eee-j                  efe-j                  ege-jv                  e^e-jx                  e_e-jz                  e`iZj G dV dWe	dXY      ZkdXd!d!d!d!dZ	 	 	 	 	 	 	 	 	 	 	 	 	 dpd[Zly)q    )annotationsN)suppress)dedent)TYPE_CHECKING	TypedDict)DocstringAttributeDocstringClassDocstringFunctionDocstringModuleDocstringParameterDocstringRaiseDocstringReceiveDocstringReturnDocstringSectionDocstringSectionAdmonitionDocstringSectionAttributesDocstringSectionClassesDocstringSectionDeprecatedDocstringSectionExamplesDocstringSectionFunctionsDocstringSectionModulesDocstringSectionOtherParametersDocstringSectionParametersDocstringSectionRaisesDocstringSectionReceivesDocstringSectionReturnsDocstringSectionTextDocstringSectionTypeAliasesDocstringSectionTypeParametersDocstringSectionWarnsDocstringSectionYieldsDocstringTypeAliasDocstringTypeParameterDocstringWarnDocstringYield)docstring_warningparse_docstring_annotation)DocstringSectionKindLogLevel)ExprName)Pattern)AnyLiteral)Expr)	Docstring
deprecated
parameterszother parametersztype parametersreturnsyieldsreceivesraiseswarnsexamples
attributes	functionsmethodsclassesztype aliasesmodulesstrc                $    | j                          S )N)striplines    r/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/griffe/_internal/docstrings/numpy.py_is_empty_linerC   [   s    zz|    c                T    t        |        xr t        | j                  dd            S )N- )rC   replacer@   s    rB   _is_dash_linerI   _   s%    d##Mt||C7L(MMrD   T)warningsc                  | j                   }|t        |      k\  rg |fS |}g }t        ||         r|dz  }t        ||         r||   g}|dz  }|t        |      k  r||   }t        |      r|j                  d       n|j	                  d      r|j                  |dd         n|j	                  d      rRt        |      t        |j                               z
  }	|j                  ||	d         |rNt        | |d|dz    d|	        n7|dz   t        |      k  rt        ||dz            rn(|j                  |       |g}|dz  }|t        |      k  r|r|j                  |       ||dz
  fS )N   rG   z        z,Confusing indentation for continuation line z' in docstring, should be 4 spaces, not )lineslenrC   append
startswithlstripr&   rI   )
	docstringoffsetrJ   optionsrO   
new_offsetitemscurrent_itemrA   cont_indents
             rB   _read_block_itemsr[   c   s    OOEU6zJE z*
+a
 z*
+ *%&L!OJ s5z
!Z $#__W%QR)__S!d)c$++-&88K[\ 23!B:PQ>BR S//:m= !^c%j(]5a;P-Q LL& 6La
? s5z
!B \"*q.  rD   c                  | j                   }|t        |      k\  rd|fS |}g }t        ||         r|dz  }t        ||         r|t        |      k  rt        ||         }|r#|t        |      dz
  k  rt        ||dz            rnM|r#|t        |      dz
  k  rt        ||dz            rn(|j	                  ||          |dz  }|t        |      k  rdj                  |      j                  d      |dz
  fS )NrG   rL      
)rO   rP   rC   rI   rQ   joinrstrip)rT   rU   rV   rO   rW   blockis_emptys          rB   _read_blockrc      s   OOEU6zJE z*
+a
 z*
+
s5z
!!%
"34
SZ!^3eJYZNF[8\
SZ!^3eJYZNF[8\U:&'a
 s5z
! 99U""4(*q.88rD   z\{_RE_OBz\}_RE_CBz\*{0,2}[_a-z][_a-z0-9]*_RE_NAMEz.+_RE_TYPEz
    (?:
        (?P<nt_name>z)\s*:\s*(?P<nt_type>z4)  # name and type
        |  # or
        (?P<name>zu)\s*:\s*  # just name
        |  # or
        \s*:\s*$  # no name, no type
        |  # or
        (?::\s*)?(?P<type>z)\s*  # just type
    )
    r+   _RE_RETURNS
_RE_YIELDS_RE_RECEIVESz
    (?P<names>z(?:,\sz5)*)
    (?:
        \s:\s
        (?:
            (?:z(?P<choices>.+)z)|
            (?P<type>z)
        )?
    )?
    _RE_PARAMETERz^\s*<BLANKLINE>\s*$_RE_DOCTEST_BLANKLINEz(\s*#\s*doctest:.+)$_RE_DOCTEST_FLAGS)warn_unknown_paramswarn_missing_typesrJ   c               j   g }t        | fd|i|\  }}|D ]o  }	t        j                  |	d         }
|
s|rt        | |d|	d    d       5|
j	                  d      j                  d      }|
j	                  d      xs d |
j	                  d      }d |r||j                  dd	      d   n<r:t        j                  d
      }
|
r"|
j	                  d      |
j	                  d      rj                  d      rd d t        |	      d	kD  r"dj                  |	d	d        j                         nd^|D ]D  }t        t        t              5  | j                  j                  |   j                   	 d d d         n2 |r/|r-t        | |d|        nt#        | t$        j&                        I|D ]D  }t        t        t              5  | j                  j                  |   j(                  	 d d d         n |rn|rlt        t              5  | j                  j                  }|D ]8  }||vsd| d}d| d| fD ]  }||v s|d| dz  } n t        | ||       : 	 d d d        |j+                  fd|D               r ||fS # 1 sw Y   `xY w# 1 sw Y   xY w# 1 sw Y   ExY w)NrU   r   Could not parse line ''names, typechoicesrL   8^(?P<annotation>.+),\s+default(?: |: |=)(?P<default>.+)$default
annotationz
, optionalir^   rG   z'No types or annotations for parameters 	log_levelzParameter 'z+' does not appear in the function signature***. Did you mean ''?c              3  <   K   | ]  }t        |         yw)valuery   descriptionN)r   ).0namery   rx   r   s     rB   	<genexpr>z#_read_parameters.<locals>.<genexpr>"  s'      
puhlt7zWbccpu   )r[   rk   matchr&   groupsplitreendswithrP   r_   r`   r   AttributeErrorKeyErrorparentr1   ry   r'   r)   debugrx   extend)rT   rU   rn   ro   rJ   rV   r1   rX   rW   itemr   rs   rv   r   paramsmessagestarred_namery   rx   r   s                    @@@rB   _read_parametersr      s    ,.J *)NFNgNE:##DG,!)Z;QRVWXRYQZZ[9\]G$**40[[(0D
++i( JmmD!,Q/GHHXZdeE++i0"[[6
*--l;#DS)J69$i!mdiiQR)002nh7!*!1!1!<!<T!B!M!MJ 87 
  2%i?fglfm=no3J	U]UcUcdJ?nh7'..99$?GGG 87 
 +.)"))44!D6)$/v5`"a/0Z2dV,EL+v5 '-=l^2+N N % -F *)ZI " * 	 
pu
 	
k r z!!? 87 87
 *)s0   %J%J J)1J)	J)JJ&)J2	c               p    t        | f||d|\  }}|rt        |      |fS |rt        | |d|        d |fS )NrU   rJ   z!Empty parameters section at line )r   r   r&   )rT   rU   rJ   rV   r1   rW   s         rB   _read_parameters_sectionr   )  sX     .ieQYe]deJ
)*5zAA)Z3TU[T\1]^rD   )rn   rJ   c               r    t        | f|d|d|\  }}|rt        |      |fS |rt        | |d|        d |fS )NF)rU   rn   rJ   z'Empty other parameters section at line )r   r   r&   )rT   rU   rn   rJ   rV   r1   rW   s          rB   _read_other_parameters_sectionr   8  sg     .!	
 J
 .z:JFF)Z3Z[aZb1cdrD   )rn   c               x   g }t        | fd|i|\  }}|D ]V  }t        j                  |d         }|st        | |d|d    d       3|j	                  d      j                  d      }	|j	                  d      xs d |j	                  d      }
d |
r|
|
j                  dd	      d   n<r:t        j                  d
      }|r"|j	                  d      |j	                  d      t        |      d	kD  r"dj                  |d	d        j                         ndJ|	D ]D  }t        t        t              5  | j                  j                  |   j                  	 d d d         n nt!        | t"        j$                        I|	D ]D  }t        t        t              5  | j                  j                  |   j&                  	 d d d         n |rt        t              5  | j                  j                  }|	D ]O  }||vsd| d| j                  j(                   d}d| d| fD ]  }||v s|d| dz  } n t        | ||       Q 	 d d d        |j+                  fd|	D               Y |rt-        |      |fS t        | |d|        d |fS # 1 sw Y   xY w# 1 sw Y   %xY w# 1 sw Y   exY w)NrU   r   rq   rr   rs   rt   ru   rv   rL   rw   rx   ry   r^   rG   rz   zType parameter 'z' does not appear in the z
 signaturer|   r}   r~   r   c              3  <   K   | ]  }t        |         ywr   )r#   )r   r   boundrx   r   s     rB   r   z0_read_type_parameters_section.<locals>.<genexpr>  s'      
otgk"4w5Vabbotr   z&Empty type parameters section at line )r[   rk   r   r&   r   r   r   rP   r_   r`   r   r   r   r   type_parametersry   r'   r)   r   rx   kindr   r   )rT   rU   rn   rV   r   rX   rW   r   r   rs   rv   r   type_paramsr   r   r   rx   r   s                  @@@rB   _read_type_parameters_sectionr   N  s    57O *)NFNgNE:##DG,i7MdSTgYVW5XYG$**40F#+t++i(EmmD!,Q/GHHXZ_`E++i0L169$i!mdiiQR)002=nh7%,,<<TBMME 87 
 /ui8>>ZE?nh7'..>>tDLLG 87 
 .)'..>>!D;.$4TF:ST]TdTdTiTiSjjt"u/0Z2dV,EL+{: '-=l^2+N N % -F *)ZI " * 	 
ot
 	
_ f -o>
JJi/UV\U]-^_A 87 87
 *)s0   7%J%J#  J0.J00J0J #J-0J9	c                  t        | f||d|\  }}|s|rt        | |d|        d |fS |rt        |      dkD  rt        | |d|        |d   }|d   }t        dj	                  |dd              }t        ||      |fS )Nr   z!Empty deprecated section at line rL   zToo many deprecated items at r   r^   )versiontext)r[   r&   rP   r   r_   r   )	rT   rU   rJ   rV   rX   rW   r   r   r   s	            rB   _read_deprecated_sectionr     s     *)aFXaY`aE:i7XY_X`5abZCJN)Z3PQWPX1YZ8D1gG$))DH%&D%gDA:MMrD   c                  t        | f||d|\  }}|s|rt        | |d|        d |fS g }t        |      D ]  \  }}t        j	                  |d         }	|	s|rt        | |d|d    d       8|	j                         }
|
d   xs |
d   }|
d   xs |
d	   }t        d
j                  |dd              }|7t        t        t        t              5  | j                  j                  r| j                  j                  }n3| j                  j                  r| j                  j                   }nt        t#        |      dkD  r|j$                  r|j&                  j(                  |   }n|j*                  r|j&                  }n,|j,                  r|j&                  j(                  d   }nt        t/        |t0              r|}n(|j$                  r|j&                  j(                  |   }n|}d d d        nt3        || t4        j6                        }|j9                  t;        |xs d||              t=        |      |fS # 1 sw Y   :xY w)Nr   zEmpty returns section at line r   rq   rr   nt_namer   nt_typeru   r^   rL   r]   rz   rG   r   ry   r   )r[   r&   	enumeraterh   r   	groupdictr   r_   r   r   r   
ValueErrorr   is_functionr2   is_attributery   rP   is_tuplesliceelementsis_iteratoris_generator
isinstancer*   r'   r)   r   rQ   r   r   )rT   rU   rJ   rV   rX   rW   r2   indexr   r   groupsr   ry   r   return_items                  rB   _read_returns_sectionr     s,    *)aFXaY`aE:i7UV\U]5^_ZG 't!!$q'*!)Z;QRVWXRYQZZ[9\]"i 2F6NI&8&.
diiQR)*.(J?##//!*!1!1!9!9J%%22!*!1!1!<!<J$$u:>!**%/%5%5%>%>u%E
%11*4*:*:K'44*4*:*:*C*CA*FK",,%k8<)4J(11)4):):)C)CE)JJ)4J- @?0 4J	U]UcUcdJDJB:[_`aM (N #7+Z775 @?s   DH<<I	c                  t        | f||d|\  }}|s|rt        | |d|        d |fS g }t        |      D ]y  \  }}t        j	                  |d         }	|	s|rt        | |d|d    d       8|	j                         }
|
d   xs |
d   }|
d   xs |
d	   }t        d
j                  |dd              }|t        t        t        t        t              5  | j                  j                  }|j                  r|j                   }n,|j"                  r|j                   j$                  d   }nt        t'        |t(              r|}n(|j*                  r|j                   j$                  |   }n|}d d d        nt-        || t.        j0                        }|j3                  t5        |xs d||             | t7        |      |fS # 1 sw Y   :xY w)Nr   zEmpty yields section at line r   rq   rr   r   r   r   ru   r^   rL   rz   rG   r   )r[   r&   r   ri   r   r   r   r_   r   r   
IndexErrorr   r   r   ry   r   r   r   r   r   r*   r   r'   r)   r   rQ   r%   r!   )rT   rU   rJ   rV   rX   rW   r3   r   r   r   r   r   ry   r   
yield_items                  rB   _read_yields_sectionr     s    *)aFXaY`aE:i7TU[T\5]^ZF 't  a)!)Z;QRVWXRYQZZ[9\]"i 2F6NI&8&.
diiQR)*.*h
K&--88
))!+!1!1J,,!+!1!1!:!:1!=J$$j(3!+J((!+!1!1!:!:5!AJ!+J LK 4J	U]UcUcdJn$*"Y]^_; (< "&):55# LKs   BGG	c               H   t        | f||d|\  }}|s|rt        | |d|        d |fS g }t        |      D ]O  \  }}t        j	                  |d         }	|	s|rt        | |d|d    d       8|	j                         }
|
d   xs |
d   }|
d   xs |
d	   }t        d
j                  |dd              }|t        t        t              5  | j                  j                  }|j                  rT|j                  j                  d   }t!        |t"              r|}n(|j$                  r|j                  j                  |   }n|}d d d        nt'        || t(        j*                        }|j-                  t/        |xs d||             R t1        |      |fS # 1 sw Y   :xY w)Nr   zEmpty receives section at line r   rq   rr   r   r   r   ru   r^   rL   rz   rG   r   )r[   r&   r   rj   r   r   r   r_   r   r   r   r   r2   r   r   r   r   r*   r   r'   r)   r   rQ   r   r   )rT   rU   rJ   rV   rX   rW   r4   r   r   r   r   r   ry   r   receives_items                  rB   _read_receives_sectionr     s    *)aFXaY`aE:i7VW]V^5_`ZH 't""47+!)Z;QRVWXRYQZZ[9\]"i 2F6NI&8&.
diiQR)*.(3&--55
**$.$4$4$=$=a$@M!-:%2
&//%2%8%8%A%A%%H
%2
 43 4J	U]UcUcdJ(djbZ]abc3 (4 $H-z99 43s   A7FF!	c                  t        | f||d|\  }}|s|rt        | |d|        d |fS g }|D ]J  }t        |d   |       }t        dj	                  |dd              }	|j                  t        ||	             L t        |      |fS )Nr   zEmpty raises section at line r   r^   rL   ry   r   )r[   r&   r'   r   r_   rQ   r   r   )
rT   rU   rJ   rV   rX   rW   r5   r   ry   r   s
             rB   _read_raises_sectionr   K  s     *)aFXaY`aE:i7TU[T\5]^ZF/QC
diiQR)*n
MN  "&):55rD   c                  t        | f||d|\  }}|s|rt        | |d|        d |fS g }|D ]J  }t        |d   |       }t        dj	                  |dd              }	|j                  t        ||	             L t        |      |fS )Nr   zEmpty warns section at line r   r^   rL   r   )r[   r&   r'   r   r_   rQ   r$   r    )
rT   rU   rJ   rV   rX   rW   r6   r   ry   r   s
             rB   _read_warns_sectionr   d  s     *)aFXaY`aE:i7STZS[5\]ZE/QC
diiQR)*]jdKL  !'33rD   c               P   t        | f||d|\  }}|s|rt        | |d|        d |fS g }|D ]  }|d   }d|v r:|j                  dd      \  }	}
|	j                         }	|
j                         xs d }
n|}	d }
|
<t	        t
        t        t              5  | j                  |	   j                  }
d d d        nt        |
| t        j                        }
t        dj                  |dd              }|j                  t!        |	|
|              t#        |      |fS # 1 sw Y   RxY w)	Nr   z!Empty attributes section at line r   :rL   rz   r^   r   )r[   r&   r   r?   r   r   r   	TypeErrorr   ry   r'   r)   r   r   r_   rQ   r   r   )rT   rU   rJ   rV   rX   rW   r8   r   	name_typer   ry   r   s               rB   _read_attributes_sectionr   }  s:    *)aFXaY`aE:i7XY_X`5abZ JG	)(sA6D*::<D#))+3tJDJ.(I>&--d3>>
 ?> 4J	U]UcUcdJdiiQR)*,$:[_`a! " &j1:== ?>s   DD%	c                  t        | f||d|\  }}|s|rt        | |d|        d |fS g }|D ]  }|d   }d|v r6|j                  dd      d   }	|	j                         }	|j                         }
n|}	d }
t	        dj                  |dd              j                         }|j                  t        |	|
|              t        |      |fS )Nr   z(Empty functions/methods section at line r   (rL   r^   r   )	r[   r&   r   r?   r   r_   rQ   r
   r   )rT   rU   rJ   rV   rX   rW   r9   r   name_signaturer   	signaturer   s               rB   _read_functions_sectionr     s     *)aFXaY`aE:i7_`f_g5hiZIa. !''Q/2D::<D&,,.I!DIdiiQR)*002*X\]^  %Y/;;rD   c                  t        | f||d|\  }}|s|rt        | |d|        d |fS g }|D ]  }|d   }d|v r6|j                  dd      d   }	|	j                         }	|j                         }
n|}	d }
t	        dj                  |dd              j                         }|j                  t        |	|
|              t        |      |fS )Nr   zEmpty classes section at line r   r   rL   r^   r   )	r[   r&   r   r?   r   r_   rQ   r	   r   )rT   rU   rJ   rV   rX   rW   r;   r   r   r   r   r   s               rB   _read_classes_sectionr     s     *)aFXaY`aE:i7UV\U]5^_ZGa. !''Q/2D::<D&,,.I!DIdiiQR)*002~4ISWXY  #7+Z77rD   c                  t        | fd|i|\  }}|st        | |d|        d |fS g }|D ]N  }|d   }t        dj                  |dd              j	                         }|j                  t        ||             P t        |      |fS )NrU   z#Empty type aliases section at line r   r^   rL   )r   r   )r[   r&   r   r_   r?   rQ   r"   r   )	rT   rU   rV   rX   rW   type_aliasesr   r   r   s	            rB   _read_type_aliases_sectionr     s     *)NFNgNE:)Z3VW]V^1_`ZLAwdiiQR)*002.DdKL  '|4j@@rD   c                  t        | f||d|\  }}|s|rt        | |d|        d |fS g }|D ]  }|d   }d|v r6|j                  dd      d   }	|	j                         }	|j                         }
n|}	d }
t	        dj                  |dd              j                         }|j                  t        |	|
|              t        |      |fS )Nr   zEmpty modules section at line r   r   rL   r^   r   )	r[   r&   r   r?   r   r_   rQ   r   r   )rT   rU   rJ   rV   rX   rW   r<   r   r   r   r   r   s               rB   _read_modules_sectionr     s     *)aFXaY`aE:i7UV\U]5^_ZGa. !''Q/2D::<D&,,.I!DIdiiQR)*002DYTXYZ  #7+Z77rD   )trim_doctest_flagsrJ   c               d   t        | f||d|\  }}g }d}d}	g }
g }|j                  d      D ]g  }t        |      rK|r7|r2|j                  t        j
                  dj                  |      f       g }d}H|
j                  |       Z|r@|r,t        j                  d|      }t        j                  d|      }|j                  |       |j                  d      r|	 }	|
j                  |       |	r|
j                  |       |j                  d      rp|
rA|j                  t        j                  dj                  |
      j                  d      f       g }
d}|rt        j                  d|      }|j                  |       W|
j                  |       j |
r@|j                  t        j                  dj                  |
      j                  d      f       n2|r0|j                  t        j
                  dj                  |      f       |rt        |      |fS |rt        | |d|        d |fS )	Nr   Fr^   rG   ```z>>>TzEmpty examples section at line )rc   r   rC   rQ   r(   r7   r_   rm   subrl   rR   r   r`   r   r&   )rT   rU   r   rJ   rV   r   rW   sub_sectionsin_code_examplein_code_blockcurrent_textcurrent_examplerA   s                rB   _read_examples_sectionr     s    #9ZVhZRYZD*hjLOM L!#O

4 $" '')=)F)F		RaHb(cd&(O"'##D)!(,,R6,00T:""4(__U# --M%%__U###%9%>%>		,@W@^@^_c@d$ef!"O!(,,R6""4( %E !H 166		,8O8V8VW[8\]^	1::DIIo<VWX'5zAA)Z3RSYRZ1[\rD   c                `   |re|j                         j                  dd      }|dv r|d d }| j                  t        |dj	                  |      j                  d      |             y |rEt        |      r9| j                  t        dj	                  |      j                  d                   y y y )NrN   rF   )rJ   notesr^   )r   r   title)lowerrH   rQ   r   r_   r`   anyr   )sectionscurrentadmonition_titler   s       rB   _append_sectionr   Y  s    %%'//S9(( 9D&YYw'..t4&	
 
S\,TYYw-?-F-Ft-LMN "rD   c                  L    e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   	 ded<   y)	NumpyOptionsz.Options for parsing Numpydoc-style docstrings.boolignore_init_summaryr   rn   ro   rJ   N)__name__
__module____qualname____doc____annotations__ rD   rB   r   r     s1    8JE3]N7rD   r   F)total)r   r   rn   ro   rJ   c               f   g }g }d}d}	| j                   }
|||||d}|d   xr} | j                  duxrm | j                  j                  dk(  xrR | j                  j                  xr: | j                  j                  duxr  | j                  j                  j                  }|rdnd}|t        |
      k  rn|
|   j                         }|	r8|j                  d	      j                  d
      rd}	|j                  |
|          n|j                  d	      j                  d
      rd}	|j                  |
|          nt        |
|         r|j                  d       n|t        |
      dz
  k(  r&|j                  |
|          t        |||       d}g }n~t        |
|dz            rYt        |||       g }|t        v r7d}t        t        |      } || fd|dz   i|\  }}|r1|j                  |       n|
|   }|dz  }n|j                  |
|          |dz  }|t        |
      k  rnt        |||       |S )a  Parse a Numpydoc-style docstring.

    This function iterates on lines of a docstring to build sections.
    It then returns this list of sections.

    Parameters:
        docstring: The docstring to parse.
        ignore_init_summary: Whether to ignore the summary in `__init__` methods' docstrings.
        trim_doctest_flags: Whether to remove doctest flags from Python example blocks.
        warn_unknown_params: Warn about documented parameters not appearing in the signature.
        warn_missing_types: Warn about missing types/annotations for parameters, return values, etc.
        warnings: Whether to log warnings at all.

    Returns:
        A list of docstring sections.
    rG   F)r   r   rn   ro   rJ   r   N__init__r]   r   rN   r   TrL   rU   )rO   r   r   r   is_classrP   r   rS   rR   rQ   rC   r   rI   _section_kind_section_reader)rT   r   r   rn   ro   rJ   r   current_sectionr   r   rO   rV   ignore_summaryrU   
line_lowerreadersections                    rB   parse_numpyr     sp   2 (*HOMOOE 1220G 	%& 	-D(	-!!Z/	- ((	- ##4/		-
 ##,,  !QaF
3u:
6]((*
   %007 %""5=1 s#..u5 M""5=1 E&M*""2& s5zA~%""5=1Ho7GH! O 5!,-Ho7GH O ]*#% (z)BC"("Q6A:"Q"QOOG, $)= ! ""5=1!e 3u:
j Ho/?@OrD   )rA   r=   returnr   )
rT   r/   rU   intrJ   r   rV   r,   r  ztuple[list[list[str]], int])rT   r/   rU   r  rV   r,   r  ztuple[str, int])rT   r/   rU   r  rn   r   ro   r   rJ   r   rV   r,   r  z$tuple[list[DocstringParameter], int])
rT   r/   rU   r  rJ   r   rV   r,   r  z-tuple[DocstringSectionParameters | None, int])rT   r/   rU   r  rn   r   rJ   r   rV   r,   r  z2tuple[DocstringSectionOtherParameters | None, int])
rT   r/   rU   r  rn   r   rV   r,   r  z1tuple[DocstringSectionTypeParameters | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z-tuple[DocstringSectionDeprecated | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z*tuple[DocstringSectionReturns | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z)tuple[DocstringSectionYields | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z+tuple[DocstringSectionReceives | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z)tuple[DocstringSectionRaises | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z(tuple[DocstringSectionWarns | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z-tuple[DocstringSectionAttributes | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z,tuple[DocstringSectionFunctions | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z*tuple[DocstringSectionClasses | None, int])rT   r/   rU   r  rV   r,   r  z.tuple[DocstringSectionTypeAliases | None, int])
rT   r/   rU   r  rJ   r   rV   r,   r  z*tuple[DocstringSectionModules | None, int])rT   r/   rU   r  r   r   rJ   r   rV   r,   r  z+tuple[DocstringSectionExamples | None, int])r   listr   z	list[str]r   r=   r  None)rT   r/   r   r   r   r   rn   r   ro   r   rJ   r   r  zlist[DocstringSection])m
__future__r   r   
contextlibr   textwrapr   typingr   r   "griffe._internal.docstrings.modelsr   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   !griffe._internal.docstrings.utilsr&   r'   griffe._internal.enumerationsr(   r)   griffe._internal.expressionsr*   r+   r,   r-   r.   griffe._internal.modelsr/   r0   r1   other_parametersr   r2   r3   r4   r5   r6   r7   r8   r9   r;   r   r<   r   rC   rI   r[   rc   rd   r   re   rf   rg   compile
IGNORECASEVERBOSErh   ri   rj   rk   rl   rm   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rD   rB   <module>r     s  ( # 	   +       @ \ H 1#11&11&11 ,== +;;	
 #++ ")) $-- ")) !'' $-- &11 %// #-- #++ (55  #++!(N 	;!;! ;! 	;!
 ;! !;!|92   *# *# !rzz
J28* =  $* %
 MMBJJW  "
G !#g ##
jxj ) xvh /Z  	 MMBJJw  ",,B!C w C'RZZ(?@ 7 @ !%#G"G" G" 	G"
 G" G" G" *G"\ 	  	
  3& !%  	
   84 !%	CC C 	C
 C 7CT 	NN N 	N
 N 3N< 	8888 88 	88
 88 088~ 	0606 06 	06
 06 /06n 	,:,: ,: 	,:
 ,: 1,:f 	66 6 	6
 6 /6: 	44 4 	4
 4 .4: 	$>$> $> 	$>
 $> 3$>V 	<< < 	<
 < 2<H 	88 8 	8
 8 08@AA A 	A
 4A0 	88 8 	8
 8 08H  $>> > 	>
 > > 1>BO( ##%=))+I((*G##%=!5 3!!#9##%=""$;  "7%%'A  "7  "7!5!!#9&89E 8$ !&# $#jj j 	j
 j j j jrD   