B
    îq\á˜  ã               @   sÐ  d Z ddlZddlZddlZddlZddlZddlZddlZddlm	Z	 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	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mZ ddlmZ ddl m!Z!m"Z" g Z#yddl$Z$dZ%W n e&k
rJ   dZ%Y nX da'd4dd„Z(dd„ Z)d5dd„Z*dd„ Z+d d!„ Z,d6d"d#„Z-d$d%„ Z.d&d'„ Z/d(d)„ Z0d*d+„ Z1d,Z2d7d-d.„Z3d8dd/œd0d1„Z4d2d3„ Z5dS )9zèAn extensible ASCII table reader and writer.

ui.py:
  Provides the main user functions for reading and writing tables.

:Copyright: Smithsonian Astrophysical Observatory (2010)
:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)
é    N)ÚStringIOé   )Úcore)Úbasic)Úcds)Údaophot)Úecsv)Ú
sextractor)Úipac)Úlatex)Úhtml)Úrst)Ú	fastbasic)Úcparser)Ú
fixedwidth)ÚTableÚvstackÚMaskedColumn)Úget_readable_fileobj)ÚAstropyWarningÚAstropyDeprecationWarningTFé † c                s  t ˆ tƒs€y`ˆ d  ˆ dd…  d}x*tˆ ƒD ]\}}|t|ƒ7 }||kr.P q.W tj ˆ d|d … ¡‰ W n tk
r~   Y nX t ˆ tƒrˆ d|… ‰ t 	dˆ tj
tjB ¡r²dS t dˆ dd… tj
¡rÚtj ˆ ¡rÚdS t 	dˆ tj
tjB ¡rôdS t‡ fd	d
„dD ƒƒrdS dS )zo
    Determine if ``table`` probably contains HTML content.  See PR #3693 and issue
    #3691 for context.
    r   Nr   z+( http[s]? | ftp | file ) :// .+ \.htm[l]?$Tz
\.htm[l]?$éûÿÿÿz\s* <! \s* DOCTYPE \s* HTMLc             3   s*   | ]"}t  d  |¡ˆ t jt jB ¡V  qdS )z< \s* {0} [^>]* >N)ÚreÚsearchÚformatÚ
IGNORECASEÚVERBOSE)Ú.0Úelement)Útable© ú2lib/python3.7/site-packages/astropy/io/ascii/ui.pyú	<genexpr>\   s   z!_probably_html.<locals>.<genexpr>)r    ZtrZtdF)Ú
isinstanceÚstrÚ	enumerateÚlenÚosÚlinesepÚjoinÚ	Exceptionr   Úmatchr   r   r   ÚpathÚexistsÚall)r    ZmaxcharsÚsizeÚiÚliner!   )r    r"   Ú_probably_html5   s2    
$r3   c             C   s   | a dS )z°
    Set the default value of the ``guess`` parameter for read()

    Parameters
    ----------
    guess : bool
        New default ``guess`` value (e.g., True or False)

    N)Ú_GUESS)Úguessr!   r!   r"   Ú	set_guessc   s    r6   c             K   sF   | dkr*t |ƒ}|d dkr$tj} ntj} tj| f||dœ|—Ž}|S )a
  
    Initialize a table reader allowing for common customizations.  Most of the
    default behavior for various parameters is determined by the Reader class.

    Parameters
    ----------
    Reader : `~astropy.io.ascii.BaseReader`
        Reader class (DEPRECATED). Default is :class:`Basic`.
    Inputter : `~astropy.io.ascii.BaseInputter`
        Inputter class
    Outputter : `~astropy.io.ascii.BaseOutputter`
        Outputter class
    delimiter : str
        Column delimiter string
    comment : str
        Regular expression defining a comment line in table
    quotechar : str
        One-character string to quote fields containing special characters
    header_start : int
        Line index for the header line not counting comment or blank lines.
        A line with only whitespace is considered blank.
    data_start : int
        Line index for the start of data not counting comment or blank lines.
        A line with only whitespace is considered blank.
    data_end : int
        Line index for the end of data not counting comment or blank lines.
        This value can be negative to count from the end.
    converters : dict
        Dictionary of converters.
    data_Splitter : `~astropy.io.ascii.BaseSplitter`
        Splitter class to split data columns.
    header_Splitter : `~astropy.io.ascii.BaseSplitter`
        Splitter class to split header columns.
    names : list
        List of names corresponding to each data column.
    include_names : list, optional
        List of names to include in output.
    exclude_names : list
        List of names to exclude from output (applied after ``include_names``).
    fill_values : dict
        Specification of fill values for bad or missing table values.
    fill_include_names : list
        List of names to include in fill_values.
    fill_exclude_names : list
        List of names to exclude from fill_values (applied after ``fill_include_names``).

    Returns
    -------
    reader : `~astropy.io.ascii.BaseReader` subclass
        ASCII format reader instance
    NÚenableÚforce)ÚInputterÚ	Outputter)Ú_get_fast_reader_dictr   Ú	FastBasicr   ÚBasicr   Z_get_reader)ÚReaderr9   r:   ÚkwargsÚfast_readerÚreaderr!   r!   r"   Ú
get_readerq   s    6rB   c             C   sV   | d k	r|d k	rt d |¡ƒ‚| d k	rR| tjkr<tj|  }nt d | ttjƒ¡ƒ‚|S )Nz*Cannot supply both format and {0} keywordsz*ASCII format {0!r} not in allowed list {1})Ú
ValueErrorr   r   ZFORMAT_CLASSESÚsorted)r   ZReaderWriterZlabelr!   r!   r"   Ú_get_format_class³   s    
rE   c             C   s6   t  |  dd¡¡}t|tƒr*| dd¡ nd|i}|S )zpConvert 'fast_reader' key in kwargs into a dict if not already and make sure
    'enable' key is available.
    r@   Tr7   r8   )ÚcopyÚdeepcopyÚgetr$   ÚdictÚ
setdefault)r?   r@   r!   r!   r"   r;   À   s
    
r;   c          
   K   sÊ  t dd…= t |¡}t|ƒ}||d< |d rB| d¡rBt| f|ŽS d|krTdg|d< d|krdd|d< | d	¡}t |¡}t |¡|d< t|| d
¡d
ƒ}|dk	r®||d
< |j}d	|kr¼|d	= |dkrÈt}|rŠt	| ƒ|d< d|krn| d¡}y$t
| |d}| ¡ } W dQ R X W n, tk
r*   ‚ Y nD tk
r>   Y n0X t d| ¡sX| tj } |d snt	| ƒ|d< t| |||ƒ}	|	dkrŠd}|sÆ|dkrªtf |Ž}
|
j}|d r˜d |¡tjkr˜t |¡}tjd |¡ |d
< tf |Ž}y(| | ¡}	t  t |¡|jddœ¡ W n~ tjtjtfk
r” } zT|d dkrVt d |j|¡¡‚tf |Ž}
|
 | ¡}	t  t |¡|
jddœ¡ W dd}~X Y nX n.tf |Ž}
|
 | ¡}	t  t |¡|
jddœ¡ |	S )aC  
    Read the input ``table`` and return the table.  Most of
    the default behavior for various parameters is determined by the Reader
    class.

    See also:

    - http://docs.astropy.org/en/stable/io/ascii/
    - http://docs.astropy.org/en/stable/io/ascii/read.html

    Parameters
    ----------
    table : str, file-like, list, pathlib.Path object
        Input table as a file name, file-like object, list of strings,
        single newline-separated string or pathlib.Path object .
    guess : bool
        Try to guess the table format. Defaults to None.
    format : str, `~astropy.io.ascii.BaseReader`
        Input table format
    Inputter : `~astropy.io.ascii.BaseInputter`
        Inputter class
    Outputter : `~astropy.io.ascii.BaseOutputter`
        Outputter class
    delimiter : str
        Column delimiter string
    comment : str
        Regular expression defining a comment line in table
    quotechar : str
        One-character string to quote fields containing special characters
    header_start : int
        Line index for the header line not counting comment or blank lines.
        A line with only whitespace is considered blank.
    data_start : int
        Line index for the start of data not counting comment or blank lines.
        A line with only whitespace is considered blank.
    data_end : int
        Line index for the end of data not counting comment or blank lines.
        This value can be negative to count from the end.
    converters : dict
        Dictionary of converters
    data_Splitter : `~astropy.io.ascii.BaseSplitter`
        Splitter class to split data columns
    header_Splitter : `~astropy.io.ascii.BaseSplitter`
        Splitter class to split header columns
    names : list
        List of names corresponding to each data column
    include_names : list
        List of names to include in output.
    exclude_names : list
        List of names to exclude from output (applied after ``include_names``)
    fill_values : dict
        specification of fill values for bad or missing table values
    fill_include_names : list
        List of names to include in fill_values.
    fill_exclude_names : list
        List of names to exclude from fill_values (applied after ``fill_include_names``)
    fast_reader : bool or dict
        Whether to use the C engine, can also be a dict with options which
        defaults to `False`; parameters for options dict:

        use_fast_converter: bool
            enable faster but slightly imprecise floating point conversion method
        parallel: bool or int
            multiprocessing conversion using ``cpu_count()`` or ``'number'`` processes
        exponent_style: str
            One-character string defining the exponent or ``'Fortran'`` to auto-detect
            Fortran-style scientific notation like ``'3.14159D+00'`` (``'E'``, ``'D'``, ``'Q'``),
            all case-insensitive; default ``'E'``, all other imply ``use_fast_converter``
        chunk_size : int
            If supplied with a value > 0 then read the table in chunks of
            approximately ``chunk_size`` bytes. Default is reading table in one pass.
        chunk_generator : bool
            If True and ``chunk_size > 0`` then return an iterator that returns a
            table for each chunk.  The default is to return a single stacked table
            for all the chunks.

    Reader : `~astropy.io.ascii.BaseReader`
        Reader class (DEPRECATED)
    encoding: str
        Allow to specify encoding to read the file (default= ``None``).

    Returns
    -------
    dat : `~astropy.table.Table` OR <generator>
        Output table

    Nr@   r7   Ú
chunk_sizeZfill_values)Ú Ú0r:   Fr   r>   Ú
guess_htmlZreadmeÚencoding)rO   z[\r\n]zfast_{0}z&Success with fast reader (no guessing))r?   r>   Ústatusr8   zfast reader {} exception: {}z>Success with slow reader after failing with fast (no guessing)z1Success with specified Reader class (no guessing))Ú_read_tracerF   rG   r;   rH   Ú_read_in_chunksrE   Ú_format_namer4   r3   r   ÚreadrC   r+   r   r   r(   r)   Ú_guessrB   r   r   ÚFAST_CLASSESÚappendÚ	__class__ÚParameterErrorr   ÚCParserErrorÚUnicodeEncodeErrorÚInconsistentTableError)r    r5   r?   r@   r   Z
new_kwargsr>   rO   ÚfileobjÚdatrA   Úfast_kwargsZfast_reader_rdrÚerrr!   r!   r"   rT   Ì   sˆ    X



















rT   c                sÎ  g }t |ƒ}|d rV|dk	rVd |¡tjkrVt |¡}tjd |¡ |d< |g| }nd}g }| d¡}x|D ]}|d dkr¼|d tj ¡ kr¼t 	t |¡|d j
dd d	¡d
œ¡ qp|d dkr|d tj ¡ krt 	t |¡|d j
dd d	¡d
œ¡ qpd}	xN| ¡ D ]B\}
}|
|kr6t |¡||
< n|||
 kr||krd}	P qW |	sbqp||krp| 	|¡ qpW t|ƒdkrŠdS tjttttjtjtjf}x"|D ]Ö}t ¡ }y^d|krÌd|d< tf |Ž}d|_| | ¡}t 	t |¡|j
dd t ¡ | d ¡d
œ¡ |S  |k
r~ } zHt 	t |¡d |j
jt|ƒ¡d t ¡ | d ¡dœ¡ | 	|¡ W dd}~X Y nX q¬W y2tf |Ž}| | ¡}t 	t |¡|j
ddœ¡ |S  |k
rÈ } zðt 	t |¡d |j
jt|ƒ¡dœ¡ | 	|¡ dg}x„|D ]|‰ tdd„ tˆ ƒD ƒƒ}tˆ  dtj¡ƒ}dt  d|¡ !d¡ g}‡ fdd„|D ƒ}| "dd„ |D ƒ¡ | 	d #|¡¡ qW d d!d"d#d$d%d&d'd!g	}| "|¡ t d( #|¡¡‚W dd}~X Y nX dS ))a1  
    Try to read the table using various sets of keyword args.  Start with the
    standard guess list and filter to make it unique and consistent with
    user-supplied read keyword args.  Finally, if none of those work then
    try the original user-supplied keyword args.

    Parameters
    ----------
    table : str, file-like, list
        Input table as a file name, file-like object, list of strings, or
        single newline-separated string.
    read_kwargs : dict
        Keyword arguments from user to be supplied to reader
    format : str
        Table format
    fast_reader : dict
        Options for the C engine fast reader.  See read() function for details.

    Returns
    -------
    dat : `~astropy.table.Table` or None
        Output table or None if only one guess format was available
    r7   Nzfast_{0}r>   r@   Fz/Disabled: reader only available in fast versionz
{0:.3f} msg        )r?   r>   rP   Údtr8   z-Disabled: no fast version of reader availableTr   Zstrict_nameszSuccess (guessing)iè  z{0}: {1})r?   rP   ra   z<Success with original kwargs without strict_names (guessing))r?   r>   rP   )r?   rP   zC
ERROR: Unable to guess table format with the guesses listed below:c             S   s   g | ]}|d kr|‘qS ))r>   r:   r!   )r   Úxr!   r!   r"   ú
<listcomp>1  s    z_guess.<locals>.<listcomp>zReader:z	\.(\w+)'>c             3   s   | ]}|ˆ | fV  qd S )Nr!   )r   Úkey)r?   r!   r"   r#   5  s    z_guess.<locals>.<genexpr>c             S   s   g | ]\}}d   ||¡‘qS )z{}: {!r})r   )r   rd   Úvalr!   r!   r"   rc   6  s    ú rL   zH************************************************************************zH** ERROR: Unable to guess table format with the guesses listed above. **zH**                                                                    **zH** To figure out why the table did not read, use guess=False and      **zH** fast_reader=False, along with any appropriate arguments to read(). **zH** In particular specify the format and any known attributes like the **zH** delimiter.                                                         **Ú
)$Ú_get_guess_kwargs_listr   r   rV   rF   rG   rH   ÚvaluesrQ   rW   rX   Úitemsr'   r\   rC   Ú	TypeErrorÚAttributeErrorZOptionalTableImportErrorrY   r   rZ   ÚtimerB   ZguessingrT   Ú__name__r%   rD   Úreprr   r=   r   r   ÚgroupÚextendr*   )r    Úread_kwargsr   r@   Zfailed_kwargsZfull_list_guessr_   Zfiltered_guess_kwargsZguess_kwargsZguess_kwargs_okrd   re   Zguess_exception_classesZt0rA   r^   r`   ÚlinesZsorted_keysZreader_reprZ	keys_valsZkwargs_sortedÚmsgr!   )r?   r"   rU   ¢  s¶    






