Skip to content

Commit 90d5f7e

Browse files
committed
fixup! Replace percent formatting
1 parent 98a88d8 commit 90d5f7e

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

beets/util/functemplate.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,6 @@ def __init__(self, string, in_argument=False):
296296
GROUP_CLOSE,
297297
ESCAPE_CHAR,
298298
)
299-
special_char_re = re.compile(
300-
rf"[{''.join(re.escape(c) for c in special_chars)}]|\Z"
301-
)
302299
escapable_chars = (SYMBOL_DELIM, FUNC_DELIM, GROUP_CLOSE, ARG_SEP)
303300
terminator_chars = (GROUP_CLOSE,)
304301

@@ -310,20 +307,18 @@ def parse_expression(self):
310307
"""
311308
# Append comma (ARG_SEP) to the list of special characters only when
312309
# parsing function arguments.
313-
extra_special_chars = ()
314-
special_char_re = self.special_char_re
315-
if self.in_argument:
316-
special_chars = (*self.special_chars, ARG_SEP)
317-
special_char_re = re.compile(
318-
rf"[{''.join(map(re.escape, special_chars))}]|\Z"
319-
)
310+
extra_special_chars = (ARG_SEP,) if self.in_argument else ()
311+
special_chars = (*self.special_chars, *extra_special_chars)
312+
special_char_re = re.compile(
313+
rf"[{''.join(map(re.escape, special_chars))}]|\Z"
314+
)
320315

321316
text_parts = []
322317

323318
while self.pos < len(self.string):
324319
char = self.string[self.pos]
325320

326-
if char not in self.special_chars + extra_special_chars:
321+
if char not in special_chars:
327322
# A non-special character. Skip to the next special
328323
# character, treating the interstice as literal text.
329324
next_pos = (

0 commit comments

Comments
 (0)