HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/sphinx/writers/__pycache__/text.cpython-310.pyc
o

�$�a���
@sNdZddlZddlZddlZddlZddlmZmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZddlmZmZddlmZmZmZddlmZddlmZdd	lm Z m!Z!dd
l"m#Z#e	rhddl$m%Z%Gdd
�d
�Z&Gdd�d�Z'Gdd�dej(�Z(dZ)dZ*e)fde+de,de
dee+fdd�Z-Gdd�dej.�Z/Gdd�de#�Z0dS)z�
    sphinx.writers.text
    ~~~~~~~~~~~~~~~~~~~

    Custom docutils writer for plain text.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�chain�groupby)�
TYPE_CHECKING�Any�Dict�	Generator�Iterable�List�Optional�Set�Tuple�Union�cast)�nodes�writers)�Element�Node�Text��column_width)�addnodes)�_�admonitionlabels)�SphinxTranslator)�TextBuilderc	@sZeZdZdZddedededdfd	d
�Zdefdd�Zdefd
d�Zdeddfdd�Z	dS)�CellzVRepresents a cell in a table.
    It can span multiple columns or multiple lines.
    ���text�rowspan�colspan�returnNcCs(||_g|_||_||_d|_d|_dS�N)r�wrappedrr �col�row)�selfrrr �r'�5/usr/lib/python3/dist-packages/sphinx/writers/text.py�__init__"s
z
Cell.__init__cCsd�|j|j|j|j|j�S)Nz<Cell {!r} {}v{}/{}>{}>)�formatrr%rr$r �r&r'r'r(�__repr__*s�z
Cell.__repr__cCst|j|jf�Sr")�hashr$r%r+r'r'r(�__hash__/�z
Cell.__hash__�widthcCst|j|�|_dSr")�my_wraprr#)r&r0r'r'r(�wrap2�z	Cell.wrap)rrr)
�__name__�
__module__�__qualname__�__doc__�str�intr)r,r.r2r'r'r'r(rsrc@seZdZdZd&deeddfdd�Zd'dd�Zd'd	d
�Zde	ddfdd
�Z
deeefde	fdd�Zdeeefde	ddfdd�Z
deddfdd�Zdeddfdd�Zdefdd�Zde	deedefdd�Zedee	ddffdd��Zd'd d!�Zdee	defd"d#�Zdefd$d%�ZdS)(�TableajRepresents a table, handling cells that can span multiple lines
    or rows, like::

       +-----------+-----+
       | AAA       | BBB |
       +-----+-----+     |
       |     | XXX |     |
       |     +-----+-----+
       | DDD | CCC       |
       +-----+-----------+

    This class can be used in two ways, either:

    - With absolute positions: call ``table[line, col] = Cell(...)``,
      this overwrites any existing cell(s) at these positions.

    - With relative positions: call the ``add_row()`` and
      ``add_cell(Cell(...))`` as needed.

    Cells spanning multiple rows or multiple columns (having a
    colspan or rowspan greater than one) are automatically referenced
    by all the table cells they cover. This is a useful
    representation as we can simply check
    ``if self[x, y] is self[x, y+1]`` to recognize a rowspan.

    Colwidth is not automatically computed, it has to be given, either
    at construction time, or during the table construction.

    Example usage::

       table = Table([6, 6])
       table.add_cell(Cell("foo"))
       table.add_cell(Cell("bar"))
       table.set_separator()
       table.add_row()
       table.add_cell(Cell("FOO"))
       table.add_cell(Cell("BAR"))
       print(table)
       +--------+--------+
       | foo    | bar    |
       |========|========|
       | FOO    | BAR    |
       +--------+--------+

    N�colwidthr!cCs.g|_d|_|dur|ng|_d|_d|_dS�Nr)�lines�	separatorr;�current_line�current_col)r&r;r'r'r(r)ds

zTable.__init__cCs|jd7_d|_dS)z�Add a row to the table, to use with ``add_cell()``.  It is not needed
        to call ``add_row()`` before the first ``add_cell()``.
        rrN)r?r@r+r'r'r(�add_rowks
z
Table.add_rowcCst|j�|_dS)z*Sets the separator below the current line.N)�lenr=r>r+r'r'r(�
set_separatorrszTable.set_separator�cellcCsR||j|jfr|jd7_||j|jfs|||j|jf<|j|j7_dS)z�Add a cell to the current line, to use with ``add_row()``.  To add
        a cell spanning multiple lines or rows, simply set the
        ``cell.colspan`` or ``cell.rowspan`` BEFORE inserting it into
        the table.
        rN)r?r@r )r&rDr'r'r(�add_cellvs
�zTable.add_cell�poscCs2|\}}|�|d�|�|d�|j||S�Nr)�_ensure_has_line�_ensure_has_columnr=)r&rF�liner$r'r'r(�__getitem__�szTable.__getitem__cCsn|\}}|�||j�|�||j�t|j�D]}t|j�D]}||j||||<||_||_q qdSr")rHrrIr �ranger=r%r$)r&rFrDrJr$�dline�dcolr'r'r(�__setitem__�s��zTable.__setitem__rJcCs0t|j�|kr|j�g�t|j�|ksdSdSr")rBr=�append)r&rJr'r'r(rH�s�zTable._ensure_has_liner$cCs2|jD]}t|�|kr|�d�t|�|ksqdSr")r=rBrP)r&r$rJr'r'r(rI�s

