
    O&i              	       2   d 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m	Z	m
Z
mZmZmZmZ ddlmZ ddlmZ ddlmZ ddlmZmZ dd	l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-dZ. G d dej/                  Z0i fde1de
e1e1f         de1fdZ2 G d d          Z3d ee1         dee1         fd!Z4d"e1dee1         fd#Z5d*d$e1d%e1de1fd&Z6di fde1d%e1de7de1fd'Z8 G d( d)e3          Z9dS )+z-Classes for docstring parsing and formatting.    N)partial)AnyCallableDictListTupleTypeUnion)SphinxConfig)RemovedInSphinx60Warning)___)logging)stringify_annotation)get_type_hintsz
\.\. \S+::z^(\s|\w)+:\s*$z(.+?)\(\s*(.*[^\s]+)\s*\)z^[=\-`:\'"~^_*+#<>]{2,}\s*$z(?<!:):(?!:)z>((?::(?:[a-zA-Z0-9]+[\-_+:.])*[a-zA-Z0-9]+:`.+?`)|(?:``.+?``))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Ellipsisc                   L     e Zd ZdZ e            ZdedefdZdef fdZ	 xZ
S )Dequez
    A subclass of deque that mimics ``pockets.iterators.modify_iter``.

    The `.Deque.get` and `.Deque.next` methods are added.
    nreturnc                 F    |t          |           k     r| |         n| j        S )zx
        Return the nth element of the stack, or ``self.sentinel`` if n is
        greater than the stack size.
        )lensentinel)selfr   s     j/home/geonatureadmin/si_en_reseau/tutos/venv/lib/python3.11/site-packages/sphinx/ext/napoleon/docstring.pygetz	Deque.get9   s"    
 c$ii--tAwwT]:    c                 V    | r t                                                      S t          N)superpopleftStopIteration)r   	__class__s    r    nextz
Deque.next@   s%     	 77??$$$r"   )__name__
__module____qualname____doc__objectr   intr   r!   r)   __classcell__r(   s   @r    r   r   0   s}          vxxH;S ;S ; ; ; ; c                    r"   r   _typetranslationsr   c                 4    | |v r||          S | dk    rdS d| z  S )z0Convert type specification to reference in reST.r   z:obj:`None`:class:`%s` )r2   r3   s     r    _convert_type_specr7   G   s1    E""F?? = 5((r"   c                   `   e Zd ZdZ ej        dej                  Z	 	 	 dgdee	e
e	         f         dedede	d	e	d
ededdfdZde	fdZde
e	         fdZdhdede
e	         fdZde
e	         fdZde
e	         fdZdidededee	e	e
e	         f         fdZ	 	 djdededede
ee	e	e
e	         f                  fdZdee	e
e	         f         fdZdkdede
ee	e	e
e	         f                  fdZde
e	         fdZde	fd Zde
e	         fd!Zde
e	         fd"Zdkd#e
e	         d$ede
e	         fd%Zd	e	de	fd&Z d'e
e	         de
e	         fd(Z!d)e	d#e
e	         de
e	         fd*Z"dld+e	d#e
e	         d,e	de
e	         fd-Z#	 dmd0e
ee	e	e
e	         f                  d1e	d2e	de
e	         fd3Z$d4e	d5e	d6e
e	         de
e	         fd7Z%d8e	d0e
ee	e	e
e	         f                  de
e	         fd9Z&dnd;edefd<Z'd=e	defd>Z(d#e
e	         defd?Z)d#e
e	         defd@Z*dod#e
e	         dBede
e	         fdCZ+dhd=e	dedefdDZ,d#e
e	         defdEZ-defdFZ.defdGZ/dpdHZ0dpdIZ1d)e	dJe	de
e	         fdKZ2de
e	         fdLZ3dJe	de
e	         fdMZ4dJe	de
e	         fdNZ5dJe	de
e	         fdOZ6dJe	de
e	         fdPZ7dJe	de
e	         fdQZ8dJe	de
e	         fdRZ9dJe	dSede
e	         fdTZ:dJe	de
e	         fdUZ;dJe	de
e	         fdVZ<dJe	de
e	         fdWZ=dJe	de
e	         fdXZ>dJe	de
e	         fdYZ?dJe	de
e	         fdZZ@dJe	de
e	         fd[ZAdJe	de
e	         fd\ZBdJe	de
e	         fd]ZCdJe	de
e	         fd^ZDdJe	de
e	         fd_ZEdJe	de
e	         fd`ZFd=e	dee	e	e	f         fdaZGdbe	dceHde	fddZId#e
e	         de
e	         fdeZJd4e	de	fdfZKdS )qGoogleDocstringaV  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 noindex 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*N 	docstringconfigappwhatnameobjoptionsr   c                     || _         || _        | j         s(ddlm} | j        r| j        j        n	 |            | _         |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todowarningwarningswarnwarnsyieldyields),_config_appsphinx.ext.napoleonr   r<   inspectisclassismodulecallable_what_name_obj_opt
isinstancestr
splitlinesr   maprstrip_lines_parsed_lines_is_in_section_section_indenthasattrrF   _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_sectionrG   _load_custom_sections_parse)
r   r;   r<   r=   r>   r?   r@   rA   r   liness
             r    __init__zGoogleDocstring.__init__   s    	| 	G222222/3yF49++ffhhDL 	 s##  !#&&  #  !

		i%% 	((**EEEC
E2233(*# t233 	524D$t[)) $	#36#3T;#3 WT%;[II#3 d<	#3
 74#99EE#3 '$"8(CC#3 !7AA#3 47#3 D8#3  6??#3 WT%;[II#3  E#3 $T%J#3 46#3  6??#3  2!#3" #D$H##3 #3$ d<%#3& 47'#3( D8)#3* $5+#3, 46-#3. 3/#30 $41#32 d<3#34 D85#36 wt5u==7#38  6??9#3: 74#99EE;#3< GD$:IFF=#3> 1?#3@ 2A#3B 3C#3D $4E#3 #3DNJ 	""$$$r"   c                 P    d                     |                                           S )zReturn the parsed docstring in reStructuredText format.

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

        
)joinr   r   s    r    __str__zGoogleDocstring.__str__   s     yy&&&r"   c                     | j         S )zReturn the parsed lines of the docstring in reStructuredText format.

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

        )rv   r   s    r    r   zGoogleDocstring.lines   s     !!r"      indentc                 z   g }| j                             d          }|                                 s|r|                     ||          rr|                    | j                                                    | j                             d          }|                                 s|\|                     ||          r|S Nr   )ru   r!   _is_section_break_is_indentedappendr)   )r   r   r   lines       r    _consume_indented_blockz'GoogleDocstring._consume_indented_block   s    {q!!&&((	&	&**488	& LL))++,,,;??1%%D	 &&((	&	&**488	& r"   c                 6   g }| j         r| j                             d          ru|                                 sa|                    | j                                                    | j         r.| j                             d          r|                                 a|S r   )ru   r!   _is_section_headerr   r)   r   r   s     r    _consume_contiguousz#GoogleDocstring._consume_contiguous  s    { 	-{q!!	-**,,	- LL))++,,, { 	-{q!!	-**,,	- r"   c                     g }| j                             d          }| j         rQ|sO|                    | j                                                    | j                             d          }| j         r|O|S r   )ru   r!   r   r)   r   r   r   s      r    _consume_emptyzGoogleDocstring._consume_empty  sx    {q!!k 	&$ 	&LL))++,,,;??1%%D k 	&$ 	& r"   TF
parse_typeprefer_typec                    | j                                         }|                     |          \  }}}|d|}	}}|rXt                              |          }
|
r<|
                    d                                          }|
                    d          }|                     |          }|r|s||}}|r(| j        j	        rt          || j        j        pi           }|                     |          dz   }|	g|                     |                     |                    z   }|                     || j                                                  }|||fS )Nr:   r      )ru   r)   _partition_field_on_colon_google_typed_arg_regexmatchgroupstrip_escape_args_and_kwargsre   napoleon_preprocess_typesr7   napoleon_type_aliases_get_indent_dedentr   r(   r   )r   r   r   r   beforecolonafterrm   r2   _descr   r   _descss                r    _consume_fieldzGoogleDocstring._consume_field  sP   {!!#==dCCu$b%eu 	'+11&99E 'A,,..A,,U33 	(u 	( %5E 	XT\; 	X&udl.P.VTVWWE!!$''!+4<<(D(DV(L(LMMM55;;==eV##r"   multiplec                    |                                   g }|                                 s|                     ||          \  }}}|rE|rC|                    d          D ],}|                    |                                ||f           -n|s|s|r|                    |||f           |                                 |S )N,)r   r   r   splitr   r   )	r   r   r   r   fieldsrm   r2   r   r?   s	            r    _consume_fieldszGoogleDocstring._consume_fields-  s    ((** 	6"&"5"5j+"N"NE5% 6E 6!KK,, @ @DMM4::<<">????@ 6% 65 6ueU4555 ((** 	6 r"   c                 8   | j                                         }|                     |          \  }}}|r|s	||}}||z  }|g|                     |                                           z   }|                     || j                                                  }||fS r$   )ru   r)   r   r   _consume_to_endr(   re   r   )r   r   r2   r   r   r   s         r    _consume_inline_attributez)GoogleDocstring._consume_inline_attribute:  s    {!!"<<TBBue 	E 	 %5EUNE4<<(<(<(>(>???55;;==f}r"   preprocess_typesc                    |                      |                                           }|r|                     |d                   \  }}}dd|}}}|r|r|g|dd          z   }n
|dd          }|}|r*|r(| j        j        rt          || j        j        pi           }|                     || j                                                  }|||fgS g S )Nr   r:   r   )	r   _consume_to_next_sectionr   re   r   r7   r   r(   r   )	r   r   r   r   r   r   rm   r2   r   s	            r    _consume_returns_sectionz(GoogleDocstring._consume_returns_sectionD  s    T::<<== 	#'#A#A%(#K#K FE5"$b%%5E  &"GeABBi/EE!!""IE \* \L:\*5$,2T2ZXZ[[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:)ru   r)   r   lowerrG   )r   sectionstripped_sections      r    _consume_section_headerz'GoogleDocstring._consume_section_header`  sJ    +""$$"==--!!##t~55&Gr"   c                 ~    g }| j         r3|                    | j                                                    | j         3|S r$   )ru   r   r)   r   s     r    r   zGoogleDocstring._consume_to_endg  sB    k 	-LL))++,,, k 	-r"   c                    |                                   g }|                                 s@|                    | j                                                   |                                 @||                                  z   S r$   )r   r   r   ru   r)   r   s     r    r   z(GoogleDocstring._consume_to_next_sectionm  sz    ((** 	-LL))++,,, ((** 	-t**,,,,r"   r   fullc                 f    |rd |D             S |                      |          fd|D             S )Nc                 6    g | ]}|                                 S r6   )lstrip).0r   s     r    
<listcomp>z+GoogleDocstring._dedent.<locals>.<listcomp>v  s     444dDKKMM444r"   c                 $    g | ]}|d          S r$   r6   )r   r   
min_indents     r    r   z+GoogleDocstring._dedent.<locals>.<listcomp>y  s"    888$D%888r"   )_get_min_indent)r   r   r   r   s      @r    r   zGoogleDocstring._dedentt  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   *z\*)endswithgetattrre   )r   r?   s     r    r   z'GoogleDocstring._escape_args_and_kwargs{  s    == 	%'$,8SUZ"["[ 	%9u$D8tT!""X%%"1"X__48##Kr"   descc                 D   |                      |          rdg|z   }n|d                             d          rh|dd          }|                     |d                   }|                     |          }||k    rdg|z   }n!d|d         g|                     |d          z   }|S )Nr:   r   ::r      )_is_listr   r   _get_initial_indent_indent)r   r   
desc_blockr   block_indents        r    _fix_field_desczGoogleDocstring._fix_field_desc  s    == 		C4$;DD!Wd## 	CabbJ%%d1g..F33J??Lf$$td{DG}t||J'B'BBr"   
admonitionc                    |                      |          }t          |          dk    r"d|d|d                                         dgS |r7|                     |                     |          d          }d|z  dg|z   dgz   S d|z  dgS )Nr   z.. z:: r   r:      z.. %s::)_strip_emptyr   r   r   r   )r   r   r   s      r    _format_admonitionz"GoogleDocstring._format_admonition  s    !!%((u::???$.JJa0@0@0@A2FF 	0LLe!4!4a88E
*B/%72$>>
*B//r"   prefixpaddingc                 (   |r|dt          |          z  }g }t          |          D ]f\  }}|dk    r+|                    ||z                                              6|r|                    ||z              Q|                    d           g|S |gS )N r   r:   )r   	enumerater   rt   )r   r   r   r   result_linesir   s          r    _format_blockzGoogleDocstring._format_block  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|           |dgz   S )Nr   r   : r:   )r   anyr   extendr   r   )	r   r   r   r   r   rm   r2   r   fields	            r    _format_docutils_paramsz'GoogleDocstring._format_docutils_params  s     #) 
	G 
	GE5%%%e,,E5zz >,,U33&0jj%%%8T//u==>>>>***eee<=== GYYYuuEFFFt|r"   rm   r2   r   c                 V   |                      |          }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}|r:|                     |          }|d
         r||d
         z   g|dd          z   S |g|z   S |gS )Nz -- r:   `r   z** ()z** (*z*)r   r   r   )r   r   r   )r   rm   r2   r   has_desc	separatorr   s          r    _format_fieldzGoogleDocstring._format_field  s1   !!%((u::&.FFB	 	 8%<<</4uueeeYYGEE   27yyIEE	8 ',eeYY7 	e||"'%3  %*EE995E 	((//EQx 'a()E!""I55w&7Nr"   
field_typec                    d|                                 z  }dt          |          z  }t          |          dk    }g }|D ]\  }}}|                     |||          }	|r\|r-|                    |                     |dz   |	                     N|                    |                     |dz   |	                     {|                    |                     |dz   |	                     |r|d         r|                    d           |S )Nz:%s:r   r   z * r   r:   )r   r   r  r   r   r   )
r   r  r   r   multir   rm   r2   r   r   s
             r    _format_fieldszGoogleDocstring._format_fields  s$   j..000
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   )ru   r!   r   r   )r   r	  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$   )r   isspacer   )r   r   r   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    r   z#GoogleDocstring._get_initial_indent  s=     	. 	.D .''-----.qr"   c                 `    d }|D ]&}|r"|                      |          }||}||k     r|}'|pdS r   r  )r   r   r   r   r   s        r    r   zGoogleDocstring._get_min_indent  sY    
 	( 	(D ())$//%!'JJj((!'JQr"   r   r   c                      fd|D             S )Nc                      g | ]
}d z  |z   S )r   r6   )r   r   r   s     r    r   z+GoogleDocstring._indent.<locals>.<listcomp>  s"    333TqD 333r"   r6   )r   r   r   s     `r    r   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 NTF)r   r  )r   r   r   r   r  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_regexr   _enumerated_list_regexr   r   r   )r   r   r   next_indentr   s        r    r   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   )r	  TF)ru   r!   r   _google_section_regexr   r   rG   r   r  rF   _directive_regex
startswith)r   r   r   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   ru   r!   r   rw   r   rx   )r   r   s     r    r   z!GoogleDocstring._is_section_break8  sk    {q!!K G''))G$ FF))$0DEEE		H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)
re   napoleon_custom_sectionsrp   rq   _parse_custom_generic_sectionrG   r   "_parse_custom_params_style_section#_parse_custom_returns_style_sectionr!   )r   entrys     r    r   z%GoogleDocstring._load_custom_sections@  s   <0<> S SeS)) S 594VDN5;;==11 Qx>11 C uQx~~'7'788q_44 D uQx~~'7'788 !N..uQx~~/?/?/3/QS S uQx~~'7'788# =<S Sr"   c                 N   |                                  | _        | j        rM| j        dv rDg }	 |                                 }n# t
          $ r Y nw xY w| j                            |           d S | j        r/|                                 r	 | 	                                }d| _
        |                                 | _        t                              |          r|g|                                 z   }n( | j        |                                         |          }d| _
        d| _        nX# d| _
        d| _        w xY w| j        s*|                                 |                                  z   }n|                                 }| j                            |           | j        -d S d S )N)	attributedatapropertyTFr   )r   rv   rm   rl   _parse_attribute_docstringr'   r   ru   r   r   rw   r  rx   r  r   r   rG   r   r   )r   resr   r   s       r    r   zGoogleDocstring._parseV  s   !0022: 		$*(III  C5577    %%c***Fk 	-&&(( <
-"::<<G*.D'+/+C+C+E+ED('--g66 I!(	D,I,I,K,K K ?w}} ? H H*/D'+,D(( +0D'+,D(,,,,) < 44669L9L9N9NNEE 99;;E%%e,,,% k 	- 	- 	- 	- 	-s   A 
AABD) )D9r   c                 V    |                                  }|                     ||          S r$   )r   r   )r   r   r   r   s       r    r{   z!GoogleDocstring._parse_admonitionx  s)    --//&&z5999r"   c                     |                                  \  }}|                     dd|          }|r|                    dd|z  g           |S )Nr:   	:type: %s)r   r  r   )r   r2   r   r   s       r    r/  z*GoogleDocstring._parse_attribute_docstring}  sW    5577u""2r511 	4LL"kE12333r"   c                 :   g }|                                  D ]a\  }}}|s|                     |          }| j        j        rLd|z  }|                    |                     ||                     |r|                    d|d|           v|                    d|z              | j        rd| j        v r|                    d           |                    d           |                     dd|          }|                    | 	                    |d                     |rB|                    d           |                    | 	                    d	|z  gd                     |                    d           c| j        j        r|                    d           |S )
Nz
:ivar %s: z	:vartype r   z.. attribute:: noindex   :noindex:r:   r   r3  )
r   _lookup_annotationre   napoleon_use_ivarr   r   r   ro   r  r   )r   r   r   rm   r2   r   r   r   s           r    r|   z)GoogleDocstring._parse_attributes_section  s   #'#7#7#9#9 	! 	!E5% 7//66|- !$u,T//u==>>> ELLLeeeUU!CDDD.67779 1di!7!7LL000R   ++BE::T\\&!44555 ILL$$$LL{U/B.CQ!G!GHHHR    <) 	LLr"   c                     t          d          t          d          d}| j        j        }|                    |                                |          }|                     ||          S )NExampleExamples)rO   rP   )r   re   $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$   )r  r   rB  s     r    r(  z2GoogleDocstring._parse_custom_params_style_section  s$    ""7D,@,@,B,BCCCr"   c                 Z    |                      d          }|                     ||          S )NTr   )r   r  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:r:   z.. code-block:: pythonr   )r   r   )r   r   headerblockr   s        r    _parse_usage_sectionz$GoogleDocstring._parse_usage_section  sP    &+)2.++--UA&&~%,,r"   r?  c                     |                      |                                           }|                     |          }|rd|z  }|                     |d          }nd|z  }|r|dg|z   dgz   S |dgS )Nz.. admonition:: %sr   z.. rubric:: %sr:   )r   r   r   r   )r   r   r?  r   rH  s        r    r=  z&GoogleDocstring._parse_generic_section  s    !!$"?"?"A"ABBU## 	0)G3FLL**EE%/F 	 B<%'2$..B<r"   c                     |                                  }| j        j        r|                     |dd          S |                     t          d          |          S )Nkeywordkwtype)r   r   zKeyword Arguments)r   re   napoleon_use_keywordr   r  r   rF  s      r    r~   z0GoogleDocstring._parse_keyword_arguments_section  sh    %%''<, 	G//$" 0 $ $ $
 &&q)<'='=vFFFr"   c                 F   g }|                      d          D ]\  }}}|                    d|z             | j        rd| j        v r|                    d           |r-|                    dg|                     |d          z              |                    d           |S )NF)r   z.. method:: %sr5  r6  r:   r   )r   r   ro   r   r   )r   r   r   rm   r2   r   s         r    r   z&GoogleDocstring._parse_methods_section  s    #'#7#75#7#I#I 	 	E5%LL)E1222y -Y$)33^,,, <bTDLL$:$::;;;LLr"   c                 `    | j         j        }|                     t          d          |          S )NNotes)re   !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re   napoleon_use_paramr   r   r  r   rF  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 )NTrV  
