MCPcopy Create free account
hub / github.com/microsoft/Webwright / _resolve_prompt

Function _resolve_prompt

src/webwright/tools/self_reflection.py:458–470  ·  view source on GitHub ↗
(cfg: dict[str, Any], key: str, *, required: bool)

Source from the content-addressed store, hash-verified

456# ---------------------------------------------------------------------------
457
458def _resolve_prompt(cfg: dict[str, Any], key: str, *, required: bool) -> str | None:
459 inline = cfg.get(key)
460 file_key = f"{key}_file"
461 file_path = cfg.get(file_key)
462 if inline is not None and file_path is not None:
463 raise ValueError(f"Provide only one of {key!r} or {file_key!r}, not both.")
464 if file_path is not None:
465 return Path(file_path).read_text(encoding="utf-8")
466 if inline is not None:
467 return inline
468 if required:
469 raise ValueError(f"Missing required prompt: {key} (or {file_key}).")
470 return None
471
472
473def _load_config(config_arg: str) -> dict[str, Any]:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected