Files
Investidor-V2/outputs/investmoz-parques-QA-20261016/normalize-logs.py
T
nala cef6e201c7
tests / ci (push) Canceled after 0s
versao nrgocios 2
2026-10-16 20:11:05 +02:00

7 lines
597 B
Python

from pathlib import Path
import re,json,hashlib
out=Path(__file__).resolve().parent;history=[]
for name in ['BUILD-CANDIDATE.log','BUILD-COMPATIBILITY.log','TYPES-CHECK.log','LINT.log']:
p=out/name;raw=p.read_bytes();text=raw.decode('utf-16') if raw.startswith(b'\xff\xfe') else raw.decode('utf-8-sig');text=re.sub(r'\x1b\[[0-9;]*[A-Za-z]','',text);history.append({'name':name,'source_sha256':hashlib.sha256(raw).hexdigest(),'normalization':'UTF-8; terminal colour escapes removed'});p.write_text(text,'utf-8')
(out/'NORMALIZACAO-LOGS.json').write_text(json.dumps(history,indent=2)+'\n','utf-8')