From 6c23e4335db10e900ea0ca2402e267322c3a2e69 Mon Sep 17 00:00:00 2001 From: Anthony Kim <62267334+anthonykim1@users.noreply.github.com> Date: Thu, 12 Oct 2023 14:44:50 -0700 Subject: [PATCH] Handle white spaces for list along with dictionary (#22209) Legacy normalization script leaves unnecessary white spaces for dictionary as well as list. While there are multiple correct usage of it such as for after a function, for more intuitive REPL experience. We want to keep previous normalization style and white space format EXCEPT for dictionary and list case. Dictionary case is handled, but this is the PR to handle the elimination of extra white spaces for list as well. Closes: #22208 --- pythonFiles/normalizeSelection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonFiles/normalizeSelection.py b/pythonFiles/normalizeSelection.py index 0ac47ab5dc3b..7ace42daa901 100644 --- a/pythonFiles/normalizeSelection.py +++ b/pythonFiles/normalizeSelection.py @@ -119,7 +119,7 @@ def normalize_lines(selection): # Insert a newline between each top-level statement, and append a newline to the selection. source = "\n".join(statements) + "\n" - if selection[-2] == "}": + if selection[-2] == "}" or selection[-2] == "]": source = source[:-1] except Exception: # If there's a problem when parsing statements,