From 99c6cf6f056a8cb1d493598aadec70e6327bbc5a Mon Sep 17 00:00:00 2001 From: Tsuyoshi Hombashi Date: Sun, 26 Jul 2020 22:07:22 +0900 Subject: [PATCH] Update docstrings --- pytablewriter/writer/_table_writer.py | 11 ++++++++++- pytablewriter/writer/text/_text_writer.py | 10 +++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/pytablewriter/writer/_table_writer.py b/pytablewriter/writer/_table_writer.py index e7ffc413..4bc76d11 100644 --- a/pytablewriter/writer/_table_writer.py +++ b/pytablewriter/writer/_table_writer.py @@ -98,7 +98,16 @@ class AbstractTableWriter(TableWriterInterface, metaclass=abc.ABCMeta): :type: bool :value: True - [Only for text format writers] If |True|, colorize text with |Style| for terminals. + [Only for text format writers] [experimental] + If |True|, colorize text outputs with |Style|. + + .. py:attribute:: enable_ansi_escape + :type: bool + :value: True + + [Only for text format writers] + If |True|, applies ANSI escape sequences to terminal's text outputs + with |Style|. .. py:attribute:: write_callback diff --git a/pytablewriter/writer/text/_text_writer.py b/pytablewriter/writer/text/_text_writer.py index 86b15798..4959e60e 100644 --- a/pytablewriter/writer/text/_text_writer.py +++ b/pytablewriter/writer/text/_text_writer.py @@ -198,11 +198,15 @@ def write_table(self, **kwargs) -> None: def dump(self, output: Union[str, IO], close_after_write: bool = True, **kwargs) -> None: """Write data to the output with tabular format. + During the executing this method, + :py:attr:`~pytablewriter.writer._table_writer.AbstractTableWriter.enable_ansi_escape` + attribute will be temporarily set to |False|. + Args: - output (file descriptor or str): - file descriptor or path to the output file. + output: + The value must either an output stream or a path to an output file. - close_after_write (bool, optional): + close_after_write: Close the output after write. Defaults to |True|. """