3

T'íc!8ã@sÂddlZddlmZmZmZmZmZddlmZddl	m
Z
mZddlm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZddlmZmZddlmZmZmZdd
lm Z ddl!m"Z"m#Z#ddl$m%Z%ddl&m'Z'erðddl(m)Z)ej*dƒZ+ej,e-ƒZ.e/e0dœdd„Z1Gdd„de ƒZ2Gdd„de ƒZ3Gdd„deƒZ4Gdd„de ƒZ5Gdd„de ƒZ6Gd d!„d!e ƒZ7Gd"d#„d#e ƒZ8Gd$d%„d%e ƒZ9Gd&d'„d'ee ƒZd(ee/efd)œd*d+„Z:dS),éN)Ú
TYPE_CHECKINGÚAnyÚDictÚListÚcast)Únodes)ÚElementÚNode)Ú
directives)ÚBaseAdmonition)ÚClass)ÚInclude)Úaddnodes)Ú
VersionChange)Ú_Ú__)Údocname_joinÚloggingÚurl_re)ÚSphinxDirective)ÚMatcherÚ	patfilter)Úexplicit_title_re)Ú
OptionSpec)ÚSphinxz
.*[*?\[].*)ÚargumentÚreturncCs|sdSt|ƒS)Niç)Úint)r©rú9/tmp/pip-build-gk9425m9/sphinx/sphinx/directives/other.pyÚint_or_nothingsr c
@sneZdZdZdZdZdZdZee	j
e	je	je	je	je
e	je	jdœ	Zeedœdd„Zejeed	œd
d„ZdS)
ÚTocTreezœ
    Directive to notify Sphinx about the hierarchical structure of the docs,
    and to include a table-of-contents like tree in the current document.
    TrF)	ÚmaxdepthÚnameÚcaptionÚglobÚhiddenÚ
includehiddenÚnumberedÚ
titlesonlyÚreversed)rcCsÔtjƒ}|jj|d<g|d<g|d<|jjddƒ|d<|jjdƒ|d<d|jk|d<d|jk|d<d	|jk|d	<|jjd
dƒ|d
<d|jk|d<|j|ƒtjd
gd}|j	|ƒ|j
|ƒ|j|ƒ}|j	|ƒ|S)NÚparentÚentriesÚincludefilesr"ér$r%r&r'r(rr)ztoctree-wrapper)Úclasseséÿÿÿÿ)rÚtoctreeÚenvÚdocnameÚoptionsÚgetÚset_source_inforZcompoundÚappendZadd_nameÚ
parse_content)ÚselfÚsubnodeZwrappernodeÚretrrrÚrun7s$




zTocTree.run)r1rcCsZ|jj}|jjjƒ}|j|jjƒg}t|jjƒ}xì|j	D]à}|sHq<t
j|ƒ}|drätj|ƒrä|rät
j|ƒrät|jj|ƒ}tt||ƒƒ}	x6|	D].}
|j|
ƒ|djd|
fƒ|dj|
ƒq˜W|	sâtjtdƒ||dq<|r|jdƒ}|jdƒ}|}
n|}}
d}x.|D]&}
|
j|
ƒr|
dt|
ƒ…}
PqWt|jj|
ƒ}
t
j|ƒsd|dkrx|dj||fƒq<|
|jjkrÔ||jj|
dƒƒr¨td	ƒ}d
}ntdƒ}d}tj||
d
||d|jjƒq<|
|krê|j|
ƒntjtdƒ|
|d|dj||
fƒ|dj|
ƒq<Wd|jkrVtt|dƒƒ|d<tt|dƒƒ|d<|S)Nr%r,r-z2toctree glob pattern %r didn't match any documents)Úlocationér.r9z2toctree contains reference to excluded document %rÚexcludedz5toctree contains reference to nonexisting document %rZnot_readableZtoc)ÚtypeÚsubtyper=z%duplicated entry found in toctree: %sr*)ÚconfigZ
source_suffixr2Z
found_docsÚcopyÚremover3rZexclude_patternsÚcontentrÚmatchÚglob_rerrÚsortedrr7ÚloggerÚwarningrÚgroupÚendswithÚlenZdoc2pathZnote_rereadr4Úlistr*)r9r1ÚsuffixesZall_docnamesr;r?ÚentryÚexplicitZpatnameZdocnamesr3ÚrefÚtitleÚsuffixÚmessagerArrrr8Osh







