Files
cs249r_book/scripts/final_last_4.py
T
Vijay Janapa Reddi fccee3c735 Refactor: complete the Great Constant Migration across mlsysim and Quarto chapters
- Migrated all legacy constants from constants.py to hardware and model registries
- Updated dozens of LEGO blocks in Volume 1 and Volume 2 to use Engine.solve and formulas
- Resolved all resulting NameError, TypeError, and AttributeError exceptions in the inline Python blocks
- Master Quarto HTML build now passes with zero execution failures
2026-05-23 16:45:00 -04:00

17 lines
602 B
Python

import re
import glob
qmds = glob.glob('book/quarto/contents/**/*.qmd', recursive=True)
for q in qmds:
with open(q, 'r') as f: c = f.read()
orig = c
if 'data_engineering.qmd' in q:
c = c.replace('calc_transfer_time(dataset_pb * ureg.petabyte, network_bw)', '(dataset_pb * ureg.petabyte) / network_bw')
c = c.replace('calc_transfer_time(dataset_pb * ureg.petabyte, 10 * Gbps)', '(dataset_pb * ureg.petabyte) / (10 * Gbps)')
c = c.replace('from mlsysim.core.formulas import calc_transfer_time', '')
if c != orig:
with open(q, 'w') as f: f.write(c)