Skip to content

Commit

Permalink
Switch to using ruamel YAML parser
Browse files Browse the repository at this point in the history
  • Loading branch information
EdmundGoodman committed Feb 17, 2024
1 parent f085ce6 commit 3579f20
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- [x] Generate sbatch files from YAML
- [ ] Improvements
- [ ] Results analysis
- [ ] Result aggregation
- [x] Result aggregation
- [ ] Result analysis
- [ ] Statistical re-runs
- [ ] YAML schema
Expand Down
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry.dependencies]
python = "^3.10"
pyyaml = "^6.0.1"
pydantic = "^2.6.1"
types-pyyaml = "^6.0.12.12"
ruamel-yaml = "^0.18.6"

[tool.poetry.group.dev.dependencies]
black = "^23.7.0"
Expand Down
6 changes: 3 additions & 3 deletions src/hpc_multibench/yaml_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class Defaults(BaseModel):
from re import search as re_search
from typing import Any, Self

import yaml
# from yaml import safe_load
from ruamel.yaml import YAML
from pydantic import BaseModel

from hpc_multibench.configuration import RunConfiguration
Expand Down Expand Up @@ -140,8 +141,7 @@ class TestPlan(BaseModel):
def from_yaml(cls, file: Path) -> Self:
"""Construct the model from a YAML file."""
with file.open(encoding="utf-8") as handle:
data = yaml.safe_load(handle)
return cls(**data)
return cls(**YAML(typ="safe").load(handle))

def run(self) -> None:
"""."""
Expand Down

0 comments on commit 3579f20

Please sign in to comment.