
    HR-e                         d dl Z d dlmZ d dlmZ d dlmZ d dlm	Z	 d
dZ
d
dZd Ze	j        s8 ej        d	ee
            ej        d	ee            ej        d	ee           dS dS )    N)registry)create_asdf_deprecation_warning)Table)optional_depsc                 N   t          j        t                                 	 ddl}n# t          $ r t          d          w xY w|r|rt          d           |j        | fi |5 }|r ||j                  cddd           S ||pd         cddd           S # 1 swxY w Y   dS )a  
    Read a `~astropy.table.Table` object from an ASDF file.

    This requires `asdf <https://pypi.org/project/asdf/>`_ to be installed.
    By default, this function will look for a Table object with the key of
    ``data`` in the top-level ASDF tree. The parameters ``data_key`` and
    ``find_key`` can be used to override the default behavior.

    This function is registered as the Table reader for ASDF files with the
    unified I/O interface.

    Parameters
    ----------
    filename : str or :class:`py.lath:local`
        Name of the file to be read
    data_key : str
        Optional top-level key to use for finding the Table in the tree. If not
        provided, uses ``data`` by default. Use of this parameter is not
        compatible with ``find_table``.
    find_table : function
        Optional function to be used for locating the Table in the tree. The
        function takes a single parameter, which is a dictionary representing
        the top of the ASDF tree. The function must return a
        `~astropy.table.Table` instance.

    Returns
    -------
    table : `~astropy.table.Table`
        `~astropy.table.Table` instance
    r   N8The asdf module is required to read and write ASDF filesz6Options 'data_key' and 'find_table' are not compatibledata)	warningswarnr   asdfImportError	Exception
ValueErroropentree)filenamedata_key
find_tablekwargsr   afs         <lib/python3.11/site-packages/astropy/io/misc/asdf/connect.py
read_tabler      sE   > M133444T T T TRSSST  SJ SQRRR	8	&	&v	&	& *" 	*:bg&&* * * * * * * * h(&)	* * * * * * * * * * * * * * * * * *s!   ' A%B	BB!Bc                 R   t          j        t                                 	 ddl}n# t          $ r t          d          w xY w|r|rt          d          |r ||           }n|pd| i}|                    |          5 } |j        |fi | ddd           dS # 1 swxY w Y   dS )a  
    Write a `~astropy.table.Table` object to an ASDF file.

    This requires `asdf <https://pypi.org/project/asdf/>`_ to be installed.
    By default, this function will write a Table object in the top-level ASDF
    tree using the key of ``data``. The parameters ``data_key`` and
    ``make_tree`` can be used to override the default behavior.

    This function is registered as the Table writer for ASDF files with the
    unified I/O interface.

    Parameters
    ----------
    table : `~astropy.table.Table`
        `~astropy.table.Table` instance to be written
    filename : str or :class:`py.path:local`
        Name of the new ASDF file to be created
    data_key : str
        Optional top-level key in the ASDF tree to use when writing the Table.
        If not provided, uses ``data`` by default. Use of this parameter is not
        compatible with ``make_tree``.
    make_tree : function
        Optional function to be used for creating the ASDF tree. The function
        takes a single parameter, which is the `~astropy.table.Table` instance
        to be written. The function must return a `dict` representing the ASDF
        tree to be created.
    r   Nr   z5Options 'data_key' and 'make_tree' are not compatibler	   )	r
   r   r   r   r   r   r   AsdfFilewrite_to)tabler   r   	make_treer   r   r   r   s           r   write_tabler   ;   s1   8 M133444T T T TRSSST  RI RPQQQ +y"FE*	t		 (H'''''( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (s   ' A BB #B c                 b    	 dd l }n# t          $ r Y dS w xY w|d uo|                    d          S )Nr   Fz.asdf)r   r   endswith)originfilepathfileobjargsr   r   s         r   asdf_identifyr%   j   sT       uu 4>H$5$5g$>$>>s    
r   )NN)r
   
astropy.ior   io_registry astropy.io.misc.asdf.deprecationr   astropy.tabler   astropy.utils.compatr   r   r   r%   HAS_ASDF_ASTROPYregister_readerregister_writerregister_identifier     r   <module>r1      s     . . . . . . L L L L L L       . . . . . .-* -* -* -*`,( ,( ,( ,(^? ? ? % BKz:::K{;;;#K#FE=AAAAAB Br0   