16 lines
506 B
Python
16 lines
506 B
Python
#!/usr/bin/env python3
|
|
import json
|
|
from pathlib import Path
|
|
import sys
|
|
root=Path(__file__).resolve().parents[1]
|
|
files=list((root/'data'/'osv').rglob('*.json'))
|
|
if not files:
|
|
sys.exit('Fehler: Keine OSV-Dateien gefunden')
|
|
for p in files:
|
|
try:
|
|
v=json.loads(p.read_bytes())
|
|
assert isinstance(v,dict) and isinstance(v.get('id'),str) and v['id']
|
|
except (ValueError, AssertionError) as e:
|
|
sys.exit(f'Ungültig: {p}: {e}')
|
|
print(f'{len(files)} Ubuntu OSV-Datensätze gültig')
|