1010"""\
1111 Support asyncio with serial ports. EXPERIMENTAL
1212
13- Posix platforms only, Python 3.4 + only.
13+ Posix platforms only, Python 3.5 + only.
1414
1515Windows event loops can not wait for serial ports with the current
1616implementation. It should be possible to get that working though.
@@ -408,16 +408,14 @@ def _call_connection_lost(self, exc):
408408 self ._loop = None
409409
410410
411- @asyncio .coroutine
412- def create_serial_connection (loop , protocol_factory , * args , ** kwargs ):
411+ async def create_serial_connection (loop , protocol_factory , * args , ** kwargs ):
413412 ser = serial .serial_for_url (* args , ** kwargs )
414413 protocol = protocol_factory ()
415414 transport = SerialTransport (loop , protocol , ser )
416415 return (transport , protocol )
417416
418417
419- @asyncio .coroutine
420- def open_serial_connection (* ,
418+ async def open_serial_connection (* ,
421419 loop = None ,
422420 limit = asyncio .streams ._DEFAULT_LIMIT ,
423421 ** kwargs ):
@@ -438,7 +436,7 @@ def open_serial_connection(*,
438436 loop = asyncio .get_event_loop ()
439437 reader = asyncio .StreamReader (limit = limit , loop = loop )
440438 protocol = asyncio .StreamReaderProtocol (reader , loop = loop )
441- transport , _ = yield from create_serial_connection (
439+ transport , _ = await create_serial_connection (
442440 loop = loop ,
443441 protocol_factory = lambda : protocol ,
444442 ** kwargs )
0 commit comments