INNER CODE UNIT · Python
last_key_indent
magicsword-io/LOLRMM · bin/fix_yaml_formatting.py:57
last_key_indent = expected_dash_indent + 2 # Key is at dash + 2
# Check if this dash should be indented under the last key
elif last_key_indent is not None and leading_spaces == last_key_indent + 2:
# This dash is 2 spaces more than the last key (ruamel's offset from parent dash)
# But it should be 4 spaces more
expected_dash_indent = last_key_indent + 4
fixed_lines.append(" " * expected_dash_indent + stripped)
list_stack.append((expected_dash_indent, expected_dash_indent + 2))
# Remember this adjustment for sibling dashes
dash_adjustments[leading_spaces] = expected_dash_indent
# If this dash has a key, track it for nested lists
if dash_has_key:
last_key_indent = expected_dash_indent + 2
else:
last_key_indent = None
else:
# Regular dash - keep as-is
fixed_lines.append(line)