summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Stapleton Cordasco <graffatcolmingov@gmail.com>2019-01-27 18:27:14 -0600
committerGitHub <noreply@github.com>2019-01-27 18:27:14 -0600
commit99a4eb8d0c010dc7cd96a68bc8090de8735ea6b1 (patch)
treed48fd6f33af66a0f6c365e175189ce58bc2a6098
parent2e0de4be72335e3a4ed6bf9fe4a2ac48c1e7d5c4 (diff)
parent78d8b45d65a7dc32565031aa10f6f263139ca2fa (diff)
downloadpep8-99a4eb8d0c010dc7cd96a68bc8090de8735ea6b1.tar.gz
Merge pull request #831 from asottile/noqa_W605
Allow W605 to be silenced by noqa
-rwxr-xr-xpycodestyle.py5
-rw-r--r--testsuite/W60.py4
2 files changed, 8 insertions, 1 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index 766e6bd..a022165 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -1509,12 +1509,15 @@ def python_3000_backticks(logical_line):
@register_check
-def python_3000_invalid_escape_sequence(logical_line, tokens):
+def python_3000_invalid_escape_sequence(logical_line, tokens, noqa):
r"""Invalid escape sequences are deprecated in Python 3.6.
Okay: regex = r'\.png$'
W605: regex = '\.png$'
"""
+ if noqa:
+ return
+
# https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
valid = [
'\n',
diff --git a/testsuite/W60.py b/testsuite/W60.py
index 42a8c6d..5003677 100644
--- a/testsuite/W60.py
+++ b/testsuite/W60.py
@@ -40,6 +40,10 @@ regex = r'''
\\.png$
'''
s = '\\'
+regex = '\w' # noqa
+regex = '''
+\w
+''' # noqa
#: W606
async = 42
#: W606