
    O&i              	          d dl 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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Optional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    i/home/geonatureadmin/si_en_reseau/tutos/venv/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                   j    e Zd ZdZdede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+   )	r7   	_reportergenoptr:   setrecord_dependenciesr   resultr;   )r$   r7   r8   r9   r:   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warningr7   docnamer:   )r$   rC   s     r%   rK   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.rE   rF   )rJ   rK   r   r@   r#   s    r%   filename_setzDocumenterBridge.filename_set=   s,    D.1	> 	> 	> 	>''r'   )r/   r0   r1   r2   r   r   r   r   intr   rB   r4   rK   propertyr   rP   r"   r'   r%   r6   r6   *   s        11, 8J U\ %(-1   F F F F F F (c ( ( ( X( ( (r'   r6   
documenterconfigr9   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
isinstancer4   AUTODOC_EXTENDABLE_OPTIONS
startswithjoingetlstripr   r   items)rS   rT   r9   namenegateds        r%   process_documenter_optionsrf   D   sF    ( : :z---kk%$,55=Gv555g57??z&2PQU2VX['\'\? 999"4=49Q9QRU9V9V4,/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;   rg   rS   nodes       r%   parse_generated_contentrp   ^   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.
    TrX   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: rH   r   )more_contentz[autodoc] output:
%s
) r;   rk   r8   get_source_and_liner:   AttributeErrorrL   debug
block_textrd   r7   appregistrydocumentersrf   rT   r9   KeyError
ValueError	TypeErrorerrorrN   r6   	argumentsgeneraterg   rA   r`   r@   settingsaddrp   )r$   r8   sourcer:   objtypedocclsdocumenter_optionsexcparamsrS   fnrA   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/   r0   r1   r2   r   rZ   has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacer   r   r   r"   r'   r%   rr   rr   o   sc         
 "/##KK $%T$Z % % % % % %r'   rr   )0rJ   typingr   r   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/   rL   rY   r^   dictr   r6   rf   rp   rr   r"   r'   r%   <module>r      sg    A A A A A A A A A A A A A A A A A A       ( ( ( ( ( ( ( ( 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'   