MCPcopy
hub / github.com/walter201230/Python / cmd_validate

Function cmd_validate

tools/download_legacy_images.py:115–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113
114
115def cmd_validate() -> int:
116 pairs = scan_urls()
117 bad: list[Path] = []
118 missing: list[Path] = []
119 for local, url in pairs:
120 if not local.exists():
121 missing.append(local)
122 continue
123 if detect_image_kind(local) is None:
124 bad.append(local)
125 print(f"扫描到 {len(pairs)} 个 URL,缺失 {len(missing)},损坏 {len(bad)}")
126 for p in bad:
127 print(f" BAD {p}")
128 for p in missing[:20]:
129 print(f" MISSING {p}")
130 if len(missing) > 20:
131 print(f" ... 共 {len(missing)} 个缺失")
132 return 1 if bad or missing else 0
133
134
135def main() -> int:

Callers 1

mainFunction · 0.85

Calls 2

scan_urlsFunction · 0.85
detect_image_kindFunction · 0.85

Tested by

no test coverage detected