���zTable._ensure_has_columncCsd�dd�|jD��S)N�
cs��|]}t|�VqdSr")�repr)�.0rJr'r'r(�	<genexpr>���z!Table.__repr__.<locals>.<genexpr>)�joinr=r+r'r'r(r,��zTable.__repr__�sourcecCsDd}t||j|jfj�D]}|||j|7}q
||jddS)z�Give the cell width, according to the given source (either
        ``self.colwidth`` or ``self.measured_widths``).
        This takes into account cells spanning multiple columns.
        rr�)rLr%r$r )r&rDrYr0�ir'r'r(�
cell_width�szTable.cell_widthccsN�t�}t|j�D]\}}t|�D]\}}|r#||vr#|V|�|�qq	dSr")�set�	enumerater=�add)r&�seen�linenorJ�colnorDr'r'r(�cells�s�
���zTable.cellscCs�|jdd�|_|jD]9}|j|�||j�d�|jsqt�tdd�|jD��|j	�}t
|j|j|j	�D]
}t|j||�|j|<q6qdS)z�Call ``cell.wrap()`` on all cells, and measure each column width
        after wrapping (result written in ``self.measured_widths``).
        N�r0csrRr"r�rT�xr'r'r(rU�rVzTable.rewrap.<locals>.<genexpr>)r;�measured_widthsrcr2r\r#�math�ceil�maxr rLr$)r&rDr0r$r'r'r(�rewrap�s
 ��zTable.rewrapcCs"d}|D]
}t|t|j��}q|S)zfFor a given line, compute the number of physical lines it spans
        due to text wrapping.
        r)rjrBr#)r&rJ�physical_linesrDr'r'r(�physical_lines_for_line�szTable.physical_lines_for_linecs:g}���d
dtdttdtf�fdd�
}t�j�D]u\}}�jr0|�jkr0|�|d|��n|�|d|��t��	|��D]P}dg}t|�D]>\}}|j
|krRqH||jkrZd	}	n|t|j
�krdd	}	n|j
|}	t|	�t|	�}
|�d
|	���|�j�d|
�d�qH|�d	�|��q?q|�|d��d�|�S)N�-�charrar!cs�g}t�j�D]-\}}|dur+|dkr+�||f�|d|fur+|�d|d�q|�||d�q|dddkr?dnd}|d	ddkrKdnd}d
d�t||dd��D�}|�|�|d�t�t||���S)
zfCalled on the line *before* lineno.
            Called with no *lineno* for the last sep.
            Nrr� �rn�+�|���cSs0g|]\}}|ddks|ddkrdnd�qS)rrnrrrsr')rT�left�rightr'r'r(�
<listcomp>�s��z3Table.__str__.<locals>.writesep.<locals>.<listcomp>r)r^rgrP�ziprWr�
from_iterable)rora�outrbr0�head�tail�gluer+r'r(�writesep�s�
zTable.__str__.<locals>.writesep�=rsrrprrQ)rnN)rkr8r
r9r^r=r>rPrLrmr$r%rBr#r�ljustr\rgrW)r&rzr~rarJ�
physical_line�linestrrbrD�
physical_text�
adjust_lenr'r+r(�__str__�s> 


�����
z
Table.__str__r"�r!N)r4r5r6r7r	r9r)rArCrrErrKrOrHrIr8r,r\�propertyrrcrkrmr�r'r'r'r(r:6s"-





	r:c
