From 6a725a0a52f44b7a84617bb3740836c9dcbebfc8 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 18 Jun 2018 06:25:07 +0000 Subject: [PATCH] Fix "invalid escape sequence" when running with -Werror ``` $ python3.7 -Werror Python 3.7.0rc1 (default, Jun 16 2018, 03:32:08) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> '# noqa(?:: (?P([A-Z][0-9]+(?:[,\s]+)?)+))?' File "", line 1 SyntaxError: invalid escape sequence \s ``` --- src/flake8/defaults.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flake8/defaults.py b/src/flake8/defaults.py index 55cb48a..3ad959b 100644 --- a/src/flake8/defaults.py +++ b/src/flake8/defaults.py @@ -46,7 +46,7 @@ NOQA_INLINE_REGEXP = re.compile( # We do not care about the ``: `` that follows ``noqa`` # We do not care about the casing of ``noqa`` # We want a comma-separated list of errors - '# noqa(?:: (?P([A-Z][0-9]+(?:[,\s]+)?)+))?', + r'# noqa(?:: (?P([A-Z][0-9]+(?:[,\s]+)?)+))?', re.IGNORECASE )