MCPcopy Create free account
hub / github.com/BeingBeyond/BeTTER / _require_optional_string_tuple

Function _require_optional_string_tuple

src/task/specs/task_draft_pipeline.py:128–139  ·  view source on GitHub ↗
(payload: Mapping[str, object], key: str)

Source from the content-addressed store, hash-verified

126
127
128def _require_optional_string_tuple(payload: Mapping[str, object], key: str) -> tuple[str, ...]:
129 value = payload.get(key)
130 if value is None:
131 return ()
132 if not isinstance(value, Sequence) or isinstance(value, (str, bytes)):
133 raise ValueError(f"{key} must be a sequence of strings.")
134 result: list[str] = []
135 for item in value:
136 if not isinstance(item, str):
137 raise ValueError(f"{key} must contain only strings.")
138 result.append(item)
139 return tuple(result)
140
141
142

Callers 1

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected