You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
560 B

  1. from typing import List
  2. from .dataset import Dataset
  3. from .formatters import Formatter
  4. from .writers import Writer
  5. class ExportApplicationService:
  6. def __init__(self, dataset: Dataset, formatters: List[Formatter], writer: Writer):
  7. self.dataset = dataset
  8. self.formatters = formatters
  9. self.writer = writer
  10. def export(self, file):
  11. dataset = self.dataset.to_dataframe()
  12. for formatter in self.formatters:
  13. dataset = formatter.format(dataset)
  14. self.writer.write(file, dataset)
  15. return file