MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / resolve_specs

Function resolve_specs

scripts/update_cddl.py:226–243  ·  view source on GitHub ↗

(shortname, cddl_filename) for the core spec and each linked spec, resolved through webref's index.

(webref_commit, urls)

Source from the content-addressed store, hash-verified

224
225
226def resolve_specs(webref_commit, urls):
227 """(shortname, cddl_filename) for the core spec and each linked spec, resolved through webref's index."""
228 index = json.loads(get(WEBREF_RAW.format(commit=webref_commit, path="index.json")))["results"]
229 by_shortname = {entry["shortname"]: entry for entry in index}
230 entries = [by_shortname[CORE_SHORTNAME]]
231 for url in urls:
232 matches = [entry for entry in index if url.rstrip("/") in spec_urls(entry)]
233 if len(matches) != 1:
234 raise RuntimeError(f"Expected one webref spec for {url}, found {len(matches)}")
235 entries.append(matches[0])
236
237 specs = []
238 for entry in entries:
239 extracts = [extract["file"] for extract in entry.get("cddl", []) if extract["name"] == "all"]
240 if len(extracts) != 1:
241 raise RuntimeError(f"{entry['shortname']} has no single 'all' CDDL extract in webref: {entry.get('cddl')}")
242 specs.append((entry["shortname"], Path(extracts[0]).name))
243 return specs
244
245
246def repo_names(shortname):

Callers 1

mainFunction · 0.85

Calls 6

spec_urlsFunction · 0.85
PathClass · 0.85
getFunction · 0.70
getMethod · 0.65
formatMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected