Skip to content

Commit

Permalink
Update util.py
Browse files Browse the repository at this point in the history
Added type check for int, float, or str and raise a value error if none of the above
  • Loading branch information
djinnome authored Oct 1, 2024
1 parent b5dee31 commit 146205a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mira/sources/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ def parameter_to_mira(parameter, param_symbols=None) -> Parameter:
for param_key, param_value in distr_json.get("parameters", {}).items():
if isinstance(param_value, float) or isinstance(param_value, int):
processed_distr_parameters[param_key] = param_value
else:
elif isinstance(param_value, str):
processed_distr_parameters[param_key] = \
safe_parse_expr(param_value)
else:
raise ValueError(f"{param_value} is neither a float, int, or str")
distr = Distribution(
type=distr_type,
parameters=processed_distr_parameters,
Expand Down

0 comments on commit 146205a

Please sign in to comment.