BaseInputter#

class astropy.io.ascii.BaseInputter[source]#

Bases: object

Get the lines from the table input and return a list of lines.

Attributes Summary

encoding

Encoding used to read the file

Methods Summary

get_lines(table[, newline])

Get the lines from the table input.

process_lines(lines)

Process lines for subsequent use.

Attributes Documentation

encoding = None#

Encoding used to read the file

Methods Documentation

get_lines(table, newline=None)[source]#

Get the lines from the table input.

The input table can be one of:

  • File name

  • String (newline separated) with all header and data lines (must have at least 2 lines)

  • File-like object with read() method

  • List of strings

Parameters:
tablestr, file-like object, list

Can be either a file name, string (newline separated) with all header and data lines (must have at least 2 lines), a file-like object with a read() method, or a list of strings.

newline

Line separator. If None use OS default from splitlines().

Returns:
lineslist

List of lines

process_lines(lines)[source]#

Process lines for subsequent use. In the default case do nothing. This routine is not generally intended for removing comment lines or stripping whitespace. These are done (if needed) in the header and data line processing.

Override this method if something more has to be done to convert raw input lines to the table rows. For example the ContinuationLinesInputter derived class accounts for continuation characters if a row is split into lines.