Skip to content

Commit

Permalink
fix(storage): issue to run server
Browse files Browse the repository at this point in the history
  • Loading branch information
skamril committed Apr 23, 2024
1 parent e167300 commit 8c42941
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions antarest/study/storage/rawstudy/model/filesystem/config/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import typing as t

import typing_extensions as te
from pydantic import Field, root_validator, validator

from antarest.study.business.enum_ignore_case import EnumIgnoreCase
Expand Down Expand Up @@ -468,9 +467,6 @@ class AreaFolder(IniProperties):
)


EnergyCost = te.Annotated[float, Field(ge=0, description="Energy cost (€/MWh)")]


# noinspection SpellCheckingInspection
class ThermalAreasProperties(IniProperties):
"""
Expand Down Expand Up @@ -526,20 +522,20 @@ class ThermalAreasProperties(IniProperties):
'unserverdenergycost': {'at': 6500.0, 'be': 3500.0, 'de': 1250.0, 'fr': 0.0}}
"""

unserverd_energy_cost: t.MutableMapping[str, EnergyCost] = Field(
unserverd_energy_cost: t.MutableMapping[str, float] = Field(
default_factory=dict,
alias="unserverdenergycost",
description="unserverd energy cost (€/MWh) of each area",
)

spilled_energy_cost: t.MutableMapping[str, EnergyCost] = Field(
spilled_energy_cost: t.MutableMapping[str, float] = Field(
default_factory=dict,
alias="spilledenergycost",
description="spilled energy cost (€/MWh) of each area",
)

@validator("unserverd_energy_cost", "spilled_energy_cost", pre=True)
def _validate_energy_cost(cls, v: t.Any) -> t.MutableMapping[str, EnergyCost]:
def _validate_energy_cost(cls, v: t.Any) -> t.MutableMapping[str, float]:
if isinstance(v, dict):
return {str(k): float(v) for k, v in v.items()}
raise TypeError(f"Invalid type for energy cost: {type(v)}")

0 comments on commit 8c42941

Please sign in to comment.