class documentation

class Input(TransformSpec): (source)

Known subclasses: docutils.io.DocTreeInput, docutils.io.FileInput, docutils.io.NullInput, docutils.io.StringInput

View In Hierarchy

Abstract base class for input wrappers.
Method __init__ Undocumented
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.
Method read Undocumented
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 source The source of input data.
Instance Variable source​_path A text reference to the source.
Instance Variable successful​_encoding The encoding that successfully decoded the source data.

Inherited from TransformSpec:

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'): (source)
overridden in docutils.io.FileInput

Undocumented

def __repr__(self): (source)

Undocumented

def decode(self, data): (source)

Decode a string, data, heuristically. Raise UnicodeError if unsuccessful.

The client application should call locale.setlocale at the beginning of processing:

locale.setlocale(locale.LC_ALL, '')
def determine_encoding_from_data(self, data): (source)
Try to determine the encoding of data by looking in data. Check for a byte order mark (BOM) or an encoding declaration.
byte_order_marks = (source)
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.
coding_slug = (source)
Encoding declaration pattern.
component_type: str = (source)

Undocumented

encoding = (source)
Text encoding for the input source.
error_handler = (source)
Text decoding error handler.
source = (source)
overridden in docutils.io.FileInput
The source of input data.
source_path = (source)
overridden in docutils.io.FileInput
A text reference to the source.
successful_encoding = (source)
The encoding that successfully decoded the source data.