sharktide/tools / buckets_s3_coverage.py
sharktide's picture
download
raw
1.86 kB
"""Check the explicit parity inventory against the pinned SDK's S3 API model."""
import argparse
from collections import Counter
import csv
import json
from pathlib import Path
from botocore.session import Session
ROOT = Path(__file__).resolve().parents[1]
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--check", action="store_true", help="Fail if API coverage inventory is incomplete or invalid")
parser.parse_args()
model = Session().get_service_model("s3")
with (ROOT / "docs/buckets/s3-compatibility.csv").open(newline="") as stream:
rows = list(csv.DictReader(stream))
expected = set(model.operation_names)
actual = [row["operation"] for row in rows]
if len(actual) != len(set(actual)) or set(actual) != expected:
raise SystemExit(
f"S3 inventory mismatch: missing={sorted(expected - set(actual))}, obsolete={sorted(set(actual) - expected)}"
)
for row in rows:
if row["status"] not in {"missing", "partial", "complete"}:
raise SystemExit(f"Invalid status: {row['operation']}")
if row["status"] != "missing":
evidence = row["verification"].split(";")
if not all(name.startswith("tests/") and (ROOT / name).is_file() for name in evidence):
raise SystemExit(f"Missing verification references: {row['operation']}")
if row["status"] in {"missing", "partial"} and not row["remaining"]:
raise SystemExit(f"Missing gap description: {row['operation']}")
print(
json.dumps(
{
"api_version": model.api_version,
"operations": len(rows),
"status": dict(Counter(row["status"] for row in rows)),
},
sort_keys=True,
)
)
if __name__ == "__main__":
main()

Xet Storage Details

Size:
1.86 kB
·
Xet hash:
8330f0963b49bbad01793cf21d95030b9a866609d4ccd08b8dfcbf3d7852ba9b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.