Private
Public Access
0
0

wip: SSDL analysis (has indentation bug, needs fix)

This commit is contained in:
2026-06-22 10:46:34 -04:00
parent 9113bc21e5
commit 09167986d5
3 changed files with 351 additions and 1 deletions
@@ -0,0 +1,35 @@
"""Fix indentation in ssdl.py file."""
import re
filepath = r'C:\projects\manual_slop_tier2\src\code_path_audit_ssdl.py'
with open(filepath, 'r') as f:
lines = f.readlines()
# Walk and fix indentation based on Python's standard rules
new_lines = []
indent_stack = [0]
for line in lines:
stripped = line.lstrip()
if not stripped or stripped.startswith('#'):
new_lines.append(line)
continue
cur_indent = len(line) - len(stripped)
# If line ends with ':', expected next indent is cur_indent + 2
# If line is at less indent than top of stack, pop
while indent_stack and indent_stack[-1] > cur_indent:
indent_stack.pop()
# Validate the line matches one of the stack
if not indent_stack or indent_stack[-1] != cur_indent:
# Try to recover by setting the indent to top of stack
new_line = ' ' * (indent_stack[-1] if indent_stack else 0) + stripped
else:
new_line = line
new_lines.append(new_line if 'new_line' in dir() else line)
if stripped.rstrip().endswith(':') and not stripped.startswith(' '):
indent_stack.append(cur_indent + 2)
with open(filepath, 'w') as f:
f.writelines(new_lines)
print('done')