
    -Ph0                       d Z ddlmZ ddlZddlZddl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 ddlmZ dd	lmZmZ erdd
lmZmZ ddlmZ ddlmZ  ej        e          Z  ej!        d          Z" ej!        d          Z# ej!        d          Z$ ej!        d          Z% ej!        d          Z& ej!        d          Z' ej!        d          Z( ej!        d          Z) ej!        d          Z* ej!        d          Z+ ej!        d          Z, e-h d          Z. G d dej/        e                   Z0d1dZ1d2d!Z2d3d4d%Z3	 	 d5d6d)Z4d7d,Z5 G d- d.          Z6 G d/ d0e6          Z7dS )8z-Classes for docstring parsing and formatting.    )annotationsN)partial)starmap)TYPE_CHECKINGAny)___)logging)get_type_hintsstringify_annotation)CallableIterator)SphinxConfigz
\.\. \S+::z^(\s|\w)+:\s*$z(.+?)\(\s*(.*[^\s]+)\s*\)z^[=\-`:\'"~^_*+#<>]{2,}\s*$z(?<!:):(?!:)zi((?::(?:[a-zA-Z0-9]+[\-_+:.])*[a-zA-Z0-9]+:`.+?`)|(?:``.+?``)|(?::meta .+:.*)|(?:`.+?\s*(?<!\x00)<.*?>`))z5(?:(?::(?:[a-zA-Z0-9]+[\-_+:.])*[a-zA-Z0-9]+:)?`.+?`)z^(\*|\+|\-)(\s+\S|\s*$)zP^(?P<paren>\()?(\d+|#|[ivxlcdm]+|[IVXLCDM]+|[a-zA-Z])(?(paren)\)|\.)(\s+\S|\s*$)z_(,\sor\s|\sor\s|\sof\s|:\s|\sto\s|,\sand\s|\sand\s|,\s|[{]|[}]|"(?:\\"|[^"])*"|'(?:\\'|[^'])*')z^default[^_0-9A-Za-z].*$>   NoneTrueFalseEllipsis...c                  @     e Zd ZdZ e            ZddZd	 fdZ xZS )
DequezA subclass of deque that mimics ``pockets.iterators.modify_iter``.

    The `.Deque.get` and `.Deque.next` methods are added.
    nintreturnr   c                F    |t          |           k     r| |         n| j        S )zoReturn the nth element of the stack, or ``self.sentinel`` if n is
        greater than the stack size.
        )lensentinel)selfr   s     ]/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sphinx/ext/napoleon/docstring.pygetz	Deque.getA   s"     c$ii--tAwwT]:    c                V    | r t                                                      S t          N)superpopleftStopIteration)r   	__class__s    r    nextz
Deque.nextG   s%     	 77??$$$r"   )r   r   r   r   )r   r   )	__name__
__module____qualname____doc__objectr   r!   r)   __classcell__r(   s   @r    r   r   9   sh         
 vxxH; ; ; ;                   r"   r   tokens	list[str]r   c                z    t          j        |           }ddfddfd}t           ||                    S )	N)optionaldefaultr1   collections.deque[str]r   Iterator[str]c              3  X  K   d}d }	 	 |                                  }n# t          $ r Y d S w xY w|dk    r|}1|                                sF|v r.|                     |           ||                     |           d S ||V  d }|dk    r|dz  }n|dk    r|dz  }|V  |dk    rd S )Nr   T, {   })r&   
IndexErrorstrip
appendleft)r1   open_bracesprevious_tokentokenkeywordss       r    takewhile_setz,_recombine_set_tokens.<locals>.takewhile_setR   s     	((    }}!&;;==   !!%(((!-%%n555)$$$$!%||q #q KKKa?	s    
--c              3     K   	 	 |                                  }n# t          $ r Y d S w xY w|dk    r6|                     d           d                     |                     V  n|V  h)NTr:    )r&   r=   r?   join)r1   rB   rD   s     r    combine_setz*_recombine_set_tokens.<locals>.combine_setv   s      
	((    ||!!#&&&ggmmF33444444
	s    
)))r1   r6   r   r7   )collectionsdequelist)r1   token_queuerH   rC   rD   s      @@r    _recombine_set_tokensrM   N   sp    #F++K&H" " " " " "H      K(()))r"   specstrc                \    ddfdt                               |           D             }|S )NitemrO   r   r2   c                n    t                               |           r| d d         }| dd          }|d|gS | gS )N       )_default_regexmatch)rQ   r5   others      r    postprocessz(_tokenize_type_spec.<locals>.postprocess   sH    %% 	2A2hG HES%((6Mr"   c                4    g | ]} |          D ]}||S  r[   ).0	raw_tokenrQ   rY   s      r    
<listcomp>z'_tokenize_type_spec.<locals>.<listcomp>   sP       K	**  	   r"   )rQ   rO   r   r2   )_token_regexsplit)rN   r1   rY   s     @r    _tokenize_type_specra      sT    	 	 	 	   %++D11  F Mr"   rB   debug_location
str | Nonec                   dd}|                      d          s|                     d          rd}n ||           s~|                      d          r|                     d	          sT|                      d
          r|                     d
          s*|                      d          r|                     d          rd}n.|                      d          r-t                              t	          d          | |           d}n|                     d	          r-t                              t	          d          | |           d}n|                      d          r-t                              t	          d          | |           d}nh|                     d          r-t                              t	          d          | |           d}n&| dv rd}nt
                              |           rd}nd}|S )NrB   rO   r   boolc                H    	 t          |            dS # t          $ r Y dS w xY wNTF)complex
ValueError)rB   s    r    
is_numericz_token_type.<locals>.is_numeric   s=    	ENNN 4  	 	 	55	s    
!!rU   	delimiterr:   r<   "'literalz-invalid value set (missing closing brace): %s)locationz-invalid value set (missing opening brace): %s)rm   rl   z4malformed string literal (missing closing quote): %sz4malformed string literal (missing opening quote): %s>   r5   r4   control	referenceobj)rB   rO   r   re   )
startswithendswithloggerwarningr	   _xref_regexrW   )rB   rb   rj   type_s       r    _token_typery      sQ        ,s 3 3 ,
5*S!!*&+nnS&9&9* S!!* ',nnS&9&9* S!!	* ',nnS&9&9	* 			#		 #>??# 	 	
 	
 	

 			 >??# 	 	
 	
 	

 			*	%	% EFF# 	 	
 	
 	

 	
	#	# EFF# 	 	
 	
 	

 	)	)	) 			5	!	! Lr"   _typetranslationsdict[str, str] | Nonec                    i t          |           }t          |          }fd|D             }d fdd d d dd                    fd	|D                       }|S )
Nc                4    g | ]}|t          |          fS r[   )ry   )r\   rB   rb   s     r    r^   z&_convert_type_spec.<locals>.<listcomp>   s(    VVVUe[778VVVr"   c                    d|  dS )Nz``r[   xs    r    <lambda>z$_convert_type_spec.<locals>.<lambda>   s    Z!ZZZ r"   c                $    t          |           S r$   )_convert_type_spec_obj)r   r{   s    r    r   z$_convert_type_spec.<locals>.<lambda>   s    /<@@ r"   c                    d|  dS )N*r[   r   s    r    r   z$_convert_type_spec.<locals>.<lambda>   s    XXXX r"   c                    | S r$   r[   r   s    r    r   z$_convert_type_spec.<locals>.<lambda>       q r"   c                    | S r$   r[   r   s    r    r   z$_convert_type_spec.<locals>.<lambda>   r   r"   )rn   rr   rp   rk   rq   rF   c              3  Z   K   | ]%\  }}                      |          |          V  &d S r$   )r!   )r\   rB   rx   
converterss      r    	<genexpr>z%_convert_type_spec.<locals>.<genexpr>   sQ        E5 	
ue$$     r"   )ra   rM   rG   )rz   r{   rb   r1   combined_tokenstypes	convertedr   s    ``    @r    _convert_type_specr      s    
  ''F+F33OVVVVoVVVE ('@@@@%% [ [ J     !    I
 r"   rr   dict[str, str]c                    |                     | |           }t                              |          |S |t          v r|dk    rdS d| dS d| dS )Nr   z:py:obj:`... <Ellipsis>`	:py:obj:``z:py:class:`)r!   rw   rW   _SINGLETONS)rr   r{   translations      r    r   r      sq    ""3,,K%%1 k!!%--);))))'''''r"   c                  >   e Zd ZdZ ej        dej                  Z	 	 	 	 	 	 dsdtdZdudZ	dvdZ
dwdZdxdydZdwdZdwdZ	 	 dzd{d%Z	 d|d}d(Zd~d*Z	 ddd,Zdwd-Zdud.Zdwd/Zdwd0Zddd3Zdd4Zdd6Zdd8Z	 ddd;Z	 	 dddAZddEZddGZdddJZddLZ ddMZ!ddNZ"dddQZ#dxddRZ$ddSZ%ddTZ&ddUZ'ddVZ(ddWZ)ddYZ*dwdZZ+dd[Z,dd\Z-dd]Z.dd^Z/dd_Z0dd`Z1ddbZ2ddcZ3dddZ4ddeZ5ddfZ6ddgZ7ddhZ8ddiZ9ddjZ:ddkZ;ddlZ<ddmZ=ddnZ>ddpZ?ddqZ@ddrZAdS )GoogleDocstringaW  Convert Google style docstrings to reStructuredText.

    Parameters
    ----------
    docstring : :obj:`str` or :obj:`list` of :obj:`str`
        The docstring to parse, given either as a string or split into
        individual lines.
    config: :obj:`sphinx.ext.napoleon.Config` or :obj:`sphinx.config.Config`
        The configuration settings to use. If not given, defaults to the
        config object on `app`; or if `app` is not given defaults to the
        a new :class:`sphinx.ext.napoleon.Config` object.


    Other Parameters
    ----------------
    app : :class:`sphinx.application.Sphinx`, optional
        Application object representing the Sphinx process.
    what : :obj:`str`, optional
        A string specifying the type of the object to which the docstring
        belongs. Valid values: "module", "class", "exception", "function",
        "method", "attribute".
    name : :obj:`str`, optional
        The fully qualified name of the object.
    obj : module, class, exception, function, method, or attribute
        The object to which the docstring belongs.
    options : :class:`sphinx.ext.autodoc.Options`, optional
        The options given to the directive: an object with attributes
        inherited_members, undoc_members, show_inheritance and no_index that
        are True if the flag option of same name was given to the auto
        directive.


    Example
    -------
    >>> from sphinx.ext.napoleon import Config
    >>> config = Config(napoleon_use_param=True, napoleon_use_rtype=True)
    >>> docstring = '''One line summary.
    ...
    ... Extended description.
    ...
    ... Args:
    ...   arg1(int): Description of `arg1`
    ...   arg2(str): Description of `arg2`
    ... Returns:
    ...   str: Description of return value.
    ... '''
    >>> print(GoogleDocstring(docstring, config))
    One line summary.
    <BLANKLINE>
    Extended description.
    <BLANKLINE>
    :param arg1: Description of `arg1`
    :type arg1: int
    :param arg2: Description of `arg2`
    :type arg2: str
    <BLANKLINE>
    :returns: Description of return value.
    :rtype: str
    <BLANKLINE>

    zX^\s*((?::(?P<role>\S+):)?`(?P<name>~?[a-zA-Z0-9_.-]+)`| (?P<name2>~?[a-zA-Z0-9_.-]+))\s*NrF   	docstringstr | list[str]configSphinxConfig | NoneappSphinx | NonewhatrO   namerr   r   optionsr   r   c                   || _         |r|| _        n$|r|j        | _        nddlm}  |            | _        |sBt          j        |          rd}n+t          j        |          rd}nt          |          rd}nd}|| _	        || _
        || _        || _        t          |t                    r|                                }	n|}	t!          t#          t          j        |	                    | _        g | _        d| _        d| _        t/          | d          sg | _        t/          | d	          si d
| j        d| j        dt5          | j        d          d| j        dt5          | j        d          dt5          | j        d          dt5          | j        d          d| j        d| j        dt5          | j        d          dt5          | j        d          d| j        d| j        d| j        dt5          | j        d          d| j         d| j!        i d| j        d| j"        d| j"        d| j#        d| j#        d | j$        d!| j$        d"| j%        d#| j&        d$t5          | j        d$          d%t5          | j        d%          d&t5          | j        d&          d't5          | j        d&          d(| j'        d)| j'        d*| j(        d+| j(        | _)        | *                                 | +                                 d S ),Nr   r   classmodulefunctionr.   F_directive_sections	_sectionsargs	arguments	attention
attributescautiondangererrorexampleexampleshint	importantzkeyword argszkeyword argumentsmethodsnotenoteszother parameters
parametersreceivereceivesr   returnsraiseraises
referenceszsee alsotiptodorv   warningswarnwarnsyieldyields),_app_configr   sphinx.ext.napoleonr   inspectisclassismodulecallable_what_name_obj_opt
isinstancerO   
splitlinesr   maprstrip_lines_parsed_lines_is_in_section_section_indenthasattrr   _parse_parameters_sectionr   _parse_admonition_parse_attributes_section_parse_examples_section _parse_keyword_arguments_section_parse_methods_section_parse_notes_section_parse_other_parameters_section_parse_receives_section_parse_returns_section_parse_raises_section_parse_references_section_parse_see_also_section_parse_warns_section_parse_yields_sectionr   _load_custom_sections_parse)
r   r   r   r   r   r   rr   r   r   liness
             r    __init__zGoogleDocstring.__init__F  s    	 	$!DLL 	$:DLL222222!688DL 	 s##  !#&&  #  !

		i%% 	((**EEEC
E2233(*# t233 	524D$t[)) $	#C6#CT;#C WT%;[II#C d<	#C
 74#99EE#C '$"8(CC#C !7AA#C 47#C D8#C  6??#C WT%;[II#C  E#C $T%J#C 46#C  6??#C  2!#C" #D$H##C #C$ d<%#C& 47'#C( D8)#C* $5+#C, 46-#C. 3/#C0 $41#C2 d<3#C4 D85#C6 wt5u==7#C8  6??9#C: 74#99EE;#C< GD$:IFF=#C> 1?#C@ 2A#CB 3C#CD $4E#C #CDNJ 	""$$$r"   c                P    d                     |                                           S )zReturn the parsed docstring in reStructuredText format.

        Returns
        -------
        unicode
            Unicode version of the docstring.

        
)rG   r   r   s    r    __str__zGoogleDocstring.__str__  s     yy&&&r"   rc   c                    	 | j         t          j        | j                   nd }n# t          $ r d }Y nw xY w| j        }||d S |d}| d| S )NrF   z:docstring of )r   r   getfile	TypeErrorr   )r   filepathr   s      r    _get_locationzGoogleDocstring._get_location  s    	59Y5Jwty111PTHH 	 	 	HHH	z4H00$000s   "% 44r2   c                    | j         S )zReturn the parsed lines of the docstring in reStructuredText format.

        Returns
        -------
        list(str)
            The lines of the docstring in a list.

        )r   r   s    r    r   zGoogleDocstring.lines  s     !!r"   r;   indentr   c                z   g }| j                             d          }|                                 s|r|                     ||          rr|                    | j                                                    | j                             d          }|                                 s|\|                     ||          r|S Nr   )r   r!   _is_section_break_is_indentedappendr)   )r   r   r   lines       r    _consume_indented_blockz'GoogleDocstring._consume_indented_block  s    {q!!((** 	&	&))$77	& LL))++,,,;??1%%D	 ((** 	&	&))$77	&
 r"   c                6   g }| j         r| j                             d          ru|                                 sa|                    | j                                                    | j         r.| j                             d          r|                                 a|S r   )r   r!   _is_section_headerr   r)   r   r   s     r    _consume_contiguousz#GoogleDocstring._consume_contiguous  s    k 	-dkooa00 	-9P9P9R9R 	-LL))++,,, k 	-dkooa00 	-9P9P9R9R 	-r"   c                    g }| j                             d          }| j         rQ|sO|                    | j                                                    | j                             d          }| j         r|O|S r   )r   r!   r   r)   r   r   r   s      r    _consume_emptyzGoogleDocstring._consume_empty  sx    {q!!k 	&$ 	&LL))++,,,;??1%%D k 	&$ 	& r"   TF
parse_typere   prefer_typetuple[str, str, list[str]]c                   | j                                         }|                     |          \  }}}|d|}	}}|rXt                              |          }
|
r<|
                    d                                          }|
                    d          }|                     |          }|r|s||}}|r<| j        j	        r0t          || j        j        pi |                                           }|                     |          dz   }|	g|                     |                     |                    }|                     || j                                                  }|||fS )NrF   r;      r{   rb   )r   r)   _partition_field_on_colon_google_typed_arg_regexrW   groupr>   _escape_args_and_kwargsr   napoleon_preprocess_typesr   napoleon_type_aliasesr   _get_indent_dedentr   r(   r   )r   r  r  r   beforecolonafterr   rz   _descrW   r   _descss                r    _consume_fieldzGoogleDocstring._consume_field  sl   
 {!!#==dCCu$b%eu 	'+11&99E 'A,,..A,,U33 	(u 	( %5E 	T\; 	&!\?E2#1133  E !!$''!+M$,,t'C'CF'K'KLLM55;;==eV##r"   multiple list[tuple[str, str, list[str]]]c                j   |                                   g }|                                 s|                     ||          \  }|r8|r6|                    fd|                    d          D                        n|ssr|                    |f           |                                 |S )Nc              3  F   K   | ]}|                                 fV  d S r$   )r>   )r\   r   r  rz   s     r    r   z2GoogleDocstring._consume_fields.<locals>.<genexpr>  s2      XXttzz||UE:XXXXXXr"   ,)r  r   r  extendr`   r   )r   r  r  r  fieldsr   r  rz   s         @@r    _consume_fieldszGoogleDocstring._consume_fields  s     	35((** 	5"&"5"5j+"N"NE5% 5E 5XXXXXu{{SVGWGWXXXXXXX 5% 55 5ueU3444 ((** 	5 r"   tuple[str, list[str]]c                6   | j                                         }|                     |          \  }}}|r|s	||}}||z  }|g|                     |                                           }|                     || j                                                  }||fS r$   )r   r)   r
  r  _consume_to_endr(   r   r   )r   r   rz   r  r  r  s         r    _consume_inline_attributez)GoogleDocstring._consume_inline_attribute  s    {!!"<<TBBue 	E 	 %5EUNE?$,,t';';'='=>>?55;;==f}r"   preprocess_typesc                   |                      |                                           }|r|                     |d                   \  }}}dd|}}}|r|r|g|dd          z   }n
|dd          }|}|r>|r<| j        j        r0t          || j        j        pi |                                           }|                     || j                  	                                }|||fgS g S )Nr   rF   r;   r	  )
r  _consume_to_next_sectionr
  r   r  r   r  r   r(   r   )	r   r$  r   r  r  r  r   rz   r  s	            r    _consume_returns_sectionz(GoogleDocstring._consume_returns_section  s    T::<<== 	#'#A#A%(#K#K FE5"$b%%5E  &"GeABBi/EE!!""IE ) dl.T *!%!C!Ir#'#5#5#7#7   NN5$,77==??EE5)**Ir"   c                T    |                      |                                           }|S r$   )r  r&  r   s     r    _consume_usage_sectionz&GoogleDocstring._consume_usage_section,  s$    T::<<==r"   c                    | j                                         }|                    d          }|                                | j        v r|}|S )N:)r   r)   r>   lowerr   )r   sectionstripped_sections      r    _consume_section_headerz'GoogleDocstring._consume_section_header0  sJ    +""$$"==--!!##t~55&Gr"   c                ~    g }| j         r3|                    | j                                                    | j         3|S r$   )r   r   r)   r   s     r    r"  zGoogleDocstring._consume_to_end7  sB    k 	-LL))++,,, k 	-r"   c                   |                                   g }|                                 s@|                    | j                                                   |                                 @||                                  z   S r$   )r  r   r   r   r)   r   s     r    r&  z(GoogleDocstring._consume_to_next_section=  sz    ((** 	-LL))++,,, ((** 	-t**,,,,r"   r   fullc                f    |rd |D             S |                      |          fd|D             S )Nc                6    g | ]}|                                 S r[   )lstrip)r\   r   s     r    r^   z+GoogleDocstring._dedent.<locals>.<listcomp>F  s     444dDKKMM444r"   c                $    g | ]}|d          S r$   r[   )r\   r   
min_indents     r    r^   z+GoogleDocstring._dedent.<locals>.<listcomp>I  s"    888$D%888r"   )_get_min_indent)r   r   r2  r7  s      @r    r  zGoogleDocstring._dedentD  sL     	944e4444--e44J8888%8888r"   c                    |                     d          r#t          | j        dd          r|d d         dz   }|d d         dk    rd|dd          z   S |d d	         d
k    rd|d	d          z   S |S )Nr   strip_signature_backslashFz\_r  **z\*\*r;   r   z\*)rt   getattrr   )r   r   s     r    r  z'GoogleDocstring._escape_args_and_kwargsK  s    == 	%'L5u#
 #
 	% 9u$D8tT!""X%%"1"X__48##Kr"   descc                >   |                      |          rdg|}n|d                             d          rf|dd          }|                     |d                   }|                     |          }||k    rdg|}n d|d         g|                     |d          }|S )NrF   r   ::r;      )_is_listrt   r  _get_initial_indent_indent)r   r>  
desc_blockr   block_indents        r    _fix_field_desczGoogleDocstring._fix_field_descX  s    == 		C;;DD!Wd## 	CabbJ%%d1g..F33J??Lf$${T{DGBdll:q&A&ABr"   
admonitionc                   |                      |          }t          |          dk    r"d| d|d                                          dgS |r5|                     |                     |          d          }d| ddg|dS d| ddgS )Nr;   z.. z:: r   rF      r@  )_strip_emptyr   r>   rD  r  )r   rH  r   s      r    _format_admonitionz"GoogleDocstring._format_admonitione  s    !!%((u::??;*;;q)9)9;;R@@ 	.LLe!4!4a88E(*((("9u9b99(*((("--r"   prefixpaddingc                (   |r|dt          |          z  }g }t          |          D ]f\  }}|dk    r+|                    ||z                                              6|r|                    ||z              Q|                    d           g|S |gS )NrU   r   rF   )r   	enumerater   r   )r   rM  r   rN  result_linesir   s          r    _format_blockzGoogleDocstring._format_blocko  s      	F+L$U++ , ,466 ''$(>(>(@(@AAAA , ''$7777 ''++++8Or"   paramtyper  
field_role	type_rolec           	     t   g }|D ]\  }}}|                      |          }t          |          rH|                     |          }d| d| d}|                    |                     ||                     n|                    d| d| d           |r|                    d| d| d|            g |dS )Nr+  rU   : rF   )rK  anyrG  r  rS  r   )	r   r  rV  rW  r   r   rz   r  fields	            r    _format_docutils_paramsz'GoogleDocstring._format_docutils_params  s     #) 
	? 
	?E5%%%e,,E5zz 8,,U332J22222T//u==>>>>666e666777 ?===U==e==>>>||r"   r   rz   r  c                T   |                      |          }t          |          }|rdnd}|r'|rd|v rd| d| d| }n-d| d| d| }n!d| d| }n|rd|v r| | }nd	| d	| }nd}|r9|                     |          }|d
         r||d
         z   g|dd          z   S |g|S |gS )Nz -- rF   r   r<  z** ()z** (*z*)r   r   r;   )rK  rZ  rG  )r   r   rz   r  has_desc	separatorr[  s          r    _format_fieldzGoogleDocstring._format_field  s4   !!%((u::&.FFB	 	 2%<<???E??I??EEAAAUAAiAAEE1U11i11 	e|| -)--/E//I//E 	((//EQx 'a()E!""I55&7Nr"   
field_typec                   d|                                  d}dt          |          z  }t          |          dk    }g }|D ]\  }}}|                     |||          }	|r\|r-|                    |                     |dz   |	                     N|                    |                     |dz   |	                     {|                    |                     |dz   |	                     |r|d         r|                    d           |S )Nr+  rU   r;   z * r;  rF   )r>   r   ra  r  rS  r   )
r   rb  r  rN  multir   r   rz   r  r[  s
             r    _format_fieldszGoogleDocstring._format_fields  s,   
 /))++...
J'Fa#) 	J 	JE5%&&ueU;;E J PLL!3!3GeOU!K!KLLLLLL!3!3J4F!N!NOOOOT//
S0@%HHIIII 	U2Y 	LLr"   r   
peek_aheadc                    | j                             |          }|| j         j        urD|r|                     |          S |dz  }| j                             |          }|| j         j        uDdS )Nr;   r   )r   r!   r   r  )r   rf  r   s      r    _get_current_indentz#GoogleDocstring._get_current_indent  sv    {z**$+... .''---!OJ;??:..D	 $+...
 qr"   r   c                z    t          |          D ]\  }}|                                s|c S t          |          S r$   )rP  isspacer   )r   r   rR  ss       r    r  zGoogleDocstring._get_indent  sE    dOO 	 	DAq99;; 4yyr"   c                B    |D ]}|r|                      |          c S dS r   r  r  s      r    rC  z#GoogleDocstring._get_initial_indent  s=     	. 	.D .''-----.qr"   c                Z    d }|D ]#}|r|                      |          }|||k     r|}$|pdS r   rm  )r   r   r7  r   r   s        r    r8  zGoogleDocstring._get_min_indent  sQ    
 	( 	(D ())$//%*)<)<!'JQr"   rA  r   c                     fd|D             S )Nc                     g | ]
}d z  |z   S )rU   r[   )r\   r   r   s     r    r^   z+GoogleDocstring._indent.<locals>.<listcomp>  s"    333TqD 333r"   r[   )r   r   r   s     `r    rD  zGoogleDocstring._indent  s    3333U3333r"   c                p    t          |          D ]%\  }}||k    r dS |                                s dS &dS rg   )rP  rj  )r   r   r   rR  rk  s        r    r   zGoogleDocstring._is_indented  sL    dOO 	 	DAqF{{ttYY[[ uuur"   c                   |sdS t                               |d                   rdS t                              |d                   rdS t          |          dk     s|d                             d          rdS |                     |d                   }|}|dd          D ]}|r|                     |          } n||k    S )NFr   Tr  r@  r;   )_bullet_list_regexrW   _enumerated_list_regexr   rt   r  )r   r   r   next_indentr   s        r    rB  zGoogleDocstring._is_list  s     	5##E!H-- 	4!''a11 	4u::>>U1X..t44>5!!%(++!""I 	 	D "..t44 V##r"   c                   | j                             d                                          }t                              |          }|rM|                    d          | j        v r1|                     |          }|                     d          }||k    S | j	        r<t                              |          r"| j	        D ]}|                    |          r dS dS )Nr   r+  r;   )rf  TF)r   r!   r,  _google_section_regexrW   r>   r   r  rh  r   _directive_regexrs   )r   r-  rW   header_indentsection_indentdirective_sections         r    r   z"GoogleDocstring._is_section_header  s    +//!$$**,,%++G44 	$W]]3''4>99 ,,W55M!555CCN!M11% 	$%%g.. $)-)A $ $%))*;<< $#tt$ur"   c                    | j                             d          }| j          p8|                                 p$| j        o|o|                     || j                   S r   r   r!   r   r   r   r   )r   r   s     r    r   z!GoogleDocstring._is_section_break  sj    {q!!O &&(( # FF))$0DEEE	
r"   c                0   | j         j        | j         j        D ]}t          |t                    r"| j        | j        |                                <   9|d         dk    r(| j        | j        |d                                         <   m|d         dk    r(| j        | j        |d                                         <   | j        	                    |d                                         | j                  | j        |d                                         <   d S d S )Nr;   params_styler   returns_style)
r   napoleon_custom_sectionsr   rO   _parse_custom_generic_sectionr   r,  "_parse_custom_params_style_section#_parse_custom_returns_style_sectionr!   )r   entrys     r    r   z%GoogleDocstring._load_custom_sections  s   <0<>  eS))  594VDN5;;==11 Qx>11 C uQx~~'7'788 q_44 D uQx~~'7'788 <@>;M;M!!HNN,,d.P< <uQx~~'7'788' =< r"   c                   |                                  | _        | j        rl| j        dv rcg }t	          j        t                    5  |                                 }d d d            n# 1 swxY w Y   | j                            |           d S | j	        r.| 
                                r	 |                                 }d| _        |                                 | _        t                              |          r|g|                                 }n( | j        |                                         |          }d| _        d| _        nX# d| _        d| _        w xY w| j        s*|                                 |                                  z   }n|                                 }| j                            |           | j	        ,d S d S )N>   dataproperty	attributeTFr   )r  r   r   r   
contextlibsuppressr'   _parse_attribute_docstringr  r   r   r/  r   rh  r   rx  rW   r&  r   r,  r   )r   resr-  r   s       r    r   zGoogleDocstring._parse7  s   !0022: 	$*(IIIC$]33 8 855778 8 8 8 8 8 8 8 8 8 8 8 8 8 8 %%c***Fk 	-&&(( <
-"::<<G*.D'+/+C+C+E+ED('--g66 I!( K4+H+H+J+J K ?w}} ? H H*/D'+,D(( +0D'+,D(,,,,) < 44669L9L9N9NNEE 99;;E%%e,,,% k 	- 	- 	- 	- 	-s   A&&A*-A**BE Er-  c                V    |                                  }|                     ||          S r$   )r&  rL  )r   rH  r-  r   s       r    r   z!GoogleDocstring._parse_admonitionV  s)    --//&&z5999r"   c                    |                                  \  }}|                     dd|          }|r|                    dd| g           |S )NrF   :type: )r#  ra  r  )r   rz   r  r   s       r    r  z*GoogleDocstring._parse_attribute_docstring[  s[    5577u""2r511 	2LL"///0111r"   c                N   g }|                                  D ]k\  }}}|s|                     |          }| j        j        rMd| d}|                    |                     ||                     |r|                    d| d|            w|                    d|z              | j        r'd| j        v s	d| j        v r|                    d           |                    d           |                     dd|          }|                    | 	                    |d	                     |rB|                    d           |                    | 	                    d
| gd	                     |                    d           m| j        j        r|                    d           |S )Nz:ivar rY  z	:vartype z.. attribute:: no-indexnoindex   :no-index:rF   rJ  r  )
r  _lookup_annotationr   napoleon_use_ivarr  rS  r   r   ra  rD  )r   r-  r   r   rz   r  r[  r  s           r    r   z)GoogleDocstring._parse_attributes_sectionb  s   #'#7#7#9#9 	! 	!E5% 7//66|- !****T//u==>>> ?LL!=U!=!=e!=!=>>>.67779 6!TY..)ty2H2H_555R   ++BE::T\\&!44555 GLL$$$LL/@/@/@.A1!E!EFFFR    <) 	LLr"   c                    t          d          t          d          d}| j        j        }|                    |                                |          }|                     ||          S )NExampleExamples)r   r   )r   r   $napoleon_use_admonition_for_examplesr!   r,  _parse_generic_section)r   r-  labelsuse_admonitionlabels        r    r   z'GoogleDocstring._parse_examples_section}  s]    ||*
 
 J

7==??G44**5.AAAr"   c                .    |                      |d          S )NF)r  r   r-  s     r    r  z-GoogleDocstring._parse_custom_generic_section  s    **7E:::r"   c                R    |                      ||                                           S r$   )re  r  r  s     r    r  z2GoogleDocstring._parse_custom_params_style_section  s$    ""7D,@,@,B,BCCCr"   c                Z    |                      d          }|                     ||          S )NTr$  )r'  re  r   r-  r  s      r    r  z3GoogleDocstring._parse_custom_returns_style_section  s.    ...EE""7F333r"   c                ~    ddg}ddg}|                                  }|                     |d          }||z   |z   dgz   S )Nz.. rubric:: Usage:rF   z.. code-block:: pythonrJ  )r)  rD  )r   r-  headerblockr   s        r    _parse_usage_sectionz$GoogleDocstring._parse_usage_section  sP    &+)2.++--UA&&~%,,r"   r  c                    |                      |                                           }|                     |          }|rd| }|                     |d          }nd| }|r|dg|dS |dgS )Nz.. admonition:: rJ  z.. rubric:: rF   )rK  r&  r  rD  )r   r-  r  r   r  s        r    r  z&GoogleDocstring._parse_generic_section  s    !!$"?"?"A"ABBU## 	.111FLL**EE-G--F 	 B++++B<r"   c                    |                                  }| j        j        r|                     |dd          S |                     t          d          |          S )Nkeywordkwtype)rV  rW  zKeyword Arguments)r  r   napoleon_use_keywordr\  re  r   r  s      r    r   z0GoogleDocstring._parse_keyword_arguments_section  sf    %%''<, 	G//9 0    &&q)<'='=vFFFr"   c                V   g }|                      d          D ]\  }}}|                    d|            | j        r'd| j        v s	d| j        v r|                    d           |r,|                    dg|                     |d                     |                    d           |S )	NF)r  z.. method:: r  r  r  rF   rJ  )r  r   r   r  rD  )r   r-  r   r   rz   r  s         r    r   z&GoogleDocstring._parse_methods_section  s    #'#7#75#7#I#I 	 	E5%LL///000y 2**i49.D.DLL111 <b:4<<q#9#9:;;;LLr"   c                `    | j         j        }|                     t          d          |          S )NNotes)r   !napoleon_use_admonition_for_notesr  r   r   r-  r  s      r    r   z$GoogleDocstring._parse_notes_section  s(    G**1W::~FFFr"   c                    | j         j        r+|                     d          }|                     |          S |                                 }|                     t          d          |          S )NTr  zOther Parametersr   napoleon_use_paramr  r\  re  r   r  s      r    r   z/GoogleDocstring._parse_other_parameters_section  sj    <* 	F))4)88F//777))++F&&q);'<'<fEEEr"   c                    | j         j        r+|                     d          }|                     |          S |                                 }|                     t          d          |          S )NTr  
Parametersr  r  s      r    r   z)GoogleDocstring._parse_parameters_section  sg    <* 	@))4)88F//777))++F&&q???r"   c                B   |                      dd          }g }|D ]\  }}}| j                            |          }|r+|                    d          r|                    d          }n<t                              |          r"|                    d          }||dz   d         }|rd|z   nd	}|                     |          }t          |          rdd
                    |          z   nd	}	|	                    d| d|	            |r|	                    d	           |S )NFT)r  r  r   r   r;   r;  rU   rF   z
    z:raisesr+  )
r  	_name_rgxrW   r  rw   findrK  rZ  rG   r   )
r   r-  r  r   r   rz   r  mposr  s
             r    r   z%GoogleDocstring._parse_raises_section  s;   %%D%II#) 
	5 
	5E5%$$U++A ,QWWV__ ,""5)) ,jjoocAgl+#(0C%KKbE%%e,,E36u::ES8==////2FLL35336334444 	LLr"   c                    | j         j        r+|                     d          }|                     |          S |                                 }|                     t          d          |          S )NTr  Receivesr  r  s      r    r   z'GoogleDocstring._parse_receives_section  sf    <* 	>))4)88F//777))++F&&q}}f===r"   c                `    | j         j        }|                     t          d          |          S )N
References)r   &napoleon_use_admonition_for_referencesr  r   r  s      r    r   z)GoogleDocstring._parse_references_section  s(    L**1\??NKKKr"   c                   |                                  }t          |          dk    }|rdn| j        j        }g }|D ]\  }}}|r|                     |d|          }	n|                     |||          }	|rV|r*|                    |                     d|	                     e|                    |                     d|	                     t          |	          r)|                    |                     d|	                     |r|r|                    d| dg           |r|d         r|                    d           |S )	Nr;   FrF   z          * z:returns: * z
:returns: z:rtype: r;  )	r'  r   r   napoleon_use_rtypera  r  rS  rZ  r   )
r   r-  r  rd  	use_rtyper   r   rz   r  r[  s
             r    r   z&GoogleDocstring._parse_returns_section  so   ..00Fa"GEE(G	#) 	; 	;E5% @**5"e<<**5%?? 	; LLL!3!3NE!J!JKKKKLL!3!3NE!J!JKKKKu:: JLL!3!3L%!H!HIII ;Y ;LL"4U"4"4b!9::: 	U2Y 	LLr"   c                .    |                      d|          S Nseealso)r   r  s     r    r   z'GoogleDocstring._parse_see_also_section	  s    %%i999r"   c                l    |                      t          d          |                                           S )NWarns)re  r   r  r  s     r    r   z$GoogleDocstring._parse_warns_section  s*    ""1W::t/C/C/E/EFFFr"   c                t    |                      d          }|                     t          d          |          S )NTr  Yields)r'  re  r   r  s      r    r   z%GoogleDocstring._parse_yields_section  s4    ...EE""1X;;777r"   tuple[str, str, str]c                   g }g }d}d}t          t                              |                    D ]\  }}|r|                    |           t                              |          }|dz  dk    r|rd}||                                |                                         }|                    |d |                                                    |                    ||                                d                     |                    |           d                    |          	                                |d                    |          	                                fS )NrF   Fr  r   T)
rP  _xref_or_code_regexr`   r   _single_colon_regexsearchstartendrG   r>   )	r   r   before_colonafter_colonr  found_colonrR  sourcer  s	            r    r
  z)GoogleDocstring._partition_field_on_colon  sH   "#6#<#<T#B#BCC 	0 	0IAv 
0""6****'..v66Ea<<A<"&K"17799quuww#67E ''{{(;<<<&&vaeeggii'89999 ''////ww|$$**,,eRWW[5I5I5O5O5Q5QQQr"   c                   |rd}t          |          D ]\  }}|r|} n|dk    rg }d}t          t          t          |                              D ]}||         }|r|} n|dk    s|dz   t          |          k     r|||dz            }|S )Nr;  r   r;   )rP  reversedranger   )r   r   r  rR  r   r  s         r    rK  zGoogleDocstring._strip_empty'  s     	/E$U++  4 EE {{CeCJJ//00  Qx CE qyyC!Gc%jj00ecAgo.r"   c                   | j         j        r| j        dv r| j        rt	          | d          s\t          | j         di           }|                    t          | j         di           pi            t          | j        d |          | _        || j        v r3t          | j         dd          }t          | j        |         d|          S d	S )
N>   r   r   	exception_annotationsautodoc_type_aliasesr  "python_display_short_literal_typesFzfully-qualified-except-typing)modeshort_literalsrF   )
r   napoleon_attr_annotationsr   r   r   r=  updater   r  r   )r   r   localnsr  s       r    r  z"GoogleDocstring._lookup_annotation:  s    <1 	z===$)=t^44 
Q%dl4JBOOGNN L3  
    )7ty$(P(PD%D---%,&JE& &N 0)%0<'5    rr"   NNrF   rF   NNr   r   r   r   r   r   r   rO   r   rO   rr   r   r   r   r   r   r   rO   )r   rc   )r   r2   )r;   )r   r   r   r2   TFr  re   r  re   r   r  )TFF)r  re   r  re   r  re   r   r  )r   r   Fr$  re   r   r  )r   r2   r2  re   r   r2   r   rO   r   rO   )r>  r2   r   r2   )rH  rO   r   r2   r   r2   r$   )rM  rO   r   r2   rN  rc   r   r2   )rT  rU  )r  r  rV  rO   rW  rO   r   r2   )r   rO   rz   rO   r  r2   r   r2   )rb  rO   r  r  r   r2   )r   )rf  r   r   r   )r   rO   r   r   )r   r2   r   r   )rA  )r   r2   r   r   r   r2   )r   rO   r   r   r   re   )r   r2   r   re   r   re   )r   r   )rH  rO   r-  rO   r   r2   r-  rO   r   r2   )r-  rO   r  re   r   r2   )r   rO   r   r  )r   r2   r   r2   )r   rO   r   rO   )Br*   r+   r,   r-   recompileVERBOSEr  r   r   r   r   r   r   r  r  r  r#  r'  r)  r/  r"  r&  r  r  rG  rL  rS  r\  ra  re  rh  r  rC  r8  rD  r   rB  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
  rK  r  r[   r"   r    r   r     s]       < <| 
	-

 I '+!T T T T Tl	' 	' 	' 	'1 1 1 1	" 	" 	" 	"            !$ $ $ $ $D TY        (-    8         - - - -9 9 9 9 9      . . . . #	    0 "	    (   :   ,             4 4 4 4 4    $ $ $ $"   

 

 

 

   0- - - ->: : : :
      6B B B B; ; ; ;D D D D4 4 4 4- - - -       G G G G
 
 
 
G G G GF F F F@ @ @ @   $> > > >L L L L   4: : : :G G G G8 8 8 8R R R R(   &     r"   r   c                  ~     e Zd ZdZ	 	 	 	 	 	 d&d' fdZd( fdZ	 d)d*dZ	 d+d,dZd-dZd.dZ	d.d Z
d/d#Zd0d%Z xZS )1NumpyDocstringa
  Convert NumPy style docstrings to reStructuredText.

    Parameters
    ----------
    docstring : :obj:`str` or :obj:`list` of :obj:`str`
        The docstring to parse, given either as a string or split into
        individual lines.
    config: :obj:`sphinx.ext.napoleon.Config` or :obj:`sphinx.config.Config`
        The configuration settings to use. If not given, defaults to the
        config object on `app`; or if `app` is not given defaults to the
        a new :class:`sphinx.ext.napoleon.Config` object.


    Other Parameters
    ----------------
    app : :class:`sphinx.application.Sphinx`, optional
        Application object representing the Sphinx process.
    what : :obj:`str`, optional
        A string specifying the type of the object to which the docstring
        belongs. Valid values: "module", "class", "exception", "function",
        "method", "attribute".
    name : :obj:`str`, optional
        The fully qualified name of the object.
    obj : module, class, exception, function, method, or attribute
        The object to which the docstring belongs.
    options : :class:`sphinx.ext.autodoc.Options`, optional
        The options given to the directive: an object with attributes
        inherited_members, undoc_members, show_inheritance and no_index that
        are True if the flag option of same name was given to the auto
        directive.


    Example
    -------
    >>> from sphinx.ext.napoleon import Config
    >>> config = Config(napoleon_use_param=True, napoleon_use_rtype=True)
    >>> docstring = '''One line summary.
    ...
    ... Extended description.
    ...
    ... Parameters
    ... ----------
    ... arg1 : int
    ...     Description of `arg1`
    ... arg2 : str
    ...     Description of `arg2`
    ... Returns
    ... -------
    ... str
    ...     Description of return value.
    ... '''
    >>> print(NumpyDocstring(docstring, config))
    One line summary.
    <BLANKLINE>
    Extended description.
    <BLANKLINE>
    :param arg1: Description of `arg1`
    :type arg1: int
    :param arg2: Description of `arg2`
    :type arg2: str
    <BLANKLINE>
    :returns: Description of return value.
    :rtype: str
    <BLANKLINE>

    Methods
    -------
    __str__()
        Return the parsed docstring in reStructuredText format.

        Returns
        -------
        str
            UTF-8 encoded version of the docstring.

    __unicode__()
        Return the parsed docstring in reStructuredText format.

        Returns
        -------
        unicode
            Unicode version of the docstring.

    lines()
        Return the parsed lines of the docstring in reStructuredText format.

        Returns
        -------
        list(str)
            The lines of the docstring in a list.

    NrF   r   r   r   r   r   r   r   rO   r   rr   r   r   r   r   c           	     f    dg| _         t                                          |||||||           d S )Nz
.. index::)r   r%   r   )	r   r   r   r   r   r   rr   r   r(   s	           r    r   zNumpyDocstring.__init__  s9     %1> FCtS'JJJJJr"   c                    t                      j        }d|v r6d                    t          ||                    d                              S  ||          S )Nr9   )r%   r  rG   r   r`   )r   r   funcr(   s      r    r  z&NumpyDocstring._escape_args_and_kwargs  sN    ww.4<<99Stzz$'7'7889994::r"   TFr  re   r  r  c                   | j                                         }|r|                     |          \  }}}n|d}}|                                |                                }}|                     |          }|r|s|                     |          }|r|s||}}| j        j        r0t          || j        j	        pi | 
                                          }|                     |          dz   }|                     |                     |                    }|                     || j                                                  }|||fS )NrF   r	  r;   )r   r)   r
  r>   r  r  r   r  r   r  r   r  r  r   r(   r   )	r   r  r  r   r   r   rz   r   r  s	            r    r  zNumpyDocstring._consume_field  sP    {!! 	$"<<TBBOE1ee5E{{}}ekkmmu,,U33 	3e 	3++E22E 	(u 	( %5E<1 	&!\?E2#1133  E !!$''!+T99&AABBudl3399;;eU""r"   r$  r  c                .    |                      d          S )NT)r  )r  )r   r$  s     r    r'  z'NumpyDocstring._consume_returns_section  s     ###555r"   c                    | j                                         }t                              |          s| j                                          |S r$   )r   r)   rx  rW   r  s     r    r/  z&NumpyDocstring._consume_section_header  sD    +""$$%%g.. 	Kr"   c                    | j                             d          | j                             d          }}| j          p>|                                 p*| o| p$| j        o|o|                     || j                   S )Nr   r;   r}  )r   line1line2s      r    r   z NumpyDocstring._is_section_break  s    {q))4;??1+=+=uO &&((	'%i # GG))%1EFFF		
r"   c                   | j                             d          | j                             d          }}|                                }|| j        v r<t	          |t
                    r't          t                              |                    S | j	        r<t                              |          r"| j	        D ]}|                    |          r dS dS )Nr   r;   TF)r   r!   r,  r   r   rO   re   _numpy_section_regexrW   r   rx  rs   )r   r-  	underliner{  s       r    r   z!NumpyDocstring._is_section_header  s    ![__Q//1C1C--//dn$$Is)C)C$,229==>>>% 	$%%g.. $)-)A $ $%))*;<< $#tt$ur"   r-  r2   c                    |                                  }	 |                     |          S # t          $ r |                     d|          cY S w xY wr  )r&   _parse_numpydoc_see_also_sectionri   rL  )r   r-  r   s      r    r   z&NumpyDocstring._parse_see_also_section  sc    --//	=88??? 	= 	= 	=**9e<<<<<	=s   +  AAcontentc                    g d  fdd!fd}d" fd}d}g }|D ]}|                                 s j                            |          }|r||                                d                                                              d          r~ |||           |d|                                         ||                                d         }}|                    dd          d                                          g}|d         sg }|                    d          sd |||           d}d|v r:|                    d          D ]"}|                                 r ||g            #T|                                 r|}l|'|                    |                                             |||           sg S t          t          |                    g }	d}
D ]o\  }}}|r
d| d| d}nd| d}|s|
r|	dgz  }	|	|gz  }	n|	dxx         d| z  cc<   |r/|	 	                    d
                    |          g          z  }	d}
md}
p|	dgz  }	                     d|	          S )#a  See Also
        --------
        func_name : Descriptive text
            continued text
        another_func_name : Descriptive text
        func_name1, func_name2, :meth:`func_name`, func_name3

        Licence
        -------

        Derived from the NumpyDoc implementation of ``_parse_see_also``,
        which was under the following licence:

            Copyright (C) 2008 Stefan van der Walt <stefan@mentat.za.net>,
                               Pauli Virtanen <pav@iki.fi>

            Redistribution and use in source and binary forms, with or without
            modification, are permitted provided that the following conditions are
            met:

             1. Redistributions of source code must retain the above copyright
                notice, this list of conditions and the following disclaimer.
             2. Redistributions in binary form must reproduce the above copyright
                notice, this list of conditions and the following disclaimer in
                the documentation and/or other materials provided with the
                distribution.

            THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
            IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
            WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
            DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
            INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
            (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
            SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
            HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
            STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
            IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
            POSSIBILITY OF SUCH DAMAGE.
        textrO   r   tuple[str, str | None]c                    j                             |           }|r6|                                }|d         
|d         dfS |d         |d         fS |  d}t          |          )zMatch ':role:`name`' or 'name'r;   NrJ  r  z is not a item name)r  rW   groupsri   )r  r  gmsgr   s       r    parse_item_namezHNumpyDocstring._parse_numpydoc_see_also_section.<locals>.parse_item_name<  sp    $$T**A &HHJJQ4<Q4:%Q41:%...CS//!r"   r   rc   restr2   r   c                    | sd S  |           \  } }                     | |                                |f           |                                 d S r$   )r   copyclear)r   r  roleitemsr
  s      r    	push_itemzBNumpyDocstring._parse_numpydoc_see_also_section.<locals>.push_itemH  sU     (..JD$LL$		T2333JJLLLLLr"   r  descriptionr  !tuple[str, list[str], str | None]c                    j         j        }||s| ||fS |                    | |           }j                            |          }|s|||fS |                                }|d         }|d         p|d         }|||fS )Nr  r   name2)r   r  r!   r  rW   	groupdict)	r  r  r  r{   
translatedrW   r  new_funcr   s	           r    	translatezBNumpyDocstring._parse_numpydoc_see_also_section.<locals>.translateO  s    
  <=L|[$..%))$55JN((44E 5!;44__&&F&>Df~8H[$..r"   Nr+  r;   r   rU   r  Tz:`r   r   rF   r;  r9   Fr  )r  rO   r   r  )r   rc   r  r2   r   r   )r  rO   r  r2   r  rc   r   r  )r>   r  rW   r  rs   r`   r   rK   r   rD  rG   rL  )r   r  r  r  current_funcr  r   r  r  r   last_had_descr   r>  r  linkr  r
  s   `              @@r    r  z/NumpyDocstring._parse_numpydoc_see_also_section  s1   P :<
	" 
	" 
	" 
	" 
	" 
	"	 	 	 	 	 	 		/ 	/ 	/ 	/ 	/ 	/(  	* 	*D::<< $$T**A *T!%%''))_**,,77<< *	,---%))AEEGG)_d1557799od

3**1-33556Aw D__S)) 
*	,---#$;; $

3 0 0::<< 0%IdB///0 ZZ\\ (#'L)DJJLL)))	,%%% 	I WY..// % 	& 	&D$ +*4**4****4*** )} )"$b			[$[[(			 &sxx~~&6777 $ %"&&y%888r"   r  r  r  r  r  r  r  r  r  r  )r  r2   r   r2   )r*   r+   r,   r-   r   r  r  r'  r/  r   r   r   r  r/   r0   s   @r    r  r  V  s1       [ [@ '+!K K K K K K K      <A# # # # #< (-6 6 6 6 6
   
 
 
 

 
 
 
= = = =E9 E9 E9 E9 E9 E9 E9 E9r"   r  )r1   r2   r   r2   )rN   rO   r   r2   r$   )rB   rO   rb   rc   r   rO   )NN)rz   rO   r{   r|   rb   rc   r   rO   )rr   rO   r{   r   r   rO   )8r-   
__future__r   rI   r  r   r  	functoolsr   	itertoolsr   typingr   r   sphinx.localer   r	   sphinx.utilr
   sphinx.util.typingr   r   collections.abcr   r   sphinx.applicationr   sphinx.configr   SphinxConfig	getLoggerr*   ru   r  rx  rw  r  r  r  r  rw   rs  rt  r_   rV   	frozensetr   rJ   r   rM   ra   ry   r   r   r   r  r[   r"   r    <module>r*     s:   3 3 " " " " " "          				             % % % % % % % %               C C C C C C C C 522222222))))))444444		8	$	$2:m,, "
#455 $"*%ABB !rz"@AA  bj11  bj#   bj<   RZ :;; ##  
 rz    iDDDEE         Kc"      *5* 5* 5* 5*p   *8 8 8 8 8z +/!%    8( ( ( (R R R R R R R RjA9 A9 A9 A9 A9_ A9 A9 A9 A9 A9r"   