Loading simulation_server/models/sim.py +13 −0 Original line number Diff line number Diff line from __future__ import annotations from typing import Optional, Literal, Annotated as A import json from pathlib import Path from pydantic import AwareDatetime, Field, model_validator from raps import SingleSimConfig from raps.utils import AutoAwareDatetime Loading Loading @@ -99,6 +100,18 @@ class ServerSimConfig(SingleSimConfig): start: AutoAwareDatetime # make start required """ Start of the simulation """ def __init__(self, /, **data): # Override context to set base_path RAPS_PATH = (Path(__file__) / '../../../raps').resolve() self.__pydantic_validator__.validate_python( data, self_instance=self, context={ "base_path": RAPS_PATH, "force_under_base_path": True, } ) @model_validator(mode = "after") def _validate_server_sim_config(self): # Force these options regardless of input Loading Loading
simulation_server/models/sim.py +13 −0 Original line number Diff line number Diff line from __future__ import annotations from typing import Optional, Literal, Annotated as A import json from pathlib import Path from pydantic import AwareDatetime, Field, model_validator from raps import SingleSimConfig from raps.utils import AutoAwareDatetime Loading Loading @@ -99,6 +100,18 @@ class ServerSimConfig(SingleSimConfig): start: AutoAwareDatetime # make start required """ Start of the simulation """ def __init__(self, /, **data): # Override context to set base_path RAPS_PATH = (Path(__file__) / '../../../raps').resolve() self.__pydantic_validator__.validate_python( data, self_instance=self, context={ "base_path": RAPS_PATH, "force_under_base_path": True, } ) @model_validator(mode = "after") def _validate_server_sim_config(self): # Force these options regardless of input Loading