Skip to content

Commit d733f96

Browse files
authored
chore: bug in yaml mapper assumed process_units had name attribute (#1598)
Using dict key as name instead of name attribute, and instead of having it double up.
1 parent 4425d9a commit d733f96

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

src/libecalc/presentation/yaml/yaml_reference_service.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,11 @@ def __init__(
104104

105105
process_units_path = YamlPath(keys=("PROCESS_UNITS",))
106106
for process_unit_key, process_unit in configuration.process_units.items():
107-
name = getattr(process_unit, "name", None)
108-
if name is None:
109-
continue
107+
# TODO: We have both a name attribute (on compressor only) and they key in the dict
108+
# It is unnecessary to have both atm, so just using key for now
110109
process_unit_path = process_units_path.append(process_unit_key)
111-
references[name] = process_unit
112-
reference_yaml_context[name] = process_unit_path
110+
references[process_unit_key] = process_unit
111+
reference_yaml_context[process_unit_key] = process_unit_path
113112

114113
process_pipelines_path = YamlPath(keys=("PROCESS_PIPELINES",))
115114
for process_pipeline_key, process_pipeline in configuration.process_pipelines.items():

src/libecalc/presentation/yaml/yaml_types/process/yaml_process_units.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ class YamlCompressor(YamlBase):
3636
"""
3737

3838
type: Literal["COMPRESSOR"]
39-
name: Annotated[
40-
ProcessUnitReference,
41-
Field(
42-
description="Name of the model. See documentation for more information.",
43-
title="NAME",
44-
),
45-
]
4639
compressor_model: YamlCompressorModelChart
4740

4841

0 commit comments

Comments
 (0)