From 9b2d6c366eabc8a720f5f813f0de65fc317a7cfc Mon Sep 17 00:00:00 2001 From: Benjamin Moody Date: Thu, 18 Aug 2022 12:47:08 -0400 Subject: [PATCH] Avoid ambiguous backslashes in regular expression strings. Sequences such as "\s" should be avoided in ordinary Python strings due to the potential for confusion, and will result in warnings in some Python versions. For regular expressions, it's better to use raw strings (r"\s") instead, which make parsing unambiguous without needing to double backslashes. (Since re.compile understands all the ordinary Python backslash sequences, it should be safe to change non-raw regexp strings to raw strings as long as they don't contain any escaped backslashes or quotes.) --- tests/test_annotation.py | 6 +++--- wfdb/io/annotation.py | 6 +++--- wfdb/io/record.py | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/test_annotation.py b/tests/test_annotation.py index 068bfa81..f5a09d91 100644 --- a/tests/test_annotation.py +++ b/tests/test_annotation.py @@ -44,7 +44,7 @@ def test_1(self): target_aux_note = [None] * nannot RXannot = re.compile( - "[ \t]*(?P