o $a8@sdZddlZddlmZmZmZmZmZddlm Z ddl m Z m Z ddl mZddlmZddlmZdd lmZdd lmZdd lmZdd lmZmZdd lmZmZmZddl m!Z!ddl"m#Z#m$Z$ddl%m&Z&ddl'm(Z(erzddl)m*Z*e+dZ,e-e.Z/de0de1fddZ2Gddde!Z3Gddde!Z4GdddeZ5Gddde!Z6Gd d!d!e!Z7Gd"d#d#e!Z8Gd$d%d%e!Z9Gd&d'd'e!Z:Gd(d)d)ee!Zd*d+dee0effd,d-Z;dS).z sphinx.directives.other ~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. N) TYPE_CHECKINGAnyDictListcast)nodes)ElementNode) directives)BaseAdmonition)Class)Include)addnodes) VersionChange)___) docname_joinloggingurl_re)SphinxDirective)Matcher patfilter)explicit_title_re) OptionSpec)Sphinxz .*[*?\[].*argumentreturncCs|sdSt|S)Ni)int)rr9/usr/lib/python3/dist-packages/sphinx/directives/other.pyint_or_nothing$sr c @speZdZdZdZdZdZdZee j e j e j e j e j e e j e j d ZdeefddZd ejdeefd 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) maxdepthnamecaptionglobhidden includehiddennumbered titlesonlyreversedrcCst}|jj|d<g|d<g|d<|jdd|d<|jd|d<d|jv|d<d|jv|d<d |jv|d <|jd d |d <d |jv|d <||tjd gd}| || || |}| ||S)Nparententries includefilesr"r$r%r&r'r(rr)ztoctree-wrapper)classes) rtoctreeenvdocnameoptionsgetset_source_inforcompoundappendadd_name parse_content)selfsubnode wrappernoderetrrrrun?s$      z TocTree.runr0cCs8|jj}|jj}||jjg}t|jj}|j D]}|s!qt |}|drkt |rk|skt |skt|jj|}tt||} | D]} || |dd| f|d| qF| sjtjtd||dq|rz|d} |d} | } n|} } d} |D]} | | r| dt|  } nqt|jj| } t | s| dkr|d| | fq| |jjvr||j| drtd }d }ntd }d }tj|| d ||d|jq| |vr|| n tjtd| |d|d| | f|d| qd|jvrtt|d|d<tt|d|d<|S)Nr%r,r-z2toctree glob pattern %r didn't match any documentslocationr:z2toctree contains reference to excluded document %rexcludedz5toctree contains reference to nonexisting document %r not_readabletoc)typesubtyper@z%duplicated entry found in toctree: %sr*)config source_suffixr1 found_docscopyremover2rexclude_patternscontentrmatchglob_rerrsortedrr7loggerwarningrgroupendswithlendoc2path note_rereadr3listr*)r:r0suffixes all_docnamesr=rCentryexplicitpatnamedocnamesr2reftitlesuffixmessagerGrrrr9Wsx               zTocTree.parse_contentN)__name__ __module__ __qualname____doc__ has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacerr unchangedunchanged_requiredflagr option_specrr r>rr0r9rrrrr!*s$ r!c@@eZdZUdZdZdZdZdZiZe e d<de e fdd 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. FrBrTrorcCs|jjsgStjdd}t}||7}|jdkrtd}n|jdkr(td}n|jdkr2td}ntd }|t||7}|j |j d |j \}}| ||g}||7}|S) NF) translatable sectionauthorzSection author: moduleauthorzModule author: codeauthorz Code author: zAuthor: r) rH show_authorsr paragraphemphasisr#rTextstate inline_text argumentslinenoextend)r:paraemphtextinodesmessagesr=rrrr>s$        z Author.runNrdrerfrgrhrirjrkror__annotations__rr r>rrrrrqs  rqc@seZdZdZejZdS)SeeAlsozB An admonition mentioning things to look at as reference. N)rdrerfrgrseealso node_classrrrrrs rc@rp) TabularColumnszL Directive to give an explicit tabulary column definition to LaTeX. FrBrTrorcCs&t}|jd|d<|||gS)Nrspec)rtabular_col_specr|r5r:noderrrr>s zTabularColumns.runNrrrrrr  rc@rp) Centeredz; Directive to create a centered line of bold text. FrBrTrorcCsH|jsgSt}|j|jd|j\}}|||g}||7}|S)Nr)r|rcenteredrzr{r}r~)r:r;rrr=rrrr>s z Centered.runNrrrrrrrrc@s@eZdZUdZdZdZdZdZiZe e d<de e fddZ d S) Acksz( Directive for a list of names. TrFrorcCslt}|jj|_|j|j|j|t|jdks#t |jdt j s3t j td|jj|jfdgS|gS)NrBrz.. acks content is not a listr?)racksrzdocument nested_parserNcontent_offsetrVchildren isinstancer bullet_listrRrSrr1r2r}rrrrr>s   zAcks.runNrrrrrrrrc@sDeZdZUdZdZdZdZdZdeiZ e e d<de e fdd Zd S) HListz@ Directive for a list that gets compacted horizontally. TrFcolumnsrorc Cs|jdd}t}|jj|_|j|j|j|t |j dks*t |j dtj s:t jtd|jj|jfdgS|j d}tt ||\}}d}t}t||d<t|D]%}|||krc|dn|} t } | |j || 7} |td| 7}| }qX|gS) NrrArBrz.. hlist content is not a listr?ncolumns)r3r4rrwrzrrrNrrVrrrrRrSrr1r2r}divmodrhliststrrangehlistcol) r:rrfulllistnpercolnmoreindexnewnodecolumnendindexrrrrr>s.      z HList.runN)rdrerfrgrhrirjrkrrorrrr r>rrrrrs  rc@s@eZdZUdZdZdZdZdZiZe e d<de e fddZ d S) OnlyzI Directive to only include text if the given tag(s) are enabled. TrBrrorc CsFt}|jj|_|||jd|d<|jj}|j}|j}g|_d|_zv|jj |j |j |dd|j}|rC|rC|d|vsC|jj sM|gW||_||_Sd}|jj }|r^|d7}|j }|sU|d8}|d}t |} ||vrs||} || d} ttj|jj }t| D]} |j r|j }q||gW||_||_S||_||_w)NrexprT) match_titlesrBrA)ronlyrzrr5r|memo title_styles section_levelrrNrr+rVrrrrrr7) r:rrsurrounding_title_stylessurrounding_section_levelr current_depthr+ title_style nested_depthn_sects_to_raiseirrrr>3s\       zOnly.runNrrrrrr)rrcs*eZdZdZdeeffdd ZZS)r z Like the standard "Include" directive, but interprets absolute paths "correctly", i.e. relative to source directory. rcs`|jddr|jddrtS|j|jd\}}||jd<|j|tS)Nr<>)r| startswithrUsuperr>r1 relfn2path note_included)r: rel_filenamefilename __class__rrr>is    z Include.run)rdrerfrgrr r> __classcell__rrrrr csr apprcCstdttdttdttdttdttdttdttdttd ttd t td t td t td t ddddS)Nr0rsrtrurtabularcolumnsrrrrincludecssclassz rst-classbuiltinT)versionparallel_read_safeparallel_write_safe) r register_directiver!rqrrrrrrr r )rrrrsetupts"             r)s@             t"%: