Skip to content

Commit 9f8f4e3

Browse files
committed
Remove unnecessary parens and revert prefix to inline style
- Remove parens around `i == len(lines) - 1` assignments - Revert prefix construction back to inline ternary style https://claude.ai/code/session_01Lu9bsuRrPN8R1yVJt5T7oj
1 parent 2e17970 commit 9f8f4e3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

coconut/compiler/compiler.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4798,7 +4798,7 @@ def _d_string_dedent(text, loc, placeholder=None):
47984798
# blank lines are ignored except the last line (closing quotes line)
47994799
indent = None
48004800
for i, line in enumerate(lines):
4801-
is_last = (i == len(lines) - 1)
4801+
is_last = i == len(lines) - 1
48024802
check_line = line.replace(placeholder, "X") if placeholder else line
48034803
if not is_last and check_line.strip() == "":
48044804
continue
@@ -4821,7 +4821,7 @@ def _d_string_dedent(text, loc, placeholder=None):
48214821
# apply dedentation
48224822
result_lines = []
48234823
for i, line in enumerate(lines):
4824-
is_last = (i == len(lines) - 1)
4824+
is_last = i == len(lines) - 1
48254825
check_line = line.replace(placeholder, "X") if placeholder else line
48264826
if check_line.strip() == "" and not is_last:
48274827
result_lines.append("")
@@ -4866,12 +4866,7 @@ def d_string_handle(self, original, loc, tokens):
48664866
# apply dedentation
48674867
text = self._d_string_dedent(text, loc)
48684868

4869-
prefix = ""
4870-
if has_b:
4871-
prefix += "b"
4872-
if raw:
4873-
prefix += "r"
4874-
return prefix + self.wrap_str(text, strchar[0], multiline=True)
4869+
return ("b" if has_b else "") + ("r" if raw else "") + self.wrap_str(text, strchar[0], multiline=True)
48754870

48764871
def d_f_string_handle(self, original, loc, tokens, is_t=False):
48774872
"""Process d-string combined with f or t prefix."""

0 commit comments

Comments
 (0)