
    zi@                    |   d dl mZ d dlZd dlmZmZ d dlmZ d dlm	Z	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 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+ e	rd dl,m-Z-m.Z. d dl/m0Z0 d dl1m2Z2  ej3        d          Z4 e#j5        e6          Z7d3dZ8 G d de&          Z9 G d d e&          Z: G d! d"e          Z; G d# d$e&          Z< G d% d&e&          Z= G d' d(e&          Z> G d) d*e&          Z? G d+ d,e&          Z@ G d- d.ee&          Zd4d2ZAdS )5    )annotationsN)abspathrelpath)Path)TYPE_CHECKINGAnycast)nodes)
directives)BaseAdmonition)Class)Include)StateMachine)addnodes)VersionChange)StandardDomain)___)docname_joinloggingurl_re)SphinxDirective)Matcher	patfilter)explicit_title_re)ElementNode)Sphinx)
OptionSpecz
.*[*?\[].*argumentstrreturnintc                (    | sdS t          |           S )Ni  )r#   )r    s    b/var/www/tmov.alphamb/tmov_inventario/venv/lib/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dZd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"   
list[Node]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/   r0   r   r1   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.run>   sD   "$$ H,  	"$"l..z2>>
!\--i88	 DL0$4#2dl#B "l..z1==
 , <W%%%n.?-@AAA7###k"""  ))

;
r'   r:   addnodes.toctreec                0   t          t          j                  }| j        j        }| j        j        }|d         }| j        j                                        |z  }|	                    |           t          |          }g }t          | j        j                  }	| j        D ]}
|
st          j        |
          }t          j        |
          d u}|rt                               |
          r|s|st#          ||
          }t%          t'          ||                    }|D ]T}||v r|	                    |           |d                             d |f           |d                             |           U|s*t*                              t/          d          |
|           |r-|                    d          }|                    d          }|}n|
x}}d }|D ].}|                    |          r|                    |          } n/t#          ||          }|s|dk    r|d                             ||f           ||vr |	| j                            |d	                    rt/          d
          }d}nt/          d          }d}t*                              ||d||           | j                                         $||v r|	                    |           n*t*                              t/          d          ||           |d                             ||f           |d                             |           d| j        v rJt=          t?          |d                             |d<   t=          t?          |d                             |d<   |S )Nr-   r6   r7   z2toctree glob pattern %r didn't match any documentslocation      rD   Fz2toctree contains reference to excluded document %rexcludedz5toctree contains reference to nonexisting document %rnot_readabletoc)typesubtyperL   z%duplicated entry found in toctree: %sr2   ) 	frozensetr   _virtual_doc_namesconfigsource_suffixr;   r<   
found_docscopyremover   exclude_patternscontentr   matchr   glob_rer   sortedr   rA   loggerwarningr   groupendswithremovesuffixdoc2pathnote_rereadr=   listr2   )rD   r:   generated_docnamessuffixescurrent_docnamer-   all_docnamesfrozen_all_docnamesrG   rO   entryexplicit	url_matchpat_name	doc_namesr<   reftitlesuffixmessagerS   s                        r%   rC   zTocTree.parse_contentV   s   &~'HII;,(*v x*//114FFO,,,'554;788\ >	4 >	4E  ).u55HU++47I e,, X i '??"9\8#D#DEE	( < <G"444  ''000I&--tWo>>>N+227;;;;  <NN2&Z#[#[#(7 # < < < nnQ'' q)) %%g #  ##F++ %226::GE
 #?G<<G C6MM	"))5#,7771118DH--gu==>> - !UVVG(GG !XYYG,GweW(/  1 1 1$$&&&,&&##G,,,,r"IJJG(/  1 1 1 I%%ug&6777N#**73333 %%!%hwy/A&B&B!C!CGI&*8GN4K+L+L&M&MGN#
r'   Nr"   r3   )r:   rI   r"   r3   )__name__
__module____qualname____doc__has_contentrequired_argumentsoptional_argumentsfinal_argument_whitespacer#   r   	unchangedunchanged_requiredflagr&   option_specrH   rC    r'   r%   r)   r)   )   s          K %$0/#" oO
 
K   0R R R R R Rr'   r)   c                  :    e Zd ZU dZdZdZdZdZi Zde	d<   d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.
    FrN   r   Tr   r   r"   r3   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   )rV   show_authorsr
   	paragraphemphasisr+   r   Textstateinline_text	argumentslinenoextend)rD   paraemphtextinodesmessagesrG   s          r%   rH   z