s�eZdZdZe�d�Zdeedeefdd�Z	dede
deeeffd	d
�Zdedeef�fdd
�Z
deedeede
de
ddf
dd�Z�ZS)�TextWrapperz;Custom subclass that uses a different word separator regex.zf(\s+|(?<=\s)(?::[a-z-]+:)?`\S+|[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))�chunksr!cCsg}|jdkrtd|j��|��|r�g}d}|r|j}n|j}|jt|�}|jr8|d��dkr8|r8|d=|rUt|d�}|||krR|�|�	��||7}nn|s:|rgt|d�|krg|�
||||�|jrw|rw|d��dkrw|d=|r�|�|d�|��|s|S)z�_wrap_chunks(chunks : [string]) -> [string]

        The original _wrap_chunks uses len() to calculate width.
        This method respects wide/fullwidth characters for width adjustment.
        rzinvalid width %r (must be > 0)rtr)r0�
ValueError�reverse�subsequent_indent�initial_indentr�drop_whitespace�striprP�pop�_handle_long_wordrW)r&r�r=�cur_line�cur_len�indentr0�lr'r'r(�_wrap_chunkss8

�
�!zTextWrapper._wrap_chunks�word�
space_leftcCsVd}t|�D] \}}|t|�7}||kr&|d|d�||dd�fSq|dfS)z�_break_word(word : string, space_left : int) -> (string, string)

        Break line by unicode width instead of len(word).
        rNrr)r^r)r&r�r��totalr[�cr'r'r(�_break_word5s$�zTextWrapper._break_wordrcsrdtdttf��fdd�}g}||�D]"}t|t�D]\}}|dkr.|�|d�|���q|�t|��qq|S)z�_split(text : string) -> [string]

        Override original method that only split by 'wordsep_re'.
        This '_split' splits wide-characters into chunks by one character.
        �tr!cstt���|�Sr")�superr��_split)r�)�	__class__r&r'r(�splitGr/z!TextWrapper._split.<locals>.splitrr)r8r	rr�extendrW�list)r&rr�r��chunk�w�g�r�r+r(r�As�zTextWrapper._split�reversed_chunksr�r�r0NcCsXt||d�}|jr|�|d|�\}}|�|�||d<dS|s*|�|���dSdS)z�_handle_long_word(chunks : [string],
                             cur_line : [string],
                             cur_len : int, width : int)

        Override original method for using self._break_word() instead of slice.
        rrtN)rj�break_long_wordsr�rPr�)r&r�r�r�r0r�r��rr'r'r(r�Rs
�zTextWrapper._handle_long_word)r4r5r6r7�re�compile�
wordsep_rer	r8r�r9rr�r�r��
__classcell__r'r'r�r(r��s�/���r��FrZrr0�kwargsr!cKstdd|i|��}|�|�S)Nr0r')r�r2)rr0r�r�r'r'r(r1hs
r1csJeZdZUdZdZiZeed<dZe	ed<d
�fd	d
�Z
ddd�Z�ZS)�
TextWriter)r)zNo options here.rr'�settings_defaultsN�output�builderrr!cst���||_dSr")r�r)r�)r&r�r�r'r(r)t�

zTextWriter.__init__cCs0|j�|j|j�}|j�|�tt|�j|_dSr")r��create_translator�document�	walkaboutr�TextTranslator�bodyr�)r&�visitorr'r'r(�	translatexszTextWriter.translate)r�rr!Nr�)
r4r5r6�	supported�
settings_specr�r�__annotations__r�r8r)r�r�r'r'r�r(r�ms
r�c	sLeZdZUdZded<dejddddf�fdd�Zdeddfd	d
�Z	e
fdeddfdd
�Zddgdfde
deededdfdd�Zdeddfdd�Zdeddfdd�Zdeddfdd�Zdeddfdd�Zdeddfdd�Zdeddfd d!�ZeZeZdeddfd"d#�Zdeddfd$d%�Zdeddfd&d'�Zdeddfd(d)�Zdeddfd*d+�Zdeddfd,d-�Zdeddfd.d/�Zdedefd0d1�Z deddfd2d3�Z!deddfd4d5�Z"deddfd6d7�Z#deddfd8d9�Z$deddfd:d;�Z%deddfd<d=�Z&deddfd>d?�Z'deddfd@dA�Z(deddfdBdC�Z)deddfdDdE�Z*deddfdFdG�Z+deddfdHdI�Z,deddfdJdK�Z-deddfdLdM�Z.deddfdNdO�Z/deddfdPdQ�Z0deddfdRdS�Z1deddfdTdU�Z2deddfdVdW�Z3deddfdXdY�Z4deddfdZd[�Z5deddfd\d]�Z6deddfd^d_�Z7deddfd`da�Z8deddfdbdc�Z9deddfddde�Z:deddfdfdg�Z;deddfdhdi�Z<deddfdjdk�Z=deddfdldm�Z>deddfdndo�Z?deddfdpdq�Z@deddfdrds�ZAdeddfdtdu�ZBdeddfdvdw�ZCdeddfdxdy�ZDdeddfdzd{�ZEdeddfd|d}�ZFdeddfd~d�ZGdeddfd�d��ZHdeddfd�d��ZIdeddfd�d��ZJdeddfd�d��ZKdeddfd�d��ZLdeddfd�d��ZMdeddfd�d��ZNdeddfd�d��ZOdeddfd�d��ZPdeddfd�d��ZQdeddfd�d��ZRdeddfd�d��ZSdeddfd�d��ZTdeddfd�d��ZUdeddfd�d��ZVdeddfd�d��ZWdeddfd�d��ZXdeddfd�d��ZYdeddfd�d��ZZdeddfd�d��Z[deddfd�d��Z\deddfd�d��Z]deddfd�d��Z^deddfd�d��Z_deddfd�d��Z`deddfd�d��Zadeddfd�d��Zbdeddfd�d��Zcdeddfd�d��Zddeddfd�d��Zededdfd�d��Zfdeddfd�d��Zgdeddfd�d��Zhdeddfd�dÄZideddfd�dńZjdeddfd�dDŽZkdeddfd�dɄZldeddfd�d˄Zmdeddfd�d̈́Zndeddfd�dτZodeddfd�dфZpdeddfd�dӄZqdeddfd�dՄZrdeddfd�dׄZsdeddfd�dلZtdeddfd�dۄZudeddfd�d݄Zvdeddfd�d߄Zwdeddfd�d�Zxdeddfd�d�Zydeddfd�d�Zzdeddfd�d�Z{deddfd�d�Z|deddfd�d�Z}deddfd�d�Z~deddfd�d�Zdeddfd�d�Z�deddfd�d�Z�deddfd�d��Z�deddfd�d��Z�deddfd�d��Z�deddfd�d��Z�deddfd�d��Z�deddfd�d��Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d�d�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�e�Z�deddf�d�d	�Z�deddf�d
�d�Z�deddf�d�d
�Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d�d�Z�deddf�d �d!�Z�deddf�d"�d#�Z�deddf�d$�d%�Z�deddf�d&�d'�Z�deddf�d(�d)�Z�deddf�d*�d+�Z�deddf�d,�d-�Z�deddf�d.�d/�Z�deddf�d0�d1�Z�deddf�d2�d3�Z�deddf�d4�d5�Z�deddf�d6�d7�Z�deddf�d8�d9�Z�deddf�d:�d;�Z�deddf�d<�d=�Z�deddf�d>�d?�Z�deddf�d@�dA�Z�deddf�dB�dC�Z�deddf�dD�dE�Z�deddf�dF�dG�Z�deddf�dH�dI�Z�deddf�dJ�dK�Z�deddf�dL�dM�Z�deddf�dN�dO�Z�deddf�dP�dQ�Z�deddf�dR�dS�Z�deddf�dT�dU�Z�deddf�dV�dW�Z�deddf�dX�dY�Z�deddf�dZ�d[�Z�deddf�d\�d]�Z�deddf�d^�d_�Z�deddf�d`�da�Z�deddf�db�dc�Z�deddf�dd�de�Z�deddf�df�dg�Z�deddf�dh�di�Z�de�ddf�dj�dk�Z�de�ddf�dl�dm�Z�deddf�dn�do�Z�deddf�dp�dq�Z�deddf�dr�ds�Z�deddf�dt�du�Z�deddf�dv�dw�Z�deddf�dx�dy�Z�deddf�dz�d{�Z�deddf�d|�d}�Z�deddf�d~�d�Z�deddf�d��d��Z�deddf�d��d��Z�deddf�d��d��Z�deddf�d��d��Z�deddf�d��d��Z�deddf�d��d��Z�deddf�d��d��Z�de�ddf�d��d��Z�Z�S(�r�Nrr�r�r!cs�t��||�|jj}|dkrd|_n|dkrtj|_nd|_|jj|_|jj	|_
|jj|_gg|_
dg|_g|_d|_d|_d|_dS)N�windowsz
�nativerQr)r�r)�config�
text_newlines�nl�os�linesep�text_sectionchars�sectionchars�text_add_secnumbers�add_secnumbers�text_secnumber_suffix�secnumber_suffix�states�stateindent�list_counter�sectionlevel�lineblocklevel�table)r&r�r��newlinesr�r'r(r)�s 




