
    }c8                     d   d dl Z d dlmZmZmZmZmZ d dlmZ d dl	m
Z
mZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZmZ d dlmZmZmZ d dlm Z  d dl!m"Z"m#Z# d dl$m%Z% d dl&m'Z' erd dl(m)Z)  e j*        d          Z+ ej,        e-          Z.de/de0fdZ1 G d de           Z2 G d de           Z3 G d de          Z4 G d de           Z5 G d de           Z6 G d  d!e           Z7 G d" d#e           Z8 G d$ d%e           Z9 G d& d'ee           Zd(d)dee/ef         fd*Z:dS )+    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returnc                 (    | sdS t          |           S )Ni  )int)r   s    7lib/python3.11/site-packages/sphinx/directives/other.pyint_or_nothingr!      s     sx==    c            
           e Zd ZdZdZdZdZdZee	j
        e	j        e	j        e	j        e	j        ee	j        e	j        d	Zdee         fdZdej        dee         fd	Zd
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.
    Tr   F)	maxdepthnamecaptionglobhiddenincludehiddennumbered
titlesonlyreversedr   c                 n   t          j                    }| j        j        |d<   g |d<   g |d<   | j                            dd          |d<   | j                            d          |d<   d| j        v |d<   d| j        v |d<   d	| j        v |d	<   | j                            d
d          |d
<   d| j        v |d<   |                     |           t          j        dg          }|	                    |           | 
                    |           |                     |          }|	                    |           |S )Nparententriesincludefilesr%   r'   r(   r)   r*   r+   r   r,   ztoctree-wrapper)classes)r   toctreeenvdocnameoptionsgetset_source_infor   compoundappendadd_nameparse_content)selfsubnodewrappernoderets       r    runzTocTree.run7   sD   "$$ H,  	"$"l..z2>>
!\--i88	 DL0$4#2dl#B "l..z1==
 , <W%%%n.?-@AAA7###k"""  ))

;
r"   r4   c                 &   | j         j        }| j        j                                        }|                    | j        j                   g }t          | j         j                  }| j	        D ]}|st          j        |          }|d         rt                              |          r|st          j        |          st          | j        j        |          }t          t!          ||                    }	|	D ]O}
|                    |
           |d                             d |
f           |d                             |
           P|	s*t$                              t)          d          ||           	|r-|                    d          }|                    d          }|}
n|x}}
d }|D ]1}|
                    |          r|
d t/          |                    }
 n2t          | j        j        |
          }
t          j        |          s|dk    r|d                             ||f           |
| j        j        vr || j                            |
d                     rt)          d	          }d
}nt)          d          }d}t$                              ||
d||           | j                                         T|
|v r|                    |
           n*t$                              t)          d          |
|           |d                             ||
f           |d                             |
           d| j        v rJt7          t9          |d                             |d<   t7          t9          |d                             |d<   |S )Nr(   r0   r1   z2toctree glob pattern %r didn't match any documentslocation      r>   z2toctree contains reference to excluded document %rexcludedz5toctree contains reference to nonexisting document %rnot_readabletoc)typesubtyperE   z%duplicated entry found in toctree: %sr-   )configsource_suffixr5   
found_docscopyremover6   r   exclude_patternscontentr   matchglob_rer   r   sortedr   r;   loggerwarningr   groupendswithlendoc2pathnote_rereadr7   listr-   )r>   r4   suffixesall_docnamesrA   rH   entryexplicitpatnamedocnamesr6   reftitlesuffixmessagerL   s                   r    r=   zTocTree.parse_contentO   s   ;, x*//11DH,---4;788\ 4	< 4	<E (.u55H /<GMM%$8$8 /< /<)/e)<)</<&tx'7??!)L'"B"BCC' < <G ''000I&--tWo>>>N+227;;;; <NN2&[#\#\#(7 # < < <  !"..++C$NN1--E!GG$))C' E&  F''// ")-CKK<-"8 'tx'7AA<$$ <v <I&--ucl;;;;DH$77 <x 1 1'4 @ @AA 1"$%Y"Z"Z","$%\"]"]"0NN7G%,3 # 5 5 5H((****,. 9$++G4444r*Q'R'RT[07 ' 9 9 9 I&--ug.>???N+227;;;; % 	N!%hwy/A&B&B!C!CGI&*8GN4K+L+L&M&MGN#
r"   N)__name__
__module____qualname____doc__has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacer   r   	unchangedunchanged_requiredflagr!   option_specr   r
   rB   r   r4   r=    r"   r    r$   r$   "   s          K %$0/#" oO
 
