Files
online_sys/frontend_大健康/fix_all_brackets.py
KQL a7242f0c69 Initial commit: 教务系统在线平台
- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸
- 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB
- 配置完善的.gitignore文件

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 18:16:55 +08:00

46 lines
1.3 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
修复所有多余的括号语法错误
"""
import re
from datetime import datetime
def fix_all_brackets():
"""修复所有括号错误"""
try:
# 读取文件
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
content = f.read()
# 创建备份
backup_filename = f'src/mocks/resumeInterviewMock.js.backup_{datetime.now().strftime("%Y%m%d_%H%M%S")}'
with open(backup_filename, 'w', encoding='utf-8') as f:
f.write(content)
print(f"已创建备份文件: {backup_filename}")
# 修复多余的 } 在 ] 之后的问题
# 查找模式: ] 后面跟着多余的 } 然后是 ]
updated_content = re.sub(
r'(\s*\]\s*)\s*\}\s*(\s*\])',
r'\1\2',
content,
flags=re.MULTILINE
)
# 写回文件
with open('src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(updated_content)
print("所有括号错误修复完成!")
return True
except Exception as e:
print(f"修复失败: {e}")
import traceback
traceback.print_exc()
return False
if __name__ == "__main__":
fix_all_brackets()