diff options
| author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-04-08 21:08:59 +0000 |
|---|---|---|
| committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-04-08 21:08:59 +0000 |
| commit | b75aa2f95311fb1521038b37f2963088abcd2785 (patch) | |
| tree | 2e8a9e5e53039a6036665b2127b50da789803f9d /docutils | |
| parent | 48f9da33f1dfae946d27aee1fa3f9cba15583328 (diff) | |
| download | docutils-b75aa2f95311fb1521038b37f2963088abcd2785.tar.gz | |
Revert introduction of `core.publish_bytes()` and `io.BytesOutput`.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9339 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
| -rw-r--r-- | docutils/core.py | 37 | ||||
| -rw-r--r-- | docutils/io.py | 20 |
2 files changed, 0 insertions, 57 deletions
diff --git a/docutils/core.py b/docutils/core.py index d9a769557..b430240e4 100644 --- a/docutils/core.py +++ b/docutils/core.py @@ -474,43 +474,6 @@ def publish_string(source, source_path=None, destination_path=None, return output -def publish_bytes(source, source_path=None, destination_path=None, - reader=None, reader_name='standalone', - parser=None, parser_name='restructuredtext', - writer=None, writer_name='pseudoxml', - settings=None, settings_spec=None, - settings_overrides=None, config_section=None, - enable_exit_status=False): - """ - Set up & run a `Publisher` for programmatic use with string I/O. Return - the encoded bytes. - - Be sure to set the 'output_encoding' setting to the desired encoding.:: - - publish_bytes(..., settings_overrides={'output_encoding': 'latin1'}) - - Similarly for bytes input (`source`):: - - publish_bytes(..., settings_overrides={'input_encoding': 'latin1'}) - - Parameters: see `publish_programmatically()`. - - Provisional. - """ - output, publisher = publish_programmatically( - source_class=io.StringInput, source=source, source_path=source_path, - destination_class=io.BytesOutput, - destination=None, destination_path=destination_path, - reader=reader, reader_name=reader_name, - parser=parser, parser_name=parser_name, - writer=writer, writer_name=writer_name, - settings=settings, settings_spec=settings_spec, - settings_overrides=settings_overrides, - config_section=config_section, - enable_exit_status=enable_exit_status) - return output - - def publish_parts(source, source_path=None, source_class=io.StringInput, destination_path=None, reader=None, reader_name='standalone', diff --git a/docutils/io.py b/docutils/io.py index 68fde9ae0..2162db2b3 100644 --- a/docutils/io.py +++ b/docutils/io.py @@ -629,26 +629,6 @@ class BinaryFileOutput(FileOutput): mode = 'wb' -class BytesOutput(Output): - - """ - Direct binary output. - Provisional. - """ - - default_destination_path = '<bytes>' - - def write(self, data): - """Encode `data`, store it in `self.destination`, and return it.""" - self.destination = self.encode(data) - return self.destination - - def encode(self, data): - if isinstance(data, bytes): - return data - return str(data).encode(self.encoding, self.error_handler) - - class StringInput(Input): """Input from a `str` or `bytes` instance.""" |
