Objets/Documentation
comparaison30.py
Conditionnels communs et contrôles · comparaison30.py
Télécharger ↓"""Compare proof precision and canonical compact JSON bytes on the same historical laws."""
from pathlib import Path
import json
from decouverte30 import study
from contacts27 import TRIPLE
def size(obj):
return len(json.dumps(obj,default=str,sort_keys=True,separators=(',',':')).encode('utf8'))
def compare():
old=json.loads(Path(__file__).with_name('precision29.json').read_bytes())
current=study([('AC',[TRIPLE[0],TRIPLE[2]]),('ABC',TRIPLE)])
out=[]
for a,b in zip(old,current['certificates']):
assert a['name']==b['name'] and a['coeff']==list(b['coeff'])
out.append(dict(name=a['name'],before=a['bits'],after=b['bits'],old_bytes=size(a['endpoints']),new_bytes=size(b['endpoints'])))