Remove deprecated asyncio coroutine decorator
This commit is contained in:
		
							parent
							
								
									f806cc01d3
								
							
						
					
					
						commit
						adaa2dcad5
					
				| @ -14,7 +14,7 @@ also includes client implementation to directly read and parse smart meter data. | ||||
| 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 | ||||
|  | ||||
| @ -136,7 +136,6 @@ class DSMRProtocol(asyncio.Protocol): | ||||
|         else: | ||||
|             self.telegram_callback(parsed_telegram) | ||||
| 
 | ||||
|     @asyncio.coroutine | ||||
|     def wait_closed(self): | ||||
|     async def wait_closed(self): | ||||
|         """Wait until connection is closed.""" | ||||
|         yield from self._closed.wait() | ||||
|         await self._closed.wait() | ||||
|  | ||||
| @ -68,8 +68,7 @@ class AsyncSerialReader(SerialReader): | ||||
| 
 | ||||
|     PORT_KEY = 'url' | ||||
| 
 | ||||
|     @asyncio.coroutine | ||||
|     def read(self, queue): | ||||
|     async def read(self, queue): | ||||
|         """ | ||||
|         Read complete DSMR telegram's from the serial interface and parse it | ||||
|         into CosemObject's and MbusObject's. | ||||
| @ -81,12 +80,12 @@ class AsyncSerialReader(SerialReader): | ||||
|         """ | ||||
|         # create Serial StreamReader | ||||
|         conn = serial_asyncio.open_serial_connection(**self.serial_settings) | ||||
|         reader, _ = yield from conn | ||||
|         reader, _ = await conn | ||||
| 
 | ||||
|         while True: | ||||
|             # Read line if available or give control back to loop until new | ||||
|             # data has arrived. | ||||
|             data = yield from reader.readline() | ||||
|             data = await reader.readline() | ||||
|             self.telegram_buffer.append(data.decode('ascii')) | ||||
| 
 | ||||
|             for telegram in self.telegram_buffer.get_all(): | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user