
    Few                    H   d dl mZ d dlmZ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mZ d dlmZ d dlmZmZ d d	lmZ er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"g dZ#g dZ$ G d de%      Z& G d d      Z'	 	 ddZ(	 	 ddZ) G d de      Z*y)    )annotations)TYPE_CHECKINGAnyCallable)nodes)
StringList)Reporterassemble_option_dict)
DocumenterOptions)logging)SphinxDirectiveswitch_source_input)nested_parse_with_titles)ElementNode)RSTState)Config)BuildEnvironment)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dZddZy)DummyOptionSpecz"An option_spec allows any options.c                     y)z&Behaves like some options are defined.T )selfs    >/usr/lib/python3/dist-packages/sphinx/ext/autodoc/directive.py__bool__zDummyOptionSpec.__bool__%   s        c                    d S )Nc                    | S Nr   )xs    r   <lambda>z-DummyOptionSpec.__getitem__.<locals>.<lambda>*   s     r!   r   )r   keys     r   __getitem__zDummyOptionSpec.__getitem__)   s    r!   N)returnbool)r'   strr)   zCallable[[str], str])__name__
__module____qualname____doc__r    r(   r   r!   r   r   r   "   s    ,r!   r   c                  $    e Zd ZdZ	 	 	 	 	 	 ddZy)DocumenterBridgez'A parameters container for Documenters.c                    || _         || _        || _        || _        t	               | _        t               | _        || _        y r$   )	env	_reportergenoptlinenosetrecord_dependenciesr   resultstate)r   r3   reporteroptionsr6   r:   s         r   __init__zDocumenterBridge.__init__0   s8    !-0U  l
r!   N)r3   r   r;   zReporter | Noner<   r   r6   intr:   r   r)   None)r,   r-   r.   r/   r=   r   r!   r   r1   r1   -   s"    1%(-1r!   r1   c                4   t         D ]  }|| j                  vr|j                  d|z   d      du }||j                  v r|s||v rkt	        |j                  |   t
              rN|t        v sc||   i||   j                  d      s~dj                  |j                  |   ||   dd g      ||<   |j                  |   ||<   |j                  |      ||   j                  d      ||<    t        t        |j                         | j                              S )z0Recognize options of Documenter from user input.zno-TN+,   )AUTODOC_DEFAULT_OPTIONSoption_specpopautodoc_default_options
isinstancer+   AUTODOC_EXTENDABLE_OPTIONS
startswithjoingetlstripr   r
   items)
documenterconfigr<   namenegateds        r   process_documenter_optionsrS   ;   s"    ( 6z---++edlD1T96111'w:f.L.LT.RTW#X 55t}0WT]5M5Mc5R(+&2P2PQU2V29$-2C2E )F !' > >t D[[*#DM005GDM#6& '9O9OPQQr!   c                L   t        | |      5  |j                  r3t        j                         }| j                  |_        t        | ||       n8t        j                         }| j                  |_        | j                  |d|       |j                  cddd       S # 1 sw Y   yxY w)z1Parse an item of content generated by Documenter.r   N)	r   titles_allowedr   sectiondocumentr   	paragraphnested_parsechildren)r:   contentrO   nodes       r   parse_generated_contentr]   T   s~     
UG	, $$!MMOD!NNDM$UGT:??$D!NNDMw40}}  s   BBB#c                  6    e Zd ZdZ e       ZdZdZdZdZ	ddZ
y)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.
    TrC   r   c                h   | j                   j                  j                  }	 |j                  | j                        \  }}t        j                  d||| j                         | j                  dd  }| j                  j                  j                  j                  |   }	 t        || j                  | j                         }t-        | j                  |||| j                         } ||| j.                  d         }	|	j1                  | j2                         |j4                  sg S t        j                  d	d
j7                  |j4                               |j8                  D ];  }
| j                   j                  j:                  j8                  j=                  |
       = t?        | j                   |j4                  |	      }|S # t
        $ r	 d\  }}Y w xY w# t"        t$        t&        f$ rI}t        j)                  d| j                  d|| j                  j*                  |f       g cY d }~S d }~ww xY w)N)NNz[autodoc] %s:%s: input:
%s   zAn option to z, is either unknown or has an invalid value: )locationr   )more_contentz[autodoc] output:
%s
) r:   rW   r;   get_source_and_liner6   AttributeErrorloggerdebug
block_textrQ   r3   appregistrydocumentersrS   rP   r<   KeyError
ValueError	TypeErrorerrordocnamer1   	argumentsgenerater[   r9   rK   r8   settingsaddr]   )r   r;   sourcer6   objtypedocclsdocumenter_optionsexcparamsrO   fnr9   s               r   runzAutodocDirective.runq   s   ::&&//	*%99NFF 	2FFDOOT ))AB-&&227;	!;FDKKQUQ]Q]!^ "$((H6H&RVR\R\]FDNN1$56
6}}I,dii.FG ,, 	EBJJ((<<@@D	E )V]]JOA  	*)NFF	* *i0 	LL))S*59XX5E5Ev4N  PI		s/   F? !G ?GGH1(>H,&H1,H1N)r)   
list[Node])r,   r-   r.   r/   r   rE   has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacer}   r   r!   r   r_   r_   e   s-    
 "#KK $&r!   r_   N)rO   ztype[Documenter]rP   r   r<   dictr)   r   )r:   r   r[   r   rO   r   r)   r~   )+
__future__r   typingr   r   r   docutilsr   docutils.statemachiner   docutils.utilsr	   r
   sphinx.ext.autodocr   r   sphinx.utilr   sphinx.util.docutilsr   r   sphinx.util.nodesr   docutils.nodesr   r   docutils.parsers.rst.statesr   sphinx.configr   sphinx.environmentr   	getLoggerr,   rg   rD   rI   r   r   r1   rS   r]   r_   r   r!   r   <module>r      s    " / /  , 9 2  E 6,4$3			8	$M 
1 d  R$+R2!+"2 2r!   