o +a\@s`dZddlZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddl m Z m Z mZmZmZmZmZmZmZmZddlmZddlmZmZdd lmZdd lmZmZdd l m!Z!dd l"m#Z#ddl$Z$dd l$m%Z%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3m4Z4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;ddlm?Z?ddl@mAZAddlBmCZCddlDmEZEddlFmZmGZGmHZHddlImJZJddlKmLZLddlMmNZNdd lOmPZPdd!lQmRZRmSZSmTZTdd"lUmVZVdd#lWmXZXmYZYe rdd$lmZZZdd%l[m\Z\d&Z]d'Z^eG_e`ZaGd(d)d)ZbGd*d+d+ZcdS),a sphinx.application ~~~~~~~~~~~~~~~~~~ Sphinx application class and extensibility interface. Gracefully adapted from the TextPress system by Armin. :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. N)deque)StringIO)path) IO TYPE_CHECKINGAnyCallableDictListOptionalTupleTypeUnion)nodes)Element TextElement)Parser) Directiveroles) Transform)Lexer)locale package_dir)Config)RemovedInSphinx60Warning)DomainIndex)BuildEnvironment)EnvironmentCollector)ApplicationError ConfigErrorVersionRequirementError) EventManager) Extension) lexer_classes)__)Project)SphinxComponentRegistry)XRefRole)Theme)docutilsloggingprogress_message) BuildPhase)bold)CatalogRepository)prefixed_warnings)abspath ensuredirrelpath)Tags) RoleFunction TitleGetter)Node)Builder)0zsphinx.addnodeszsphinx.builders.changeszsphinx.builders.epub3zsphinx.builders.dirhtmlzsphinx.builders.dummyzsphinx.builders.gettextzsphinx.builders.htmlzsphinx.builders.latexzsphinx.builders.linkcheckzsphinx.builders.manpagezsphinx.builders.singlehtmlzsphinx.builders.texinfozsphinx.builders.textzsphinx.builders.xmlz sphinx.configzsphinx.domains.czsphinx.domains.changesetzsphinx.domains.citationzsphinx.domains.cppzsphinx.domains.indexzsphinx.domains.javascriptzsphinx.domains.mathzsphinx.domains.pythonzsphinx.domains.rstzsphinx.domains.stdzsphinx.directiveszsphinx.directives.codezsphinx.directives.otherzsphinx.directives.patcheszsphinx.extensionzsphinx.parserszsphinx.registryz sphinx.roleszsphinx.transformsz%sphinx.transforms.compact_bullet_listzsphinx.transforms.i18nzsphinx.transforms.referencesz!sphinx.transforms.post_transformsz&sphinx.transforms.post_transforms.codez(sphinx.transforms.post_transforms.imageszsphinx.util.compatzsphinx.versioningz*sphinx.environment.collectors.dependenciesz#sphinx.environment.collectors.assetz&sphinx.environment.collectors.metadataz#sphinx.environment.collectors.titlez%sphinx.environment.collectors.toctree alabasterzenvironment.picklec@seZdZUdZeed<eed<dejej ddddddf de de e d e d e d e d e d e de dededee dedededdfddZdddZdeddfddZde ddfddZde ddfdd Zdd!d"Zdd#ed$ee ddfd%d&Zd'e ddfd(d)Zd*e ddfd+d,Zdd.e d/ed0edefd1d2Zd3eddfd4d5Zd6d7d.e d8ed9eeed:fdefd;d<Zd6d7d.e d8ed9eeed:fdefd=d>Z dd?edd@eddfdAdBZ! 6dde dCedDe"ee fdEeddf dFdGZ#de ddfdHdIZ$ dde dJee%j&d@eddfdKdLZ'ddMee(d@edNeee efddfdOdPZ) ddMee(dQe dRe*d@edNeeefddf dSdTZ+dde dUee,d@eddfdVdWZ-dde dXed@eddfdYdZZ.dde d[ed@eddfd\d]Z/dd^ee0d@eddfd_d`Z1 dd^e de dUee,d@eddf dadbZ2 dd^e de dXe"e3e4fd@eddf dcddZ5dd^e deee6d@eddfdfdgZ7dhdddhgdfdie dje dke dledmee8dne doed@eddfdpdqZ9 h h ddie dje dke dmee8dne d@eddfdrdsZ:dtee;ddfdudvZddye d0edNeddfd|d}Z?ddye d~ede ddfddZ@  dde de deddfddZAde deeBddfddZCddUed@eddfddZDdedeee egefddfddZEdUeddfddZFdde de d@eddfddZGddeeHd@eddfddZIdeeJddfddZKde de ddfddZL  dde deeefdeeefddfddZMde de ddfddZNde defddZOddZPeQde e e ffddZRdS)SphinxaThe main application class and extensibility interface. :ivar srcdir: Directory containing source. :ivar confdir: Directory containing ``conf.py``. :ivar doctreedir: Directory for storing pickled doctrees. :ivar outdir: Directory for storing build documents. warningiserror _warncountNFrsrcdirconfdiroutdir doctreedir buildername confoverridesstatuswarningfreshenvtags verbosityparallel keep_goingreturncCsHtj|_| |_i|_d|_d|_d|_t|_ t ||_ t ||_ t ||_ t|j s5ttd|j t|j rJt|j sJttd|j |j |j krVttd| |_|duret|_d|_n||_d|_|durtt|_n||_d|_| o}||_|jrd|_n| |_t||j|jt||_tdd|_ t!"t#td t$j%t&j'd krt()d kr| d krt!"t#td d|_*t+| |_,|dur|j |_-t.i|pi|_/nt ||_-t.0|j-|pi|j,|_/|j/1|2|j/j3r |j/j3t$j%kr t4td|j/j3t5D]}|6|q |j/jD]}|6|q|7|t|sIt8td t9|Wdn 1sDwY|j/jr}tdd}t:|t;|j/jrg|j/|ntd|j/t?|j |j/j@|_|A||_|B| |CdS)Nz!Cannot find source directory (%s)z(Output directory (%s) is not a directoryz>Source directory and destination directory cannot be identicalTFr )maxlenzRunning Sphinx v%s)DarwinzFor security reasons, parallel mode is disabled on macOS and python3.8 and above. For more details, please read https://github.com/sphinx-doc/sphinx/issues/6803zWThis project needs at least Sphinx v%s and therefore cannot be built with this version.zmaking output directoryzwhile setting up extension %s:zconf.pyz'setup' as currently defined in conf.py isn't a Python callable. Please modify its definition to make it a callable function. This is needed for conf.py to behave as a Sphinx extension.z config-inited)Dr-INITIALIZATIONphaserG extensionsbuilderenvprojectr'registryr1r=r?r@risdirrr%existsrHr_statusquiet_warningr<rIr;r+setupr"eventsr messagelogloggerinfor.sphinx__display_version__sys version_infoplatformsystem statuscoder4rFr>rconfigreadpre_init_values _init_i18n needs_sphinxr!builtin_extensionssetup_extensionpreload_builderr,r2r0callabler init_valuesemitr& source_suffixcreate_builder _init_env _init_builder)selfr=r>r?r@rArBrCrDrEr;rFrGrHrI extensionprefixr{4/usr/lib/python3/dist-packages/sphinx/application.py__init__s                        zSphinx.__init__cCs|jjdurtgd\|_}dStjttd|jjddt |j |jj |jj|jj }|j D]}|jdkrF|rF||jj|jjq1t|j }|dg7}|ttdg7}t||jj\|_}|sm|jjdkrvttddSttd dS) zhLoad translated strings from the configured localedirs if enabled in the configuration. Nzloading translations [%s]... T)nonlrbrendonez#not available for built-in messages)rilanguagerinit translatorr`rar.r%r/r= locale_dirssource_encodingcatalogsdomain is_outdatedwrite_mo gettext_allow_fuzzy_translationslistrjoinr)rxhas_translationrepocatalogrr{r{r|rl s*       zSphinx._init_i18nc Cs t|jt}|stj|st||_|j|j |j dSzEt t d4t |d}t||_|j|Wdn1sCwYWdWdSWdWdS1s]wYWdSty}ztt d||jddWYd}~dSd}~ww)Nzloading pickled environmentrbz failed: %sT)rE)rrr@ENV_PICKLE_FILENAMEosrYrrU find_filesrirTr,r%openpickleloadr] Exceptionr`rarv)rxrEfilenameferrr{r{r|rv's$   &zSphinx._init_envnamecCs|j||dS)N)rWrprxrr{r{r|rp6szSphinx.preload_builderr8cCs(|dur ttdd}|j||S)Nz(No builder selected, using default: htmlhtml)r`rar%rWrurr{r{r|ru9szSphinx.create_buildercCs(|j|j|j|jddS)Nzbuilder-inited)rTset_environmentrUrr^rsrxr{r{r|rw@s zSphinx._init_builder force_all filenamesc Cstj|_z|r|j|jn|r!|j||j|n |j|j |j r4|j r4d|_ |j dkr=t dnt d}|j rq|jrV|j dkrQt d}nt d}n|j dkr`t d}nt d}tt|||j fn ttt d ||j dkr|jjrtd t|jjt|j|jjd Wn%ty}zt|jt}t|rt||j d |d}~ww|j d d|j!dS) NrPr succeededzfinished with problemsz7build %s, %s warning (with warnings treated as errors).z8build %s, %s warnings (with warnings treated as errors).zbuild %s, %s warning.zbuild %s, %s warnings.z build %s.)r?rVzbuild-finished)"r-READINGrRrTcompile_all_catalogs build_allcompile_specific_catalogsbuild_specificcompile_update_catalogs build_updater<rIrhr%r;r`rar.epilogr3r?rirVrrrr@risfilerunlinkr^rscleanup)rxrrrCmsgrenvfiler{r{r|buildGsT                z Sphinx.buildextnamecCstd||j||dS)zImport and setup a Sphinx extension module. Load the extension given by the module *name*. Use this if your extension needs the features provided by another extension. No-op if called twice. z[app] setting up extension: %rN)r`debugrWload_extension)rxrr{r{r|ro|s zSphinx.setup_extensionversioncCs|tjddkr t|dS)aCheck the Sphinx version if requested. Compare *version* with the version of the running Sphinx, and abort the build when it is too old. :param version: The required version in the form of ``major.minor``. .. versionadded:: 1.0 NrM)rbrcr!)rxrr{r{r|require_sphinxs zSphinx.require_sphinxeventcallbackprioritycCs&|j|||}td|||||S)a?Register *callback* to be called when *event* is emitted. For details on available core events and the arguments of callback functions, please see :ref:`events`. :param event: The name of target event :param callback: Callback function for the event :param priority: The priority of the callback. The callbacks will be invoked in order of *priority* (ascending). :return: A listener ID. It can be used for :meth:`disconnect`. .. versionchanged:: 3.0 Support *priority* z*[app] connecting event %r (%d): %r [id=%s])r^connectr`r)rxrrr listener_idr{r{r|rs zSphinx.connectrcCtd||j|dS)zvUnregister callback by *listener_id*. :param listener_id: A listener_id that :meth:`connect` returns z"[app] disconnecting event: [id=%s]N)r`rr^ disconnect)rxrr{r{r|rs zSphinx.disconnectr{)allowed_exceptionsargsr.cG|jj|g|Rd|iS)aEmit *event* and pass *arguments* to the callback functions. Return the return values of all callbacks as a list. Do not emit core Sphinx events in extensions! :param event: The name of event that will be emitted :param args: The arguments for the event :param allowed_exceptions: The list of exceptions that are allowed in the callbacks .. versionchanged:: 3.1 Added *allowed_exceptions* to specify path-through exceptions r)r^rsrxrrrr{r{r|rssz Sphinx.emitcGr)aEmit *event* and pass *arguments* to the callback functions. Return the result of the first callback that doesn't return ``None``. :param event: The name of event that will be emitted :param args: The arguments for the event :param allowed_exceptions: The list of exceptions that are allowed in the callbacks .. versionadded:: 0.5 .. versionchanged:: 3.1 Added *allowed_exceptions* to specify path-through exceptions r)r^emit_firstresultrr{r{r|rszSphinx.emit_firstresultrToverridecC|jj||ddS)a#Register a new builder. :param builder: A builder class :param override: If true, install the builder forcedly even if another builder is already installed as the same name .. versionchanged:: 1.8 Add *override* keyword. rN)rW add_builder)rxrTrr{r{r|rs zSphinx.add_builderdefaultrebuildtypescCs>td||||f|dvr|rdnd}|j||||dS)agRegister a configuration value. This is necessary for Sphinx to recognize new values and set default values accordingly. :param name: The name of the configuration value. It is recommended to be prefixed with the extension name (ex. ``html_logo``, ``epub_title``) :param default: The default value of the configuration. :param rebuild: The condition of rebuild. It must be one of those values: * ``'env'`` if a change in the setting only takes effect when a document is parsed -- this means that the whole environment must be rebuilt. * ``'html'`` if a change in the setting needs a full rebuild of HTML documents. * ``''`` if a change in the setting will not need any special rebuild. :param types: The type of configuration value. A list of types can be specified. For example, ``[str]`` is used to describe a configuration that takes string value. .. versionchanged:: 0.4 If the *default* value is a callable, it will be called with the config object as its argument in order to get the default value. This can be used to implement config values whose default depends on other values. .. versionchanged:: 0.6 Changed *rebuild* from a simple boolean (equivalent to ``''`` or ``'env'``) to a string. However, booleans are still accepted and converted internally. z[app] adding config value: %r)FTrUrN)r`rriadd)rxrrrrr{r{r|add_config_values" zSphinx.add_config_valuecCr)zRegister an event called *name*. This is needed to be able to emit it. :param name: The name of the event z[app] adding event: %rN)r`rr^rrr{r{r| add_event  zSphinx.add_eventtranslator_classcC|jj|||ddS)aRegister or override a Docutils translator class. This is used to register a custom output translator or to replace a builtin translator. This allows extensions to use a custom translator and define custom nodes for the translator (see :meth:`add_node`). :param name: The name of the builder for the translator :param translator_class: A translator class :param override: If true, install the translator forcedly even if another translator is already installed as the same name .. versionadded:: 1.3 .. versionchanged:: 1.8 Add *override* keyword. rN)rWadd_translator)rxrrrr{r{r|set_translatorszSphinx.set_translatornodekwargscKsXtd||f|st|rtjtd|jdddt||jj |fi|dS)aRegister a Docutils node class. This is necessary for Docutils internals. It may also be used in the future to validate nodes in the parsed documents. :param node: A node class :param kwargs: Visitor functions for each builder (see below) :param override: If true, install the node forcedly even if another node is already installed as the same name Node visitor functions for the Sphinx HTML, LaTeX, text and manpage writers can be given as keyword arguments: the keyword should be one or more of ``'html'``, ``'latex'``, ``'text'``, ``'man'``, ``'texinfo'`` or any other supported translators, the value a 2-tuple of ``(visit, depart)`` methods. ``depart`` can be ``None`` if the ``visit`` function raises :exc:`docutils.nodes.SkipNode`. Example: .. code-block:: python class math(docutils.nodes.Element): pass def visit_math_html(self, node): self.body.append(self.starttag(node, 'math')) def depart_math_html(self, node): self.body.append('') app.add_node(math, html=(visit_math_html, depart_math_html)) Obviously, translators for which you don't specify visitor methods will choke on the node when encountered in a document to translate. .. versionchanged:: 0.5 Added the support for keyword arguments giving visit functions. z[app] adding node: %rzDnode class %r is already registered, its visitors will be overriddenappadd_nodetypesubtypeN) r`rr*is_node_registeredrDr%__name__ register_noderWadd_translation_handlers)rxrrrr{r{r|r's$  zSphinx.add_nodefigtype title_gettercKs.|jj||||d|j|fd|i|dS)a_Register a Docutils node class as a numfig target. Sphinx numbers the node automatically. And then the users can refer it using :rst:role:`numref`. :param node: A node class :param figtype: The type of enumerable nodes. Each figtype has individual numbering sequences. As system figtypes, ``figure``, ``table`` and ``code-block`` are defined. It is possible to add custom nodes to these default figtypes. It is also possible to define new custom figtype if a new figtype is given. :param title_getter: A getter function to obtain the title of node. It takes an instance of the enumerable node, and it must return its title as string. The title is used to the default title of references for :rst:role:`ref`. By default, Sphinx searches ``docutils.nodes.caption`` or ``docutils.nodes.title`` from the node as a title. :param kwargs: Visitor functions for each builder (same as :meth:`add_node`) :param override: If true, install the node forcedly even if another node is already installed as the same name .. versionadded:: 1.4 rrN)rWadd_enumerable_noder)rxrrrrrr{r{r|rSszSphinx.add_enumerable_nodeclscCDtd||f|st|rtjtd|dddt||dS)a^Register a Docutils directive. :param name: The name of the directive :param cls: A directive class :param override: If true, install the directive forcedly even if another directive is already installed as the same name For example, a custom directive named ``my-directive`` would be added like this: .. code-block:: python from docutils.parsers.rst import Directive, directives class MyDirective(Directive): has_content = True required_arguments = 1 optional_arguments = 0 final_argument_whitespace = True option_spec = { 'class': directives.class_option, 'name': directives.unchanged, } def run(self): ... def setup(app): app.add_directive('my-directive', MyDirective) For more details, see `the Docutils docs `__ . .. versionchanged:: 0.6 Docutils 0.5-style directive classes are now supported. .. deprecated:: 1.8 Docutils 0.4-style (function based) directives support is deprecated. .. versionchanged:: 1.8 Add *override* keyword. z[app] adding directive: %rz9directive %r is already registered, it will be overriddenr add_directiverN)r`rr*is_directive_registeredrDr%register_directive)rxrrrr{r{r|rps ) zSphinx.add_directiverolecCr)aRegister a Docutils role. :param name: The name of role :param role: A role function :param override: If true, install the role forcedly even if another role is already installed as the same name For more details about role functions, see `the Docutils docs `__ . .. versionchanged:: 1.8 Add *override* keyword. z[app] adding role: %r4role %r is already registered, it will be overriddenradd_rolerN)r`rr*is_role_registeredrDr% register_role)rxrrrr{r{r|rs  zSphinx.add_role nodeclasscCsPtd||f|st|rtjtd|dddt||}t||dS)aRegister a generic Docutils role. Register a Docutils role that does nothing but wrap its contents in the node given by *nodeclass*. If *override* is True, the given *nodeclass* is forcedly installed even if a role named as *name* is already installed. .. versionadded:: 0.6 .. versionchanged:: 1.8 Add *override* keyword. z[app] adding generic role: %rrradd_generic_rolerN) r`rr*rrDr%r GenericRoler)rxrrrrr{r{r|rs  zSphinx.add_generic_rolercCr)a8Register a domain. :param domain: A domain class :param override: If true, install the domain forcedly even if another domain is already installed as the same name .. versionadded:: 1.0 .. versionchanged:: 1.8 Add *override* keyword. rN)rW add_domain)rxrrr{r{r|rs zSphinx.add_domaincC|jj||||ddS)aRegister a Docutils directive in a domain. Like :meth:`add_directive`, but the directive is added to the domain named *domain*. :param domain: The name of target domain :param name: A name of directive :param cls: A directive class :param override: If true, install the directive forcedly even if another directive is already installed as the same name .. versionadded:: 1.0 .. versionchanged:: 1.8 Add *override* keyword. rN)rWadd_directive_to_domain)rxrrrrr{r{r|rzSphinx.add_directive_to_domaincCr)aRegister a Docutils role in a domain. Like :meth:`add_role`, but the role is added to the domain named *domain*. :param domain: The name of the target domain :param name: The name of the role :param role: The role function :param override: If true, install the role forcedly even if another role is already installed as the same name .. versionadded:: 1.0 .. versionchanged:: 1.8 Add *override* keyword. rN)rWadd_role_to_domain)rxrrrrr{r{r|rrzSphinx.add_role_to_domainindexcCs|j||dS)aRegister a custom index for a domain. Add a custom *index* class to the domain named *domain*. :param domain: The name of the target domain :param index: The index class :param override: If true, install the index forcedly even if another index is already installed as the same name .. versionadded:: 1.0 .. versionchanged:: 1.8 Add *override* keyword. N)rWadd_index_to_domain)rxrrrr{r{r|rszSphinx.add_index_to_domainr directivenamerolename indextemplate parse_node ref_nodeclassobjnamedoc_field_typesc Cs |jj||||||||ddS)aX Register a new object type. This method is a very convenient way to add a new :term:`object` type that can be cross-referenced. It will do this: - Create a new directive (called *directivename*) for documenting an object. It will automatically add index entries if *indextemplate* is nonempty; if given, it must contain exactly one instance of ``%s``. See the example below for how the template will be interpreted. - Create a new role (called *rolename*) to cross-reference to these object descriptions. - If you provide *parse_node*, it must be a function that takes a string and a docutils node, and it must populate the node with children parsed from the string. It must then return the name of the item to be used in cross-referencing and index entries. See the :file:`conf.py` file in the source for this documentation for an example. - The *objname* (if not given, will default to *directivename*) names the type of object. It is used when listing objects, e.g. in search results. For example, if you have this call in a custom Sphinx extension:: app.add_object_type('directive', 'dir', 'pair: %s; directive') you can use this markup in your documents:: .. rst:directive:: function Document a function. <...> See also the :rst:dir:`function` directive. For the directive, an index entry will be generated as if you had prepended :: .. index:: pair: function; directive The reference node will be of class ``literal`` (so it will be rendered in a proportional font, as appropriate for code) unless you give the *ref_nodeclass* argument, which must be a docutils node class. Most useful are ``docutils.nodes.emphasis`` or ``docutils.nodes.strong`` -- you can also use ``docutils.nodes.generated`` if you want no further text decoration. If the text should be treated as literal (e.g. no smart quote replacement), but not have typewriter styling, use ``sphinx.addnodes.literal_emphasis`` or ``sphinx.addnodes.literal_strong``. For the role content, you have the same syntactical possibilities as for standard Sphinx roles (see :ref:`xref-syntax`). If *override* is True, the given object_type is forcedly installed even if an object_type having the same name is already installed. .. versionchanged:: 1.8 Add *override* keyword. rN)rWadd_object_type) rxrrrrrrrrr{r{r|rs? zSphinx.add_object_typecCs|jj||||||ddS)aRegister a new crossref object type. This method is very similar to :meth:`add_object_type` except that the directive it generates must be empty, and will produce no output. That means that you can add semantic targets to your sources, and refer to them using custom roles instead of generic ones (like :rst:role:`ref`). Example call:: app.add_crossref_type('topic', 'topic', 'single: %s', docutils.nodes.emphasis) Example usage:: .. topic:: application API The application API ------------------- Some random text here. See also :topic:`this section `. (Of course, the element following the ``topic`` directive needn't be a section.) If *override* is True, the given crossref_type is forcedly installed even if a crossref_type having the same name is already installed. .. versionchanged:: 1.8 Add *override* keyword. rN)rWadd_crossref_type)rxrrrrrrr{r{r|rQs # zSphinx.add_crossref_type transformcC|j|dS)a=Register a Docutils transform to be applied after parsing. Add the standard docutils :class:`Transform` subclass *transform* to the list of transforms that are applied after Sphinx parses a reST document. :param transform: A transform class .. list-table:: priority range categories for Sphinx transforms :widths: 20,80 * - Priority - Main purpose in Sphinx * - 0-99 - Fix invalid nodes by docutils. Translate a doctree. * - 100-299 - Preparation * - 300-399 - early * - 400-699 - main * - 700-799 - Post processing. Deadline to modify text and referencing. * - 800-899 - Collect referencing and referenced nodes. Domain processing. * - 900-999 - Finalize and clean up. refs: `Transform Priority Range Categories`__ __ https://docutils.sourceforge.io/docs/ref/transforms.html#transform-priority-range-categories N)rW add_transformrxrr{r{r|rxs!zSphinx.add_transformcCr)aRegister a Docutils transform to be applied before writing. Add the standard docutils :class:`Transform` subclass *transform* to the list of transforms that are applied before Sphinx writes a document. :param transform: A transform class N)rWadd_post_transformrr{r{r|rs zSphinx.add_post_transformrcKsD|jj|fd|i|t|jdr |jj|fd|i|dSdS)a>Register a JavaScript file to include in the HTML output. Add *filename* to the list of JavaScript files that the default HTML template will include in order of *priority* (ascending). The filename must be relative to the HTML static path , or a full URI with scheme. If the priority of the JavaScript file is the same as others, the JavaScript files will be included in order of registration. If the keyword argument ``body`` is given, its value will be added between the `` app.add_js_file('example.js', async="async") # => app.add_js_file(None, body="var myVariable = 'foo';") # => .. list-table:: priority range for JavaScript files :widths: 20,80 * - Priority - Main purpose in Sphinx * - 200 - default priority for built-in JavaScript files * - 500 - default priority for extensions * - 800 - default priority for :confval:`html_js_files` A JavaScript file can be added to the specific HTML page when an extension calls this method on :event:`html-page-context` event. .. versionadded:: 0.5 .. versionchanged:: 1.8 Renamed from ``app.add_javascript()``. And it allows keyword arguments as attributes of script tag. .. versionchanged:: 3.5 Take priority argument. Allow to add a JavaScript file to the specific page. r add_js_fileN)rWrhasattrrTrxrrrr{r{r|rs/ zSphinx.add_js_filecKsPtd||jj|fd|i|t|jdr&|jj|fd|i|dSdS)aRegister a stylesheet to include in the HTML output. Add *filename* to the list of CSS files that the default HTML template will include in order of *priority* (ascending). The filename must be relative to the HTML static path, or a full URI with scheme. If the priority of the CSS file is the same as others, the CSS files will be included in order of registration. The keyword arguments are also accepted for attributes of ```` tag. Example:: app.add_css_file('custom.css') # => app.add_css_file('print.css', media='print') # => app.add_css_file('fancy.css', rel='alternate stylesheet', title='fancy') # => .. list-table:: priority range for CSS files :widths: 20,80 * - Priority - Main purpose in Sphinx * - 200 - default priority for built-in CSS files * - 500 - default priority for extensions * - 800 - default priority for :confval:`html_css_files` A CSS file can be added to the specific HTML page when an extension calls this method on :event:`html-page-context` event. .. versionadded:: 1.0 .. versionchanged:: 1.6 Optional ``alternate`` and/or ``title`` attributes can be supplied with the arguments *alternate* (a Boolean) and *title* (a string). The default is no title and *alternate* = ``False``. For more information, refer to the `documentation `__. .. versionchanged:: 1.8 Renamed from ``app.add_stylesheet()``. And it allows keyword arguments as attributes of link tag. .. versionchanged:: 3.5 Take priority argument. Allow to add a CSS file to the specific page. zpp] adding stylesheet: %rr add_css_fileN)r`rrW add_css_filesrrTrrr{r{r|rs 6 zSphinx.add_css_file alternatetitlecCsFtdi}|rd|d<nd|d<|r||d<|j|fi|dS)zGAn alias of :meth:`add_css_file`. .. deprecated:: 1.8 zNThe app.add_stylesheet() is deprecated. Please use app.add_css_file() instead.zalternate stylesheetrel stylesheetr N)r`rDr)rxrrr  attributesr{r{r|add_stylesheets  zSphinx.add_stylesheet packagenameoptionsafter_hyperrefcC|j|||dS)aRegister a package to include in the LaTeX source code. Add *packagename* to the list of packages that LaTeX source code will include. If you provide *options*, it will be taken to the `\usepackage` declaration. If you set *after_hyperref* truthy, the package will be loaded after ``hyperref`` package. .. code-block:: python app.add_latex_package('mypackage') # => \usepackage{mypackage} app.add_latex_package('mypackage', 'foo,bar') # => \usepackage[foo,bar]{mypackage} .. versionadded:: 1.3 .. versionadded:: 3.1 *after_hyperref* option. N)rWadd_latex_package)rxrrrr{r{r|r(szSphinx.add_latex_packagealiaslexercCstd||f|t|<dS)a2Register a new lexer for source code. Use *lexer* to highlight code blocks with the given language *alias*. .. versionadded:: 0.6 .. versionchanged:: 2.1 Take a lexer class as an argument. An instance of lexers are still supported until Sphinx-3.x. z[app] adding lexer: %rN)r`rr$)rxrrr{r{r| add_lexer?s zSphinx.add_lexercCsBtd|ddlm}|j|j||jd|j||ddS)aRegister a new documenter class for the autodoc extension. Add *cls* as a new documenter class for the :mod:`sphinx.ext.autodoc` extension. It must be a subclass of :class:`sphinx.ext.autodoc.Documenter`. This allows auto-documenting new types of objects. See the source of the autodoc module for examples on how to subclass :class:`Documenter`. If *override* is True, the given *cls* is forcedly installed even if a documenter having the same name is already installed. See :ref:`autodoc_ext_tutorial`. .. versionadded:: 0.6 .. versionchanged:: 2.2 Add *override* keyword. z[app] adding autodocumenter: %rr)AutodocDirectiveautorN)r`rsphinx.ext.autodoc.directiverrWadd_documenterobjtyper)rxrrrr{r{r|add_autodocumenterLs  zSphinx.add_autodocumentertypgettercCs"td||f|j||dS)aRegister a new ``getattr``-like function for the autodoc extension. Add *getter*, which must be a function with an interface compatible to the :func:`getattr` builtin, as the autodoc attribute getter for objects that are instances of *typ*. All cases where autodoc needs to get an attribute of a type are then handled by this function instead of :func:`getattr`. .. versionadded:: 0.6 z#[app] adding autodoc attrgetter: %rN)r`rrWadd_autodoc_attrgetter)rxrrr{r{r|rcs zSphinx.add_autodoc_attrgettercCs8td|ddlm}m}t||sJ|||j<dS)aRegister a new language for the HTML search index. Add *cls*, which must be a subclass of :class:`sphinx.search.SearchLanguage`, as a support language for building the HTML full-text search index. The class must have a *lang* attribute that indicates the language it should be used for. See :confval:`html_search_language`. .. versionadded:: 1.1 z [app] adding search language: %rr)SearchLanguage languagesN)r`r sphinx.searchrr  issubclasslang)rxrrr r{r{r|add_search_languagers zSphinx.add_search_languagesuffixfiletypecCr)a3Register a suffix of source files. Same as :confval:`source_suffix`. The users can override this using the config setting. If *override* is True, the given *suffix* is forcedly installed even if the same suffix is already installed. .. versionadded:: 1.8 rN)rWadd_source_suffix)rxr%r&rr{r{r|r's zSphinx.add_source_suffixparsercCr)aRegister a parser class. If *override* is True, the given *parser* is forcedly installed even if a parser for the same suffix is already installed. .. versionadded:: 1.4 .. versionchanged:: 1.8 *suffix* argument is deprecated. It only accepts *parser* argument. Use :meth:`add_source_suffix` API to register suffix instead. .. versionchanged:: 1.8 Add *override* keyword. rN)rWadd_source_parser)rxr(rr{r{r|r)s zSphinx.add_source_parser collectorcCstd|||dS)zxRegister an environment collector class. Refer to :ref:`collector-api`. .. versionadded:: 1.6 z&[app] adding environment collector: %rN)r`renable)rxr*r{r{r|add_env_collectorrzSphinx.add_env_collector theme_pathcCs td|||j||dS)zRegister a HTML Theme. The *name* is a name of theme, and *theme_path* is a full path to the theme (refs: :ref:`distribute-your-theme`). .. versionadded:: 1.6 z[app] adding HTML theme: %r, %rN)r`rrWadd_html_theme)rxrr-r{r{r|r.szSphinx.add_html_themeinline_renderersblock_rendererscCr)aRegister a math renderer for HTML. The *name* is a name of math renderer. Both *inline_renderers* and *block_renderers* are used as visitor functions for the HTML writer: the former for inline math node (``nodes.math``), the latter for block math node (``nodes.math_block``). Regarding visitor functions, see :meth:`add_node` for details. .. versionadded:: 1.8 N)rWadd_html_math_renderer)rxrr/r0r{r{r|r1szSphinx.add_html_math_rendererr locale_dircCs$t|g|jj|t||dS)zRegister a message catalog. :param catalog: The name of the catalog :param locale_dir: The base path of the message catalog For more details, see :func:`sphinx.locale.get_translation()`. .. versionadded:: 1.8 N)rrrir init_console)rxrr2r{r{r|add_message_catalogs zSphinx.add_message_catalogcCs|dkrd}td}td}n|dkrd}td}td}ntd ||jD]2}t||d }|d urGt||jttd |d S|s[t||jttd |d Sq)d S)zCheck whether parallel processing is allowed or not. :param typ: A type of processing; ``'read'`` or ``'write'``. rjparallel_read_safezthe %s extension does not declare if it is safe for parallel reading, assuming it isn't - please ask the extension author to check and make it explicitz1the %s extension is not safe for parallel readingwriteparallel_write_safezthe %s extension does not declare if it is safe for parallel writing, assuming it isn't - please ask the extension author to check and make it explicitz1the %s extension is not safe for parallel writingz!parallel type %s is not supportedNzdoing serial %sFT)r% ValueErrorrSvaluesgetattrr`rDr)rxrattrnamemessage_not_declaredmessage_not_safeextallowedr{r{r|is_parallel_alloweds*    zSphinx.is_parallel_allowedcCs |dvr td|||j_dS)zSet the policy to include assets in HTML pages. - always: include the assets in all the pages - per_page: include the assets only in pages where they are used .. versionadded: 4.1 )alwaysper_pagezpolicy %s is not supportedN)r8rWhtml_assets_policy)rxpolicyr{r{r|set_html_assets_policys  zSphinx.set_html_assets_policycCstdt|jjS)Nzapp.html_themes is deprecated.)warningswarnrrW html_themesrr{r{r|rHszSphinx.html_themes)rJN)FN)r)F)r{)NF)rNrFNN)Sr __module__ __qualname____doc__bool__annotations__intrdstdoutstderrstrr r rr r}rlrvrprurwrrorrrrrr r rrsrrrrrr NodeVisitorrrrr6rrrrrrrrr5r(rrrrrrrrrrrr rrrrrr$r'rr)rr,r.r1r4r@rEpropertyrHr{r{r{r|r:xsT    5     '   -  0     C '# 3;           # r:c @sjeZdZdZddddedeeddfdd Zdefd d Z d ed e ddfddZ d ed e defddZ dS)TemplateBridgez This class defines the interface for a "template bridge", that is, a class that renders templates given a template name and a context. NrTr8themedirsrJcCtd)abCalled by the builder to initialize the template system. *builder* is the builder object; you'll probably want to look at the value of ``builder.config.templates_path``. *theme* is a :class:`sphinx.theming.Theme` object or None; in the latter case, *dirs* can be list of fixed directories to look for templates. !must be implemented in subclassesNotImplementedError)rxrTrVrWr{r{r|r s zTemplateBridge.initcCsdS)zCalled by the builder to determine if output files are outdated because of template changes. Return the mtime of the newest template file that was changed. The default implementation returns ``0``. rr{rr{r{r|newest_template_mtimesz$TemplateBridge.newest_template_mtimetemplatecontextcCrX)zCalled by the builder to render a template given as a filename with a specified context (a Python dictionary). rYrZrxr]r^r{r{r|renderzTemplateBridge.rendercCrX)z}Called by the builder to render a template given as a string with a specified context (a Python dictionary). rYrZr_r{r{r| render_string%razTemplateBridge.render_stringrI) rrJrKrLr)r rRrfloatr\r r`rbr{r{r{r|rUs   rU)drLrrrfrdrF collectionsriorrtypingrrrrr r r r r rr*rdocutils.nodesrrdocutils.parsersrdocutils.parsers.rstrrdocutils.transformsrpygments.lexerrrbrr sphinx.configrsphinx.deprecationrsphinx.domainsrrsphinx.environmentrsphinx.environment.collectorsr sphinx.errorsrr r! sphinx.eventsr"sphinx.extensionr#sphinx.highlightingr$ sphinx.localer%sphinx.projectr&sphinx.registryr' sphinx.rolesr(sphinx.themingr) sphinx.utilr+r,sphinx.util.build_phaser-sphinx.util.consoler.sphinx.util.i18nr/sphinx.util.loggingr0sphinx.util.osutilr1r2r3sphinx.util.tagsr4sphinx.util.typingr5r6r7sphinx.buildersr8rnr getLoggerrr`r:rUr{r{r{r|sr    0                       6