[Bugfix] Let an optional Literal flag accept the None it advertises (#52370)

Signed-off-by: Vineeth Sai <vineethsai4444@gmail.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Vineeth Sai Varikuntla
2026-09-16 12:14:54 +00:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Harry Mellor
parent 6a2fdf9ac6
commit 903285fbcc
2 changed files with 25 additions and 6 deletions
+2 -2
View File
@@ -411,7 +411,7 @@ def _compute_kwargs(cls: ConfigType) -> dict[str, dict[str, Any]]:
if type(None) in type_hints and not contains_type(type_hints, bool):
kwargs[name]["type"] = optional_type(kwargs[name]["type"])
if kwargs[name].get("choices"):
kwargs[name]["choices"].append("None")
kwargs[name]["choices"].append(None)
return kwargs
@@ -1526,7 +1526,7 @@ class EngineArgs:
)
# TODO: generalise this special case
choices = observability_kwargs["collect_detailed_traces"]["choices"]
metavar = f"{{{','.join(choices)}}}"
metavar = f"{{{','.join(str(c) for c in choices)}}}"
observability_kwargs["collect_detailed_traces"]["metavar"] = metavar
observability_kwargs["collect_detailed_traces"]["choices"] += [
",".join(p) for p in permutations(get_args(DetailedTraceModules), r=2)