Skip to content

Commit

Permalink
Remove deprecated functions and properties
Browse files Browse the repository at this point in the history
    - dump_tabledata
    - set_log_level
    - AbstractTableWriter.header_list
    - AbstractTableWriter.type_hint_list
    - AbstractTableWriter.styles
    - AbstractTableWriter.style_list
    - AbstractTableWriter.value_preprocessor.setter
  • Loading branch information
thombashi committed Jun 25, 2023
1 parent 04b8ea5 commit 7777033
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 75 deletions.
6 changes: 2 additions & 4 deletions pytablewriter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -75,9 +75,7 @@
"__version__",
"LineBreakHandling",
"TableWriterFactory",
"dump_tabledata",
"dumps_tabledata",
"set_log_level",
"set_logger",
"FormatAttr",
"TableFormat",
Expand Down
5 changes: 0 additions & 5 deletions pytablewriter/_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down
4 changes: 2 additions & 2 deletions pytablewriter/_logger/__init__.py
Original file line number Diff line number Diff line change
@@ -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")
5 changes: 0 additions & 5 deletions pytablewriter/_logger/_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
60 changes: 1 addition & 59 deletions pytablewriter/writer/_table_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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
Expand Down

0 comments on commit 7777033

Please sign in to comment.