zTextTranslator.__init__rcCs|jd�d|f�dS�Nrt)r�rP)r&rr'r'r(�add_text�szTextTranslator.add_textr�cCs|j�g�|j�|�dSr")r�rPr�)r&r�r'r'r(�	new_state�szTextTranslator.new_stateTrr2�end�firstc
s|j��}t|j��|j���g�g�d������fdd�}|D]\}}|dkr/��|�q!|����||f�g�q!|�|durv�rv�dd�}�dddgkrb��d||gf�n|�dd�d�}	��d||	gf�|jd���dS)	Nr!csP�sdS�rtd���t�d�}nd�����}�r|�7}���|f�dS)Nrrd)r1rW�MAXWIDTH�
splitlinesrP)�res�r�r��	maxindent�result�toformatr2r'r(�	do_format�sz+TextTranslator.end_state.<locals>.do_formatrtrrrr�)r�r��sumr�rP�insertr�)
r&r2r�r��contentr��
itemindent�item�	newindentrr'r�r(�	end_state�s(



zTextTranslator.end_state�nodecC�|�d�dSr<�r��r&r�r'r'r(�visit_document��zTextTranslator.visit_documentcCs*|��|j�dd�|jdD��|_dS)Ncss.�|]\}}|D]}|od||VqqdS)rpNr')rTr�r=rJr'r'r(rU�s���z1TextTranslator.depart_document.<locals>.<genexpr>r)r�r�rWr�r�r�r'r'r(�depart_document�s�zTextTranslator.depart_documentcCs |j|j|_|jd7_dSrG)r�r��_title_charr�r'r'r(�
visit_section�szTextTranslator.visit_sectioncCs|jd8_dSrG)r�r�r'r'r(�depart_section�r3zTextTranslator.depart_sectioncCr�r<r�r�r'r'r(�visit_topic�r�zTextTranslator.visit_topiccC�|��dSr"�r�r�r'r'r(�depart_topic��zTextTranslator.depart_topiccCs|�d�|�d�dS)Nrz-[ )r�r�r�r'r'r(�visit_rubric�s
zTextTranslator.visit_rubriccCs|�d�|��dS)Nz ]-�r�r�r�r'r'r(�
depart_rubric�s
zTextTranslator.depart_rubriccC�dSr"r'r�r'r'r(�visit_compound��zTextTranslator.visit_compoundcCr�r"r'r�r'r'r(�depart_compound�r�zTextTranslator.depart_compoundcCr�r"r'r�r'r'r(�visit_glossary�r�zTextTranslator.visit_glossarycCr�r"r'r�r'r'r(�depart_glossary�r�zTextTranslator.depart_glossarycCs4t|jtj�r|�|��d�tj�|�d�dS)N�: r)�
isinstance�parentr�
Admonitionr��astext�SkipNoder�r�r'r'r(�visit_title�szTextTranslator.visit_titlecCsft|jtj�r1d|jdd}|jj�|�}|dur"|jj�d�}|dur1d�tt	|��|j
SdS)N�#�idsrr�.)rrr�sectionr��
secnumbers�getrW�mapr8r�)r&r��
anchorname�numbersr'r'r(�get_section_number_string�sz(TextTranslator.get_section_number_stringcCs�t|jtj�r|j}nd}d}d�dd�|j��D��}|jr&|�	|�|}|j
��d|d|t|�dg}t|j�dkrLt|jd�dkrL|�d�|jd�
d|f�dS)	N�^rcss$�|]
}|ddkr|dVqdS)rrtrNr'rer'r'r(rUs�"z.TextTranslator.depart_title.<locals>.<genexpr>z%srqrtr)rrrr	r�rWr�r�r�rr�rrBrP)r&r�ror�titler'r'r(�depart_title�s
 
