From 3d9ae0e3759f29d5c4c79e56cb727c8ad4d337bf Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 6 Jan 2018 18:32:44 -0500 Subject: [PATCH] lint: Un-skip a few rules --- .flake8 | 4 ---- demos/benchmark/template_benchmark.py | 3 ++- maint/test/appengine/common/runtests.py | 2 +- tornado/test/gen_test.py | 2 +- tornado/websocket.py | 12 ++++++------ 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.flake8 b/.flake8 index f97bdb63..8d4ecfb0 100644 --- a/.flake8 +++ b/.flake8 @@ -2,8 +2,6 @@ exclude = .git,.tox,__pycache__,.eggs,build max-line-length = 100 ignore = - # E231 missing whitespace after ',' - E231, # E265 block comment should start with '# ' E265, # E266 too many leading '#' for block comment @@ -12,5 +10,3 @@ ignore = E402, # E722 do not use bare except E722, - # E741 ambiguous variable name 'l' - E741, diff --git a/demos/benchmark/template_benchmark.py b/demos/benchmark/template_benchmark.py index c0e67cec..03d94839 100755 --- a/demos/benchmark/template_benchmark.py +++ b/demos/benchmark/template_benchmark.py @@ -14,7 +14,8 @@ define('dump', default=False, help='print template generated code and exit') context = { 'page_title': 'mitsuhiko\'s benchmark', - 'table': [dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10) for x in range(1000)] + 'table': [dict(a=1, b=2, c=3, d=4, e=5, + f=6, g=7, h=8, i=9, j=10) for x in range(1000)] } tmpl = Template("""\ diff --git a/maint/test/appengine/common/runtests.py b/maint/test/appengine/common/runtests.py index ba89a7aa..ca7abe11 100644 --- a/maint/test/appengine/common/runtests.py +++ b/maint/test/appengine/common/runtests.py @@ -51,7 +51,7 @@ if __name__ == "__main__": for sig in [signal.SIGTERM, signal.SIGTERM, signal.SIGKILL]: os.kill(proc.pid, sig) res = os.waitpid(proc.pid, os.WNOHANG) - if res != (0,0): + if res != (0, 0): break time.sleep(0.1) else: diff --git a/tornado/test/gen_test.py b/tornado/test/gen_test.py index d19d9930..eee8655b 100644 --- a/tornado/test/gen_test.py +++ b/tornado/test/gen_test.py @@ -1021,7 +1021,7 @@ class GenCoroutineTest(AsyncTestCase): self.finished = True @skipNotCPython - @unittest.skipIf((3,) < sys.version_info < (3,6), + @unittest.skipIf((3,) < sys.version_info < (3, 6), "asyncio.Future has reference cycles") def test_coroutine_refcounting(self): # On CPython, tasks and their arguments should be released immediately diff --git a/tornado/websocket.py b/tornado/websocket.py index 4b1b220e..32012780 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -757,17 +757,17 @@ class WebSocketProtocol13(WebSocketProtocol): else: finbit = 0 frame = struct.pack("B", finbit | opcode | flags) - l = len(data) + data_len = len(data) if self.mask_outgoing: mask_bit = 0x80 else: mask_bit = 0 - if l < 126: - frame += struct.pack("B", l | mask_bit) - elif l <= 0xFFFF: - frame += struct.pack("!BH", 126 | mask_bit, l) + if data_len < 126: + frame += struct.pack("B", data_len | mask_bit) + elif data_len <= 0xFFFF: + frame += struct.pack("!BH", 126 | mask_bit, data_len) else: - frame += struct.pack("!BQ", 127 | mask_bit, l) + frame += struct.pack("!BQ", 127 | mask_bit, data_len) if self.mask_outgoing: mask = os.urandom(4) data = mask + _websocket_mask(mask, data)