"






rU   c             C   sä   g }|   dd¡r"| ttjd¡ | ttjd¡ xTtjt	j
tjtjtjtjtjtjtjtjtjtjtjtjfD ]}| t|d¡ qrW xTtjtjtjtjtj tj!fD ]4}x.dD ]&}x dD ]}| t|||d¡ q¼W q²W q¨W |S )aQ  
    Get the full list of reader keyword argument dicts that are the basis
    for the format guessing process.  The returned full list will then be:

    - Filtered to be consistent with user-supplied kwargs
    - Cleaned to have only unique entries
    - Used one by one to try reading the input table

    Note that the order of the guess list has been tuned over years of usage.
    Maintainers need to be very careful about any adjustments as the
    reasoning may not be immediately evident in all cases.

    This list can (and usually does) include duplicates.  This is a result
    of the order tuning, but these duplicates get removed later.

    Parameters
    ----------
    read_kwargs : dict
       User-supplied read keyword args

    Returns
    -------
    guess_kwargs_list : list
        List of read format keyword arg dicts
    rN   N)r>   )ú|ú,rf   z\s)ú"ú')r>   Ú	delimiterÚ	quotechar)"ÚpoprW   rI   r   ZHTMLr   ZEcsvr   ZFixedWidthTwoLiner   ZRSTr   r<   r   r=   ZFastRdbZRdbZFastTabZTabr   ZCdsr   ZDaophotr	   Z
