
    HR-e	                         d Z ddlmZ ddlmZmZmZmZ  G d de          Z G d de          Z	 G d d	e          Z
d
S )z2
:Author: Simon Gibbons (simongibbons@gmail.com).
   )DefaultSplitter)
FixedWidthFixedWidthDataFixedWidthHeaderFixedWidthTwoLineDataSplitterc                   .     e Zd ZdZdZeZdZ fdZ xZ	S )SimpleRSTHeader    r   =c                 b    t                                          |          \  }}}d |d<   |||fS )N)superget_fixedwidth_params)selflinevalsstartsends	__class__s        4lib/python3.11/site-packages/astropy/io/ascii/rst.pyr   z%SimpleRSTHeader.get_fixedwidth_params   s7    "WW::4@@fdRVT!!    )
__name__
__module____qualname__position_line
start_liner   splitter_classposition_charr   __classcell__r   s   @r   r	   r	      sL        MJ$NM" " " " " " " " "r   r	   c                       e Zd ZdZeZdS )SimpleRSTDatar   N)r   r   r   end_liner   r    r   r   r"   r"      s        H2NNNr   r"   c                   H     e Zd ZdZdZdZeZeZ	d fd	Z
 fdZ fdZ xZS )	RSTaU  reStructuredText simple format table.

    See: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#simple-tables

    Example::

      >>> from astropy.table import QTable
      >>> import astropy.units as u
      >>> import sys
      >>> tbl = QTable({"wave": [350, 950] * u.nm, "response": [0.7, 1.2] * u.count})
      >>> tbl.write(sys.stdout,  format="ascii.rst")
      ===== ========
       wave response
      ===== ========
      350.0      0.7
      950.0      1.2
      ===== ========

    Like other fixed-width formats, when writing a table you can provide ``header_rows``
    to specify a list of table rows to output as the header.  For example::

      >>> tbl.write(sys.stdout,  format="ascii.rst", header_rows=['name', 'unit'])
      ===== ========
       wave response
         nm       ct
      ===== ========
      350.0      0.7
      950.0      1.2
      ===== ========

    Currently there is no support for reading tables which utilize continuation lines,
    or for ones which define column spans through the use of an additional
    line of dashes in the header.

    rstzreStructuredText simple tableNc                 P    t                                          d d|           d S )NF)delimiter_padbookendheader_rows)r   __init__)r   r+   r   s     r   r,   zRST.__init__L   s(    tUTTTTTr   c                     t                                          |          }t          | j        j                  }||         g|z   ||         gz   }|S N)r   writelenheaderr+   )r   linesidxr   s      r   r/   z	RST.writeO   sJ    e$$$+)**su$c
|3r   c                     dt          | j        j                  z   | j        _        t                                          |          S )N   )r0   r1   r+   datar   r   read)r   tabler   s     r   r7   zRST.readU   s5     3t{'>#?#??	ww||E"""r   r.   )r   r   r   __doc___format_name_descriptionr"   
data_classr	   header_classr,   r/   r7   r   r    s   @r   r&   r&   "   s        " "H L2LJ"LU U U U U U    # # # # # # # # #r   r&   N)r9   corer   
fixedwidthr   r   r   r   r	   r"   r&   r$   r   r   <module>r@      s    
 " ! ! ! ! !           
" 
" 
" 
" 
"& 
" 
" 
"3 3 3 3 3N 3 3 3
5# 5# 5# 5# 5#* 5# 5# 5# 5# 5#r   