From 442b0adccda014e81950a38b1a56e8f06131767a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 21 Jan 2015 23:39:16 +0100 Subject: [PATCH] asyncio: pyflakes, remove unused import tests: Remove unused function; inline another function --- Lib/asyncio/base_events.py | 2 +- Lib/asyncio/selector_events.py | 1 - Lib/test/test_asyncio/test_streams.py | 10 +--------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 5df5b83b471..739296b761e 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -636,7 +636,7 @@ class BaseEventLoop(events.AbstractEventLoop): try: yield from waiter - except Exception as exc: + except Exception: transport.close() raise diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index 4d3e5d9ede8..24f8461509a 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -10,7 +10,6 @@ import collections import errno import functools import socket -import sys try: import ssl except ImportError: # pragma: no cover diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index a18603afa63..2273049b815 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -415,10 +415,6 @@ class StreamReaderTests(test_utils.TestCase): def set_err(): stream.set_exception(ValueError()) - @asyncio.coroutine - def readline(): - yield from stream.readline() - t1 = asyncio.Task(stream.readline(), loop=self.loop) t2 = asyncio.Task(set_err(), loop=self.loop) @@ -429,11 +425,7 @@ class StreamReaderTests(test_utils.TestCase): def test_exception_cancel(self): stream = asyncio.StreamReader(loop=self.loop) - @asyncio.coroutine - def read_a_line(): - yield from stream.readline() - - t = asyncio.Task(read_a_line(), loop=self.loop) + t = asyncio.Task(stream.readline(), loop=self.loop) test_utils.run_briefly(self.loop) t.cancel() test_utils.run_briefly(self.loop)