diff --git a/src/black/trans.py b/src/black/trans.py index 83e3e7960e5..15703a6d1a9 100644 --- a/src/black/trans.py +++ b/src/black/trans.py @@ -973,13 +973,13 @@ def iter_fexpr_spans(s: str) -> Iterator[Tuple[int, int]]: # if we're in an expression part of the f-string, fast forward through strings if stack: delim = None - if s[i: i + 3] in ("'''", '"""'): - delim = s[i: i + 3] + if s[i : i + 3] in ("'''", '"""'): + delim = s[i : i + 3] elif s[i] in ("'", '"'): delim = s[i] if delim: i += len(delim) - while i < len(s) and s[i:i + len(delim)] != delim: + while i < len(s) and s[i : i + len(delim)] != delim: i += 1 i += 1 @@ -1089,9 +1089,8 @@ def do_transform(self, line: Line, string_idx: int) -> Iterator[TResult[Line]]: # contain any f-expressions, but ONLY if the original f-string # contains at least one f-expression. Otherwise, we will alter the AST # of the program. - drop_pointless_f_prefix = ( - ("f" in prefix) - and any(True for _ in iter_fexpr_spans(LL[string_idx].value)) + drop_pointless_f_prefix = ("f" in prefix) and any( + True for _ in iter_fexpr_spans(LL[string_idx].value) ) first_string_line = True