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

Function _resolve_artifact_dir

src/webwright/tools/self_reflection.py:140–174  ·  view source on GitHub ↗
(
    *,
    images: list[Path],
    discovered_run_dir: Path | None,
    output_path: str,
    workspace_dir: str,
)

Source from the content-addressed store, hash-verified

138
139
140def _resolve_artifact_dir(
141 *,
142 images: list[Path],
143 discovered_run_dir: Path | None,
144 output_path: str,
145 workspace_dir: str,
146) -> Path | None:
147 candidates: list[Path] = []
148
149 inferred_run_dir = _infer_run_dir_from_images(images)
150 if inferred_run_dir is not None:
151 candidates.append(inferred_run_dir)
152
153 if discovered_run_dir is not None:
154 candidates.append(discovered_run_dir.resolve())
155
156 if output_path:
157 candidates.append(Path(output_path).resolve().parent)
158
159 base_dir = Path(workspace_dir).resolve() if workspace_dir else Path.cwd().resolve()
160 candidates.append(base_dir)
161
162 seen: set[Path] = set()
163 ordered_candidates: list[Path] = []
164 for candidate in candidates:
165 if candidate in seen:
166 continue
167 seen.add(candidate)
168 ordered_candidates.append(candidate)
169
170 for candidate in ordered_candidates:
171 if (candidate / "final_script_log.txt").is_file():
172 return candidate
173
174 return ordered_candidates[0] if ordered_candidates else None
175
176
177def _load_action_history_log(artifact_dir: Path | None) -> str:

Callers 1

mainFunction · 0.85

Calls 1

Tested by

no test coverage detected