main
John Lauer Preserve board29, component assets and scaffold-fit correction candidate with reviewed footage c54169e
"""Prepare exact native-UUID USB/debug stub trims on a disposable saved copy."""
import re,shutil,json
from pathlib import Path
p=Path(__file__).resolve().parents[1];s=(p/'kicad/adom-custom-electronic-load.kicad_pcb').read_text();edits={
'cfda7d45-11d7-4f62-b73a-5f81137bae80':('end',(152.6,46.5)),
'eb61b4c7-346a-4fb4-a835-fba81c339c01':('end',(152.6,46.5)),
'b55449b1-1c18-4939-b82d-da3c853e7df6':('end',(146,44.2)),
'89f8ac6b-f42a-4204-85a0-5c99f2615161':('start',(155,51.5))}
for uid,(which,xy)in edits.items():
 pattern=r'\(segment\s+(?:(?!\(segment)[\s\S])*?\(uuid "'+uid+r'"\)\s*\)'
 matches=list(re.finditer(pattern,s));assert len(matches)==1,uid
 m=matches[0];block=m.group();block,n=re.subn(r'\('+which+r' [^)]*\)',f'({which} {xy[0]} {xy[1]})',block);assert n==1;s=s[:m.start()]+block+s[m.end():]
out=p/'checkpoints/usb-trim';out.mkdir(exist_ok=True);(out/'adom-custom-electronic-load.kicad_pcb').write_text(s)
for ext in ['kicad_pro','kicad_dru']:shutil.copy2(p/'kicad'/('adom-custom-electronic-load.'+ext),out/('adom-custom-electronic-load.'+ext))
(out/'edits.json').write_text(json.dumps(edits,indent=2))