INNER CODE UNIT · Python
expected_dash_indent
magicsword-io/LOLRMM · bin/fix_yaml_formatting.py:51
if list_stack and expected_dash_indent == list_stack[-1][0]:
list_stack[-1] = (expected_dash_indent, expected_dash_indent + 2)
else:
list_stack.append((expected_dash_indent, expected_dash_indent + 2))
# If this dash has a key, track it for nested lists
if dash_has_key:
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: