Files
online_sys/frontend_智能开发/final_fix.py

32 lines
879 B
Python
Raw Permalink Normal View History

#!/usr/bin/env python3
import re
# 读取文件
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
content = f.read()
# 删除_end临时键
content = re.sub(r',\s*\/\/ 添加空对象以便语法正确\s*\n\s*"_end": \[\]', '', content)
# 修复第6512行的双花括号问题
lines = content.split('\n')
if len(lines) > 6511:
# 确保第6512行只有一个}
lines[6511] = ' }'
content = '\n'.join(lines)
# 写回文件
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(content)
print("修复完成")
# 验证语法
import subprocess
result = subprocess.run(['node', '-c', 'src/mocks/resumeInterviewMock.js'],
capture_output=True, text=True)
if result.returncode == 0:
print("✅ 语法验证通过!")
else:
print(f"❌ 仍有语法错误:{result.stderr}")