zTextTranslator.depart_titlecCr�r"r'r�r'r'r(�visit_subtitler�zTextTranslator.visit_subtitlecCr�r"r'r�r'r'r(�depart_subtitler�zTextTranslator.depart_subtitlecCr�)Nz-- �r�r�r'r'r(�visit_attributionr�z TextTranslator.visit_attributioncCr�r"r'r�r'r'r(�depart_attributionr�z!TextTranslator.depart_attributioncCr�r"r'r�r'r'r(�
visit_desc!r�zTextTranslator.visit_desccCr�r"r'r�r'r'r(�depart_desc$r�zTextTranslator.depart_desccCr�r<r�r�r'r'r(�visit_desc_signature'r�z#TextTranslator.visit_desc_signaturecCs|jddd�dS)NF�r2r�r�r�r'r'r(�depart_desc_signature*sz$TextTranslator.depart_desc_signaturecCr�r"r'r�r'r'r(�visit_desc_signature_line.r�z(TextTranslator.visit_desc_signature_linecCr��NrQrr�r'r'r(�depart_desc_signature_line1r�z)TextTranslator.depart_desc_signature_linecCs|��|�|j�dSr")r�r�r�r�r'r'r(�visit_desc_content4sz!TextTranslator.visit_desc_contentcCr�r"r�r�r'r'r(�depart_desc_content8r�z"TextTranslator.depart_desc_contentcCr�r"r'r�r'r'r(�visit_desc_inline;r�z TextTranslator.visit_desc_inlinecCr�r"r'r�r'r'r(�depart_desc_inline>r�z!TextTranslator.depart_desc_inlinecCr�r"r'r�r'r'r(�visit_desc_nameDr�zTextTranslator.visit_desc_namecCr�r"r'r�r'r'r(�depart_desc_nameGr�zTextTranslator.depart_desc_namecCr�r"r'r�r'r'r(�visit_desc_addnameJr�z!TextTranslator.visit_desc_addnamecCr�r"r'r�r'r'r(�depart_desc_addnameMr�z"TextTranslator.depart_desc_addnamecCr�r"r'r�r'r'r(�visit_desc_typePr�zTextTranslator.visit_desc_typecCr�r"r'r�r'r'r(�depart_desc_typeSr�zTextTranslator.depart_desc_typecCr�)Nz -> rr�r'r'r(�visit_desc_returnsVr�z!TextTranslator.visit_desc_returnscCr�r"r'r�r'r'r(�depart_desc_returnsYr�z"TextTranslator.depart_desc_returnscCs|�d�d|_dS)N�(r)r��first_paramr�r'r'r(�visit_desc_parameterlist\r�z'TextTranslator.visit_desc_parameterlistcCr�)N�)rr�r'r'r(�depart_desc_parameterlist`r�z(TextTranslator.depart_desc_parameterlistcCs,|js	|�d�nd|_|�|���tj�)N�, r)r-r�rrrr�r'r'r(�visit_desc_parametercs
z#TextTranslator.visit_desc_parametercCr�)N�[rr�r'r'r(�visit_desc_optionalkr�z"TextTranslator.visit_desc_optionalcCr�)N�]rr�r'r'r(�depart_desc_optionalnr�z#TextTranslator.depart_desc_optionalcCr�r"r'r�r'r'r(�visit_desc_annotationqr�z$TextTranslator.visit_desc_annotationcCr�r"r'r�r'r'r(�depart_desc_annotationtr�z%TextTranslator.depart_desc_annotationcCr�r"r�r�r'r'r(�visit_figureyr�zTextTranslator.visit_figurecCr�r"r�r�r'r'r(�
depart_figure|r�zTextTranslator.depart_figurecCr�r"r'r�r'r'r(�
visit_captionr�zTextTranslator.visit_captioncCr�r"r'r�r'r'r(�depart_caption�r�zTextTranslator.depart_captioncCs�|��g}tttj|�}|D]	}|�|d�qtdd�|D��}d}|D]0}|dr>|�|d�|�d�|d}n|durM|�ddt	|��|�|�
�|j�q'|jdd�t
j�)	N�	tokennamecsrRr"�rB)rT�namer'r'r(rU�rVz6TextTranslator.visit_productionlist.<locals>.<genexpr>z ::=z%s    rpF�r2)r�rrr�
productionrPrjr�r�rBrr�r�rr)r&r��names�productionlistrA�maxlen�lastnamer'r'r(�visit_productionlist�s 
z#TextTranslator.visit_productionlistcCs6ttj|d�}|����|_|�t|j�d�dS)NrrZ)rr�labelrr��	_footnoter�rB)r&r�rGr'r'r(�visit_footnote�szTextTranslator.visit_footnotecC�|jd|jd�dS�Nz[%s] �r�)r�rHr�r'r'r(�depart_footnote�rXzTextTranslator.depart_footnotecCsFt|�rt|dtj�r|d��|_nd|_|�t|j�d�dS)NrrrZ)rBrrrGr�	_citlabelr�r�r'r'r(�visit_citation�szTextTranslator.visit_citationcCrJrK)r�rNr�r'r'r(�depart_citation�rXzTextTranslator.depart_citationcC�tj�r"�rrr�r'r'r(�visit_label��zTextTranslator.visit_labelcCr�r"r'r�r'r'r(�visit_legend�r�zTextTranslator.visit_legendcCr�r"r'r�r'r'r(�
depart_legend�r�zTextTranslator.depart_legendcCr�r"r'r�r'r'r(�visit_option_list�r�z TextTranslator.visit_option_listcCr�r"r'r�r'r'r(�depart_option_list�r�z!TextTranslator.depart_option_listcCr�r<r�r�r'r'r(�visit_option_list_item�r�z%TextTranslator.visit_option_list_itemcCr�r"r�r�r'r'r(�depart_option_list_item�r�z&TextTranslator.depart_option_list_itemcCs
d|_dS)NT)�_firstoptionr�r'r'r(�visit_option_group��
z!TextTranslator.visit_option_groupcCr�)Nz     rr�r'r'r(�depart_option_group�r�z"TextTranslator.depart_option_groupcCs|jrd|_dS|�d�dS)NFr1)r[r�r�r'r'r(�visit_option�s
zTextTranslator.visit_optioncCr�r"r'r�r'r'r(�
depart_option�r�zTextTranslator.depart_optioncCr�r"r'r�r'r'r(�visit_option_string�r�z"TextTranslator.visit_option_stringcCr�r"r'r�r'r'r(�depart_option_string�r�z#TextTranslator.depart_option_stringcCs|�|d�dS)N�	delimiterrr�r'r'r(�visit_option_argument�r3z$TextTranslator.visit_option_argumentcCr�r"r'r�r'r'r(�depart_option_argument�r�z%TextTranslator.depart_option_argumentcCr�r"r'r�r'r'r(�visit_description�r�z TextTranslator.visit_descriptioncCr�r"r'r�r'r'r(�depart_description�r�z!TextTranslator.depart_descriptioncCrQr"rRr�r'r'r(�visit_tabular_col_spec�rTz%TextTranslator.visit_tabular_col_speccCs|jj�|d�tj�)Nr;)r�r;rPrrr�r'r'r(�
visit_colspec��zTextTranslator.visit_colspeccCr�r"r'r�r'r'r(�visit_tgroup�r�zTextTranslator.visit_tgroupcCr�r"r'r�r'r'r(�
depart_tgroup�r�zTextTranslator.depart_tgroupcCr�r"r'r�r'r'r(�visit_thead�r�zTextTranslator.visit_theadcCr�r"r'r�r'r'r(�depart_thead�r�zTextTranslator.depart_theadcC�|j��dSr")r�rCr�r'r'r(�visit_tbody�r�zTextTranslator.visit_tbodycCr�r"r'r�r'r'r(�depart_tbody�r�zTextTranslator.depart_tbodycCs|jjr|j��dSdSr")r�r=rAr�r'r'r(�	visit_row�s�zTextTranslator.visit_rowcCr�r"r'r�r'r'r(�
depart_row�r�zTextTranslator.depart_rowcCs4t|�dd�d|�dd�dd�|_|�d�dS)N�morerowsrr�morecols)rr )rr�entryr�r�r'r'r(�visit_entrys�zTextTranslator.visit_entrycsJ�j��fdd��j��D��}�j��|�j_�j��j�d�_dS)Nc3s �|]}�j�|d�VqdS)rN)r�rWrer+r'r(rUs�z.TextTranslator.depart_entry.<locals>.<genexpr>)	r�rWr�r�r�rvrr�rE�r&r�rr'r+r(�depart_entrys
 

zTextTranslator.depart_entrycCs$|jrtd��|�d�t�|_dS)Nz Nested tables are not supported.r)r��NotImplementedErrorr�r:r�r'r'r(�visit_tables
zTextTranslator.visit_tablecCs&|�t|j��d|_|jdd�dS�NFr@)r�r8r�r�r�r'r'r(�depart_tableszTextTranslator.depart_tablecCsVttj|d�}tttj|�}|�d�|�d�dd�|D��d�|��tj	�)Nrr1css�|]}|��VqdSr")r)rT�nr'r'r(rUrVz,TextTranslator.visit_acks.<locals>.<genexpr>r)
rr�bullet_listr�	list_itemr�r�rWr�r)r&r�r�
list_itemsr'r'r(�
visit_ackss
zTextTranslator.visit_ackscCs4d|jvr|�td�|d�|�td��tj�)N�altz[image: %s]z[image])�
attributesr�rrrr�r'r'r(�visit_image!s
zTextTranslator.visit_imagecCs4t|j�}|�d�|�dt|�|��tj�)Nrr)r�r�r�r�r�r�rr)r&r�r�r'r'r(�visit_transition's


zTextTranslator.visit_transitioncC�|j�d�dSr��r�rPr�r'r'r(�visit_bullet_list.r/z TextTranslator.visit_bullet_listcCror"�r�r�r�r'r'r(�depart_bullet_list1r�z!TextTranslator.depart_bullet_listcCs|j�|�dd�d�dS)N�startr)r�rPrr�r'r'r(�visit_enumerated_list4sz$TextTranslator.visit_enumerated_listcCror"r�r�r'r'r(�depart_enumerated_list7r�z%TextTranslator.depart_enumerated_listcCr�)N���r�r�r'r'r(�visit_definition_list:r/z$TextTranslator.visit_definition_listcCror"r�r�r'r'r(�depart_definition_list=r�z%TextTranslator.depart_definition_listcCs`|jddkr|�d�dS|jddkrdS|jdd7<|�tt|jd��d�dS)Nrtrqr�r)r�r�rBr8r�r'r'r(�visit_list_item@s zTextTranslator.visit_list_itemcCsJ|jddkr|jdd�dS|jddkrdS|jd|jdd�dS)Nrtz* rLr�z%s. )r�r�r�r'r'r(�depart_list_itemLs
zTextTranslator.depart_list_itemcCstt|�tj���|_dSr")rBr��traverser�
classifier�_classifier_count_in_lir�r'r'r(�visit_definition_list_itemTsz)TextTranslator.visit_definition_list_itemcCr�r"r'r�r'r'r(�depart_definition_list_itemWr�z*TextTranslator.depart_definition_list_itemcCr�r<r�r�r'r'r(�
visit_termZr�zTextTranslator.visit_termcCs|js|jdd�dSdS)N�r��r�r�r�r'r'r(�depart_term]s�zTextTranslator.depart_termcCr�)Nz : rr�r'r'r(�visit_classifierar�zTextTranslator.visit_classifiercCs(|jd8_|js|jdd�dSdS)Nrr�r�r�r'r'r(�depart_classifierds�z TextTranslator.depart_classifiercCr�r"r�r�r'r'r(�visit_definitionir�zTextTranslator.visit_definitioncCr�r"r�r�r'r'r(�depart_definitionlr�z TextTranslator.depart_definitioncCr�r"r'r�r'r'r(�visit_field_listor�zTextTranslator.visit_field_listcCr�r"r'r�r'r'r(�depart_field_listrr�z TextTranslator.depart_field_listcCr�r"r'r�r'r'r(�visit_fieldur�zTextTranslator.visit_fieldcCr�r"r'r�r'r'r(�depart_fieldxr�zTextTranslator.depart_fieldcCr�r<r�r�r'r'r(�visit_field_name{r�zTextTranslator.visit_field_namecCs|�d�|jdd�dS)N�:r�r�r�r'r'r(�depart_field_name~s
z TextTranslator.depart_field_namecCr�r"r�r�r'r'r(�visit_field_body�r�zTextTranslator.visit_field_bodycCr�r"r�r�r'r'r(�depart_field_body�r�z TextTranslator.depart_field_bodycCr�r"r'r�r'r'r(�visit_centered�r�zTextTranslator.visit_centeredcCr�r"r'r�r'r'r(�depart_centered�r�zTextTranslator.depart_centeredcCr�r"r'r�r'r'r(�visit_hlist�r�zTextTranslator.visit_hlistcCr�r"r'r�r'r'r(�depart_hlist�r�zTextTranslator.depart_hlistcCr�r"r'r�r'r'r(�visit_hlistcol�r�zTextTranslator.visit_hlistcolcCr�r"r'r�r'r'r(�depart_hlistcol�r�zTextTranslator.depart_hlistcolcCr�r<r�r�r'r'r(�visit_admonition�r�zTextTranslator.visit_admonitioncCr�r"r�r�r'r'r(�depart_admonition�r�z TextTranslator.depart_admonitioncCr�)Nrqr�r�r'r'r(�_visit_admonition�r�z TextTranslator._visit_admonitioncCs�t|j}t|j�t|�}t|jd�dkrK|jddddkrKt|tdd�|jdddD��krK|jdt|�7<|j|dd�dS|jd�dd|j	gf�|j|dd�dS)	NrtrrcsrRr"r>)rT�sr'r'r(rU�rVz4TextTranslator._depart_admonition.<locals>.<genexpr>r�rLr�)
r�tagnamer�r�rBr�r�r�r�r�)r&r�rGr�r'r'r(�_depart_admonition�s
(z!TextTranslator._depart_admonitioncCr�r<r�r�r'r'r(�visit_versionmodified�r�z$TextTranslator.visit_versionmodifiedcCr�r"r�r�r'r'r(�depart_versionmodified�r�z%TextTranslator.depart_versionmodifiedcCr�r"r�r�r'r'r(�visit_literal_block�r�z"TextTranslator.visit_literal_blockcC�|jdd�dSr|r�r�r'r'r(�depart_literal_block�r/z#TextTranslator.depart_literal_blockcCr�r<r�r�r'r'r(�visit_doctest_block�r�z"TextTranslator.visit_doctest_blockcCr�r|r�r�r'r'r(�depart_doctest_block�r/z#TextTranslator.depart_doctest_blockcCs|��|jd7_dSrG)r�r�r�r'r'r(�visit_line_block�szTextTranslator.visit_line_blockcCs4|jd8_|jddd�|js|�d�dSdS)NrFrrQ)r�r�r�r�r'r'r(�depart_line_block�s
�z TextTranslator.depart_line_blockcCr�r"r'r�r'r'r(�
visit_line�r�zTextTranslator.visit_linecCr�rrr�r'r'r(�depart_line�r�zTextTranslator.depart_linecCr�r"r�r�r'r'r(�visit_block_quote�r�z TextTranslator.visit_block_quotecCr�r"r�r�r'r'r(�depart_block_quote�r�z!TextTranslator.depart_block_quotecCr�r"r'r�r'r'r(�visit_compact_paragraph�r�z&TextTranslator.visit_compact_paragraphcCr�r"r'r�r'r'r(�depart_compact_paragraph�r�z'TextTranslator.depart_compact_paragraphcCs.t|jtj�rt|jtj�r|�d�dSdSr<)rrrrr�seealsor�r�r'r'r(�visit_paragraph�s
��zTextTranslator.visit_paragraphcCs,t|jtj�rt|jtj�r|��dSdSr")rrrrrr�r�r�r'r'r(�depart_paragraph�s
��zTextTranslator.depart_paragraphcCrQr"rRr�r'r'r(�visit_target�rTzTextTranslator.visit_targetcCrQr"rRr�r'r'r(�visit_indexrTzTextTranslator.visit_indexcCrQr"rRr�r'r'r(�
visit_toctreerTzTextTranslator.visit_toctreecCrQr"rRr�r'r'r(�visit_substitution_definitionrTz,TextTranslator.visit_substitution_definitioncCr�r"r'r�r'r'r(�visit_pending_xref
r�z!TextTranslator.visit_pending_xrefcCr�r"r'r�r'r'r(�depart_pending_xref
r�z"TextTranslator.depart_pending_xrefcCs@|jr|�d�}|dur|�d�tt|��|j�dSdSdS)N�	secnumberr)r�rr�rWrr8r�)r&r�rr'r'r(�visit_references
 �zTextTranslator.visit_referencecCr�r"r'r�r'r'r(�depart_referencer�zTextTranslator.depart_referencecCs"t�|�dd��}|�|�tj�)Nrr)rrr�
visit_Textrrxr'r'r(�visit_number_references
z%TextTranslator.visit_number_referencecCr�r"r'r�r'r'r(�visit_download_referencer�z'TextTranslator.visit_download_referencecCr�r"r'r�r'r'r(�depart_download_reference!r�z(TextTranslator.depart_download_referencecCr��N�*rr�r'r'r(�visit_emphasis$r�zTextTranslator.visit_emphasiscCr�r�rr�r'r'r(�depart_emphasis'r�zTextTranslator.depart_emphasiscCr�r�rr�r'r'r(�visit_literal_emphasis*r�z%TextTranslator.visit_literal_emphasiscCr�r�rr�r'r'r(�depart_literal_emphasis-r�z&TextTranslator.depart_literal_emphasiscCr��Nz**rr�r'r'r(�visit_strong0r�zTextTranslator.visit_strongcCr�r�rr�r'r'r(�
depart_strong3r�zTextTranslator.depart_strongcCr�r�rr�r'r'r(�visit_literal_strong6r�z#TextTranslator.visit_literal_strongcCr�r�rr�r'r'r(�depart_literal_strong9r�z$TextTranslator.depart_literal_strongcCr�)Nrrr�r'r'r(�visit_abbreviation<r�z!TextTranslator.visit_abbreviationcCs$|�d�r|�d|d�dSdS)N�explanationz (%s))�hasattrr�r�r'r'r(�depart_abbreviation?s
�z"TextTranslator.depart_abbreviationcC�
|�|�Sr")r�r�r'r'r(�
visit_manpageCr]zTextTranslator.visit_manpagecCr�r")r�r�r'r'r(�depart_manpageFr]zTextTranslator.depart_manpagecCr�r�rr�r'r'r(�visit_title_referenceIr�z$TextTranslator.visit_title_referencecCr�r�rr�r'r'r(�depart_title_referenceLr�z%TextTranslator.depart_title_referencecCr��N�"rr�r'r'r(�
visit_literalOr�zTextTranslator.visit_literalcCr�r�rr�r'r'r(�depart_literalRr�zTextTranslator.depart_literalcCr�)Nrrr�r'r'r(�visit_subscriptUr�zTextTranslator.visit_subscriptcCr�r"r'r�r'r'r(�depart_subscriptXr�zTextTranslator.depart_subscriptcCr�)Nrrr�r'r'r(�visit_superscript[r�z TextTranslator.visit_superscriptcCr�r"r'r�r'r'r(�depart_superscript^r�z!TextTranslator.depart_superscriptcC�|�d|���tj��Nz[%s]�r�rrrr�r'r'r(�visit_footnote_referencearjz'TextTranslator.visit_footnote_referencecCr�r�r�r�r'r'r(�visit_citation_referenceerjz'TextTranslator.visit_citation_referencecCs|�|���dSr")r�rr�r'r'r(r�ir3zTextTranslator.visit_TextcCr�r"r'r�r'r'r(�depart_Textlr�zTextTranslator.depart_TextcCr�r"r'r�r'r'r(�visit_generatedor�zTextTranslator.visit_generatedcCr�r"r'r�r'r'r(�depart_generatedrr�zTextTranslator.depart_generatedcC�*d|dvsd|dvr|�d�dSdS�N�xref�classes�termr�rr�r'r'r(�visit_inlineu��zTextTranslator.visit_inlinecCr�r�rr�r'r'r(�
depart_inlineyr�zTextTranslator.depart_inlinecCr�r"r'r�r'r'r(�visit_container}r�zTextTranslator.visit_containercCr�r"r'r�r'r'r(�depart_container�r�zTextTranslator.depart_containercCr�)Nz>>rr�r'r'r(�visit_problematic�r�z TextTranslator.visit_problematiccCr�)Nz<<rr�r'r'r(�depart_problematic�r�z!TextTranslator.depart_problematiccCs*|�d�|�d|���|��tj�)Nrz<SYSTEM MESSAGE: %s>)r�r�rr�rrr�r'r'r(�visit_system_message�s
z#TextTranslator.visit_system_messagecCrQr"rRr�r'r'r(�
visit_comment�rTzTextTranslator.visit_commentcCrQr"rRr�r'r'r(�
visit_meta�szTextTranslator.visit_metacCs>d|�dd���vr|�d�|�|���|jdd�tj�)Nrr*rrFr@)rr�r�r�rr�rrr�r'r'r(�	visit_raw�s

zTextTranslator.visit_rawcCr�r"r'r�r'r'r(�
visit_math�r�zTextTranslator.visit_mathcCr�r"r'r�r'r'r(�depart_math�r�zTextTranslator.depart_mathcCr�r"r�r�r'r'r(�visit_math_block�r�zTextTranslator.visit_math_blockcCr�r"r�r�r'r'r(�depart_math_block�r�z TextTranslator.depart_math_blockcCstd|jj��)NzUnknown node: )rzr�r4r�r'r'r(�
unknown_visit�r/zTextTranslator.unknown_visit)�r4r5r6r�r�rr�r)r8r��	STDINDENTr9r��boolr	r�rr�r�r�r�r�r��
visit_sidebar�depart_sidebarr�r�r�r�r�r�rrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r.r0r2r4r6r7r8r9r:r;r<rFrIrMrOrPrSrUrVrWrXrYrZr\r^r_r`rarbrdrerfrgrhrirkrlrmrnrprqrrrsrwryr{r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��visit_attention�depart_attention�
visit_caution�depart_caution�visit_danger�
depart_danger�visit_error�depart_error�
visit_hint�depart_hint�visit_important�depart_important�
visit_note�depart_note�	visit_tip�
depart_tip�
visit_warning�depart_warning�
visit_seealso�depart_seealsor�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�r�rrrrrrrrrr	r
rrrr
r�r'r'r�r(r�~s�
($

r�)1r7rhr�r��textwrap�	itertoolsrr�typingrrrrrr	r
rrr
r�docutilsrr�docutils.nodesrrr�docutils.utilsr�sphinxr�
sphinx.localerr�sphinx.util.docutilsr�sphinx.builders.textrrr:r�r�rr8r9r1�Writerr�r�r'r'r'r(�<module>s0	4Hg"