ParametersrW  rF  s      r    rz   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   r   r:   z
    z:raisesr   )
r   	_name_rgxr   r   _xref_regexfindr   r   r   r   )
r   r   r   r   rm   r2   r   mposr   s
             r    r   z%GoogleDocstring._parse_raises_section  s7   %%D%II#) 
	; 
	;E5%$$U++A *QWWV__ *""5)) *jjoocAgbj)#(0C%KKbE%%e,,E36u::ES8==////2FLLL555&&9:::: 	LLr"   c                     | j         j        r+|                     d          }|                     |          S |                                 }|                     t          d          |          S )NTrV  ReceivesrW  rF  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)re   &napoleon_use_admonition_for_referencesr=  r   rT  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|z  dg           |r|d         r|                    d           |S )	Nr   Fr:   z          * z:returns: * z
:returns: z
:rtype: %sr   )	r   r   re   napoleon_use_rtyper  r   r   r   r   )
r   r   r   r  	use_rtyper   rm   r2   r   r   s
             r    r   z&GoogleDocstring._parse_returns_section  sk   ..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,"6!;<<< 	U2Y 	LLr"   c                 .    |                      d|          S Nseealso)r{   rB  s     r    r   z'GoogleDocstring._parse_see_also_section*  s    %%i999r"   c                 l    |                      t          d          |                                           S )NWarns)r  r   r   rB  s     r    r   z$GoogleDocstring._parse_warns_section-  s*    ""1W::t/C/C/E/EFFFr"   c                 t    |                      d          }|                     t          d          |          S )NTrE  Yields)r   r  r   rF  s      r    r   z%GoogleDocstring._parse_yields_section0  s4    ...EE""1X;;777r"   c                    g }g }d}d}t          t                              |                    D ]\  }}|r|                    |           t                              |          }|dz  dk    r|rd}||                                |                                         }|                    |d |                                                    |                    ||                                d                     |                    |           d                    |          	                                |d                    |          	                                fS )Nr:   Fr   r   T)
r   _xref_or_code_regexr   r   _single_colon_regexsearchstartendr   r   )	r   r   before_colonafter_colonr   found_colonr   sourcer_  s	            r    r   z)GoogleDocstring._partition_field_on_colon4  sN   "#6#<#<T#B#BCC 	0 	0IAv 
0""6****'..v66Ea<<A<"&K"17799aeegg#56E ''z		z(:;;;&&vaeegghh'78888 ''////%%++--$$**,,. 	.r"   	attr_nameklassc                     t          j        d| j        j        z  t                     |rKd|vrG|                    d          r
|dd          }	 |j        }n# t          $ r
 |j        }Y nw xY wd|d|S |S )Nz!%s._qualify_name() is deprecated..~r   )r`   ra   r(   r*   r   r  r,   AttributeError)r   rz  r{  qs       r    _qualify_namezGoogleDocstring._qualify_nameJ  s    9n-./G	I 	I 	I 	-S	))##C(( *%abbM	#&! # # #N# qq)),,s   A A*)A*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   )r   reversedranger   )r   r   rt  r   r   ru  s         r    r   zGoogleDocstring._strip_emptyW  s     	-E$U++  4 EE {{CeCJJ//00  Qx CE qyyC!Gc%jj00eC!Gm,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 rt          | j        |                   S dS )N)rD   rC   	exception_annotationsautodoc_type_aliasesr   r:   )
re   napoleon_attr_annotationsrl   rn   ry   r   updater   r  r   )r   rm   localnss      r    r7  z"GoogleDocstring._lookup_annotationj  s    <1 
	Jz===$)=t^44 Q%dl4JBOOGNN7#'<1H"$% $% $+(*, , , )7ty$(P(PD%D---/0A%0HIIIrr"   NNr:   r:   NN)r   TF)TFFFr$   )r   r   )r   )r   )r   N)Lr*   r+   r,   r-   recompileXr\  r
   rq   r   SphinxConfigr   r   r   r   r   r/   r   r   r   boolr   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/  r|   r}   r'  r(  r)  rJ  r=  r~   r   r   r   rz   r   r   r   r   r   r   r   r   r	   r  r   r7  r6   r"   r    r9   r9   T   s
       < <| 
 @ACG GI QUAC15J J%T#Y"7 J JJ+.J;>JJ+.J:>J J J JX	' 	' 	' 	' 	'	"tCy 	" 	" 	" 	"	 	c 	$s) 	 	 	 	T#Y    S	    $ $ $4 $!#sDI"56$ $ $ $4 LQ). $ D "&37c3S	>Q8R3S   5d3i+@      &*5c491D+E&F   0S	        c    -$s) - - - -9 9T#Y 9d 9tCy 9 9 9 9	C 	C 	 	 	 	DI $s)    0S 0c 0tCy 0 0 0 0 C S	 C SWX[S\    " MS d5c499L3M.N ,/FI%)#Y   "3 s 49 c    : d5c4PS9AT;U6V  I   & c #         c s    	T#Y 	3 	 	 	 	4 4T#Y 43 4tCy 4 4 4 4  c $    $d3i $D $ $ $ $"D    H4 H H H HS S S S, -  -  -  -D:C :# :$s) : : : :
DI     c    4Bs BtCy B B B B;S ;T#Y ; ; ; ;D# D$s) D D D D43 449 4 4 4 4-C -DI - - - - c  4  DQTI        G GS	 G G G G	c 	d3i 	 	 	 	GC GDI G G G GFs FtCy F F F F@ @c @ @ @ @S T#Y    $>s >tCy > > > >L Lc L L L Lc d3i    4:s :tCy : : : :GC GDI G G G G8S 8T#Y 8 8 8 8.c .eCcM6J . . . .,s 4 C    $s) S	    &       r"   r9   tokensc                 v    t          j        |           }dfdfd}t           ||                    S )Noptionaldefaultc              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   })r&   
IndexErrorr   
appendleft)r  open_bracesprevious_tokentokenkeywordss       r    takewhile_setz,_recombine_set_tokens.<locals>.takewhile_set~  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  r  r   )r  r  r  s     r    combine_setz*_recombine_set_tokens.<locals>.combine_set  s      
	((    ||!!#&&&ggmmF33444444
	s    
)))collectionsdequelist)r  token_queuer  r  r  s      @@r    _recombine_set_tokensr  z  sf    #F++K&H" " " " "H     K(()))r"   specc                 Z    d fdt                               |           D             }|S )Nc                 n    t                               |           r| d d         }| dd          }|d|gS | gS )N      r   )_default_regexr   )itemr  others      r    postprocessz(_tokenize_type_spec.<locals>.postprocess  sH    %% 	2A2hG HES%((6Mr"   c                 4    g | ]} |          D ]}||S r6   r6   )r   	raw_tokenr  r  s      r    r   z'_tokenize_type_spec.<locals>.<listcomp>  sP       K	**  	   r"   )_token_regexr   )r  r  r  s     @r    _tokenize_type_specr    sO    	 	 	   %++D11  F Mr"   r  locationc                 4   d }|                      d          s|                     d          rd}n ||           s~|                      d          r|                     d          sT|                      d          r|                     d          s*|                      d          r|                     d          rd}nY|                      d          r.t                              t	          d	          | |
           d}n|                     d          r-t                              t	          d          | |
           d}n|                      d          s|                      d          r-t                              t	          d          | |
           d}n}|                     d          s|                     d          r-t                              t	          d          | |
           d}n&| dv rd}nt
                              |           rd}nd}|S )Nc                 H    	 t          |            dS # t          $ r Y dS w xY wr  )complex
ValueError)r  s    r    
is_numericz_token_type.<locals>.is_numeric  s=    	ENNN 4  	 	 	55	s    
!!r   	delimiterr  r  "'literalz-invalid value set (missing closing brace): %s)r  z-invalid value set (missing opening brace): %sz4malformed string literal (missing closing quote): %sz4malformed string literal (missing opening quote): %sr  control	referencer@   )r  r   loggerr_   r   r]  r   )r  r  r  type_s       r    _token_typer    st       ,s 3 3 ,Ju*c""*',~~c':':* c""* (-~~c':':* c""	* (-~~c':':	* 			#		 #>?? 	 	
 	
 	

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

 			#		 %"2"23"7"7 EFF 	 	
 	
 	

 			 s 3 3 EFF 	 	
 	
 	

 	)	)	) 			5	!	! Lr"   c                     d t          |           }t          |          }fd|D             }d fdd d d dd	                    fd
|D                       }|S )Nc                     |                     | |           }|t          v r	|dk    rd}n|dk    r|dk    rd}t                              |          ||z  }|S )Nr5   	:obj:`%s`z...z:obj:`%s <Ellipsis>`)r!   _SINGLETONSr]  r   )r@   r3   default_translationtranslations       r    convert_objz-_convert_numpy_type_spec.<locals>.convert_obj  sx    "&&sC00 +%%*=*N*N"-E!!&9]&J&J"8[))1-;Kr"   c                 4    g | ]}|t          |          fS r6   )r  )r   r  r  s     r    r   z,_convert_numpy_type_spec.<locals>.<listcomp>  s8        
E8,,-  r"   c                     d| z  S )Nz``%s``r6   xs    r    <lambda>z*_convert_numpy_type_spec.<locals>.<lambda>  s
    X\ r"   c                      | d          S )Nr5   r6   )r  r  r3   s    r    r  z*_convert_numpy_type_spec.<locals>.<lambda>  s    QmDD r"   c                     d| z  S )Nz*%s*r6   r  s    r    r  z*_convert_numpy_type_spec.<locals>.<lambda>  s
    VaZ r"   c                     | S r$   r6   r  s    r    r  z*_convert_numpy_type_spec.<locals>.<lambda>      q r"   c                     | S r$   r6   r  s    r    r  z*_convert_numpy_type_spec.<locals>.<lambda>  r  r"   )r  r@   r  r  r  r:   c              3   Z   K   | ]%\  }}                      |          |          V  &d S r$   )r!   )r   r  r  
converterss      r    	<genexpr>z+_convert_numpy_type_spec.<locals>.<genexpr>!  s>      OO-
u--e44OOOOOOr"   )r  r  r   )	r2   r  r3   r  combined_tokenstypes	convertedr  r  s	    ``    @@r    _convert_numpy_type_specr    s       !''F+F33O   $  E *)DDDDD'' [ [ J OOOOOOOOOIr"   c                   `    e Zd ZdZ	 	 	 ddeeee         f         dedededed	e	d
e	ddf fdZ
defdZdedef fdZddededeeeee         f         fdZddedeeeeee         f                  fdZdefdZdefdZdefdZdedee         fdZdee         dee         fdZ xZS ) 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 noindex 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.

    Nr:   r;   r<   r=   r>   r?   r@   rA   r   c           	      f    dg| _         t                                          |||||||           d S )Nz
