Sources
In order to keep the parser extensible, input sources are represented as Source objects. That way, the parser can work with any kind of input that adheres to this interface.
This implementation provides two source implementations, one for strings and one for files. Both implementations are considered internal and are only accessible through the parser interface.
Interface
- class Source
 Abstract base class for configuration sources.
- abstractmethod open() None
 Open the source.
- Raises:
 ConfIoError – If the source cannot be opened.
- abstractmethod readline() str
 Read a single line from the source.
- Returns:
 The line read, or an empty string if the end of the source has been reached.
- Raises:
 ConfIoError – If there was an IO problem reading the source.
ConfLimitExceeded – If the line exceeds
MAX_LINE_LENGTHbytes.ConfEncodingError – If the data cannot be decoded as UTF-8.
- abstractmethod start_digest_calculation()
 Start or restart the digest calculation.
The digest calculation shall start at the next
readline()call. If the digest calculation is already running, it shall be restarted.- Raises:
 NotImplementedError – If the source does not support digest calculation.
- abstractmethod get_digest() str
 Get the digest of the source.
The document digest shall always be reported as a string in the format
<algorithm> <digest>. Algorithm is the lowercase name of the algorithm used, e.g.sha3-256. Digest is the hexadecimal representation of the digest.- Returns:
 The digest of the source or an empty string if digests are not supported.
- abstractmethod close()
 Close the source.
- abstract property identifier: SourceIdentifier
 Return the
SourceIdentifierfor this source.