Found by Codex global repository scan of deepmodeling/dpgen2 at commit 2679611a3704f5c2646c8cb353e34177518db758.
make_lmp_task_group_from_config overwrites caller-provided conf_idx with None:
|
def make_lmp_task_group_from_config( |
|
numb_models, |
|
mass_map, |
|
config, |
|
): |
|
# Work around the required conf_idx. |
|
# May not be a good design!!! |
|
config["conf_idx"] = [] if "conf_idx" not in config else None |
|
config = lmp_normalize(config) |
|
config = config_strip_confidx(config) |
The comment says this is a workaround for required conf_idx, but the conditional is reversed for preserving user input:
config["conf_idx"] = [] if "conf_idx" not in config else None
If conf_idx is present, the helper discards it before normalization and before config_strip_confidx can process it. Direct users of the exported helper can lose their selected configuration indices or fail validation with None.
Suggested fix: preserve an existing conf_idx value, only insert the empty default when the key is absent, and add a regression test that passes an explicit conf_idx through this helper.
Found by Codex global repository scan of
deepmodeling/dpgen2at commit2679611a3704f5c2646c8cb353e34177518db758.make_lmp_task_group_from_configoverwrites caller-providedconf_idxwithNone:dpgen2/dpgen2/exploration/task/make_task_group_from_config.py
Lines 631 to 640 in 2679611
The comment says this is a workaround for required
conf_idx, but the conditional is reversed for preserving user input:If
conf_idxis present, the helper discards it before normalization and beforeconfig_strip_confidxcan process it. Direct users of the exported helper can lose their selected configuration indices or fail validation withNone.Suggested fix: preserve an existing
conf_idxvalue, only insert the empty default when the key is absent, and add a regression test that passes an explicitconf_idxthrough this helper.