Message234067
On 15.01.2015 05:43, Martin Panter wrote:
>
> New patch that also fixes StreamWriter.writelines() in general for the byte codecs
Could you explain this new undocumented class ?
+class _IncrementalBasedWriter(StreamWriter):
+ """Generic StreamWriter implementation.
+
+ The _EncoderClass attribute must be set to an IncrementalEncoder
+ class to use.
+ """
+
+ def __init__(self, stream, errors='strict'):
+ super().__init__(stream, errors)
+ self._encoder = self._Encoder(errors)
+
+ def write(self, object):
+ self.stream.write(self._encoder.encode(object))
+
+ def reset(self):
+ self.stream.write(self._encoder.encode(final=True))
+
Note that the doc-string mentions a non-existing attribute and there
are doc-string missing for the other methods.
The purpose appears to be a StreamWriter which works with
an IncrementalEncoder. A proper name would thus be
IncrementalStreamWriter which provides an .encode()
method which adapts the signature of the incremental encoder
to the one expected for StreamWriters and Codecs. |
|
Date |
User |
Action |
Args |
2015-01-15 08:48:52 | lemburg | set | recipients:
+ lemburg, loewis, doerwalter, jcea, amcnabb, vstinner, martin.panter |
2015-01-15 08:48:52 | lemburg | link | issue13881 messages |
2015-01-15 08:48:52 | lemburg | create | |
|