pydiffx.dom.reader#
Reader for parsing a DiffX file into DOM objects.
Classes
|
A reader for parsing a DiffX file into DOM objects. |
- class pydiffx.dom.reader.DiffXDOMReader(diffx_cls)#
Bases:
object
A reader for parsing a DiffX file into DOM objects.
This will construct a
DiffX
from an input byte stream, such as a file, HTTP response, or memory-backed stream.Often, you won’t use this directly. Instead, you’ll call
DiffXFile.from_stream()
orDiffXFile.from_bytes()
.If constructing manually, one instance can be reused for multiple streams.
- reader_cls#
The class to instantiate for reading from a stream.
Subclasses can set this if they need to use a more specialized reader.
- Type
alias of
DiffXReader
- __init__(diffx_cls)#
Initialize the reader.
- parse(stream)#
Parse a stream and construct the DOM objects.
The stream will be closed after reading.
- Parameters
stream (
file
orio.IOBase
) – The byte stream containing a valid DiffX file.- Returns
The resulting DiffX instance.
- Return type
- Raises
pydiffx.errors.DiffXParseError – The DiffX contents could not be parsed. Details will be in the error message.