Merge pull request #76 from frenck/frenck-2021-0772

Remove deprecated asyncio coroutine decorator
This commit is contained in:
Nigel Dokter 2021-03-04 21:48:04 +01:00 committed by GitHub
commit 247860be16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View File

@ -14,7 +14,7 @@ also includes client implementation to directly read and parse smart meter data.
Features Features
-------- --------
DSMR Parser supports DSMR versions 2, 3, 4 and 5. It has been tested with Python 3.4, 3.5 and 3.6. DSMR Parser supports DSMR versions 2, 3, 4 and 5. It has been tested with Python 3.5, 3.6, 3.7, 3.8 and 3.9.
Client module usage Client module usage

View File

@ -136,7 +136,6 @@ class DSMRProtocol(asyncio.Protocol):
else: else:
self.telegram_callback(parsed_telegram) self.telegram_callback(parsed_telegram)
@asyncio.coroutine async def wait_closed(self):
def wait_closed(self):
"""Wait until connection is closed.""" """Wait until connection is closed."""
yield from self._closed.wait() await self._closed.wait()

View File

@ -68,8 +68,7 @@ class AsyncSerialReader(SerialReader):
PORT_KEY = 'url' PORT_KEY = 'url'
@asyncio.coroutine async def read(self, queue):
def read(self, queue):
""" """
Read complete DSMR telegram's from the serial interface and parse it Read complete DSMR telegram's from the serial interface and parse it
into CosemObject's and MbusObject's. into CosemObject's and MbusObject's.
@ -81,12 +80,12 @@ class AsyncSerialReader(SerialReader):
""" """
# create Serial StreamReader # create Serial StreamReader
conn = serial_asyncio.open_serial_connection(**self.serial_settings) conn = serial_asyncio.open_serial_connection(**self.serial_settings)
reader, _ = yield from conn reader, _ = await conn
while True: while True:
# Read line if available or give control back to loop until new # Read line if available or give control back to loop until new
# data has arrived. # data has arrived.
data = yield from reader.readline() data = await reader.readline()
self.telegram_buffer.append(data.decode('ascii')) self.telegram_buffer.append(data.decode('ascii'))
for telegram in self.telegram_buffer.get_all(): for telegram in self.telegram_buffer.get_all():

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py35,py36,py37,py38 envlist = py35,py36,py37,py38,py39
[testenv] [testenv]
deps= deps=