KT$Z    0DX%5 D$t* D D D D D Dr"   r$   c                   J    e Zd ZU dZdZdZdZdZi Ze	e
d<   dee         fd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.
    FrG   r   Trt   r   c                     | j         j        sg S t          j        d          }t          j                    }||z  }| j        dk    rt          d          }nE| j        dk    rt          d          }n*| j        dk    rt          d          }nt          d	          }|t          j        |          z  }| j        	                    | j
        d
         | j                  \  }}|                    |           |g}||z  }|S )NF)translatablesectionauthorzSection author: moduleauthorzModule author: 
codeauthorzCode author: zAuthor: r   )rM   show_authorsr   	paragraphemphasisr&   r   Textstateinline_text	argumentslinenoextend)r>   paraemphtextinodesmessagesrA   s          r    rB   z
Author.run   s   {' 	IU;;;~9' 	!'((DDY.( 	!&''DDY,& 	!_%%DDZ==D
4   :11$.2CT[QQF&x
r"   Nri   rj   rk   rl   rm   rn   ro   rp   rt   r   __annotations__r   r
   rB   ru   r"   r    rw   rw      sh           K $ K   T$Z      r"   rw   c                        e Zd ZdZej        ZdS )SeeAlsozB
    An admonition mentioning things to look at as reference.
    N)ri   rj   rk   rl   r   seealso
node_classru   r"   r    r   r      s"          !JJJr"   r   c                   J    e Zd ZU dZdZdZdZdZi Ze	e
d<   dee         fdZd	S )
TabularColumnszL
    Directive to give an explicit tabulary column definition to LaTeX.
    FrG   r   Trt   r   c                 x    t          j                    }| j        d         |d<   |                     |           |gS )Nr   spec)r   tabular_col_specr   r9   r>   nodes     r    rB   zTabularColumns.run   s;    (**~a(VT"""vr"   Nr   ru   r"   r    r   r      sh           K $ K   T$Z      r"   r   c                   J    e Zd ZU dZdZdZdZdZi Ze	e
d<   dee         fdZd	S )
Centeredz;
    Directive to create a centered line of bold text.
    FrG   r   Trt   r   c                     | j         sg S t          j                    }| j                            | j         d         | j                  \  }}|                    |           |g}||z  }|S )Nr   )r   r   centeredr   r   r   r   )r>   r?   r   r   rA   s        r    rB   zCentered.run   sk    ~ 	I#,..:11$.2CT[QQv")x
r"   Nr   ru   r"   r    r   r      sh           K $ K   	T$Z 	 	 	 	 	 	r"   r   c                   J    e Zd ZU dZdZdZdZdZi Ze	e
d<   dee         fdZdS )	Acksz(
    Directive for a list of names.
    Tr   Frt   r   c                    t          j                    }| j        j        |_        | j                            | j        | j        |           t          |j                  dk    s%t          |j        d         t          j                  s<t                              t          d          | j        j        | j        f           g S |gS )NrG   r   z.. acks content is not a listrD   )r   acksr   documentnested_parserS   content_offsetr[   children
isinstancer   bullet_listrW   rX   r   r5   r6   r   r   s     r    rB   zAcks.run   s    }
+
d.A4HHHt}" 	*T]15E5:5F+H +H 	NN2=>>%)X%5t{$C  E E EIvr"   Nr   ru   r"   r    r   r      sh           K % K   	T$Z 	 	 	 	 	 	r"   r   c                   N    e Zd ZU dZdZdZdZdZdeiZ	e
ed<   dee         fdZd	S )
HListz@
    Directive for a list that gets compacted horizontally.
    Tr   Fcolumnsrt   r   c                 .   | j                             dd          }t          j                    }| j        j        |_        | j                            | j        | j        |           t          |j
                  dk    s%t          |j
        d         t          j                  s<t                              t          d          | j        j        | j        f           g S |j
        d         }t'          t          |          |          \  }}d}t)          j                    }t-          |          |d<   t/          |          D ]Q}|||k     r|dz   n|z   }	t          j                    }
|
|j
        ||	         z  }
|t)          j        d|
          z  }|	}R|gS )	Nr   rF   rG   r   z.. hlist content is not a listrD   ncolumns )r7   r8   r   r~   r   r   r   rS   r   r[   r   r   r   rW   rX   r   r5   r6   r   divmodr   hliststrrangehlistcol)r>   r   r   fulllistnpercolnmoreindexnewnodecolumnendindexr   s              r    rB   z	HList.run  s   <##Iq11  
+
d.A4HHHt}" 	*T]15E5:5F+H +H 	NN2>??%)X%5t{$C  E E EI=#Hx88.""!(mm
Hoo 	 	F% L1WMH+--K8,U8^<<Kx([999GEEyr"   N)ri   rj   rk   rl   rm   rn   ro   rp   r   rt   r   r   r   r
   rB   ru   r"   r    r   r      su           K %3K   T$Z      r"   r   c                   J    e Zd ZU dZdZdZdZdZi Ze	e
d<   dee         fdZdS )	OnlyzI
    Directive to only include text if the given tag(s) are enabled.
    TrG   r   rt   r   c                 H   t          j                    }| j        j        |_        |                     |           | j        d         |d<   | j        j        }|j        }|j        }g |_        d|_        	 | j        	                    | j
        | j        |d           |j        }|r|r|d         |vs| j        j        s|g||_        ||_        S d}| j        j        }|r|dz  }|j        }||dz  }|d         }t          |          }	||v r|                    |          }	||	z
  dz   }
t          t           j        | j        j                  }t%          |
          D ]}|j        r|j        }|                    |           g ||_        ||_        S # ||_        ||_        w xY w)Nr   exprT)match_titlesrG   rF   )r   onlyr   r   r9   r   memotitle_stylessection_levelr   rS   r   r/   r[   r   r   r   r	   r   r;   )r>   r   r   surrounding_title_stylessurrounding_section_levelr   current_depthr/   title_stylenested_depthn_sects_to_raise_is               r    rB   zOnly.run+  s   }
+T"""~a(V JO#'#4 $($6! 	;J##DL$2E$(t $ = = =,L, $ O+CC 
)
 v, !9D!:D+ MZ&F '"  ' QM&q/K788L66 K7==kJJ  -|;a?%-):;;F,-- + += +#]FMM$ 8D!:D !9D!:D::::s   3AF B5F F!Nr   ru   r"   r    r   r   !  sh           K $ K   -;T$Z -; -; -; -; -; -;r"   r   c                   4     e Zd ZdZdee         f fdZ xZS )r   z
    Like the standard "Include" directive, but interprets absolute paths
    "correctly", i.e. relative to source directory.
    r   c                    | j         d                             d          r@| j         d                             d          r t                                                      S | j                            | j         d                   \  }}|| j         d<   | j                            |           t                                                      S )Nr   <>)r   
