Skip to content
Snippets Groups Projects
Commit 368e62cb authored by Adi Roiban's avatar Adi Roiban Committed by Ian Stapleton Cordasco
Browse files

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 
parent eb91b79a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -102,7 +102,7 @@ REPORT_FORMAT = {
 
PyCF_ONLY_AST = 1024
SINGLETONS = frozenset(['False', 'None', 'True'])
KEYWORDS = frozenset(keyword.kwlist + ['print']) - SINGLETONS
KEYWORDS = frozenset(keyword.kwlist + ['print', 'async']) - SINGLETONS
UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-'])
ARITHMETIC_OP = frozenset(['**', '*', '/', '//', '+', '-'])
WS_OPTIONAL_OPERATORS = ARITHMETIC_OP.union(['^', '&', '|', '<<', '>>', '%'])
Loading
Loading
@@ -121,7 +121,7 @@ RAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,')
RERAISE_COMMA_REGEX = re.compile(r'raise\s+\w+\s*,.*,\s*\w+\s*$')
ERRORCODE_REGEX = re.compile(r'\b[A-Z]\d{3}\b')
DOCSTRING_REGEX = re.compile(r'u?r?["\']')
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[\[({] | [\]}),;:]')
WHITESPACE_AFTER_COMMA_REGEX = re.compile(r'[,;:]\s*(?: |\t)')
COMPARE_SINGLETON_REGEX = re.compile(r'(\bNone|\bFalse|\bTrue)?\s*([=!]=)'
r'\s*(?(1)|(None|False|True))\b')
Loading
Loading
Loading
Loading
@@ -39,7 +39,7 @@ def munge(input: AnyStr, sep: AnyStr = None, limit=1000,
async def add(a: int = 0, b: int = 0) -> int:
return a + b
# Previously E251 four times
#: E272:1:6
#: E271:1:6
async def add(a: int = 0, b: int = 0) -> int:
return a + b
#: E252:1:15 E252:1:16 E252:1:27 E252:1:36
Loading
Loading
Loading
Loading
@@ -157,7 +157,7 @@ def main():
if __name__ == '__main__':
main()
# Previously just E272:1:6 E272:4:6
#: E302:4:1 E272:1:6 E272:4:6
#: E302:4:1 E271:1:6 E271:4:6
async def x():
pass
 
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@ del a[:]; a.append(42);
def f(x): return 2
#: E704:1:1
async def f(x): return 2
#: E704:1:1 E272:1:6
#: E704:1:1 E271:1:6
async def f(x): return 2
#: E704:1:1 E226:1:19
def f(x): return 2*x
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment