diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-07-08 12:08:54 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-07-08 12:08:54 -0400 |
commit | f75d60a63f9b5e99481231ea9b2b956616278327 (patch) | |
tree | cf6762c8b801fbb25dea8177f9b8774f735e1546 /coverage/misc.py | |
parent | 8447c995e822ca63836037290d045f0fd6d53fb5 (diff) | |
download | python-coveragepy-git-f75d60a63f9b5e99481231ea9b2b956616278327.tar.gz |
style: use new regex match object group access
Diffstat (limited to 'coverage/misc.py')
-rw-r--r-- | coverage/misc.py | 6 |
1 files changed, 3 insertions, 3 deletions
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 |