Files
manual_slop/temp_cleanup.py
T
ed f6feab9243 fix(gui): Correct indentation bug in _render_mma_dashboard that caused crash
The code after the 'prior session' return block was incorrectly indented
at 1 space, placing it inside the 'if is_viewing_prior_session' block
instead of after it. This caused 'total_cost' and 'perc' to be undefined
when viewing an active session, triggering an IM_ASSERT error.

Fix: Moved 'track_name', 'track_stats', and 'total_cost' to the
correct 2-space indentation (method body level).
2026-05-06 19:41:22 -04:00

35 lines
1.3 KiB
Python

import re
with open('src/mcp_client.py', 'r', encoding='utf-8') as f:
content = f.read()
# 1. Remove nested imports
nested_imports = [
r'^\s+from src\.paths import get_config_path\n',
r'^\s+from src\.ai_client import get_credentials_path\n',
r'^\s+from src\.file_cache import ASTParser\n',
r'^\s+import re\n'
]
for pattern in nested_imports:
content = re.sub(pattern, '', content, flags=re.MULTILINE)
# 2. Update _re to re
content = content.replace('_re.sub', 're.sub')
# 3. Ensure 1-space indentation for code
# This is tricky without a full parser, but let's try to fix lines that have 4n spaces
# and convert them to n spaces if they are not in multi-line strings.
# BUT the user said "Ensure the entire file uses exactly 1-space indentation."
# If the file is already mostly 1-space, maybe just fixing the ones that are not is enough.
# Let's try a simple reindentation:
# Every leading space count 's' becomes 's/1'? No, that doesn't make sense.
# Usually this means: if level 1 was 4 spaces, make it 1 space.
# But here level 1 IS already 1 space.
# So if something is 4 spaces, it might be level 4 or it might be level 1 in 4-space indent style.
# Given the project, it's likely already 1-space per level.
with open('src/mcp_client.py', 'w', encoding='utf-8') as f:
f.write(content)