3

T'ícFVã@s
dZddlZddlZddlmZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZddlmZddlmZddlmZmZmZdd	lmZdd
lmZddlmZyddl m!Z!Wn e"k
rÜddl#m!Z!YnXdd
l$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+m,Z,m-Z-ddl.m/Z/m0Z0ddl1m2Z2ddl3m4Z4m5Z5m6Z6ddl7m8Z8ddl9m:Z:dd	l;mZ<ddl=m>Z>ddl?m@Z@ddlAmBZBddlCmDZDmEZEer¼ddlFmGZGddlHmIZIe@jJeKƒZLddiZMGdd„dƒZNd e'dd!œd"d#„ZOd eePe	fd$œd%d&„ZQdS)'zSphinx component registry.éN)Ú
import_module)Ú
MethodType)
Ú
TYPE_CHECKINGÚAnyÚCallableÚDictÚIteratorÚListÚOptionalÚTupleÚTypeÚUnion)Únodes)ÚInput)ÚElementÚNodeÚTextElement)ÚParser)Ú	Directive)Ú	Transform)Úentry_points)ÚBuilder)ÚConfig)ÚRemovedInSphinx60Warning)ÚDomainÚIndexÚObjType)Ú
GenericObjectÚTarget)ÚBuildEnvironment)ÚExtensionErrorÚSphinxErrorÚVersionRequirementError)Ú	Extension)Ú__)ÚXRefRole)Úlogging)Úprefixed_warnings)ÚRoleFunctionÚTitleGetter)ÚSphinx)Ú
Documenterzsphinxjp.themecorez1.2c@sreZdZddœdd„Zdneeeddœdd„Zd	edd
œdd„Z	d	eed
œd
d„Z
doeeeddœdd„Zeedœdd„Z
eeedœdd„Zdpeeeeeddœdd„Zdqeeeeefeddœdd„Zdreeeeddœdd „Zd!ddd!gdfeeeeeeeeedd"œ	d#d$„Zdseeeeeeedd%œd&d'„Zdteeedd(œd)d*„Zdueeedd+œd,d-„Z eeed.œd/d0„Z!e"eeefdœd1d2„Z#d	eed3œd4d5„Z$ee%ee&d.œd6d7„Z'dveee(j)edd8œd9d:„Z*ee+e,eefdd;œd<d=„Z-eee(j)d>œd?d@„Z.ee/e(j)dAœdBdC„Z0ee1ddDœdEdF„Z2eee1dœdGdH„Z3ee1ddDœdIdJ„Z4eee1dœdKdL„Z5eedMddNœdOdP„Z6eee/ee/ge/fddQœdRdS„Z7ee/ddTœdUdV„Z8ee/ddTœdWdX„Z9eedYœdZd[„Z:dweeedd\œd]d^„Z;dxee<ee=edd_œd`da„Z>ee,eefe,eefddbœdcdd„Z?eeddeœdfdg„Z@d	eddhœdidj„ZAd	e"eefdkœdldm„ZBdS)yÚSphinxComponentRegistryN)ÚreturncCs”i|_i|_i|_g|_i|_i|_i|_i|_i|_i|_	i|_
i|_d|_i|_
g|_g|_g|_g|_i|_i|_i|_i|_i|_g|_dS)NZper_page)Úautodoc_attrgettrsÚbuildersÚdocumentersÚ	css_filesÚdomainsÚdomain_directivesÚdomain_indicesÚdomain_object_typesÚdomain_rolesÚenumerable_nodesÚhtml_inline_math_renderersÚhtml_block_math_renderersZhtml_assets_policyÚhtml_themesÚjs_filesÚlatex_packagesÚlatex_packages_after_hyperrefÚpost_transformsÚsource_parsersÚ
source_inputsÚ
source_suffixÚtranslatorsÚtranslation_handlersÚ
transforms)Úself©rFú1/tmp/pip-build-gk9425m9/sphinx/sphinx/registry.pyÚ__init__3s0z SphinxComponentRegistry.__init__F)ÚbuilderÚoverrider-cCshtjd|ƒt|dƒs&ttdƒ|ƒ‚|j|jkrX|rXttdƒ|j|j|jjfƒ‚||j|j<dS)Nz[app] adding builder: %rÚnamez(Builder class %s has no "name" attributez(Builder %r already exists (in module %s))ÚloggerÚdebugÚhasattrr r$rKr/Ú
__module__)rErIrJrFrFrGÚadd_builder€s
z#SphinxComponentRegistry.add_builderr*)ÚapprKr-cCst|dkrdS||jkrptdd}y||}Wn4tk
r`}zttdƒ|ƒ|‚WYdd}~XnX|j||jƒdS)Nzsphinx.builders)Úgroupz?Builder name %s not registered or available through entry point)r/rÚKeyErrorr!r$Úload_extensionÚmodule)rErQrKZbuilder_entry_pointsZentry_pointÚexcrFrFrGÚpreload_builder‰s

z'SphinxComponentRegistry.preload_buildercCs(||jkrttdƒ|ƒ‚|j||ƒS)NzBuilder name %s not registered)r/r!r$)rErQrKrFrFrGÚcreate_builder—s
z&SphinxComponentRegistry.create_builder)ÚdomainrJr-cCs@tjd|ƒ|j|jkr0|r0ttdƒ|jƒ‚||j|j<dS)Nz[app] adding domain: %rzdomain %s already registered)rLrMrKr2r r$)rErYrJrFrFrGÚ
add_domainsz"SphinxComponentRegistry.add_domain)rYr-cCs
||jkS)N)r2)rErYrFrFrGÚ
has_domain£sz"SphinxComponentRegistry.has_domain)Úenvr-ccsœx–|jjƒD]ˆ}||ƒ}|jj|jj|jiƒƒ|jj|jj|jiƒƒ|j	j
|jj|jgƒƒx,|jj|jiƒj
ƒD]\}}|j||ƒqvW|VqWdS)N)r2ÚvaluesÚ
directivesÚupdater3ÚgetrKÚrolesr6ÚindicesÚextendr4r5ÚitemsÚadd_object_type)rEr\ZDomainClassrYrKÚobjtyperFrFrGÚcreate_domains¦sz&SphinxComponentRegistry.create_domains)rYrKÚclsrJr-cCshtjd|||fƒ||jkr,ttdƒ|ƒ‚|jj|iƒ}||kr\|r\ttdƒ||fƒ‚|||<dS)Nz$[app] adding directive to domain: %rzdomain %s not yet registeredz3The %r directive is already registered to domain %s)rLrMr2r r$r3Ú
setdefault)rErYrKrhrJr^rFrFrGÚadd_directive_to_domain³s
z/SphinxComponentRegistry.add_directive_to_domain)rYrKÚrolerJr-cCshtjd|||fƒ||jkr,ttdƒ|ƒ‚|jj|iƒ}||kr\|r\ttdƒ||fƒ‚|||<dS)Nz[app] adding role to domain: %rzdomain %s not yet registeredz.The %r role is already registered to domain %s)rLrMr2r r$r6ri)rErYrKrkrJrarFrFrGÚadd_role_to_domain¿s
z*SphinxComponentRegistry.add_role_to_domain)rYÚindexrJr-cCsjtjd||fƒ||jkr*ttdƒ|ƒ‚|jj|gƒ}||kr\|r\ttdƒ|j|fƒ‚|j|ƒdS)Nz [app] adding index to domain: %rzdomain %s not yet registeredz/The %r index is already registered to domain %s)	rLrMr2r r$r4rirKÚappend)rErYrmrJrbrFrFrGÚadd_index_to_domainËs
z+SphinxComponentRegistry.add_index_to_domainÚ)	Ú
directivenameÚrolenameÚ
indextemplateÚ
parse_nodeÚ
ref_nodeclassÚobjnameÚdoc_field_typesrJr-c		Csštjd|||||||fƒt|ttf|t|ƒ|dœƒ}	|jd||	ƒ|jd|t|dƒ|j	j
diƒ}
||
kr„|r„ttdƒ|ƒ‚t
|pŒ||ƒ|
|<dS)Nz[app] adding object type: %r)rsrtrwÚstd)Úinnernodeclassz(The %r object_type is already registered)rLrMÚtyperÚobjectÚstaticmethodrjrlr%r5rir r$r)rErqrrrsrtrurvrwrJÚ	directiveÚobject_typesrFrFrGreÖs
z'SphinxComponentRegistry.add_object_type)rqrrrsrurvrJr-c	CsŽtjd|||||fƒt|ttfd|iƒ}|jd||ƒ|jd|t|dƒ|jj	diƒ}||krx|rxt
tdƒ|ƒ‚t|p€||ƒ||<dS)Nz[app] adding crossref type: %rrsrx)ryz*The %r crossref_type is already registered)
rLrMrzrr{rjrlr%r5rir r$r)	rErqrrrsrurvrJr}r~rFrFrGÚadd_crossref_typeîs
z)SphinxComponentRegistry.add_crossref_type)ÚsuffixÚfiletyperJr-cCs>tjd||ƒ||jkr0|r0ttdƒ|ƒ‚n
||j|<dS)Nz"[app] adding source_suffix: %r, %rz&source_suffix %r is already registered)rLrMrAr r$)rEr€rrJrFrFrGÚadd_source_suffixsz)SphinxComponentRegistry.add_source_suffix)ÚparserrJr-cCsLtjd|ƒx:|jD]0}||jkr:|r:ttdƒ|ƒ‚q||j|<qWdS)Nz%[app] adding search source_parser: %rz*source_parser for %r is already registered)rLrMÚ	supportedr?r r$)rErƒrJrrFrFrGÚadd_source_parser	s
z)SphinxComponentRegistry.add_source_parser)rr-cCsDy
|j|Stk
r>}zttdƒ|ƒ|‚WYdd}~XnXdS)Nz#Source parser for %s not registered)r?rSr!r$)rErrVrFrFrGÚget_source_parsers
z)SphinxComponentRegistry.get_source_parsercCs|jS)N)r?)rErFrFrGÚget_source_parserssz*SphinxComponentRegistry.get_source_parsers)rQÚfilenamer-cCs(|j|ƒ}|ƒ}t|tƒr$|j|ƒ|S)N)r†Ú
isinstanceÚSphinxParserZset_application)rErQrˆÚparser_classrƒrFrFrGÚcreate_source_parsers



z,SphinxComponentRegistry.create_source_parsercCsPtjdtƒy
|j|Stk
rJy
|jdStk
rDdSXYnXdS)Nz9SphinxComponentRegistry.get_source_input() is deprecated.Ú*)ÚwarningsÚwarnrr@rS)rErrFrFrGÚget_source_input$s

z(SphinxComponentRegistry.get_source_input)rKÚ
translatorrJr-cCs:tjd|ƒ||jkr,|r,ttdƒ|ƒ‚||j|<dS)Nz.[app] Change of translator for the %s builder.z Translator for %r already exists)rLrMrBr r$)rErKr‘rJrFrFrGÚadd_translator1sz&SphinxComponentRegistry.add_translator)ÚnodeÚkwargsr-c	KsŠtjd||ƒxv|jƒD]j\}}|jj|iƒ}y|\}}||f||j<Wqtk
r€}zttdƒ||fƒ|‚WYdd}~XqXqWdS)Nz)[app] adding translation_handlers: %r, %rzEkwargs for add_node() must be a (visit, depart) function tuple: %r=%r)	rLrMrdrCriÚ__name__Ú
ValueErrorr r$)	rEr“r”Zbuilder_nameÚhandlersrCÚvisitÚdepartrVrFrFrGÚadd_translation_handlers8s
z0SphinxComponentRegistry.add_translation_handlers)rIr-cCs|jj|j|jƒS)N)rBr`rKZdefault_translator_class)rErIrFrFrGÚget_translator_classFs
z,SphinxComponentRegistry.get_translator_class)rIÚargsr-c	Gsš|j|ƒ}|std|jƒ‚||Ž}|jj|jdƒ}|dkrL|jj|jiƒ}xH|jƒD]<\}\}}t|d|t||ƒƒ|rVt|d|t||ƒƒqVW|S)Nztranslator not found for %sÚvisit_Zdepart_)	r›ÚAssertionErrorrKrCr`ÚformatrdÚsetattrr)	rErIrœZtranslator_classr‘r—rKr˜r™rFrFrGÚcreate_translatorJs
z)SphinxComponentRegistry.create_translator)Ú	transformr-cCstjd|ƒ|jj|ƒdS)Nz[app] adding transform: %r)rLrMrDrn)rEr¢rFrFrGÚ
add_transform\sz%SphinxComponentRegistry.add_transformcCs|jS)N)rD)rErFrFrGÚget_transforms`sz&SphinxComponentRegistry.get_transformscCstjd|ƒ|jj|ƒdS)Nz[app] adding post transform: %r)rLrMr>rn)rEr¢rFrFrGÚadd_post_transformcsz*SphinxComponentRegistry.add_post_transformcCs|jS)N)r>)rErFrFrGÚget_post_transformsgsz+SphinxComponentRegistry.get_post_transformsr+)rfÚ
documenterr-cCs||j|<dS)N)r0)rErfr§rFrFrGÚadd_documenterjsz&SphinxComponentRegistry.add_documenter)ÚtypÚ
attrgetterr-cCs||j|<dS)N)r.)rEr©rªrFrFrGÚadd_autodoc_attrgettermsz.SphinxComponentRegistry.add_autodoc_attrgetter)rˆÚ
attributesr-cKs|jj||fƒdS)N)r1rn)rErˆr¬rFrFrGÚ
add_css_filesqsz%SphinxComponentRegistry.add_css_filescKs"tjd||ƒ|jj||fƒdS)Nz[app] adding js_file: %r, %r)rLrMr;rn)rErˆr¬rFrFrGÚadd_js_filetsz#SphinxComponentRegistry.add_js_file)rKr-cs"|j|j}t‡fdd„|DƒƒS)Ncsg|]}|dˆkr|‘qS)rrF)Ú.0Úx)rKrFrGú
<listcomp>zsz=SphinxComponentRegistry.has_latex_package.<locals>.<listcomp>)r<r=Úbool)rErKÚpackagesrF)rKrGÚhas_latex_packagexsz)SphinxComponentRegistry.has_latex_package)rKÚoptionsÚafter_hyperrefr-cCsN|j|ƒrtjd|ƒtjd|ƒ|r:|jj||fƒn|jj||fƒdS)Nz#latex package '%s' already includedz[app] adding latex package: %r)r´rLrrMr=rnr<)rErKrµr¶rFrFrGÚadd_latex_package|s
z)SphinxComponentRegistry.add_latex_package)r“ÚfigtypeÚtitle_getterrJr-cCsBtjd|||ƒ||jkr0|r0ttdƒ|ƒ‚||f|j|<dS)Nz*[app] adding enumerable node: (%r, %r, %r)z%enumerable_node %r already registered)rLrMr7r r$)rEr“r¸r¹rJrFrFrGÚadd_enumerable_node†sz+SphinxComponentRegistry.add_enumerable_node)rKÚinline_renderersÚblock_renderersr-cCsBtjd|||ƒ||jkr*ttdƒ|ƒ‚||j|<||j|<dS)Nz+[app] adding html_math_renderer: %s, %r, %rz&math renderer %s is already registered)rLrMr8r r$r9)rErKr»r¼rFrFrGÚadd_html_math_renderers


