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

Function pin_vendors

scripts/update_cddl.py:267–280  ·  view source on GitHub ↗

(namespace, source, branch, commit, [(filename, sha256)]) per vendor, for every .cddl file in its directory.

()

Source from the content-addressed store, hash-verified

265
266
267def pin_vendors():
268 """(namespace, source, branch, commit, [(filename, sha256)]) per vendor, for every .cddl file in its directory."""
269 pinned = []
270 for namespace, source in VENDOR_CDDL_SOURCES.items():
271 repo, path = source["repo"], source["path"]
272 branch, commit = resolve_path_commit_for(repo, source["branches"], path)
273 listing = json.loads(get(f"https://api.github.com/repos/{repo}/contents/{path}?ref={commit}", API_HEADERS))
274 filenames = sorted(e["name"] for e in listing if e["type"] == "file" and e["name"].endswith(".cddl"))
275 if not filenames:
276 raise RuntimeError(f"No CDDL files in {repo}@{commit} under {path}")
277 base_url = VENDOR_RAW.format(repo=repo, commit=commit, path=path)
278 files = [(filename, sha256_of(get(f"{base_url}/{filename}"))) for filename in filenames]
279 pinned.append((namespace, source, branch, commit, files))
280 return pinned
281
282
283def vendor_repo_names(vendors):

Callers 1

mainFunction · 0.85

Calls 6

resolve_path_commit_forFunction · 0.85
sha256_ofFunction · 0.85
itemsMethod · 0.80
getFunction · 0.70
formatMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected