Skip to content

Commit 78d8b45

Browse files
committed
Allow W605 to be silenced by noqa
1 parent 2e0de4b commit 78d8b45

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pycodestyle.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,12 +1509,15 @@ def python_3000_backticks(logical_line):
15091509

15101510

15111511
@register_check
1512-
def python_3000_invalid_escape_sequence(logical_line, tokens):
1512+
def python_3000_invalid_escape_sequence(logical_line, tokens, noqa):
15131513
r"""Invalid escape sequences are deprecated in Python 3.6.
15141514
15151515
Okay: regex = r'\.png$'
15161516
W605: regex = '\.png$'
15171517
"""
1518+
if noqa:
1519+
return
1520+
15181521
# https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
15191522
valid = [
15201523
'\n',

testsuite/W60.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
\\.png$
4141
'''
4242
s = '\\'
43+
regex = '\w' # noqa
44+
regex = '''
45+
\w
46+
''' # noqa
4347
#: W606
4448
async = 42
4549
#: W606

0 commit comments

Comments
 (0)