SExtractorr
   ZIpacr   ZLatexZAASTexÚFastCommentedHeaderÚCommentedHeaderZFastNoHeaderZNoHeader)rr   Zguess_kwargs_listrA   r>   ry   rz   r!   r!   r"   rh   F  s&    



rh   c                sP  |d }|  d¡}|  dd¡}d|d< t| |f|Ž}|r<|S t|ƒ}|j}dd„ | ¡ D ƒ‰ d}xÀ|D ]¸}	||	jO }x¨|	j ¡ D ]š\}
}ˆ |
 |j }}|jj	|krÈ|jj	|krÈt
j| ¡ |jj	d	}n.|jj	|krö|jj	|kröt
j| ¡ |jj	d	}|rt
jjnt
j}|||gƒˆ |
< q€W qfW ‡ fd
d„|jD ƒ‰ |jˆ |j|jdd}|S )z†
    For fast_reader read the ``table`` in chunks and vstack to create
    a single table, OR return a generator of chunk tables.
    r@   rK   Úchunk_generatorFZparallelc             S   s   i | ]}|j  ¡ |j“qS r!   )ÚdatarF   Úname)r   Úcolr!   r!   r"   ú
<dictcomp>–  s    z#_read_in_chunks.<locals>.<dictcomp>)ÚSÚU)Údtypec                s   g | ]}ˆ | ‘qS r!   r!   )r   r€   )Úout_colsr!   r"   rc   ¯  s    z#_read_in_chunks.<locals>.<listcomp>)ÚnamesÚmetarF   )r{   Ú_read_in_chunks_generatorÚnextÚmaskedÚitercolsÚcolumnsrj   r   r…   ZkindÚnpZarrayÚtolistZmaÚconcatenateÚcolnamesrX   rˆ   )r    r?   r@   rK   r~   Z
tbl_chunksZtbl0r‹   Z	str_kindsÚtblr€   r   Zcol1Zcol2r   Úoutr!   )r†   r"   rR   „  s2    