.. index::)rF   r%   r   )	r   r;   r<   r=   r>   r?   r@   rA   r(   s	           r    r   zNumpyDocstring.__init__  s9     %1> FCtS'JJJJJr"   c                     	 | j         t          j        | j                   nd }n# t          $ r d }Y nw xY w| j        }||d S |d}d                    |d|z  g          S )Nr:   r   zdocstring of %s)rn   rh   getfile	TypeErrorrm   r   )r   filepathr?   s      r    _get_locationzNumpyDocstring._get_location  s    	59Y5Jwty111PTHH 	 	 	HHH	z4Hxx#4t#;<===s   "% 44c                     t                      j        d|v r4d                    fd|                    d          D                       S  |          S )Nr  c              3   .   K   | ]} |          V  d S r$   r6   )r   r   funcs     r    r  z9NumpyDocstring._escape_args_and_kwargs.<locals>.<genexpr>  s+      GGUTT%[[GGGGGGr"   )r%   r   r   r   )r   r?   r  r(   s     @r    r   z&NumpyDocstring._escape_args_and_kwargs  sZ    ww.4<<99GGGGdjj6F6FGGGGGG4::r"   TFr   r   c                    | j                                         }|r|                     |          \  }}}n|d}}|                                |                                }}|                     |          }|r|s|                     |          }|r|s||}}| j        j        r0t          || 	                                | j        j
        pi           }|                     |          dz   }|                     |                     |                    }|                     || j                                                  }|||fS )Nr:   )r  r3   r   )ru   r)   r   r   r   r7  re   r   r  r  r   r   r   r   r(   r   )	r   r   r   r   rm   r   r2   r   r   s	            r    r   zNumpyDocstring._consume_field  sN   {!! 	$"<<TBBOE1ee5E{{}}ekkmmu,,U33 	3e 	3++E22E 	(u 	( %5E<1 	,++--!\?E2  E !!$''!+T99&AABBudl3399;;eU""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$   )ru   r)   r  r   rB  s     r    r   z&NumpyDocstring._consume_section_header  sD    +""$$%%g.. 	Kr"   c                     | j                             d          | j                             d          }}| j          pB|                                 p.ddg||gk    p$| j        o|o|                     || j                   S )Nr   r   r:   r"  )r   line1line2s      r    r   z NumpyDocstring._is_section_break  s    {q))4;??1+=+=uK H''))HRUEN*H $ GG))%1EFFF	I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)ru   r!   r   rG   rp   rq   r  _numpy_section_regexr   rF   r  r  )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   c                     |                                  }	 |                     |          S # t          $ r |                     d|          cY S w xY wrj  )r    _parse_numpydoc_see_also_sectionr  r   )r   r   r   s      r    r   z&NumpyDocstring._parse_see_also_section  sc    --//	=88??? 	= 	= 	=**9e<<<<<	=s   +  AAcontentc                 @    g dt           dt          t           t           f         f fddt           dt          t                    ddff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 fdD             g }d}	D ]n\  }
}}|r
d	|d|
d}nd|
z  }|s|	r|dgz  }||gz  }n|dxx         d|z  z  cc<   |r/| 
                    d                    |          g          z  }d}	ld}	o|dgz  }                     d|          S )a  
        Derived from the NumpyDoc implementation of _parse_see_also.

        See Also
        --------
        func_name : Descriptive text
            continued text
        another_func_name : Descriptive text
        func_name1, func_name2, :meth:`func_name`, func_name3

        textr   c                     j                             |           }|r6|                                }|d         