startswithrZ   superrB   r5   
relfn2pathnote_included)r>   rel_filenamefilename	__class__s      r    rB   zInclude.runa  s    >!'',, 	!>!%%c**	! 77;;== !%!4!4T^A5F!G!Gh$qx(((ww{{}}r"   )ri   rj   rk   rl   r   r
   rB   __classcell__)r   s   @r    r   r   [  sR         
T$Z          r"   r   appr   c                    t          j        dt                     t          j        dt                     t          j        dt                     t          j        dt                     t          j        dt                     t          j        dt
                     t          j        dt                     t          j        dt                     t          j        d	t                     t          j        d
t                     t          j        dt                     t          j        dt                     t          j        dt                     ddddS )Nr4   rz   r{   r|   r   tabularcolumnsr   r   r   r   includecssclassz	rst-classbuiltinT)versionparallel_read_safeparallel_write_safe)r   register_directiver$   rw   r   r   r   r   r   r   r   r   )r   s    r    setupr   l  s   !)W555!/6:::!.&999!,777!)W555!"2NCCC!*h777!&$///!'5111!&$///!)W555 !*e444!+u555 "#  r"   );retypingr   r   r   r   r   docutilsr   docutils.nodesr	   r
   docutils.parsers.rstr   +docutils.parsers.rst.directives.admonitionsr   $docutils.parsers.rst.directives.miscr   r   BaseIncludesphinxr   sphinx.domains.changesetr   sphinx.localer   r   sphinx.utilr   r   r   sphinx.util.docutilsr   sphinx.util.matchingr   r   sphinx.util.nodesr   sphinx.util.typingr   sphinx.applicationr   compilerU   	getLoggerri   rW   r   r   r!   r$   rw   r   r   r   r   r   r   r   ru   r"   r    <module>r      so   				 7 7 7 7 7 7 7 7 7 7 7 7 7 7       ( ( ( ( ( ( ( ( + + + + + + F F F F F F 6 6 6 6 6 6 G G G G G G       2 2 2 2 2 2         5 5 5 5 5 5 5 5 5 5 0 0 0 0 0 0 3 3 3 3 3 3 3 3 / / / / / / ) ) ) ) ) ) *)))))) "*]
#
#		8	$	$S S    q q q q qo q q qh    _   D" " " " "n " " "    _   "       ,    ?   ," " " " "O " " "J7; 7; 7; 7; 7;? 7; 7; 7;t    k?   "x DcN      r"   