rR   c          	   k   sT  t jddd„ƒ}t| tƒr8d| ks*d| kr8t| ƒ} |}nt| dƒrRt| dƒrR|}nt}d|d	 d
< d}d}d}|| | d¡dÊ}xÂ| |¡}	t	|	ƒ|k }
|
r¬t
 d|	¡s¬P x6tt	|	ƒd ddƒD ]}|
sÖ|	| dkrÂP qÂW tdƒ‚|| |	d|d …  }|	|d d… }t|fddi|—Ž}|r6|j d¡}d}|V  |
r„P q„W W dQ R X dS )zk
    For fast_reader read the ``table`` in chunks and return a generator
    of tables for each chunk.
    Nc             s   s
   | V  dS )zoStub for get_readable_fileobj, which does not seem to work in Py3
        for input File-like object, see #6460Nr!   )r]   rO   r!   r!   r"   Úpassthrough_fileobj¼  s    z6_read_in_chunks_generator.<locals>.passthrough_fileobjrg   úrT   ÚseekTr@   Zreturn_header_charsrL   rO   )rO   z\Sr   éÿÿÿÿz1no newline found in chunk (chunk_size too small?)r5   FZ"__ascii_fast_reader_header_chars__)N)Ú
contextlibÚcontextmanagerr$   r%   r   Úhasattrr   rH   rT   r'   r   r   ÚrangerC   rˆ   r{   )r    rK   r?   r”   Zfileobj_contextÚheaderZprev_chunk_charsZfirst_chunkZfhÚchunkZfinal_chunkÚidxZcomplete_chunkr’   r!   r!   r"   r‰   ¶  s>    

