From c28544cc9a0c5113bd3a9279f47a2b7ea8826980 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 3 Oct 2022 10:08:44 -0400 Subject: refactor: since we are showing regexes, make them a bit simpler The old code would always wrap the regex in a needless `(?s:...)` parenthesis. Path aliases are always single regexes, so they don't need that extra wrapping. This makes logged path maps easier to understand. --- coverage/misc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'coverage/misc.py') diff --git a/coverage/misc.py b/coverage/misc.py index 98a5d139..e3c67bc6 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -182,7 +182,11 @@ def bool_or_none(b): def join_regex(regexes): """Combine a series of regexes into one that matches any of them.""" - return "|".join(f"(?:{r})" for r in regexes) + regexes = list(regexes) + if len(regexes) == 1: + return regexes[0] + else: + return "|".join(f"(?:{r})" for r in regexes) def file_be_gone(path): -- cgit v1.2.1