From e41786ee814a2068cb7b541fb947f2940d422a2a Mon Sep 17 00:00:00 2001 From: Mohamed Abdel Wedoud Date: Tue, 23 Jul 2024 23:40:29 +0200 Subject: [PATCH] fix(BCs-management): correct `typos` within the code, improve the naming --- antarest/study/business/binding_constraint_management.py | 2 +- .../study/storage/rawstudy/model/filesystem/lazy_node.py | 4 ++-- .../variantstudy/model/command/update_binding_constraint.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/antarest/study/business/binding_constraint_management.py b/antarest/study/business/binding_constraint_management.py index c63a5db722..95090e0e32 100644 --- a/antarest/study/business/binding_constraint_management.py +++ b/antarest/study/business/binding_constraint_management.py @@ -956,5 +956,5 @@ def check_attributes_coherence( ] if conflicting_matrices: raise InvalidFieldForVersionError( - f"You cannot fill matrices '{OPERATOR_CONFLICT_MAP[operator]}' while using the operator " f"'{operator}'" + f"You cannot fill matrices '{OPERATOR_CONFLICT_MAP[operator]}' while using the operator '{operator}'" ) diff --git a/antarest/study/storage/rawstudy/model/filesystem/lazy_node.py b/antarest/study/storage/rawstudy/model/filesystem/lazy_node.py index c3abb91e15..73a1ab2b3e 100644 --- a/antarest/study/storage/rawstudy/model/filesystem/lazy_node.py +++ b/antarest/study/storage/rawstudy/model/filesystem/lazy_node.py @@ -144,7 +144,7 @@ def save(self, data: t.Union[str, bytes, S], url: t.Optional[t.List[str]] = None self.get_link_path().unlink() return None - def rename_filename(self, target: t.Union[Path, "LazyNode[t.Any, t.Any, t.Any]"]) -> None: + def rename_file(self, target: t.Union[Path, "LazyNode[t.Any, t.Any, t.Any]"]) -> None: target_path = target if isinstance(target, Path) else target._infer_target_path(self.get_link_path().exists()) target_path.unlink(missing_ok=True) self._infer_path().rename(target_path) @@ -176,7 +176,7 @@ def load( Args: url: data path to retrieve depth: after url is reached, node expand tree until matches depth asked - expanded: context parameter to determine if current node become from an expansion + expanded: context parameter to determine if current node comes from an expansion formatted: ask for raw file transformation Returns: diff --git a/antarest/study/storage/variantstudy/model/command/update_binding_constraint.py b/antarest/study/storage/variantstudy/model/command/update_binding_constraint.py index 204ed1673e..6c1d9bafae 100644 --- a/antarest/study/storage/variantstudy/model/command/update_binding_constraint.py +++ b/antarest/study/storage/variantstudy/model/command/update_binding_constraint.py @@ -81,10 +81,10 @@ def _update_matrices_names( assert isinstance( new_matrix_node, LazyNode ), f"Node type not handled yet: LazyNode expected, got {type(new_matrix_node)}" - matrix_node.rename_filename(new_matrix_node) + matrix_node.rename_file(new_matrix_node) elif new_operator == BindingConstraintOperator.BOTH: if existing_operator == BindingConstraintOperator.EQUAL: - matrix_eq.rename_filename(matrix_lt) + matrix_eq.rename_file(matrix_lt) matrix_gt.delete() # copy the matrix lt to gt matrix_lt.copy_file(matrix_gt) @@ -97,7 +97,7 @@ def _update_matrices_names( else: if new_operator == BindingConstraintOperator.EQUAL: # we may retrieve the mean of the two matrices, but here we just copy the lt matrix - matrix_lt.rename_filename(matrix_eq) + matrix_lt.rename_file(matrix_eq) matrix_gt.delete() elif new_operator == BindingConstraintOperator.LESS: matrix_gt.delete()