r‰   )ry   Úcommentrz   Úformatsr‡   Úinclude_namesÚexclude_namesÚstrip_whitespacec             K   s^   | dkrt j} d|krd|d< tj| |f|Ž}t|t jtjfƒrZt| dd¡t	ƒsZt
dƒ‚|S )aE  
    Initialize a table writer allowing for common customizations.  Most of the
    default behavior for various parameters is determined by the Writer class.

    Parameters
    ----------
    Writer : ``Writer``
        Writer class (DEPRECATED). Defaults to :class:`Basic`.
    delimiter : str
        Column delimiter string
    comment : str
        String defining a comment line in table
    quotechar : str
        One-character string to quote fields containing special characters
    formats : dict
        Dictionary of format specifiers or formatting functions
    strip_whitespace : bool
        Strip surrounding whitespace from column values.
    names : list
        List of names corresponding to each data column
    include_names : list
        List of names to include in output.
    exclude_names : list
        List of names to exclude from output (applied after ``include_names``)
    fast_writer : bool
        Whether to use the fast Cython writer.

    Returns
    -------
    writer : `~astropy.io.ascii.BaseReader` subclass
        ASCII format writer instance
    Nr£   TrŸ   rL   z´for the commented_header writer you must supply a string
value for the `comment` keyword.  In order to disable writing
table comments use `del t.meta['comments']` prior to writing.)r   r=   r   Z_get_writerr$   r}   r   r|   rH   r%   rC   )ÚWriterÚfast_writerr?   Úwriterr!   r!   r"   Ú
get_writer  s    !r§   )Ú	overwritec            K   sÐ  t |tƒrDtj |¡rD|dkr2t d |¡t¡ n|sDt	d |¡ƒ‚|dkrRt
j}| d¡}t | tƒr°| j| |d}x4t| ¡ |  ¡ ƒD ]\}	}
t |
tƒrˆ|
jj|	j_qˆW |} nt| |d} | dd…  ¡ }t || d¡| d¡| d¡¡ t| d	g ¡ƒt|jƒ }|r t d
 |¡t¡ | jr,d}t||dƒ}tf ||dœ|—Ž}|jtjkrj| | |¡ dS | | ¡}tj  !|¡}t"|dƒs¶t#|dƒ}| |¡ | tj ¡ | $¡  n| |¡ | tj ¡ dS )a  Write the input ``table`` to ``filename``.  Most of the default behavior
    for various parameters is determined by the Writer class.

    See also:

    - http://docs.astropy.org/en/stable/io/ascii/
    - http://docs.astropy.org/en/stable/io/ascii/write.html

    Parameters
    ----------
    table : `~astropy.io.ascii.BaseReader`, array_like, str, file_like, list
        Input table as a Reader object, Numpy struct array, file name,
        file-like object, list of strings, or single newline-separated string.
    output : str, file_like
        Output [filename, file-like object]. Defaults to``sys.stdout``.
    format : str
        Output table format. Defaults to 'basic'.
    delimiter : str
        Column delimiter string
    comment : str
        String defining a comment line in table
    quotechar : str
        One-character string to quote fields containing special characters
    formats : dict
        Dictionary of format specifiers or formatting functions
    strip_whitespace : bool
        Strip surrounding whitespace from column values.
    names : list
        List of names corresponding to each data column
    include_names : list
        List of names to include in output.
    exclude_names : list
        List of names to exclude from output (applied after ``include_names``)
    fast_writer : bool
        Whether to use the fast Cython writer.
    overwrite : bool
        If ``overwrite=None`` (default) and the file exists, then a
        warning will be issued. In a future release this will instead
        generate an exception. If ``overwrite=False`` and the file
        exists, then an exception is raised.
        This parameter is ignored when the ``output`` arg is not a string
        (e.g., a file object).
    Writer : ``Writer``
        Writer class (DEPRECATED).

    Nzx{} already exists. Automatically overwriting ASCII files is deprecated. Use the argument 'overwrite=True' in the future.z{} already existsr‡   )r‡   r   r¡   r¢   r    zKThe keys {} specified in the formats argument does not match a column name.Fr¤   )r¤   r¥   ÚwriteÚw)%r$   r%   r(   r-   ÚlexistsÚwarningsÚwarnr   r   ÚOSErrorÚsysÚstdoutrH   r   rX   ÚziprŒ   r   ÚinfoZserialize_methodrF   r   Z_apply_include_exclude_namesÚsetr‘   r   Zhas_mixin_columnsrE   r§   rS   rV   r©   r)   r*   rš   ÚopenÚclose)r    Úoutputr   r¤   r¥   r¨   r?   r‡   Znew_tblZnew_colr   Ztable0Zdiff_format_with_namesr¦   rs   Zoutstrr!   r!   r"   r©   7  sT    0









r©   c               C   s
   t  t¡S )a¨  
    Return a traceback of the attempted read formats for the last call to
    `~astropy.io.ascii.read` where guessing was enabled.  This is primarily for
    debugging.

    The return value is a list of dicts, where each dict includes the keyword
    args ``kwargs`` used in the read call and the returned ``status``.

    Returns
    -------
    trace : list of dicts
       Ordered list of format guesses and status
    )rF   rG   rQ   r!   r!   r!   r"   Úget_read_trace«  s    r·   )r   )NNN)N)NT)NNNT)6Ú__doc__r   r(   r¯   rF   rm   r¬   r˜   Úior   ZnumpyrŽ   rL   r   r   r   r   r   r	   r
   r   r   r   r   r   r   Zastropy.tabler   r   r   Zastropy.utils.datar   Zastropy.utils.exceptionsr   r   rQ   ZyamlZHAS_YAMLÚImportErrorr4   r3   r6   rB   rE   r;   rT   rU   rh   rR   r‰   Zextra_writer_parsr§   r©   r·   r!   r!   r!   r"   Ú<module>	   sb   

.
B
 W %>2G
6s