Remove bare-value fallback from _extract_labeled
The JS always emits {id, label} objects now; the else branch was dead code
and the docstring was wrong. Update the remaining test that was still
passing bare strings.
https://claude.ai/code/session_01EyAJcMoDktLrY9tSbdHViA
This commit is contained in:
@@ -62,15 +62,9 @@ def _filter_parse(filter_json: str) -> dict:
|
||||
return {}
|
||||
|
||||
|
||||
def _extract_labeled(items: list) -> list[LabeledOption]:
|
||||
"""Convert a list of bare values or ``{id, label}`` dicts to ``(value, label)`` pairs."""
|
||||
result = []
|
||||
for item in items:
|
||||
if isinstance(item, dict):
|
||||
result.append((str(item.get("id", "")), str(item.get("label", ""))))
|
||||
else:
|
||||
result.append((str(item), ""))
|
||||
return result
|
||||
def _extract_labeled(items: list[dict]) -> list[LabeledOption]:
|
||||
"""Convert a list of ``{id, label}`` dicts to ``(value, label)`` pairs."""
|
||||
return [(str(item["id"]), str(item["label"])) for item in items]
|
||||
|
||||
|
||||
def _filter_get_choice(existing: dict, field: str) -> FilterChoice:
|
||||
|
||||
Reference in New Issue
Block a user