From 1ef0b761b4523f13bc86783b4b26c2ad19798516 Mon Sep 17 00:00:00 2001 From: Thomas Johansen Date: Mon, 18 Nov 2024 14:01:05 +0100 Subject: [PATCH] chore: remove unused methods unused? avoid using because it is not intuitive? complicates things? Refs: ECALC-1830 --- src/ecalc_cli/io/output.py | 9 ++++++--- .../presentation/exporter/formatters/formatter.py | 11 +---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/ecalc_cli/io/output.py b/src/ecalc_cli/io/output.py index 2a5e24d942..181c58f3fd 100644 --- a/src/ecalc_cli/io/output.py +++ b/src/ecalc_cli/io/output.py @@ -151,9 +151,12 @@ def export_tsv( prognosis_filter = config.filter(frequency=frequency) result = prognosis_filter.filter(ExportableGraphResult(results), resampled_periods) - row_based_data: dict[str, list[str]] = CSVFormatter( - separation_character="\t", index_formatters=PeriodFormatterConfig.get_row_index_formatters() - ).format_groups(result) + row_based_data: dict[str, list[str]] = { + key: CSVFormatter( + separation_character="\t", index_formatters=PeriodFormatterConfig.get_row_index_formatters() + ).format(val) + for key, val in result.items() + } exporter = Exporter() exporter.add_handler( diff --git a/src/libecalc/presentation/exporter/formatters/formatter.py b/src/libecalc/presentation/exporter/formatters/formatter.py index a205bca148..d687f7d14f 100644 --- a/src/libecalc/presentation/exporter/formatters/formatter.py +++ b/src/libecalc/presentation/exporter/formatters/formatter.py @@ -1,6 +1,6 @@ import abc -from libecalc.presentation.exporter.formatters.formattable import Formattable, FormattableGroup +from libecalc.presentation.exporter.formatters.formattable import Formattable from libecalc.presentation.exporter.formatters.index_formatter import IndexFormatter @@ -13,9 +13,6 @@ def format(self, table: Formattable) -> list[str]: """ ... - @abc.abstractmethod - def format_group(self, groups: FormattableGroup) -> dict[str, list[str]]: ... - class CSVFormatter: def __init__(self, separation_character: str = ",", index_formatters: list[IndexFormatter] = None): @@ -42,9 +39,3 @@ def format(self, tabular: Formattable) -> list[str]: row = [str(tabular.get_value(row_id, column_id)) for column_id in column_ids] rows.append(self.separation_character.join([*row_index, *row])) return rows - - def format_groups(self, grouped_tabular: FormattableGroup) -> dict[str, list[str]]: - csv_formatted_lists_per_installation: dict[str, list[str]] = {} - for group_name, tabular in grouped_tabular.groups: - csv_formatted_lists_per_installation[group_name] = self.format(tabular) - return csv_formatted_lists_per_installation