File size: 1,810 Bytes
4b8c78e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
"""Offline release metadata and code-inventory checks; no experiment claims."""
from __future__ import annotations
import json
import re
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / 'tools'))
from release_integrity import verify


def main() -> int:
    errors = verify(ROOT, ROOT / 'SHA256SUMS')
    for name in ('README.md', 'CITATION.cff', 'LICENSE', 'RELEASE_SCOPE.md', 'PROVENANCE.md'):
        if not (ROOT / name).is_file():
            errors.append(f'Required release file missing: {name}')
    doc = json.loads((ROOT / 'dataset_metadata/croissant.json').read_text())
    if doc.get('version') != '1.0.2' or doc.get('url') != 'https://huggingface.co/datasets/CM-EVS-Dataset/cmevs-erp-eval':
        errors.append('Dataset metadata version or public URL is not the reviewed release')
    text = json.dumps(doc)
    if any(marker in text for marker in ('TODO_SHA256', 'Anonymous Authors', 'under review')):
        errors.append('Dataset metadata contains legacy release markers')
    for item in doc.get('distribution', []):
        if item.get('@type') == 'cr:FileObject' and not re.fullmatch(r'[0-9a-f]{64}', item.get('sha256', '')):
            errors.append(f'Invalid resource checksum: {item.get("@id")}')
    title = 'CM-EVS: Sparse Panoramic RGB-D-Pose Data for Coverage-Oriented Scene Observation'
    if title not in (ROOT / 'CITATION.cff').read_text() or 'Anonymous Authors' in (ROOT / 'LICENSE').read_text():
        errors.append('Citation title or license attribution is stale')
    if errors:
        print('\n'.join(errors), file=sys.stderr)
        return 1
    print('PASS: public release metadata and code integrity checks')
    return 0


if __name__ == '__main__':
    raise SystemExit(main())