From f75d60a63f9b5e99481231ea9b2b956616278327 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 8 Jul 2022 12:08:54 -0400 Subject: style: use new regex match object group access --- coverage/misc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'coverage/misc.py') diff --git a/coverage/misc.py b/coverage/misc.py index 777cdc43..e9b1b8eb 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -324,17 +324,17 @@ def substitute_variables(text, variables): def dollar_replace(match): """Called for each $replacement.""" - # Only one of the groups will have matched, just get its text. + # Only one of the dollar_groups will have matched, just get its text. word = next(g for g in match.group(*dollar_groups) if g) # pragma: always breaks if word == "$": return "$" elif word in variables: return variables[word] - elif match.group('strict'): + elif match['strict']: msg = f"Variable {word} is undefined: {text!r}" raise CoverageException(msg) else: - return match.group('defval') + return match['defval'] text = re.sub(dollar_pattern, dollar_replace, text) return text -- cgit v1.2.1