Skip to content

Commit d42be5a

Browse files
committed
indent
1 parent 81b423e commit d42be5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/update_readme_snippets.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ def process_snippet_block(match: re.Match, check_mode: bool = False) -> str:
7979
elif in_code:
8080
code_lines.append(line)
8181
existing_code = "\n".join(code_lines).strip()
82-
# Need to remove the indent from existing code for comparison
83-
dedented_existing = "\n".join(line.lstrip() for line in existing_code.split("\n"))
84-
if dedented_existing == code.strip():
82+
# Compare with the indented version we would generate
83+
expected_code = code.replace('\n', f'\n{indent}').strip()
84+
if existing_code == expected_code:
8585
return full_match
8686

8787
return replacement

0 commit comments

Comments
 (0)