MCPcopy Create free account
hub / github.com/github/spec-kit / _normalize_gate_options

Function _normalize_gate_options

src/specify_cli/workflows/_commands.py:238–251  ·  view source on GitHub ↗

Normalise a gate's ``options`` to a stable ``list[str]`` (or ``None``). A valid gate stores a list, but an unvalidated workflow could leave a scalar or tuple. ``None`` stays ``None`` (no options); a list/tuple maps each element through ``str``; any other scalar becomes a single-element

(options: Any)

Source from the content-addressed store, hash-verified

236
237
238def _normalize_gate_options(options: Any) -> list[str] | None:
239 """Normalise a gate's ``options`` to a stable ``list[str]`` (or ``None``).
240
241 A valid gate stores a list, but an unvalidated workflow could leave a
242 scalar or tuple. ``None`` stays ``None`` (no options); a list/tuple maps
243 each element through ``str``; any other scalar becomes a single-element
244 list — so the emitted JSON schema is always ``list[str] | None``. A bare
245 string is treated as one option, never iterated character-by-character.
246 """
247 if options is None:
248 return None
249 if isinstance(options, (list, tuple)):
250 return [str(o) for o in options]
251 return [str(options)]
252
253
254def _run_outcome_exit_code(status_value: str) -> int:

Callers 1

_gate_outcomeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected