|
25 | 25 |
|
26 | 26 |
|
27 | 27 | class Modbus(object): |
28 | | - """Modbus register abstraction.""" |
| 28 | + """ |
| 29 | + Modbus register abstraction |
| 30 | +
|
| 31 | + :param itf: Abstraction interface |
| 32 | + :type itf: Callable |
| 33 | + :param addr_list: List of addresses |
| 34 | + :type addr_list: List[int] |
| 35 | + """ |
29 | 36 | def __init__(self, itf, addr_list: List[int]) -> None: |
30 | 37 | self._itf = itf |
31 | 38 | self._addr_list = addr_list |
@@ -262,14 +269,14 @@ def add_coil(self, |
262 | 269 | :type value: Union[bool, List[bool]], optional |
263 | 270 | :param on_set_cb: Callback on setting the coil |
264 | 271 | :type on_set_cb: Callable[ |
265 | | - [str, int, Union[List[bool], List[int]]], |
266 | | - None |
267 | | - ] |
| 272 | + [str, int, Union[List[bool], List[int]]], |
| 273 | + None |
| 274 | + ] |
268 | 275 | :param on_get_cb: Callback on getting the coil |
269 | 276 | :type on_get_cb: Callable[ |
270 | | - [str, int, Union[List[bool], List[int]]], |
271 | | - None |
272 | | - ] |
| 277 | + [str, int, Union[List[bool], List[int]]], |
| 278 | + None |
| 279 | + ] |
273 | 280 | """ |
274 | 281 | self._set_reg_in_dict(reg_type='COILS', |
275 | 282 | address=address, |
@@ -412,9 +419,9 @@ def add_ist(self, |
412 | 419 | :type value: bool or list of bool, optional |
413 | 420 | :param on_get_cb: Callback on getting the discrete input register |
414 | 421 | :type on_get_cb: Callable[ |
415 | | - [str, int, Union[List[bool], List[int]]], |
416 | | - None |
417 | | - ] |
| 422 | + [str, int, Union[List[bool], List[int]]], |
| 423 | + None |
| 424 | + ] |
418 | 425 | """ |
419 | 426 | self._set_reg_in_dict(reg_type='ISTS', |
420 | 427 | address=address, |
@@ -483,9 +490,9 @@ def add_ireg(self, |
483 | 490 | :type value: Union[int, List[int]], optional |
484 | 491 | :param on_get_cb: Callback on getting the input register |
485 | 492 | :type on_get_cb: Callable[ |
486 | | - [str, int, Union[List[bool], List[int]]], |
487 | | - None |
488 | | - ] |
| 493 | + [str, int, Union[List[bool], List[int]]], |
| 494 | + None |
| 495 | + ] |
489 | 496 | """ |
490 | 497 | self._set_reg_in_dict(reg_type='IREGS', |
491 | 498 | address=address, |
@@ -561,14 +568,14 @@ def _set_reg_in_dict(self, |
561 | 568 | :type value: Union[bool, int, List[bool], List[int]] |
562 | 569 | :param on_set_cb: Callback on setting the register |
563 | 570 | :type on_get_cb: Callable[ |
564 | | - [str, int, Union[List[bool], List[int]]], |
565 | | - None |
566 | | - ] |
| 571 | + [str, int, Union[List[bool], List[int]]], |
| 572 | + None |
| 573 | + ] |
567 | 574 | :param on_get_cb: Callback on getting the register |
568 | 575 | :type on_get_cb: Callable[ |
569 | | - [str, int, Union[List[bool], List[int]]], |
570 | | - None |
571 | | - ] |
| 576 | + [str, int, Union[List[bool], List[int]]], |
| 577 | + None |
| 578 | + ] |
572 | 579 |
|
573 | 580 | :raise KeyError: No register at specified address found |
574 | 581 | """ |
@@ -615,14 +622,14 @@ def _set_single_reg_in_dict(self, |
615 | 622 | :type value: Union[bool, int] |
616 | 623 | :param on_set_cb: Callback on setting the register |
617 | 624 | :type on_get_cb: Callable[ |
618 | | - [str, int, Union[List[bool], List[int]]], |
619 | | - None |
620 | | - ] |
| 625 | + [str, int, Union[List[bool], List[int]]], |
| 626 | + None |
| 627 | + ] |
621 | 628 | :param on_get_cb: Callback on getting the register |
622 | 629 | :type on_get_cb: Callable[ |
623 | | - [str, int, Union[List[bool], List[int]]], |
624 | | - None |
625 | | - ] |
| 630 | + [str, int, Union[List[bool], List[int]]], |
| 631 | + None |
| 632 | + ] |
626 | 633 | """ |
627 | 634 | data = {'val': value} |
628 | 635 |
|
|
0 commit comments