INNER CODE UNIT · Python

leading_spaces

magicsword-io/LOLRMM · bin/fix_yaml_formatting.py:59

            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)
                # If this dash is at the same level as the top of stack, replace (sibling item)
                # Otherwise push a new level (nested item)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…