zTocTree.parse_contentN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úhas_contentÚrequired_argumentsÚoptional_argumentsÚfinal_argument_whitespacerr
Z	unchangedZunchanged_requiredÚflagr Úoption_specrr	r<rr1r8rrrrr!"s 
r!c@s<eZdZUdZdZdZdZdZiZe	e
edœdd„Zd	S)
ÚAuthorz•
    Directive to give the name of the author of the current document
    or section. Shown in the output only if the show_authors option is on.
    Fr.rT)rcCs²|jjsgStjdd}tjƒ}||7}|jdkr<tdƒ}n0|jdkrPtdƒ}n|jdkrdtdƒ}ntd	ƒ}|tj||ƒ7}|jj	|j
d
|jƒ\}}|j|ƒ|g}||7}|S)NF)ZtranslatableÚ
sectionauthorzSection author: ÚmoduleauthorzModule author: Ú
codeauthorz
Code author: zAuthor: r)
rBZshow_authorsrÚ	paragraphZemphasisr#rZTextÚstateÚinline_textÚ	argumentsÚlinenoÚextend)r9ÚparaZemphÚtextÚinodesÚmessagesr;rrrr<¡s$






z
Author.runN)
rVrWrXrYrZr[r\r]r_rrr	r<rrrrr`–s
r`c@seZdZdZejZdS)ÚSeeAlsozB
    An admonition mentioning things to look at as reference.
    N)rVrWrXrYrÚseealsoZ
node_classrrrrrn¸srnc@s<eZdZUdZdZdZdZdZiZe	e
edœdd„Zd	S)
ÚTabularColumnszL
    Directive to give an explicit tabulary column definition to LaTeX.
    Fr.rT)rcCs&tjƒ}|jd|d<|j|ƒ|gS)NrÚspec)rZtabular_col_specrgr6)r9Únoderrrr<És
zTabularColumns.runN)
rVrWrXrYrZr[r\r]r_rrr	r<rrrrrp¿s
rpc@s<eZdZUdZdZdZdZdZiZe	e
edœdd„Zd	S)
ÚCenteredz;
    Directive to create a centered line of bold text.
    Fr.rT)rcCsH|js
gStjƒ}|jj|jd|jƒ\}}|j|ƒ|g}||7}|S)Nr)rgrÚcenteredrerfrhri)r9r:rlrmr;rrrr<Ús
zCentered.runN)
rVrWrXrYrZr[r\r]r_rrr	r<rrrrrsÐs
rsc@s<eZdZUdZdZdZdZdZiZe	e
edœdd„ZdS)	ÚAcksz(
    Directive for a list of names.
    TrF)rcCsntjƒ}|jj|_|jj|j|j|ƒt|jƒdksHt	|jdt
jƒrhtj
tdƒ|jj|jfdgS|gS)Nr.rz.. acks content is not a list)r=)rÚacksreÚdocumentÚnested_parserEÚcontent_offsetrMÚchildrenÚ
isinstancerÚbullet_listrIrJrr2r3rh)r9rrrrrr<ðs


zAcks.runN)
rVrWrXrYrZr[r\r]r_rrr	r<rrrrruæs
ruc@s@eZdZUdZdZdZdZdZdeiZ	e
	eedœdd„Z
d	S)
ÚHListz@
    Directive for a list that gets compacted horizontally.
    TrFÚcolumns)rcCs|jjddƒ}tjƒ}|jj|_|jj|j|j|ƒt	|j
