From 3fcbf964d8d31b4c2e66ed3b8708b49252e01b1e Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Mon, 22 Oct 2018 20:26:40 +0530 Subject: [PATCH 1/4] Updated setup.py to make it build with python 3.7. --- setup.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 26db7af5..7b7dafec 100755 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ import os import re import tokenize as std_tokenize -from tokenize import ASYNC, AWAIT, NAME, NEWLINE, NL, STRING, ENCODING +from tokenize import NAME, NEWLINE, NL, STRING, ENCODING import codecs @@ -60,11 +60,7 @@ def bleach_tokens(tokens): # TODO __await__, ...? used_space = None for space, toknum, tokval in tokens: - if toknum in [ASYNC, AWAIT]: # TODO Python 3.7+ - # When remove async or await, we want to use the whitespace that - # was before async/await before the next token so that - # `print(await stuff)` becomes `print(stuff)` and not - # `print( stuff)` + if tokval in ["async", "await"]: used_space = space else: if toknum == NAME and tokval in ASYNC_TO_SYNC: From 3b43462dfe6070b21020619179447c7e8b40597f Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Mon, 22 Oct 2018 21:01:08 +0530 Subject: [PATCH 2/4] Added comments and fixed the typo. --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7b7dafec..3fa0366e 100755 --- a/setup.py +++ b/setup.py @@ -59,7 +59,11 @@ def tokenize(f): def bleach_tokens(tokens): # TODO __await__, ...? used_space = None - for space, toknum, tokval in tokens: + for space, toknum, tokval in tokens: # TODO Python 3.7+ + # When removing async or await, we want to use the whitespace that + # was before async/await before the next token so that + # `print(await stuff)` becomes `print(stuff)` and not + # `print( stuff)` if tokval in ["async", "await"]: used_space = space else: From 92e16b6076158f76468524ffbb5b54c48c522889 Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Mon, 22 Oct 2018 21:05:19 +0530 Subject: [PATCH 3/4] Added comments at right place and fixed the typo. --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3fa0366e..78b6d9b2 100755 --- a/setup.py +++ b/setup.py @@ -59,12 +59,12 @@ def tokenize(f): def bleach_tokens(tokens): # TODO __await__, ...? used_space = None - for space, toknum, tokval in tokens: # TODO Python 3.7+ + for space, toknum, tokval in tokens: + if tokval in ["async", "await"]: # TODO Python 3.7+ # When removing async or await, we want to use the whitespace that # was before async/await before the next token so that # `print(await stuff)` becomes `print(stuff)` and not # `print( stuff)` - if tokval in ["async", "await"]: used_space = space else: if toknum == NAME and tokval in ASYNC_TO_SYNC: From 5155ae14ce9792ba3e915098e7c44414e407b8a3 Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Mon, 22 Oct 2018 21:51:27 +0530 Subject: [PATCH 4/4] Removes # TODO from the comments. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 78b6d9b2..13d163fa 100755 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ def bleach_tokens(tokens): # TODO __await__, ...? used_space = None for space, toknum, tokval in tokens: - if tokval in ["async", "await"]: # TODO Python 3.7+ + if tokval in ["async", "await"]: # When removing async or await, we want to use the whitespace that # was before async/await before the next token so that # `print(await stuff)` becomes `print(stuff)` and not