Skip to content

Commit e4ea4d1

Browse files
authored
Use async def syntax (#58)
* Use async def syntax * Require Python 3.5 at least * Drop py34, add py37, py38
1 parent cf256c6 commit e4ea4d1

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ language: python
55
cache: pip
66

77
python:
8-
- 3.4
98
- 3.5
109
- 3.6
10+
- 3.7
11+
- 3.8
1112

1213
install:
1314
- pip install -r requirements-travis.txt

serial_asyncio/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
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
1515
Windows event loops can not wait for serial ports with the current
1616
implementation. 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)

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import re
1212
import sys
1313

14-
if sys.version_info < (3, 4):
15-
raise RuntimeError("pyserial-asyncio requires at least Python 3.4")
14+
if sys.version_info < (3, 5):
15+
raise RuntimeError("pyserial-asyncio requires at least Python 3.5")
1616

1717
from setuptools import setup
1818

@@ -76,10 +76,10 @@ def find_version(*file_paths):
7676
'Operating System :: MacOS :: MacOS X',
7777
'Programming Language :: Python',
7878
'Programming Language :: Python :: 3',
79-
'Programming Language :: Python :: 3.4',
8079
'Programming Language :: Python :: 3.5',
8180
'Programming Language :: Python :: 3.6',
8281
'Programming Language :: Python :: 3.7',
82+
'Programming Language :: Python :: 3.8',
8383
'Topic :: Communications',
8484
'Topic :: Software Development :: Libraries',
8585
'Topic :: Software Development :: Libraries :: Python Modules',

0 commit comments

Comments
 (0)