o $aI @sXdZddlZddlmZmZmZmZmZmZddl m Z ddl m Z m Z ddlmZddlmZddlmZmZdd lmZdd lmZmZdd lmZdd lmZmZdd lm Z ddl!m"Z"m#Z#ddl$m%Z%e &e'Z(gdZ)gdZ*Gddde+Z,GdddZ-deedededefddZ.dedededee fddZ/Gd d!d!e"Z0dS)"z sphinx.ext.autodoc.directive ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. N)AnyCallableDictListSetType)nodes)ElementNode)RSTState) StringList)Reporterassemble_option_dict)Config)RemovedInSphinx50WarningRemovedInSphinx60Warning)BuildEnvironment) DocumenterOptions)logging)SphinxDirectiveswitch_source_input)nested_parse_with_titles) membersz undoc-memberszinherited-memberszshow-inheritanceprivate-membersspecial-memberszignore-module-allexclude-membersz member-orderzimported-memberszclass-doc-from)rrrrc@s:eZdZdZdefddZdedeegeffddZdS) DummyOptionSpecz"An option_spec allows any options.returncCsdS)z&Behaves like some options are defined.Tselfrr>/usr/lib/python3/dist-packages/sphinx/ext/autodoc/directive.py__bool__*szDummyOptionSpec.__bool__keycCsddS)NcSs|SNr)xrrr"/sz-DummyOptionSpec.__getitem__..r)r!r$rrr" __getitem__.szDummyOptionSpec.__getitem__N) __name__ __module__ __qualname____doc__boolr#strrr(rrrr"r's rc @sheZdZdZdedededededdf d d Z d e ddfd d Z e de fddZe defddZdS)DocumenterBridgez'A parameters container for Documenters.envreporteroptionslinenostaterNcCs2||_||_||_||_t|_t|_||_dSr%) r0 _reportergenoptr3setrecord_dependenciesr resultr4)r!r0r1r2r3r4rrr"__init__5s zDocumenterBridge.__init__msgcCs,tjdtddtj||jj|jfddS)NzTDocumenterBridge.warn is deprecated. Please use sphinx.util.logging module instead. stacklevellocation)warningswarnrloggerwarningr0docnamer3)r!r;rrr"rB?szDocumenterBridge.warncCtjdtdd|jS)Nz,DocumenterBridge.filename_set is deprecated.r<r=)rArBrr8r rrr" filename_setEzDocumenterBridge.filename_setcCrF)Nz(DocumenterBridge.reporter is deprecated.r<r=)rArBrr5r rrr"r1KrHzDocumenterBridge.reporter)r)r*r+r,rr rintrr:r.rBpropertyrrGr1rrrr"r/2s  r/ documenterconfigr2rcCstD]a}||jvr q|d|ddu}||jvrS|sS||vrKt|j|trK|tvrJ||durJ||drJd|j|||ddg||<q|j|||<q| |durc|| d||<qt t | |jS)z0Recognize options of Documenter from user input.zno-TN+,)AUTODOC_DEFAULT_OPTIONS option_specpopautodoc_default_options isinstancer.AUTODOC_EXTENDABLE_OPTIONS startswithjoingetlstriprritems)rKrLr2namenegatedrrr"process_documenter_optionsRs"   r]r4contentcCsvt||,|jrt}|j|_t|||nt}|j|_||d||jWdS1s4wYdS)z1Parse an item of content generated by Documenter.rN) rtitles_allowedrsectiondocumentr paragraph nested_parsechildren)r4r^rKnoderrr"parse_generated_contentls $rfc@s8eZdZdZeZdZdZdZdZ de e fddZ dS) 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. TrOrrc CsP|jjj}z ||j\}}Wn tyd\}}Ynwtd|||j|j dd}|j j j j |}z t||j|j}Wn'tttfyf}ztjd|j |f|j j|fdgWYd}~Sd}~wwt|j ||||j}|||jd} | j|jd|jsgStdd |j|jD] } |jjjj| qt|j|j| } | S) N)NNz[autodoc] %s:%s: input: %sz=An option to %s is either unknown or has an invalid value: %sr?r) more_contentz[autodoc] output: %s ) r4rar1get_source_and_liner3AttributeErrorrCdebug block_textr[r0appregistry documentersr]rLr2KeyError ValueError TypeErrorerrorrEr/ argumentsgenerater^r9rWr8settingsaddrf) r!r1sourcer3objtypedocclsdocumenter_optionsexcparamsrKfnr9rrr"runs<     zAutodocDirective.runN) r)r*r+r,rrQ has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacerr rrrrr"rg}srg)1r,rAtypingrrrrrrdocutilsrdocutils.nodesr r docutils.parsers.rst.statesr docutils.statemachiner docutils.utilsr r sphinx.configrsphinx.deprecationrrsphinx.environmentrsphinx.ext.autodocrr sphinx.utilrsphinx.util.docutilsrrsphinx.util.nodesr getLoggerr)rCrPrUdictrr/r]rfrgrrrr"s6