Files
TinyTorch/fix_mlops_syntax.py
Vijay Janapa Reddi 34a59e2064 Fix module test execution issues
- Fixed test functions to only run when modules executed directly
- Added proper __name__ == '__main__' guards to all test calls
- Fixed syntax errors from incorrect replacements in Module 13 and 15
- Modules now import properly without executing tests
- ProductionBenchmarkingProfiler (Module 14) and ProductionMLSystemProfiler (Module 16) fully working
- Other profiler classes present but require full numpy environment to test completely
2025-09-16 00:17:32 -04:00

21 lines
562 B
Python

#!/usr/bin/env python3
"""Fix syntax errors in mlops_dev.py"""
import re
# Read the file
with open('modules/source/15_mlops/mlops_dev.py', 'r') as f:
content = f.read()
# Fix the malformed function definitions
# Pattern: def if __name__ == "__main__":\n function_name():
pattern = r'def if __name__ == "__main__":\n (\w+)\(\):'
replacement = r'def \1():'
content = re.sub(pattern, replacement, content)
# Write back
with open('modules/source/15_mlops/mlops_dev.py', 'w') as f:
f.write(content)
print("✅ Fixed syntax errors in mlops_dev.py")