
    %jQ                       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-j7        de-j8        de-j9        de-j:        de-j;        de-j<        de-j=        de-j>        de-j?        de-j@        de-jA        de-jB        de-jB        de-jC        de-jD        de-jE        ZFdd"ZGdd#ZHd$d%dd.ZIdd0ZJd1ZKdeLd2<   d3ZMdeLd4<   d5ZNdeLd6<   d7ZOdeLd8<    ejP        d9eN d:eO d;eN d<eO d=	ejQ        ejR        z            ZSd>eLd?<   eSZTd>eLd@<   eSZUd>eLdA<    ejP        dBeN dCeN dDeK dEeM dFeO dGejQ        ejR        z            ZVd>eLdH<    ejP        dI          ZWd>eLdJ<    ejP        dK          ZXd>eLdL<   d$d$d$dMddQZYd$d%ddSZZd$d$dTddVZ[d$dWddYZ\d$d%dd[Z]d$d%dd]Z^d$d%dd_Z_d$d%ddaZ`d$d%ddcZad$d%ddeZbd$d%ddgZcd$d%ddiZdd$d%ddkZeddmZfd$d%ddoZgd$d$dpddsZhddzZie-j8        eZe-j9        e[e-j:        e\e-j7        e]e-j>        eae-j?        ebe-j@        ehe-jA        ece-jB        ede-jC        eee-jD        efe-jE        ege-j;        e^e-j<        e_e-j=        e`iZj G d{ d|e	d}~          Zkd}d$d$d$d$dddZldS )    )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linestrreturnboolc                ,    |                                   S )N)stripr=   s    i/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/griffe/_internal/docstrings/numpy.py_is_empty_linerE   [   s    zz||    c                h    t          |            o"t          |                     dd                    S )N- )rE   replacerC   s    rD   _is_dash_linerK   _   s.    d###Mt||C7L7L(M(MMrF   T)warnings	docstringr/   offsetintrL   optionsr,   tuple[list[list[str]], int]c                  | j         }|t          |          k    rg |fS |}g }t          ||                   r|dz  }t          ||                   ||         g}|dz  }|t          |          k     r@||         }t          |          r|                    d           n|                    d          r|                    |dd                     n|                    d          rkt          |          t          |                                          z
  }	|                    ||	d                     |rt          | |d|dz    d|	            nG|dz   t          |          k     rt          ||dz                      rn1|                    |           |g}|dz  }|t          |          k     @|r|                    |           ||dz
  fS )N   rI   z        z,Confusing indentation for continuation line z' in docstring, should be 4 spaces, not )lineslenrE   append
startswithlstripr&   rK   )
rM   rN   rL   rP   rV   
new_offsetitemscurrent_itemr=   cont_indents
             rD   _read_block_itemsr_   c   s    OEU6zJE z*
+
+ a
 z*
