class documentation

class FileInput(Input): (source)

View In Hierarchy

Input for single, simple file-like objects.
Method __init__ No summary
Method close Undocumented
Method read Read and decode a single file and return the data (Unicode string).
Method readlines Return lines of a single file as list of Unicode strings.
Instance Variable autoclose Undocumented
Instance Variable source The source of input data.
Instance Variable source​_path A text reference to the source.
Instance Variable _stderr Undocumented

Inherited from Input:

Method __repr__ Undocumented
Method decode Decode a string, data, heuristically. Raise UnicodeError if unsuccessful.
Method determine​_encoding​_from​_data Try to determine the encoding of data by looking in data. Check for a byte order mark (BOM) or an encoding declaration.
Class Variable byte​_order​_marks Sequence of (start_bytes, encoding) tuples for encoding detection. The first bytes of input data are checked against the start_bytes strings. A match indicates the given encoding.
Class Variable coding​_slug Encoding declaration pattern.
Class Variable component​_type Undocumented
Class Variable default​_source​_path Undocumented
Instance Variable encoding Text encoding for the input source.
Instance Variable error​_handler Text decoding error handler.
Instance Variable successful​_encoding The encoding that successfully decoded the source data.

Inherited from TransformSpec (via Input):

Method get​_transforms Transforms required by this class. Override in subclasses.
Class Variable default​_transforms Undocumented
Class Variable unknown​_reference​_resolvers No summary
def __init__(self, source=None, source_path=None, encoding=None, error_handler='strict', autoclose=True, mode=('r' if sys.version_info >= (3, 0) else 'rU')): (source)
Parameters
sourceeither a file-like object (which is read directly), or None (which implies sys.stdin if no source_path given).
source​_patha path to a file, which is opened and then read.
encodingthe expected text encoding of the input file.
error​_handlerthe encoding error handler to use.
autocloseclose automatically after read (except when sys.stdin is the source).
modehow the file is to be opened (see standard function open). The default 'rU' provides universal newline support for text files with Python 2.x.
def close(self): (source)

Undocumented

def read(self): (source)
Read and decode a single file and return the data (Unicode string).
def readlines(self): (source)
Return lines of a single file as list of Unicode strings.
autoclose = (source)

Undocumented

source = (source)
The source of input data.
source_path = (source)
A text reference to the source.
_stderr = (source)

Undocumented