Skip to content

Commit

Permalink
refactor(filesystem): remove useless file
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Jun 18, 2024
1 parent 1155701 commit 6e4b7b5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -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,
)
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
)


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

This file was deleted.

0 comments on commit 6e4b7b5

Please sign in to comment.