Skip to content

Commit a105686

Browse files
DLWoodruffclaude
andauthored
Fix option_dict_to_string flag serialization (missing f-string) (#804)
For a valueless (flag-style) option, option_dict_to_string emitted the literal string "{i}" instead of the option name, because the None branch used a plain string literal rather than an f-string. Flags now serialize as their name and round-trip cleanly through option_string_to_dict. Also collapsed the accumulator loop into a single join expression. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3174edf commit a105686

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

mpisppy/utils/sputils.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -944,13 +944,8 @@ def option_dict_to_string(odict):
944944
"""
945945
if odict is None:
946946
return None
947-
ostr = ""
948-
for i, v in odict.items():
949-
if v is None:
950-
ostr += "{i} "
951-
else:
952-
ostr += f"{i}={v} "
953-
return ostr
947+
return "".join(f"{k} " if v is None else f"{k}={v} "
948+
for k, v in odict.items())
954949

955950

956951
# Solver-options layered representation. See

0 commit comments

Comments
 (0)