z.SphinxComponentRegistry.add_html_math_renderer)rKÚ
theme_pathr-cCs||j|<dS)N)r:)rErKr¾rFrFrGÚadd_html_theme˜sz&SphinxComponentRegistry.add_html_theme)rQÚextnamer-c&Csf||jkrdS|tkr0tjtdƒ|t|ƒdStdƒ|}t|ƒyt|ƒ}WnLtk
r }z0tjtdƒt	j
ƒƒttdƒ||ƒ|‚WYdd}~XnXt|ddƒ}|dkrÌtjtdƒ|ƒi}nHy||ƒ}Wn:t
k
r}zt
tdƒ||fƒ|‚WYdd}~XnX|dkr$i}n t|tƒsDtjtd	ƒ|ƒi}t||f|Ž|j|<WdQRXdS)
zLoad a Sphinx extension.Nz\the extension %r was already merged with Sphinx since version %s; this extension is ignored.zwhile setting up extension %s:zOriginal exception:
zCould not import extension %sÚsetupzMextension %r has no setup() function; is it really a Sphinx extension module?zpThe %s extension used by this project needs at least Sphinx v%s; it therefore cannot be built with this version.zuextension %r returned an unsupported object from its setup() function; it should return None or a metadata dictionary)Ú
extensionsÚEXTENSION_BLACKLISTrLÚwarningr$r'rÚImportErrorÚverboseÚ	tracebackÚ
format_excr Úgetattrr"r‰Údictr#)rErQrÀÚprefixÚmodÚerrrÁÚmetadatarFrFrGrT›sB





