Skip to content

Commit

Permalink
Adjusting validation to be 2 or more args
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Lee committed Oct 6, 2023
1 parent a036c55 commit 2318870
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions idaes/core/util/model_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,15 @@ def svd_callback_validator(val):
"""
if callable(val):
sig = signature(val)
if len(sig.parameters) == 2:
if len(sig.parameters) >= 2:
return val

_log.error(f"SVD callback {val} must be a callable which takes two arguments.")
raise ValueError("SVD callback must be a callable which takes two arguments.")
_log.error(
f"SVD callback {val} must be a callable which takes at least two arguments."
)
raise ValueError(
"SVD callback must be a callable which takes at least two arguments."
)


def svd_dense(jacobian, number_singular_values):
Expand Down Expand Up @@ -1445,6 +1449,7 @@ def display_rank_of_equality_constraints(self, stream=None):
counter = 0
for e in self.s:
if e < self.config.singular_value_tolerance:
print(e)
counter += 1

stream.write("=" * MAX_STR_LENGTH + "\n\n")
Expand Down

0 comments on commit 2318870

Please sign in to comment.