Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Nov 29, 2021
1 parent 8694740 commit d709a80
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/black/trans.py
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d709a80

Please sign in to comment.