|d         dfS |d         |d         fS t          d| z            )zMatch ':role:`name`' or 'name'r   Nr   r   z%s is not a item name)r\  r   groupsr  )r  r_  gr   s      r    parse_item_namezHNumpyDocstring._parse_numpydoc_see_also_section.<locals>.parse_item_name  sj    $$T**A &HHJJQ4<Q4:%Q41:%4t;<<<r"   r?   restNc                     | sd S  |           \  } }                     | t          |          |f           |d d = d S r$   )r   r  )r?   r  roleitemsr  s      r    	push_itemzBNumpyDocstring._parse_numpydoc_see_also_section.<locals>.push_item  sQ     (..JD$LL$T

D1222QQQr"   c                     j         j        }||s| ||fS |                    | |           }j                            |          }|s|||fS |                                }|d         }|d         p|d         }|||fS )Nr  r?   name2)re   r   r!   r\  r   	groupdict)	r  descriptionr  r3   
translatedr   r  new_funcr   s	           r    	translatezBNumpyDocstring._parse_numpydoc_see_also_section.<locals>.translate  s    <=L|[$..%))$55JN((44E 5!;44__&&F&>Df~8H[$..r"   r   r   r   r   r   c                 2    g | ]\  }}} |||          S r6   r6   )r   r  r  r  r  s       r    r   zCNumpyDocstring._parse_numpydoc_see_also_section.<locals>.<listcomp>1  s=     
 
 
'k4 IdK..
 
 
r"   Tz:`r   r  r:   r   z, %sFrk  )rq   r   r   r   r\  r   ru  r  r   r   r   r   r   )r   r  r   current_funcr  r   r_  r  r   last_had_descr?   r   r  linkr  r  r  s   `             @@@r    r  z/NumpyDocstring._parse_numpydoc_see_also_section  sc    		=# 		=%S/ 		= 		= 		= 		= 		= 		=	C 	tCy 	T 	 	 	 	 	 	 		/ 	/ 	/ 	/ 	/   	* 	*D::<< $$T**A *T!%%''((^))++66s;; *	,---%)(15577(^T!%%''((^d

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

3 0 0::<< 0%IdB///0 ZZ\\ (#'L)DJJLL)))	,%%% 	I
 
 
 
+0
 
 

  % 	& 	&D$ * *%)TT4440"T) +} +"$b			Vd]*			 &sxx~~&6777 $ %"&&y%888r"   r  r  r  )r*   r+   r,   r-   r
   rq   r   r  r   r   r   r  r   r  r   r   r   r   r   r   r   r  r0   r1   s   @r    r  r  &  s)       [ [x QUAC15K K%T#Y"7 K KK+.K;>KK+.K:>K K K K K K>s > > > >C C      # # #4 #!#sDI"56# # # #86 6 6&*5c491D+E&F6 6 6 6    I4 I I I I
D 
 
 
 
=s =tCy = = = =g9S	 g9d3i g9 g9 g9 g9 g9 g9 g9 g9r"   r  r$   ):r-   r  rh   r  r`   	functoolsr   typingr   r   r   r   r   r	   r
   sphinx.applicationr   sphinx.configr   r  sphinx.deprecationr   sphinx.localer   r   sphinx.utilr   sphinx.util.inspectr   sphinx.util.typingr   	getLoggerr*   r  r  r  r  r   r  rr  rq  r]  r  r  r  r  r  r  r   rq   r7   r9   r  r  r  dictr  r  r6   r"   r    <module>r     s   3 3      				        @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ % % % % % % 0 0 0 0 0 0 7 7 7 7 7 7               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    4         K      . CE 
 
c 
c3h 
 
 
 
 
c c c c c c c cL5*$s) 5*S	 5* 5* 5* 5*pc d3i    *8 8s 8c 8S 8 8 8 8v :>TV ! !C !3 !T ![^ ! ! ! !Hc9 c9 c9 c9 c9_ c9 c9 c9 c9 c9r"   