Skip to content

Commit

Permalink
chore: remove unused methods
Browse files Browse the repository at this point in the history
unused? avoid using because it is not intuitive? complicates
things?

Refs: ECALC-1830
  • Loading branch information
TeeeJay committed Nov 18, 2024
1 parent 9527609 commit 1ef0b76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
9 changes: 6 additions & 3 deletions src/ecalc_cli/io/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 1 addition & 10 deletions src/libecalc/presentation/exporter/formatters/formatter.py
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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):
Expand All @@ -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

0 comments on commit 1ef0b76

Please sign in to comment.