From 77770338b7ffdefa1aa8c45b0de1137d529a9fcd Mon Sep 17 00:00:00 2001 From: Tsuyoshi Hombashi Date: Sun, 25 Jun 2023 16:03:53 +0900 Subject: [PATCH] Remove deprecated functions and properties - dump_tabledata - set_log_level - AbstractTableWriter.header_list - AbstractTableWriter.type_hint_list - AbstractTableWriter.styles - AbstractTableWriter.style_list - AbstractTableWriter.value_preprocessor.setter --- pytablewriter/__init__.py | 6 +-- pytablewriter/_function.py | 5 --- pytablewriter/_logger/__init__.py | 4 +- pytablewriter/_logger/_logger.py | 5 --- pytablewriter/writer/_table_writer.py | 60 +-------------------------- 5 files changed, 5 insertions(+), 75 deletions(-) diff --git a/pytablewriter/__init__.py b/pytablewriter/__init__.py index 52e96902..609501c8 100644 --- a/pytablewriter/__init__.py +++ b/pytablewriter/__init__.py @@ -6,8 +6,8 @@ from .__version__ import __author__, __copyright__, __email__, __license__, __version__ from ._factory import TableWriterFactory -from ._function import dump_tabledata, dumps_tabledata -from ._logger import set_log_level, set_logger +from ._function import dumps_tabledata +from ._logger import set_logger from ._table_format import FormatAttr, TableFormat from .error import ( EmptyTableDataError, @@ -75,9 +75,7 @@ "__version__", "LineBreakHandling", "TableWriterFactory", - "dump_tabledata", "dumps_tabledata", - "set_log_level", "set_logger", "FormatAttr", "TableFormat", diff --git a/pytablewriter/_function.py b/pytablewriter/_function.py index 7ed28f1f..6290e966 100644 --- a/pytablewriter/_function.py +++ b/pytablewriter/_function.py @@ -58,11 +58,6 @@ def dumps_tabledata(value: TableData, format_name: str = "rst_grid_table", **kwa return writer.dumps() -def dump_tabledata(value, format_name="rst_grid_table", **kwargs): - # deprecated: alias to dumps_tabledata() - return dumps_tabledata(value, format_name, **kwargs) - - def normalize_enum( value, enum_class: Type[Enum], validate: bool = True, default: Optional[Enum] = None ): diff --git a/pytablewriter/_logger/__init__.py b/pytablewriter/_logger/__init__.py index af6b6e97..e0ee56da 100644 --- a/pytablewriter/_logger/__init__.py +++ b/pytablewriter/_logger/__init__.py @@ -1,4 +1,4 @@ -from ._logger import WriterLogger, logger, set_log_level, set_logger +from ._logger import WriterLogger, logger, set_logger -__all__ = ("WriterLogger", "logger", "set_log_level", "set_logger") +__all__ = ("WriterLogger", "logger", "set_logger") diff --git a/pytablewriter/_logger/_logger.py b/pytablewriter/_logger/_logger.py index 66ef40f3..d3624d0e 100644 --- a/pytablewriter/_logger/_logger.py +++ b/pytablewriter/_logger/_logger.py @@ -46,11 +46,6 @@ def set_logger(is_enable: bool, propagation_depth: int = 1) -> None: pass -def set_log_level(log_level): - # deprecated - logger.disable(MODULE_NAME) - - class WriterLogger: @property def logger(self): diff --git a/pytablewriter/writer/_table_writer.py b/pytablewriter/writer/_table_writer.py index 07f9d74c..afdc07f5 100644 --- a/pytablewriter/writer/_table_writer.py +++ b/pytablewriter/writer/_table_writer.py @@ -121,17 +121,6 @@ def margin(self) -> int: def margin(self, value: int) -> None: raise NotImplementedError() - @property - def header_list(self): - warnings.warn("'header_list' has moved to 'headers'", DeprecationWarning) - - return self.headers - - @header_list.setter - def header_list(self, value): - warnings.warn("'header_list' has moved to 'headers'", DeprecationWarning) - self.headers = value - @property def value_matrix(self) -> Sequence: """Data of a table to be outputted.""" @@ -156,56 +145,9 @@ def table_format(self): return TableFormat.from_name(self.format_name) @property - def type_hint_list(self): - warnings.warn("'type_hint_list' has moved to 'type_hints'", DeprecationWarning) - - return self.type_hints - - @type_hint_list.setter - def type_hint_list(self, value): - warnings.warn("'type_hint_list' has moved to 'type_hints'", DeprecationWarning) - - self.type_hints = value - - @property - def styles(self): - warnings.warn("'styles' has moved to 'column_styles'", DeprecationWarning) - return self.column_styles - - @styles.setter - def styles(self, value): - warnings.warn("'styles' has moved to 'column_styles'", DeprecationWarning) - self.column_styles = value - - @property - def style_list(self): - warnings.warn("'style_list' has moved to 'column_styles'", DeprecationWarning) - - return self.column_styles - - @style_list.setter - def style_list(self, value): - warnings.warn("'style_list' has moved to 'column_styles'", DeprecationWarning) - - self.column_styles = value - - @property - def value_preprocessor(self): + def value_preprocessor(self) -> Preprocessor: return self._dp_extractor.preprocessor - @value_preprocessor.setter - def value_preprocessor(self, value): - warnings.warn( - "this setter will be deleted in the future. use update_preprocessor instead", - DeprecationWarning, - ) - - if self._dp_extractor.preprocessor == value: - return - - self._dp_extractor.preprocessor = value - self.__clear_preprocess() - @property def stream(self): return self._stream