U
    e»{jÞ  ã                   @   sP   d dl mZ ddlmZ ddgZddgZG dd„ dejƒZG dd„ dejƒZdS )	é    ©Úregistryé   )Úserialize_method_asÚ	TableReadÚ
TableWritec                       s(   e Zd ZdZ‡ fdd„Zdd„ Z‡  ZS )r   ax  Read and parse a data table and return as a Table.

    This function provides the Table interface to the astropy unified I/O
    layer.  This allows easily reading a file in many supported data formats
    using syntax such as::

      >>> from astropy.table import Table
      >>> dat = Table.read('table.dat', format='ascii')
      >>> events = Table.read('events.fits', format='fits')

    Get help on the available readers for ``Table`` using the``help()`` method::

      >>> Table.read.help()  # Get help reading Table and list supported formats
      >>> Table.read.help('fits')  # Get detailed help on Table FITS reader
      >>> Table.read.list_formats()  # Print list of available formats

    See also: https://docs.astropy.org/en/stable/io/unified.html

    Parameters
    ----------
    *args : tuple, optional
        Positional arguments passed through to data reader. If supplied the
        first argument is typically the input filename.
    format : str
        File format specifier.
    units : list, dict, optional
        List or dict of units to apply to columns
    descriptions : list, dict, optional
        List or dict of descriptions to apply to columns
    **kwargs : dict, optional
        Keyword arguments passed through to data reader.

    Returns
    -------
    out : `~astropy.table.Table`
        Table corresponding to file contents

    Notes
    -----
    c                    s   t ƒ j||dd d� d S )NÚreadr   ©ÚsuperÚ__init__©ÚselfÚinstanceÚcls©Ú	__class__© úT/var/www/html/bwave/python/venv/lib/python3.8/site-packages/astropy/table/connect.pyr   5   s    zTableRead.__init__c                 O   s�   | j }| dd ¡}| dd ¡}| jj|f|ž|Ž}||jk	rtz||dd�}W n& tk
rr   td|j› d�ƒ‚Y nX | d|¡ | d|¡ |S )	NÚunitsÚdescriptionsF)Úcopyz#could not convert reader output to z class.ÚunitÚdescription)	Ú_clsÚpopr   r   r   Ú	ExceptionÚ	TypeErrorÚ__name__Z_set_column_attribute)r   ÚargsÚkwargsr   r   r   Úoutr   r   r   Ú__call__9   s    
ÿ
zTableRead.__call__©r   Ú
__module__Ú__qualname__Ú__doc__r   r!   Ú__classcell__r   r   r   r   r      s   )c                       s.   e Zd ZdZ‡ fdd„Zddœdd„Z‡  ZS )r   as  
    Write this Table object out in the specified format.

    This function provides the Table interface to the astropy unified I/O
    layer.  This allows easily writing a file in many supported data formats
    using syntax such as::

      >>> from astropy.table import Table
      >>> dat = Table([[1, 2], [3, 4]], names=('a', 'b'))
      >>> dat.write('table.dat', format='ascii')

    Get help on the available writers for ``Table`` using the``help()`` method::

      >>> Table.write.help()  # Get help writing Table and list supported formats
      >>> Table.write.help('fits')  # Get detailed help on Table FITS writer
      >>> Table.write.list_formats()  # Print list of available formats

    The ``serialize_method`` argument is explained in the section on
    `Table serialization methods
    <https://docs.astropy.org/en/latest/io/unified.html#table-serialization-methods>`_.

    See also: https://docs.astropy.org/en/stable/io/unified.html

    Parameters
    ----------
    *args : tuple, optional
        Positional arguments passed through to data writer. If supplied the
        first argument is the output filename.
    format : str
        File format specifier.
    serialize_method : str, dict, optional
        Serialization method specifier for columns.
    **kwargs : dict, optional
        Keyword arguments passed through to data writer.

    Notes
    -----
    c                    s   t ƒ j||dd d� d S )NÚwriter   r	   r   r   r   r   r   {   s    zTableWrite.__init__N)Úserialize_methodc             	   O   s4   | j }t||ƒ� | jj|f|ž|Ž W 5 Q R X d S )N)Z	_instancer   r   r'   )r   r(   r   r   r   r   r   r   r!      s    zTableWrite.__call__r"   r   r   r   r   r   S   s   'N)	Z
astropy.ior   Úinfor   Ú__all__Z__doctest_skip__ZUnifiedReadWriter   r   r   r   r   r   Ú<module>   s
   H