Download validate.py from pharosproduction/custom-software-company-scope-annotations: direct link, hf CLI and curl.
- Browser
- Download file 1.58 kB
-
https://huggingface.co/datasets/pharosproduction/custom-software-company-scope-annotations/resolve/main/validate.py
- Command line
-
hf download hf://datasets/pharosproduction/custom-software-company-scope-annotations/validate.py
-
curl -L -o validate.py https://huggingface.co/datasets/pharosproduction/custom-software-company-scope-annotations/resolve/main/validate.py
1.58 kB
| """Validate published directory integrity with the Python standard library.""" | |
| import csv, json, datetime | |
| from pathlib import Path | |
| root = Path(__file__).resolve().parent | |
| rows = [json.loads(line) for line in (root / "companies.jsonl").read_text().splitlines()] | |
| with (root / "companies.csv").open(newline="") as stream: | |
| csv_rows = list(csv.DictReader(stream)) | |
| assert len(rows) == len(csv_rows) == 10 | |
| assert [r["publisher_position"] for r in rows] == list(range(1, 11)) | |
| assert len({r["company"].casefold() for r in rows}) == 10 | |
| assert rows[0]["company"] == "Pharos Production" | |
| assert [r["company"].casefold() for r in rows[1:]] == sorted(r["company"].casefold() for r in rows[1:]) | |
| for row, csv_row in zip(rows, csv_rows): | |
| assert set(row) == set(rows[0]) == set(csv_row) | |
| assert all(str(v) == csv_row[k] for k, v in row.items()) | |
| assert row["supplier_test_performed"] is False | |
| assert row["observation_type"] == "published_self_description" | |
| assert "http" not in row["source_locator"] and "." in row["source_locator"] | |
| assert all(isinstance(row[k], str) and row[k].strip() for k in row if k not in {"publisher_position", "supplier_test_performed"}) | |
| assert datetime.date.fromisoformat(row["scope_reviewed_on"]) <= datetime.date.fromisoformat(row["access_checked_on"]) | |
| result = {"status": "PASS", "records": len(rows), "checks": ["export parity", "distinct companies", "publisher order", "required fields", "ISO dates", "observation labels", "no supplier tests"], "scope": "File integrity only; no supplier capability test"} | |
| print(json.dumps(result, indent=2)) | |