z&SphinxComponentRegistry.load_extension)rQr-cCs,ddlm}dd„|jjƒDƒ}||d<|S)Nr)ÚENV_VERSIONcSs&i|]}|jjdƒr|jd|j“qS)Zenv_version)rÎr`rK)r¯ÚextrFrFrGú
<dictcomp>Ësz:SphinxComponentRegistry.get_envversion.<locals>.<dictcomp>Zsphinx)Úsphinx.environmentrÏrÂr])rErQrÏZ
envversionrFrFrGÚget_envversionÉsz&SphinxComponentRegistry.get_envversion)F)F)F)F)F)rpNrpF)F)F)F)F)NF)Cr•rOÚ__qualname__rHrrr²rPÚstrrWrXrrZr[rrrgrrjr
r(r%rlrrorrr	rerr‚rr…r†rr‡rŒr
rrrÚNodeVisitorr’rrršr›rr¡rr£r¤r¥r¦r¨r«r­r®r´r·rr)rºr½r¿rTrÓrFrFrFrGr,2s^M	
 

	.r,r*)rQÚconfigr-cCs`xN|jjjƒD]>\}}||jjkr0||jj|<q|jj|dkr||jj|<qW|jj|j_dS)zDMerge any user-specified source_suffix with any added by extensions.N)ÚregistryrArdr×)rQr×r€rrFrFrGÚmerge_source_suffixÑsrÙ)rQr-cCs|jdtddddddœS)Nz
config-initedi )ÚpriorityÚbuiltinT)ÚversionZparallel_read_safeZparallel_write_safe)ÚconnectrÙ)rQrFrFrGrÁßsrÁ)RÚ__doc__rÇrŽÚ	importlibrÚtypesrÚtypingrrrrrr	r
rrr
ZdocutilsrZdocutils.iorZdocutils.nodesrrrZdocutils.parsersrZdocutils.parsers.rstrZdocutils.transformsrZimportlib_metadatarrÅZimportlib.metadataZsphinx.buildersrZ
sphinx.configrZsphinx.deprecationrZsphinx.domainsrrrZsphinx.domains.stdrrrÒrZ
sphinx.errorsr r!r"Zsphinx.extensionr#Z
sphinx.localer$Zsphinx.parsersrŠZsphinx.rolesr%Zsphinx.utilr&Zsphinx.util.loggingr'Zsphinx.util.typingr(r)Zsphinx.applicationr*Zsphinx.ext.autodocr+Ú	getLoggerr•rLrÃr,rÙrÕrÁrFrFrFrGÚ<module>sP0
"