Files
douyi_guaji_main/tools/legacy/check_indent.py
T
Your Name 836a31d817 refactor: Remove outdated files and enhance Web GUI functionality
- Deleted obsolete markdown files related to follow tab coordinates testing and results.
- Removed outdated batch scripts for launching the Web GUI.
- Updated `config.json` to improve reservation handling and adjust prize value settings.
- Enhanced logging and error handling in `web_gui.py` and `app.js` for better user experience.
- Added automatic screenshot functionality during Web GUI startup for improved monitoring.
2025-12-19 03:31:08 +08:00

38 lines
1.2 KiB
Python

import re
with open('douyin_fudai.py', 'r', encoding='utf-8') as f:
content = f.read()
lines = content.split('\n')
# 查找所有可能的缩进问题模式
problems = []
for i in range(len(lines)-1):
line = lines[i]
next_line = lines[i+1] if i+1 < len(lines) else ''
stripped = line.rstrip()
next_stripped = next_line.rstrip()
if not stripped or not next_stripped:
continue
# 当前行缩进
indent = len(line) - len(line.lstrip())
next_indent = len(next_line) - len(next_line.lstrip())
# 如果当前行是控制语句(以冒号结尾)
if stripped.endswith(':'):
next_content = next_stripped.lstrip()
# 下一行不是 else/elif/except/finally,且缩进不正确
if next_content and not next_content.startswith(('else:', 'elif ', 'except', 'finally:')):
if next_indent <= indent:
problems.append((i+2, indent, next_indent, stripped[-80:], next_stripped[:80]))
print(f'Found {len(problems)} potential indentation problems:')
for p in problems[:50]:
print(f'Line {p[0]}: expected indent > {p[1]}, got {p[2]}')
print(f' After: ...{p[3]}')
print(f' Line: {p[4]}')
print()