
    iz"                       S SK Jr  S SKrS SKJrJrJrJr  S SKJ	r	  S SK
Jr  \(       a$  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr  \R0                  \R2                  \R4                  /r\S   r \R2                  S/ SQ4\R4                  S/ SQ4\R0                  S/ SQ40r " S S\SS9rSSSSS.             SS jjr " S S\SS9r SSSSS.             SS jjr!g)    )annotationsN)TYPE_CHECKINGAnyLiteral	TypedDict)warn)Parser)GoogleOptions)DocstringSection)NumpyOptions)DocstringStyle)SphinxOptions)	Docstring)
heuristicsmax_sectionsz!\n[ \t]*{0}:([ \t]+.+)?\n[ \t]+.+)args	argumentsparams
parameterszkeyword argszkeyword argumentsz
other argszother argumentszother paramsother parametersraises
exceptionsreturnsyieldsreceivesexamples
attributes	functionsmethodsclassesmoduleswarnswarningsz\n[ \t]*{0}\n[ \t]*---+\n)
deprecatedr   r   r   r   r   r   r"   r   r   r   r    r!   z&\n[ \t]*:{0}([ \t]+\w+)*:([ \t]+.+)?\n)param	parameterargargumentkeykeywordtypevarivarcvarvartyper   returnrtyper   raiseexcept	exceptionc                  <    \ rS rSr% SrS\S'    S\S'    S\S'   S	rg
)PerStyleOptionsj   z(Per-style options for docstring parsing.r
   googler   numpyr   sphinx N__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r;       Z/home/james-whalen/.local/lib/python3.13/site-packages/griffe/_internal/docstrings/auto.pyr6   r6   j   s     2.-.rD   r6   F)totalr   methodstyle_orderdefaultper_style_optionsc          	       ^  SSK Jn  U(       a'  U(       a  [        S5      e[        S[        SS9  XUUS.nO	U(       d  0 nU=(       d    [
         Vs/ s H%  n[        U[        5      (       a  [        U5      OUPM'     nnUS:X  a  U H  n[        U   u  pU	 V
s/ s HH  n
[        R                  " UR                  U
5      [        R                  [        R                  -  5      PMJ     nn
[        U 4S	 jU 5       5      (       d  M  US
4s  $    Ub  [        U[        5      (       a  US
4$ [        U5      S
4$ US:X  a  0 nU H   nXg   " T 40 UR!                  U0 5      D6X'   M"     UR#                  5        VVs0 s H  u  p}U[%        U5      _M     nnn['        UR)                  5       5      nU H  nX   U:X  d  M  X|U   4s  $    [        SU S35      es  snf s  sn
f s  snnf )a  Infer the parser to use for the docstring.

The 'heuristics' method uses regular expressions. The 'max_sections' method
parses the docstring with all parsers specified in `style_order` and returns
the one who parsed the most sections.

If heuristics fail, the `default` parser is returned. If multiple parsers
parsed the same number of sections, `style_order` is used to decide which
one to return. The `default` parser is never used with the 'max_sections' method.

Additional options are parsed to the detected parser, if any.

Parameters:
    docstring: The docstring to parse.
    method: The method to use to infer the parser.
    style_order: The order of the styles to try when inferring the parser.
    default: The default parser to use if the inference fails.
    per_style_options: Additional parsing options per style.
    **options: Deprecated. Use `per_style_options` instead.

Returns:
    The inferred parser, and optionally parsed sections (when method is 'max_sections').
r   )parsers2Cannot use both `options` and `per_style_options`.z;`**options` is deprecated. Use `per_style_options` instead.   
stacklevelr8   r9   r:   r   c              3  X   >#    U  H  oR                  TR                  5      v   M!     g 7f)N)searchvalue).0pattern	docstrings     rE   	<genexpr>(infer_docstring_style.<locals>.<genexpr>   s     K(w>>)//22(s   '*Nr   zInvalid method 'z'.)#griffe._internal.docstrings.parsersrM   
ValueErrorr   DeprecationWarning_default_style_order
isinstancestrr	   	_patternsrecompileformat
IGNORECASE	MULTILINEanygetitemslenmaxvalues)rX   rH   rI   rJ   rK   optionsrM   stylerW   replacementsreplacementpatternsstyle_sectionssectionstyle_lengthsr   s   `               rE   infer_docstring_styleru   u   s   B < QRRJL^klm'.GTS^SvbvSvwSv%Juc$:$:6%=ESvKw E$-e$4!GiuiuZe

7>>+68TUiu   K(KKKd{" ! "/Z-H-Hw_cccfU\o_ccc E$+N9$a@Q@U@UV[]_@`$aN! !CQCWCWCYZCYG,CYZ=//12 E#|3U333 ! 'xr2
33- x
 [s   ,GAG7Gc                  H    \ rS rSr% SrS\S'    S\S'    S\S'    S	\S
'   Srg)AutoOptions   z"Options for Auto-style docstrings.DocstringDetectionMethodrH   *list[Parser] | list[DocstringStyle] | NonerI   Parser | DocstringStyle | NonerJ   PerStyleOptions | NonerK   r;   Nr<   r;   rD   rE   rw   rw      s)    ,$$0;;?++;--/rD   rw   c                   SSK Jn  U(       a'  U(       a  [        S5      e[        S[        SS9  XUUS.nO	U(       d  0 n[        U UUUUS9u  pxUc  U" X40 UR                  U0 5      D6$ U$ )	aE  Parse a docstring by automatically detecting the style it uses.

See [`infer_docstring_style`][griffe.infer_docstring_style] for more information
on the available parameters.

Parameters:
    docstring: The docstring to parse.
    method: The method to use to infer the parser.
    style_order: The order of the styles to try when inferring the parser.
    default: The default parser to use if the inference fails.
    per_style_options: Additional parsing options per style.
    **options: Deprecated. Use `per_style_options` instead.

Returns:
    A list of docstring sections.
r   )parserN   z<`**options` are deprecated. Use `per_style_options` instead.rO   rP   rR   rG   )r[   r~   r\   r   r]   ru   rh   )	rX   rH   rI   rJ   rK   rm   r~   rn   sectionss	            rE   
parse_autor      s    4 : QRRKM_lmn'.GT++OE YJ):)>)>ub)IJJOrD   )rX   r   rH   ry   rI   rz   rJ   r{   rK   r|   rm   r   r0   z3tuple[Parser | None, list[DocstringSection] | None])rX   r   rH   ry   rI   rz   rJ   r{   rK   r|   rm   r   r0   zlist[DocstringSection])"
__future__r   rb   typingr   r   r   r   r#   r   griffe._internal.enumerationsr	   "griffe._internal.docstrings.googler
   "griffe._internal.docstrings.modelsr   !griffe._internal.docstrings.numpyr   r[   r   "griffe._internal.docstrings.sphinxr   griffe._internal.modelsr   r:   r8   r9   r^   ry   ra   r6   ru   rw   r   r;   rD   rE   <module>r      sy   # 	 9 9  0@C>B@1 v}}fllC  ##?@  6 MM,	
8 LL$	
& MM1	
aG	T/iu / (4>B.204B4B4 %B4 <	B4
 ,B4 .B4 B4 9B4J
0)5 
0  (4>B.204.. %. <	.
 ,. .. . .rD   