ƒdksVt|j
dtjƒrvt
jtdƒ|jj|jfdgS|j
d}tt	|ƒ|ƒ\}}d}tjƒ}t|ƒ|d<xVt|ƒD]J}|||krÊ|dn|}	tjƒ}
|
|j
||	…7}
|tjd|
ƒ7}|	}q´W|gS)	Nr~r>r.rz.. hlist content is not a list)r=ÚncolumnsÚ)r4r5rrdrerwrxrEryrMrzr{r|rIrJrr2r3rhÚdivmodrÚhlistÚstrÚrangeZhlistcol)r9rrrZfulllistZnpercolZnmoreÚindexZnewnodeÚcolumnZendindexr|rrrr<s*



z	HList.runN)rVrWrXrYrZr[r\r]rr_rrr	r<rrrrr}üs
r}c@s<eZdZUdZdZdZdZdZiZe	e
edœdd„ZdS)	ÚOnlyzI
    Directive to only include text if the given tag(s) are enabled.
    Tr.r)rcCs>tjƒ}|jj|_|j|ƒ|jd|d<|jj}|j}|j}g|_d|_zà|jj	|j
|j|dd|j}|sŒ|sŒ|d|ksŒ|jjr’|gSd}|jj}x|r´|d7}|j}q W|d8}|d}t
|ƒ}	||krà|j|ƒ}	||	d}
ttj|jjƒ}x t|
ƒD]}|jr|j}qW|j|ƒgS||_||_XdS)NrÚexprT)Zmatch_titlesr.r>)rÚonlyrerwr6rgÚmemoÚtitle_stylesZ
section_levelrxrEryr+rMr…rrrr„r7)r9rrrŠZsurrounding_title_stylesZsurrounding_section_levelr‹Z
current_depthr+Ztitle_styleZnested_depthZn_sects_to_raiseZ_irrrr<+sJ






zOnly.runN)
rVrWrXrYrZr[r\r]r_rrr	r<rrrrr‡!s
r‡cs*eZdZdZeedœ‡fdd„Z‡ZS)r
    Like the standard "Include" directive, but interprets absolute paths
    "correctly", i.e. relative to source directory.
    )rcs`|jdjdƒr*|jdjdƒr*tƒjƒS|jj|jdƒ\}}||jd<|jj|ƒtƒjƒS)Nrú<ú>)rgÚ
startswithrLÚsuperr<r2Z
relfn2pathZ
note_included)r9Zrel_filenameÚfilename)Ú	__class__rrr<as

zInclude.run)rVrWrXrYrr	r<Ú
__classcell__rr)r‘rr
[sr
r)ÚapprcCs¨tjdtƒtjdtƒtjdtƒtjdtƒtjdtƒtjdtƒtjdtƒtjdtƒtjd	tƒtjd
t	ƒtjdt
ƒtjdtƒtjd
tƒddddœS)Nr1rarbrcroZtabularcolumnsrtrvr‚r‰ÚincludeZcssclassz	rst-classÚbuiltinT)ÚversionZparallel_read_safeZparallel_write_safe)r
Zregister_directiver!r`rnrprsrur}r‡r
r)r“rrrÚsetupls r—);ÚreÚtypingrrrrrZdocutilsrZdocutils.nodesrr	Zdocutils.parsers.rstr
Z+docutils.parsers.rst.directives.admonitionsrZ$docutils.parsers.rst.directives.miscrr
ZBaseIncludeZsphinxrZsphinx.domains.changesetrZ
sphinx.localerrZsphinx.utilrrrZsphinx.util.docutilsrZsphinx.util.matchingrrZsphinx.util.nodesrZsphinx.util.typingrZsphinx.applicationrÚcompilerGÚ	getLoggerrVrIrƒrr r!r`rnrprsrur}r‡r—rrrrÚ<module>s<

t"%: