Skip to content

Commit 368e62c

Browse files
adiroibansigmavirus24
authored andcommitted
Finalize support for Python 3.7
Python 3.7 added a warning for a future feature of nested regular expressions. To avoid this warning we escape what is not a nested regex. This also keeps track of the `async` keyword and handles it appropriately. Closes gh-728
1 parent eb91b79 commit 368e62c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

pycodestyle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def lru_cache(maxsize=128): # noqa as it's a fake implementation.
102102

103103
PyCF_ONLY_AST = 1024
104104
SINGLETONS = frozenset(['False', 'None', 'True'])
105-
KEYWORDS = frozenset(keyword.kwlist + ['print']) - SINGLETONS
105+
KEYWORDS = frozenset(keyword.kwlist + ['print', 'async']) - SINGLETONS
106106
UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-'])
107107
ARITHMETIC_OP = frozenset(['**', '*', '/', '//', '+', '-'])
108108
WS_OPTIONAL_OPERATORS = ARITHMETIC_OP.union(['^', '&', '|', '<<', '>>', '%'])
@@ -121,7 +121,7 @@ def lru_cache(maxsize=128): # noqa as it's a fake implementation.
121121
RERAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,.*,\s*\w+\s*$')
122122
ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b')
123123
DOCSTRING_REGEX = re.compile(r'u?r?["\']')
124-
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
124+
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[\[({] | [\]}),;:]')
125125
WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
126126
COMPARE_SINGLETON_REGEX = re.compile(r'(\bNone|\bFalse|\bTrue)?\s*([=!]=)'
127127
r'\s*(?(1)|(None|False|True))\b')

testsuite/E25.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def munge(input: AnyStr, sep: AnyStr = None, limit=1000,
3939
async def add(a: int = 0, b: int = 0) -> int:
4040
return a + b
4141
# Previously E251 four times
42-
#: E272:1:6
42+
#: E271:1:6
4343
async def add(a: int = 0, b: int = 0) -> int:
4444
return a + b
4545
#: E252:1:15 E252:1:16 E252:1:27 E252:1:36

testsuite/E30.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def main():
157157
if __name__ == '__main__':
158158
main()
159159
# Previously just E272:1:6 E272:4:6
160-
#: E302:4:1 E272:1:6 E272:4:6
160+
#: E302:4:1 E271:1:6 E271:4:6
161161
async def x():
162162
pass
163163

testsuite/E70.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def f(x): return 2
1515
#: E704:1:1
1616
async def f(x): return 2
17-
#: E704:1:1 E272:1:6
17+
#: E704:1:1 E271:1:6
1818
async def f(x): return 2
1919
#: E704:1:1 E226:1:19
2020
def f(x): return 2*x

0 commit comments

Comments
 (0)