
    }c              	          d dl Z d dlmZmZmZmZmZ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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 m!Z! d dl"m#Z#  ej$        e%          Z&g dZ'g dZ( G d de)          Z* G d d          Z+dee         dededefdZ,dedededee         fdZ- G d de           Z.dS )    N)AnyCallableDictListSetType)nodes)ElementNode)RSTState)
StringList)Reporterassemble_option_dict)Config)RemovedInSphinx60Warning)BuildEnvironment)
DocumenterOptions)logging)SphinxDirectiveswitch_source_input)nested_parse_with_titles)memberszundoc-memberszinherited-memberszshow-inheritanceprivate-membersspecial-memberszignore-module-allexclude-memberszmember-orderzimported-memberszclass-doc-fromzno-value)r   r   r   r   c                   @    e Zd ZdZdefdZdedeegef         fdZdS )DummyOptionSpecz"An option_spec allows any options.returnc                     dS )z&Behaves like some options are defined.T selfs    <lib/python3.11/site-packages/sphinx/ext/autodoc/directive.py__bool__zDummyOptionSpec.__bool__"   s    t    keyc                     d S )Nc                     | S Nr!   )xs    r$   <lambda>z-DummyOptionSpec.__getitem__.<locals>.<lambda>'   s     r&   r!   )r#   r'   s     r$   __getitem__zDummyOptionSpec.__getitem__&   s
    {r&   N)	__name__
__module____qualname____doc__boolr%   strr   r-   r!   r&   r$   r   r      sb        ,,$    s xs
';      r&   r   c                   ^    e Zd ZdZdedededededdfd	Z	d
e
ddfdZedefd            ZdS )DocumenterBridgez'A parameters container for Documenters.envreporteroptionslinenostater   Nc                     || _         || _        || _        || _        t	                      | _        t                      | _        || _        d S r*   )	r6   	_reportergenoptr9   setrecord_dependenciesr   resultr:   )r#   r6   r7   r8   r9   r:   s         r$   __init__zDocumenterBridge.__init__-   s@    !-0UU  ll


r&   msgc                     t          j        dt          d           t                              || j        j        | j        f           d S )NzTDocumenterBridge.warn is deprecated.  Please use sphinx.util.logging module instead.   
stacklevellocation)warningswarnr   loggerwarningr6   docnamer9   )r#   rB   s     r$   rJ   zDocumenterBridge.warn7   sO     (.1	> 	> 	> 	> 	sdh&6%DEEEEEr&   c                 H    t          j        dt          d           | j        S )Nz,DocumenterBridge.filename_set is deprecated.rD   rE   )rI   rJ   r   r?   r"   s    r$   filename_setzDocumenterBridge.filename_set=   s,    D.1	> 	> 	> 	>''r&   )r.   r/   r0   r1   r   r   r   intr   rA   r3   rJ   propertyr   rO   r!   r&   r$   r5   r5   *   s        11,  7 %(-1   F F F F F F (c ( ( ( X( ( (r&   r5   
documenterconfigr8   r   c                 n   t           D ]}|| j        vr|                    d|z   d          du }||j        v r|s||v rt	          |j        |         t
                    r`|t          v rV||         N||                             d          r3d                    |j        |         ||         dd         g          ||<   |j        |         ||<   |	                    |          ||         
                    d          ||<   t          t          |                                | j                            S )z0Recognize options of Documenter from user input.zno-TN+,   )AUTODOC_DEFAULT_OPTIONSoption_specpopautodoc_default_options
isinstancer3   AUTODOC_EXTENDABLE_OPTIONS
startswithjoingetlstripr   r   items)rR   rS   r8   namenegateds        r$   process_documenter_optionsre   D   s_    ( : :z-- 	:kk%$,55=Gv55 :g :7? Iz&2PQU2VX['\'\ I 99 J"4= J9Q9QRU9V9V J,/HHf6TUY6Z6=dmABB6G6I -J -JGDM %+$B4$HGDMMT"" : ' 4 4S 9 9'9OPPQQQr&   r:   contentc                 @   t          | |          5  |j        r1t          j                    }| j        |_        t          | ||           n6t          j                    }| j        |_        |                     |d|           |j        cddd           S # 1 swxY w Y   dS )z1Parse an item of content generated by Documenter.r   N)	r   titles_allowedr	   sectiondocumentr   	paragraphnested_parsechildren)r:   rf   rR   nodes       r$   parse_generated_contentro   ^   s     
UG	,	,  $ 	1!MOOD!NDM$UGT::::?$$D!NDMw4000}                 s   A5BBBc                   N    e Zd ZdZ e            ZdZdZdZdZ	de
e         fdZdS )AutodocDirectivezA directive class for all autodoc directives. It works as a dispatcher of Documenters.

    It invokes a Documenter upon running. After the processing, it parses and returns
    the content generated by Documenter.
    TrW   r   r   c                    | j         j        j        }	 |                    | j                  \  }}n# t
          $ r d\  }}Y nw xY wt                              d||| j                   | j	        dd          }| j
        j        j        j        |         }	 t          || j        | j                  }nY# t"          t$          t&          f$ r?}t                              d| j	        d|| j
        j        |f           g cY d }~S d }~ww xY wt-          | j
        |||| j                   } ||| j        d                   }	|	                    | j                   |j        sg S t                              d	d
                    |j                             |j        D ]+}
| j         j        j        j                            |
           ,t?          | j         |j        |	          }|S )N)NNz[autodoc] %s:%s: input:
%s   zAn option to z, is either unknown or has an invalid value: rG   r   )more_contentz[autodoc] output:
%s
) r:   rj   r7   get_source_and_liner9   AttributeErrorrK   debug
block_textrc   r6   appregistrydocumentersre   rS   r8   KeyError
ValueError	TypeErrorerrorrM   r5   	argumentsgeneraterf   r@   r_   r?   settingsaddro   )r#   r7   sourcer9   objtypedocclsdocumenter_optionsexcparamsrR   fnr@   s               r$   runzAutodocDirective.run{   s   :&/	*%99$+FFNFFF 	* 	* 	*)NFFFF	*2FFDOTTT )ABB-&27;	!;FDKQUQ]!^!^*i0 	 	 	LLL)))SS*59X5Ev4N  P P PIIIIII		 "$(H6H&RVR\]]VFDN1$566
666} 	I,dii.F.FGGG , 	E 	EBJ(<@@DDDD(V]JOOs-   1 AAB0 0D4D;DDN)r.   r/   r0   r1   r   rY   has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacer   r   r   r!   r&   r$   rq   rq   o   sc         
 "/##KK $%T$Z % % % % % %r&   rq   )/rI   typingr   r   r   r   r   r   docutilsr	   docutils.nodesr
   r   docutils.parsers.rst.statesr   docutils.statemachiner   docutils.utilsr   r   sphinx.configr   sphinx.deprecationr   sphinx.environmentr   sphinx.ext.autodocr   r   sphinx.utilr   sphinx.util.docutilsr   r   sphinx.util.nodesr   	getLoggerr.   rK   rX   r]   dictr   r5   re   ro   rq   r!   r&   r$   <module>r      sa    7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7       ( ( ( ( ( ( ( ( 0 0 0 0 0 0 , , , , , , 9 9 9 9 9 9 9 9             7 7 7 7 7 7 / / / / / / 2 2 2 2 2 2 2 2       E E E E E E E E 6 6 6 6 6 6		8	$	$M M M 
1 1 1     d   ( ( ( ( ( ( ( (4R4
+; RV RVZ R$+R R R R48 j j !%d   "1 1 1 1 1 1 1 1 1 1r&   