Skip to content

Commit

Permalink
fix(BCs-management): correct typos within the code, improve the naming
Browse files Browse the repository at this point in the history
  • Loading branch information
mabw-rte committed Jul 23, 2024
1 parent 08d652c commit e41786e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion antarest/study/business/binding_constraint_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'"
)
4 changes: 2 additions & 2 deletions antarest/study/storage/rawstudy/model/filesystem/lazy_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit e41786e

Please sign in to comment.