Author.run   s    {' 	IU;;;~9'''((DDY.((&''DDY,&&_%%DDZ==D
4   :11$.2CT[QQF&x
r'   Nrv   rw   rx   ry   rz   r{   r|   r}   r~   r   __annotations__rH   r   r'   r%   r   r      s^           K $ K         r'   r   c                       e Zd ZdZej        ZdS )SeeAlsozB
    An admonition mentioning things to look at as reference.
    N)rw   rx   ry   rz   r   seealso
node_classr   r'   r%   r   r      s"          !JJJr'   r   c                  :    e Zd ZU dZdZdZdZdZi Zde	d<   dd
Z
dS )TabularColumnszL
    Directive to give an explicit tabulary column definition to LaTeX.
    FrN   r   Tr   r   r"   r3   c                x    t          j                    }| j        d         |d<   |                     |           |gS )Nr   spec)r   tabular_col_specr   r?   rD   nodes     r%   rH   zTabularColumns.run   s;    (**~a(VT"""vr'   Nrv   r   r   r'   r%   r   r      s^           K $ K         r'   r   c                  :    e Zd ZU dZdZdZdZdZi Zde	d<   dd
Z
dS )Centeredz;
    Directive to create a centered line of bold text.
    FrN   r   Tr   r   r"   r3   c                    | j         sg S t          j                    }| j                            | j         d         | j                  \  }}|                    |           |g}||z  }|S )Nr   )r   r   centeredr   r   r   r   )rD   rE   r   r   rG   s        r%   rH   zCentered.run   sk    ~ 	I#,..:11$.2CT[QQv")x
r'   Nrv   r   r   r'   r%   r   r      s^           K $ K    	 	 	 	 	 	r'   r   c                  :    e Zd ZU dZdZdZdZdZi Zde	d<   dd	Z
d
S )Acksz(
    Directive for a list of names.
    Tr   Fr   r   r"   r3   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 )NrN   r   z.. acks content is not a listrK   )r   acksr   documentnested_parser\   content_offsetlenchildren
isinstancer
   bullet_listr`   ra   r   r;   r<   r   r   s     r%   rH   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'   Nrv   r   r   r'   r%   r   r      s^           K % K    	 	 	 	 	 	r'   r   c                  >    e Zd ZU dZdZdZdZdZdeiZ	de
d<   dd
ZdS )HListz@
    Directive for a list that gets compacted horizontally.
    Tr   Fcolumnsr   r   r"   r3   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   rM   rN   r   z.. hlist content is not a listrK   ncolumns )r=   r>   r
   r   r   r   r   r\   r   r   r   r   r   r`   ra   r   r;   r<   r   divmodr   hlistr!   rangehlistcol)rD   r   r   fulllistnpercolnmoreindexnewnodecolumnendindexr   s              r%   rH   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%1WMH+--K8,U8^<<Kx([999GEEyr'   Nrv   )rw   rx   ry   rz   r{   r|   r}   r~   r#   r   r   rH   r   r'   r%   r   r     sm           K %3K         r'   r   c                  :    e Zd ZU dZdZdZdZdZi Zde	d<   dd	Z
d
S )OnlyzI
    Directive to only include text if the given tag(s) are enabled.
    TrN   r   r   r   r"   r3   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_titlesrN   rM   )r   onlyr   r   r?   r   memotitle_stylessection_levelr   r\   r   r5   r   r   r	   r
   r   r   rA   )rD   r   r   surrounding_title_stylessurrounding_section_levelr   current_depthr5   title_stylenested_depthn_sects_to_raise_is               r%   rH   zOnly.run@  s   }
+T"""~a(V JO#'#4 $($6! 	;J##DL$2E$(t $ = = =,L, $ O+CCC
) D v, !9D!:D+ MZ&F '"  ' QM&q/K788L6667==kJJ  -|;a?%-):;;F,-- + += +#]FMM$ 8D!:D !9D!:D::::s   3AF B5F F!Nrv   r   r   r'   r%   r   r   6  s^           K $ K    -; -; -; -; -; -;r'   r   c                  $     e Zd ZdZd 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"   r3   c                     fd} j         j        j        j                            d          r| j        _         j        d                             d          r@ j        d         	                    d          r t                                                      S  j                              j        d                   \  }}| j        d<    j                             |           t                                                      S )Nc                   d                     | d d                   }t          t          t          |          j        j                            }j        j        }|g}j        j        j        	                    d|||           |d         }|
                                | dd          z   } t          j        j        | |          S )N
)startinclude-readr   )joinr   r   r   r;   srcdirr<   appeventsemit
splitlinesr   insert_inputstate_machine)include_linessourcer   pathr<   argrD   s         r%   _insert_inputz"Include.run.<locals>._insert_input}  s     99]3B3/00DtxGGGHHDh&G &CHL$$^T7CHHHq6D !OO--bcc0BBM
  ,T-?PVWWWr'   r   r   <>)r;   r   r   	listenersr>   r   r   r   
startswithrc   superrH   
relfn2pathnote_included)rD   r   rel_filenamefilename	__class__s   `   r%   rH   zInclude.runv  s    	X 	X 	X 	X 	X2 8<(,,^<< 	<.;D+>!'',, 	!>!%%c**	! 77;;== !%!4!4T^A5F!G!Gh$qx(((ww{{}}r'   rv   )rw   rx   ry   rz   rH   __classcell__)r   s   @r%   r   r   p  sG         
+ + + + + + + + + +r'   r   r   r   dict[str, Any]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 )Nr:   r   r   r   r   tabularcolumnsr   r   r   r   includecssclassz	rst-classbuiltinT)versionparallel_read_safeparallel_write_safe)r   register_directiver)   r   r   r   r   r   r   r   r   r   )r   s    r%   setupr     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'   )r    r!   r"   r#   )r   r   r"   r   )B
__future__r   reos.pathr   r   pathlibr   typingr   r   r	   docutilsr
   docutils.parsers.rstr   +docutils.parsers.rst.directives.admonitionsr   $docutils.parsers.rst.directives.miscr   r   BaseIncludedocutils.statemachiner   sphinxr   sphinx.domains.changesetr   sphinx.domains.stdr   sphinx.localer   r   sphinx.utilr   r   r   sphinx.util.docutilsr   sphinx.util.matchingr   r   sphinx.util.nodesr   docutils.nodesr   r   sphinx.applicationr   sphinx.util.typingr   compiler^   	getLoggerrw   r`   r&   r)   r   r   r   r   r   r   r   r   r   r'   r%   <module>r     s   " " " " " " 				 $ $ $ $ $ $ $ $       + + + + + + + + + +       + + + + + + 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	$	$       o   D    _   D" " " " "n " " "    _   "       ,    ?   ," " " " "O " " "J7; 7; 7; 7; 7;? 7; 7; 7;t1 1 1 1 1k? 1 1 1h     r'   