Skip to content

Commit 327907b

Browse files
committed
fix MRO for async classes
1 parent 46e3929 commit 327907b

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

umodbus/asynchronous/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def send_response(self,
3131
:type signed: bool
3232
"""
3333

34-
print("sending async response...")
34+
#print("sending async response...")
3535
await self._itf.send_response(slave_addr=self.unit_addr,
3636
function_code=self.function,
3737
request_register_addr=self.register_addr,

umodbus/asynchronous/modbus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async def _process_read_access(self,
5959
"""@see Modbus._process_read_access"""
6060

6161
task = super()._process_read_access(request, reg_type)
62-
print("async process_read_access task = ", task)
62+
#print("async process_read_access task = ", task)
6363
if task is not None:
6464
await task
6565

@@ -69,6 +69,6 @@ async def _process_write_access(self,
6969
"""@see Modbus._process_write_access"""
7070

7171
task = super()._process_write_access(request, reg_type)
72-
print("async process_write_access task = ", task)
72+
#print("async process_write_access task = ", task)
7373
if task is not None:
7474
await task

umodbus/asynchronous/serial.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,8 @@ async def _send(self,
144144
slave_addr: int) -> None:
145145
"""@see CommonRTUFunctions._send"""
146146

147-
print("async RTU: _send() called")
148-
post_send_actions = super()._send(device=self,
149-
modbus_pdu=modbus_pdu,
150-
slave_addr=slave_addr)
151-
await post_send_actions
147+
await super()._send(modbus_pdu=modbus_pdu,
148+
slave_addr=slave_addr)
152149

153150
async def _post_send(self, sleep_time_us: float) -> None:
154151
"""
@@ -159,7 +156,6 @@ async def _post_send(self, sleep_time_us: float) -> None:
159156
@see CommonRTUFunctions._post_send
160157
"""
161158

162-
print("async RTU: _post_send() called")
163159
await hybrid_sleep(sleep_time_us)
164160
if self._ctrlPin:
165161
self._ctrlPin.off()
@@ -244,15 +240,15 @@ async def send_response(self,
244240
:type request: AsyncRequest, optional
245241
"""
246242

247-
print("async RTU: calling send_response()")
243+
#print("async RTU: calling send_response()")
248244
task = super().send_response(slave_addr=slave_addr,
249245
function_code=function_code,
250246
request_register_addr=request_register_addr, # noqa: E501
251247
request_register_qty=request_register_qty,
252248
request_data=request_data,
253249
values=values,
254250
signed=signed)
255-
print("async RTU: send_response() called, task is:", task)
251+
#print("async RTU: send_response() called, task is:", task)
256252
if task is not None:
257253
await task
258254

@@ -271,11 +267,11 @@ async def send_exception_response(self,
271267
:type request: AsyncRequest, optional
272268
"""
273269

274-
print("async RTU: calling send_exception_response()")
270+
#print("async RTU: calling send_exception_response()")
275271
task = super().send_exception_response(slave_addr=slave_addr,
276272
function_code=function_code,
277273
exception_code=exception_code)
278-
print("async RTU: called send_exception_response(), task is:", task)
274+
#print("async RTU: called send_exception_response(), task is:", task)
279275
if task is not None:
280276
await task
281277

@@ -298,7 +294,7 @@ def set_params(self,
298294
self.req_handler = req_handler
299295

300296

301-
class AsyncSerial(CommonRTUFunctions, CommonAsyncRTUFunctions, CommonAsyncModbusFunctions):
297+
class AsyncSerial(CommonAsyncRTUFunctions, CommonAsyncModbusFunctions, CommonRTUFunctions):
302298
"""Asynchronous Modbus Serial client"""
303299

304300
def __init__(self,

umodbus/modbus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def _process_read_access(self, request: Request, reg_type: str) \
204204
_cb = self._register_dict[reg_type][address]['on_get_cb']
205205
_cb(reg_type=reg_type, address=address, val=vals)
206206

207-
print("creating response...", type(self).__name__, "->", type(request).__name__)
207+
#print("creating response...", type(self).__name__, "->", type(request).__name__)
208208
vals = self._create_response(request=request, reg_type=reg_type)
209209
return request.send_response(vals)
210210
else:

umodbus/serial.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def __init__(self,
103103
:param read_timeout: The read timeout in ms.
104104
:type read_timeout: int
105105
"""
106+
107+
super().__init__()
106108
# UART flush function is introduced in Micropython v1.20.0
107109
self._has_uart_flush = callable(getattr(UART, "flush", None))
108110
self._uart = UART(uart_id,

0 commit comments

Comments
 (0)