+
+  *%&L!OJ s5zz
!
!Z $ 	"####__W%% 	"QRR))))__S!! 	"d))c$++--&8&88K[\\ 2333 !=:PQ> = =/:= =   !^c%jj((]5a;P-Q-Q( LL&&& 6La
? s5zz
!
!B  #\"""*q.  rF   tuple[str, int]c               x   | j         }|t          |          k    rd|fS |}g }t          ||                   r|dz  }t          ||                   |t          |          k     rt          ||                   }|r/|t          |          dz
  k     rt          ||dz                      rnd|r/|t          |          dz
  k     rt          ||dz                      rn3|                    ||                    |dz  }|t          |          k     d                    |                              d          |dz
  fS )NrI   rS      
)rV   rW   rE   rK   rX   joinrstrip)rM   rN   rP   rV   r[   blockis_emptys          rD   _read_blockrh      sR   OEU6zJE z*
+
+ a
 z*
+
+ 
s5zz
!
!!%
"344 	
SZZ!^33eJYZNF[8\8\3 	
SZZ!^33eJYZNF[8\8\3U:&'''a
 s5zz
!
! 99U""4((*q.88rF   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_typesrL   rs   rt   $tuple[list[DocstringParameter], int]c                  g }t          | fd|i|\  }}|D ]}	t                              |	d                   }
|
s|rt          | |d|	d          d           C|
                    d                              d          }|
                    d          pd |
                    d          }d |r||                    dd	          d         nCrAt          j        d
          }
|
r*|
                    d          |
                    d          r                    d          r
d d         t          |	          d	k    r/d	                    |	d	d                    
                                ndi|D ]M}t          t          t                    5  | j        j        |         j        	 d d d             nA# 1 swxY w Y   N|r|rt          | |d|            nt#          | t$          j                  P|D ]M}t          t          t                    5  | j        j        |         j        	 d d d             n# 1 swxY w Y   N|rw|rut          t                    5  | j        j        }|D ]9}||vr3d| d}d| d| fD ]}||v r|d| dz  } nt          | ||           :	 d d d            n# 1 swxY w Y   |                    fd|D                        ||fS )NrN   r   Could not parse line ''names, typechoicesrS   8^(?P<annotation>.+),\s+default(?: |: |=)(?P<default>.+)$default
annotationz
, optionalirc   rI   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          |           V  dS )valuer   descriptionN)r   ).0namer   r~   r   s     rD   	<genexpr>z#_read_parameters.<locals>.<genexpr>"  sG       
 
hlt7zWbccc
 
 
 
 
 
rF   )r_   rp   matchr&   groupsplitreendswithrW   rd   re   r   AttributeErrorKeyErrorparentr1   r   r'   r)   debugr~   extend)rM   rN   rs   rt   rL   rP   r1   r\   r[   itemr   ry   r|   r   paramsmessagestarred_namer   r~   r   s                    @@@rD   _read_parametersr      s    ,.J *)NNFNgNNE: 7
 7
##DG,, 	 ^!)Z9\RVWXRY9\9\9\]]]G$$**400[[((0D
++i(( 	7 JmmD!,,Q/GG 	7HXZdeeE 7++i00"[[66
 	**--l;; 	*#DSD)J69$ii!mmdiiQRR))00222 p pnh77  !*!1!<T!B!MJ                  p 2 p%i=ngl=n=nooo3J	U]UcdddJ?  nh77  '.9$?GG                  
	J+ 
	J.)) 	J 	J")4! J JD6))"a"a"a"a-7ZZd,E & &L+v55 '+Nl+N+N+N N %  6 *)ZIIIJ	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	 
 
 
 
 
 
pu
 
 
 	
 	
 	
 	
 z!!s7   GG	G#I		II-A	KK	
K	-tuple[DocstringSectionParameters | None, int]c                   t          | f||d|\  }}|rt          |          |fS |rt          | |d|            d |fS )NrN   rL   z!Empty parameters section at line )r   r   r&   )rM   rN   rL   rP   r1   r[   s         rD   _read_parameters_sectionr   )  ss     .ieQYee]deeJ
 B)*55zAA _)Z1]U[1]1]^^^rF   )rs   rL   2tuple[DocstringSectionOtherParameters | None, int]c                   t          | f|d|d|\  }}|rt          |          |fS |rt          | |d|            d |fS )NF)rN   rs   rL   z'Empty other parameters section at line )r   r   r&   )rM   rN   rs   rL   rP   r1   r[   s          rD   _read_other_parameters_sectionr   8  s     .!	 
  J
  G.z::JFF e)Z1c[a1c1cdddrF   )rs   1tuple[DocstringSectionTypeParameters | None, int]c                  g }t          | fd|i|\  }}|D ]}t                              |d                   }|st          | |d|d          d           A|                    d                              d          }	|                    d          pd |                    d          }
d |
r|
|
                    dd	          d         nCrAt          j        d
          }|r*|                    d          |                    d          t          |          d	k    r/d                    |d	d                    	                                ndQ|	D ]M}t          t          t                    5  | j        j        |         j        	 d d d             n)# 1 swxY w Y   Nnt!          | t"          j                  P|	D ]M}t          t          t                    5  | j        j        |         j        	 d d d             n# 1 swxY w Y   N|rt          t                    5  | j        j        }|	D ]F}||vr@d| d| j        j         d}d| d| fD ]}||v r|d| dz  } nt          | ||           G	 d d d            n# 1 swxY w Y   |                    fd|	D                        |rt-          |          |fS t          | |d|            d |fS )NrN   r   rw   rx   ry   rz   r{   r|   rS   r}   r~   r   rc   rI   r   zType parameter 'z' does not appear in the z
 signaturer   r   r   r   c              3  >   K   | ]}t          |           V  dS r   )r#   )r   r   boundr~   r   s     rD   r   z0_read_type_parameters_section.<locals>.<genexpr>  sG       
 
gk"4w5Vabbb
 
 
 
 
 
rF   z&Empty type parameters section at line )r_   rp   r   r&   r   r   r   rW   rd   re   r   r   r   r   type_parametersr   r'   r)   r   r~   kindr   r   )rM   rN   rs   rP   r   r\   r[   r   r   ry   r|   r   type_paramsr   r   r   r~   r   s                  @@@rD   _read_type_parameters_sectionr   N  s~    57O *)NNFNgNNE: 1
 1
##DG,, 	i5XdSTg5X5X5XYYYG$$**400F##+t++i(( 	2EmmD!,,Q/GG 	2HXZ_``E 2++i00L1169$ii!mmdiiQRR))00222=  nh77  %,<TBME                
 /ui8>ZZZE?  nh77  '.>tDLG                  
	J.)) 	J 	J'.>! J JD;.."uT"u"uT]TdTi"u"u"u-7ZZd,E & &L+{:: '+Nl+N+N+N N %  ; *)ZIIIJ	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	 
 
 
 
 
 
ot
 
 
 	
 	
 	
 	
  K-o>>
JJi-^V\-^-^___s7   9FF#&F#(HHH0AJJ	J	-tuple[DocstringSectionDeprecated | None, int]c               L   t          | f||d|\  }}|s|rt          | |d|            d |fS |r't          |          dk    rt          | |d|            |d         }|d         }t          d                    |dd                              }t          ||          |fS )Nr   z!Empty deprecated section at line rS   zToo many deprecated items at r   rc   )versiontext)r_   r&   rW   r   rd   r   )	rM   rN   rL   rP   r\   r[   r   r   r   s	            rD   _read_deprecated_sectionr     s     *)aFXaaY`aaE:   	ci5aY_5a5abbbZ [CJJNN)Z1YQW1Y1YZZZ8D1gG$))DH%%&&D%gDAAA:MMrF   *tuple[DocstringSectionReturns | None, int]c                  t          | f||d|\  }}|s|rt          | |d|            d |fS g }t          |          D ]\  }}t                              |d                   }	|	s|rt          | |d|d          d           F|	                                }
|
d         p|
d         }|
d         p|
d	         }t          d
                    |dd                              }|t          t          t          t                    5  | j        j        r| j        j        }n | j        j        r| j        j        }nt          t#          |          dk    r~|j        r|j        j        |         }nd|j        r|j        }n!|j        r|j        j        d         }nt          t/          |t0                    r|}n|j        r|j        j        |         }n|}d d d            n# 1 swxY w Y   nt3          || t4          j                  }|                    t;          |pd||                     t=          |          |fS )Nr   zEmpty returns section at line r   rw   rx   nt_namer   nt_typer{   rc   rS   rb   r   rI   r   r   r   )r_   r&   	enumeraterm   r   	groupdictr   rd   r   r   r   
ValueErrorr   is_functionr2   is_attributer   rW   is_tuplesliceelementsis_iteratoris_generator
isinstancer*   r'   r)   r   rX   r   r   )rM   rN   rL   rP   r\   r[   r2   indexr   r   groupsr   r   r   return_items                  rD   _read_returns_sectionr     s    *)aFXaaY`aaE:   	`i5^V\5^5^___ZG '' &b &bt!!$q'** 	 ^!)Z9\RVWXRY9\9\9\]]]""i 2F6NI&8&.
diiQRR))**.(J?? 5 5#/ %!*!1!9JJ%2 %!*!1!<JJ$$u::>>!* 5%/%5%>u%E

%1 -*4*:KK'4 -*4*:*CA*FKK",,%k8<< 5)4JJ(1 5)4):)CE)JJJ)4J-5 5 5 5 5 5 5 5 5 5 5 5 5 5 50 4J	U]UcdddJDJB:[_```aaaa"7++Z77s   CGG#	&G#	)tuple[DocstringSectionYields | None, int]c                  t          | f||d|\  }}|s|rt          | |d|            d |fS g }t          |          D ]\  }}t                              |d                   }	|	s|rt          | |d|d          d           F|	                                }
|
d         p|
d         }|
d         p|
d	         }t          d
                    |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# 1 swxY w Y   nt-          || t.          j                  }|                    t5          |pd||                     t7          |          |fS )Nr   zEmpty yields section at line r   rw   rx   r   r   r   r{   rc   rS   r   rI   r   )r_   r&   r   rn   r   r   r   rd   r   r   
IndexErrorr   r   r   r   r   r   r   r   r   r*   r   r'   r)   r   rX   r%   r!   )rM   rN   rL   rP   r\   r[   r3   r   r   r   r   r   r   r   
yield_items                  rD   _read_yields_sectionr     sj    *)aFXaaY`aaE:   	_i5]U[5]5]^^^ZF '' ` `t  a)) 	 ^!)Z9\RVWXRY9\9\9\]]]""i 2F6NI&8&.
diiQRR))**.*h
KK , ,&-8
) %!+!1JJ, %!+!1!:1!=JJ$$j(33 ,!+JJ( ,!+!1!:5!AJJ!+J, , , , , , , , , , , , , , , 4J	U]UcdddJn$*"Y]^^^____!&)):55s   A1F

F	F	+tuple[DocstringSectionReceives | None, int]c                  t          | f||d|\  }}|s|rt          | |d|            d |fS g }t          |          D ]u\  }}t                              |d                   }	|	s|rt          | |d|d          d           F|	                                }
|
d         p|
d         }|
d         p|
d	         }t          d
                    |dd                              }|t          t          t                    5  | j        j        }|j        rF|j        j        d         }t!          |t"                    r|}n|j        r|j        j        |         }n|}d d d            n# 1 swxY w Y   nt'          || t(          j                  }|                    t/          |pd||                     wt1          |          |fS )Nr   zEmpty receives section at line r   rw   rx   r   r   r   r{   rc   rS   r   rI   r   )r_   r&   r   ro   r   r   r   rd   r   r   r   r   r2   r   r   r   r   r*   r   r'   r)   r   rX   r   r   )rM   rN   rL   rP   r\   r[   r4   r   r   r   r   r   r   r   receives_items                  rD   _read_receives_sectionr     sJ    *)aFXaaY`aaE:   	ai5_W]5_5_```ZH '' d dt""47++ 	 ^!)Z9\RVWXRY9\9\9\]]]""i 2F6NI&8&.
diiQRR))**.(33 	3 	3&-5
* 3$.$4$=a$@M!-:: 3%2

&/ 3%2%8%A%%H

%2
	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 4J	U]UcdddJ(djbZ]abbbcccc#H--z99s   AE''E+	.E+	)tuple[DocstringSectionRaises | None, int]c               X   t          | f||d|\  }}|s|rt          | |d|            d |fS g }|D ]f}t          |d         |           }t          d                    |dd                              }	|                    t          ||	                     gt          |          |fS )Nr   zEmpty raises section at line r   rc   rS   r   r   )r_   r&   r'   r   rd   rX   r   r   )
rM   rN   rL   rP   r\   r[   r5   r   r   r   s
             rD   _read_raises_sectionr   K  s     *)aFXaaY`aaE:   	_i5]U[5]5]^^^ZF O O/QCC
diiQRR))**n
MMMNNNN!&)):55rF   (tuple[DocstringSectionWarns | None, int]c               X   t          | f||d|\  }}|s|rt          | |d|            d |fS g }|D ]f}t          |d         |           }t          d                    |dd                              }	|                    t          ||	                     gt          |          |fS )Nr   zEmpty warns section at line r   rc   rS   r   )r_   r&   r'   r   rd   rX   r$   r    )
rM   rN   rL   rP   r\   r[   r6   r   r   r   s
             rD   _read_warns_sectionr   d  s     *)aFXaaY`aaE:   	^i5\TZ5\5\]]]ZE M M/QCC
diiQRR))**]jdKKKLLLL ''33rF   -tuple[DocstringSectionAttributes | None, int]c                  t          | f||d|\  }}|s|rt          | |d|            d |fS g }|D ]}|d         }d|v rD|                    dd          \  }	}
|	                                }	|
                                pd }
n|}	d }
|
Kt	          t
          t          t                    5  | j        |	         j	        }
d d d            n# 1 swxY w Y   nt          |
| t          j                  }
t          d                    |dd                              }|                    t!          |	|
|                     t#          |          |fS )	Nr   z!Empty attributes section at line r   :rS   r   rc   r   )r_   r&   r   rB   r   r   r   	TypeErrorr   r   r'   r)   r   r   rd   rX   r   r   )rM   rN   rL   rP   r\   r[   r8   r   	name_typer   r   r   s               rD   _read_attributes_sectionr   }  s    *)aFXaaY`aaE:   	ci5aY_5a5abbbZ J b bG	)(sA66D*::<<D#))++3tJJDJ.(I>> ? ?&-d3>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 4J	U]UcdddJdiiQRR))**,$:[_```aaaa%j11:==s   -CC	C	,tuple[DocstringSectionFunctions | None, int]c                  t          | f||d|\  }}|s|rt          | |d|            d |fS g }|D ]}|d         }d|v rE|                    dd          d         }	|	                                }	|                                }
n|}	d }
t	          d                    |dd                                                              }|                    t          |	|
|                     t          |          |fS )Nr   z(Empty functions/methods section at line r   (rS   rc   r   )	r_   r&   r   rB   r   rd   rX   r
   r   )rM   rN   rL   rP   r\   r[   r9   r   name_signaturer   	signaturer   s               rD   _read_functions_sectionr     s4    *)aFXaaY`aaE:   	ji5h`f5h5hiiiZI 
_ 
_a.  !''Q//2D::<<D&,,..II!DIdiiQRR))**0022*X\]]]^^^^$Y//;;rF   *tuple[DocstringSectionClasses | None, int]c                  t          | f||d|\  }}|s|rt          | |d|            d |fS g }|D ]}|d         }d|v rE|                    dd          d         }	|	                                }	|                                }
n|}	d }
t	          d                    |dd                                                              }|                    t          |	|
|                     t          |          |fS )Nr   zEmpty classes section at line r   r   rS   rc   r   )	r_   r&   r   rB   r   rd   rX   r	   r   )rM   rN   rL   rP   r\   r[   r;   r   r   r   r   r   s               rD   _read_classes_sectionr     s1    *)aFXaaY`aaE:   	`i5^V\5^5^___ZG 
Z 
Za.  !''Q//2D::<<D&,,..II!DIdiiQRR))**0022~4ISWXXXYYYY"7++Z77rF   .tuple[DocstringSectionTypeAliases | None, int]c               Z   t          | fd|i|\  }}|st          | |d|            d |fS g }|D ]j}|d         }t          d                    |dd                                                              }|                    t          ||                     kt          |          |fS )NrN   z#Empty type aliases section at line r   rc   rS   )r   r   )r_   r&   r   rd   rB   rX   r"   r   )	rM   rN   rP   r\   r[   type_aliasesr   r   r   s	            rD   _read_type_aliases_sectionr     s     *)NNFNgNNE:  )Z1_W]1_1_```ZL M MAwdiiQRR))**0022.DdKKKLLLL&|44j@@rF   *tuple[DocstringSectionModules | None, int]c                  t          | f||d|\  }}|s|rt          | |d|            d |fS g }|D ]}|d         }d|v rE|                    dd          d         }	|	                                }	|                                }
n|}	d }
t	          d                    |dd                                                              }|                    t          |	|
|                     t          |          |fS )Nr   zEmpty modules section at line r   r   rS   rc   r   )	r_   r&   r   rB   r   rd   rX   r   r   )rM   rN   rL   rP   r\   r[   r<   r   r   r   r   r   s               rD   _read_modules_sectionr     s1    *)aFXaaY`aaE:   	`i5^V\5^5^___ZG 
[ 
[a.  !''Q//2D::<<D&,,..II!DIdiiQRR))**0022DYTXYYYZZZZ"7++Z77rF   )trim_doctest_flagsrL   r   +tuple[DocstringSectionExamples | None, int]c                  t          | f||d|\  }}g }d}d}	g }
g }|                    d          D ]}t          |          rS|r;|r6|                    t          j        d                    |          f           g }d}O|
                    |           e|rN|r6t                              d|          }t                              d|          }|                    |           |
                    d          r|	 }	|
                    |           |	r|
                    |           |
                    d          r|
rI|                    t          j        d                    |
                              d          f           g }
d}|rt                              d|          }|                    |           |
                    |           |
rH|                    t          j        d                    |
                              d          f           n6|r4|                    t          j        d                    |          f           |rt          |          |fS |rt          | |d|            d |fS )	Nr   Frc   rI   ```z>>>TzEmpty examples section at line )rh   r   rE   rX   r(   r7   rd   rr   subrq   rY   r   re   r   r&   )rM   rN   r   rL   rP   r   r[   sub_sectionsin_code_examplein_code_blockcurrent_textcurrent_exampler=   s                rD   _read_examples_sectionr     s    #9ZVhZZRYZZD*hjLOM L!#O

4   "& "&$ !	& *" ) '')=)F		RaHbHb(cddd&(O"'##D)))) 	&! ;(,,R66,00T::""4((((__U## 	& --M%%%% 	&%%%%__U## 	& "##%9%>		,@W@W@^@^_c@d@d$efff!"O! 7(,,R66""4(((( %%%% Y16		,8O8O8V8VW[8\8\]^^^^	 Y1:DIIo<V<VWXXX B'55zAA ])Z1[SY1[1[\\\rF   sectionslistcurrent	list[str]admonition_titleNonec                   |r|                                                     dd          }|dv r
|d d         }|                     t          |d                    |                              d          |                     d S |rYt          |          rL|                     t          d                    |                              d                               d S d S d S )NrU   rH   )rL   notesrc   )r   r   title)lowerrJ   rX   r   rd   re   anyr   )r   r   r   r   s       rD   _append_sectionr  Y  s    O%%''//S99((( 9D&YYw''..t44&  	
 	
 	
 	
 	
 
 OS\\ O,TYYw-?-?-F-Ft-L-LMMNNNNNO O O OrF   c                  N    e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   	 ded<   dS )	NumpyOptionsz.Options for parsing Numpydoc-style docstrings.r@   ignore_init_summaryr   rs   rt   rL   N)__name__
__module____qualname____doc____annotations__ rF   rD   r  r    s]         88JE3]NNN77rF   r  F)total)r  r   rs   rt   rL   r  list[DocstringSection]c                  g }g }d}d}	| j         }
|||||d}|d         oC| j        duo:| j        j        dk    o*| j        j        o| j        j        duo| j        j        j        }|rdnd}|t          |
          k     r|
|                                         }|	rG|                    d	                              d
          rd}	|	                    |
|                    nY|                    d	                              d
          rd}	|	                    |
|                    nt          |
|                   r|	                    d           n|t          |
          dz
  k    r1|	                    |
|                    t          |||           d}g }nt          |
|dz                      rmt          |||           g }|t          v rCd}t          t          |                  } || fd|dz   i|\  }}|r|	                    |           n)|
|         }|dz  }n|	                    |
|                    |dz  }|t          |
          k     t          |||           |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.
    rI   F)r   r  rs   rt   rL   r  N__init__rb   r   rU   r   TrS   rN   )rV   r   r   r   is_classrW   r   rZ   rY   rX   rE   r  rK   _section_kind_section_reader)rM   r  r   rs   rt   rL   r   current_sectionr   r   rV   rP   ignore_summaryrN   
line_lowerreadersections                    rD   parse_numpyr    s   2 (*HOMOE 1220 G 	%& 	-D(	-!Z/	- (	- #4/		-
 #,  !'QQaF
3u::

6]((**
  ,	2  %%0077 & %""5=1111 s##..u55 $	2 M""5=1111 E&M** 	2""2&&&& s5zzA~%%""5=111Ho7GHHH! OO 5!,-- 	2Ho7GHHH O ]**#% (z)BC"(&"Q"Q6A:"Q"Q"Q -OOG,,, $)= ! ""5=111!e 3u::

j Ho/?@@@OrF   )r=   r>   r?   r@   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   rQ   )rM   r/   rN   rO   rP   r,   r?   r`   )rM   r/   rN   rO   rs   r@   rt   r@   rL   r@   rP   r,   r?   ru   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )rM   r/   rN   rO   rs   r@   rL   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rs   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )rM   r/   rN   rO   rP   r,   r?   r   )
rM   r/   rN   rO   rL   r@   rP   r,   r?   r   )rM   r/   rN   rO   r   r@   rL   r@   rP   r,   r?   r   )r   r   r   r   r   r>   r?   r   )rM   r/   r  r@   r   r@   rs   r@   rt   r@   rL   r@   r?   r  )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  rE   rK   r_   rh   ri   r	  rj   rk   rl   compile
IGNORECASEVERBOSErm   rn   ro   rp   rq   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r
  rF   rD   <module>r%     s  ( # " " " " " " 				             + + + + + + + +                                                               @ \ [ [ [ [ [ [ [ H H H H H H H H 1 1 1 1 1 1 2########111111111111&1&1 ,= +;	
 #+ ") $- ") !' $- &1 %/ #- #+ (5  #+!(   N N N N 	;! ;! ;! ;! ;! ;!|9 9 9 92         * * * * *    !rz

 
3;
 
 	
 
 $
 
 
 MBJ      "
 ! ! ! !# # # # ##		 	'	 	
 	 	
 (.	 	 	 	 	 MBJ      ",,B!C!C  C C C C'RZ(?@@  @ @ @ @ !%#G" G" G" G" G" G"\ 	     & !%     4 !%	C C C C C CT 	N N N N N N< 	88 88 88 88 88 88~ 	06 06 06 06 06 06n 	,: ,: ,: ,: ,: ,:f 	6 6 6 6 6 6: 	4 4 4 4 4 4: 	$> $> $> $> $> $>V 	< < < < < <H 	8 8 8 8 8 8@A A A A0 	8 8 8 8 8 8H  $> > > > > >BO O O O( #%=)+I(*G#%=!5 3!#9#%="$; "7%'A "7 "7!5!#9&8 8 8 8 89E 8 8 8 8$ !&# $#j j j j j j j jrF   