From 6e4b7b533beaa694ae1c570f6b384681a5fd90f9 Mon Sep 17 00:00:00 2001 From: belthlemar Date: Wed, 12 Jun 2024 17:50:21 +0200 Subject: [PATCH] refactor(filesystem): remove useless file --- .../root/output/simulation/mode/common/utils.py | 13 +++++++++++++ .../root/output/simulation/mode/economy.py | 6 +++--- .../root/output/simulation/mode/mcall/mcall.py | 14 -------------- .../root/output/simulation/mode/mcind/mcind.py | 6 +++--- .../root/output/simulation/mode/mcind/scn.py | 14 -------------- 5 files changed, 19 insertions(+), 34 deletions(-) delete mode 100644 antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcall/mcall.py delete mode 100644 antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcind/scn.py diff --git a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/common/utils.py b/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/common/utils.py index 5b332d6457..925a26732d 100644 --- a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/common/utils.py +++ b/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/common/utils.py @@ -1,5 +1,7 @@ import typing as t +from antarest.study.storage.rawstudy.model.filesystem.folder_node import FolderNode +from antarest.study.storage.rawstudy.model.filesystem.inode import TREE from antarest.study.storage.rawstudy.model.filesystem.root.output.simulation.mode.common.areas import ( OutputSimulationAreas, ) @@ -27,3 +29,14 @@ "links": OutputSimulationLinks, "binding_constraints": OutputSimulationBindingConstraintItem, } + + +class OutputSimulationModeCommon(FolderNode): + def build(self) -> TREE: + if not self.config.output_path: + return {} + children: TREE = {} + for key, simulation_class in OUTPUT_MAPPING.items(): + if (self.config.path / key).exists(): + children[key] = simulation_class(self.context, self.config.next_file(key)) + return children diff --git a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/economy.py b/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/economy.py index eec1cd2a77..2ab44c9ad8 100644 --- a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/economy.py +++ b/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/economy.py @@ -2,8 +2,8 @@ from antarest.study.storage.rawstudy.model.filesystem.context import ContextServer from antarest.study.storage.rawstudy.model.filesystem.folder_node import FolderNode from antarest.study.storage.rawstudy.model.filesystem.inode import TREE -from antarest.study.storage.rawstudy.model.filesystem.root.output.simulation.mode.mcall.mcall import ( - OutputSimulationModeMcAll, +from antarest.study.storage.rawstudy.model.filesystem.root.output.simulation.mode.common.utils import ( + OutputSimulationModeCommon, ) from antarest.study.storage.rawstudy.model.filesystem.root.output.simulation.mode.mcind.mcind import ( OutputSimulationModeMcInd, @@ -27,6 +27,6 @@ def build(self) -> TREE: self.context, self.config.next_file("mc-ind"), self.simulation ) if self.simulation.synthesis: - children["mc-all"] = OutputSimulationModeMcAll(self.context, self.config.next_file("mc-all")) + children["mc-all"] = OutputSimulationModeCommon(self.context, self.config.next_file("mc-all")) return children diff --git a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcall/mcall.py b/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcall/mcall.py deleted file mode 100644 index ff9aded294..0000000000 --- a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcall/mcall.py +++ /dev/null @@ -1,14 +0,0 @@ -from antarest.study.storage.rawstudy.model.filesystem.folder_node import FolderNode -from antarest.study.storage.rawstudy.model.filesystem.inode import TREE -from antarest.study.storage.rawstudy.model.filesystem.root.output.simulation.mode.common.utils import OUTPUT_MAPPING - - -class OutputSimulationModeMcAll(FolderNode): - def build(self) -> TREE: - if not self.config.output_path: - return {} - children: TREE = {} - for key, simulation_class in OUTPUT_MAPPING.items(): - if (self.config.path / key).exists(): - children[key] = simulation_class(self.context, self.config.next_file(key)) - return children diff --git a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcind/mcind.py b/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcind/mcind.py index 8007eddd91..403554e71b 100644 --- a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcind/mcind.py +++ b/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcind/mcind.py @@ -2,8 +2,8 @@ from antarest.study.storage.rawstudy.model.filesystem.context import ContextServer from antarest.study.storage.rawstudy.model.filesystem.folder_node import FolderNode from antarest.study.storage.rawstudy.model.filesystem.inode import TREE -from antarest.study.storage.rawstudy.model.filesystem.root.output.simulation.mode.mcind.scn import ( - OutputSimulationModeMcIndScn, +from antarest.study.storage.rawstudy.model.filesystem.root.output.simulation.mode.common.utils import ( + OutputSimulationModeCommon, ) @@ -19,7 +19,7 @@ def __init__( def build(self) -> TREE: children: TREE = { - str("{:05d}".format(scn)): OutputSimulationModeMcIndScn( + str("{:05d}".format(scn)): OutputSimulationModeCommon( self.context, self.config.next_file("{:05d}".format(scn)) ) for scn in self.simulation.playlist or range(1, self.simulation.nbyears + 1) diff --git a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcind/scn.py b/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcind/scn.py deleted file mode 100644 index 4a2ce634a8..0000000000 --- a/antarest/study/storage/rawstudy/model/filesystem/root/output/simulation/mode/mcind/scn.py +++ /dev/null @@ -1,14 +0,0 @@ -from antarest.study.storage.rawstudy.model.filesystem.folder_node import FolderNode -from antarest.study.storage.rawstudy.model.filesystem.inode import TREE -from antarest.study.storage.rawstudy.model.filesystem.root.output.simulation.mode.common.utils import OUTPUT_MAPPING - - -class OutputSimulationModeMcIndScn(FolderNode): - def build(self) -> TREE: - if not self.config.output_path: - return {} - children: TREE = {} - for key, simulation_class in OUTPUT_MAPPING.items(): - if (self.config.path / key).exists(): - children[key] = simulation_class(self.context, self.config.next_file(key)) - return children