Skip to content

Commit 5e9c9be

Browse files
update doc string style of modbus.py for sphinx usage
1 parent 03941fa commit 5e9c9be

File tree

1 file changed

+32
-25
lines changed

1 file changed

+32
-25
lines changed

umodbus/modbus.py

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@
2525

2626

2727
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+
"""
2936
def __init__(self, itf, addr_list: List[int]) -> None:
3037
self._itf = itf
3138
self._addr_list = addr_list
@@ -262,14 +269,14 @@ def add_coil(self,
262269
:type value: Union[bool, List[bool]], optional
263270
:param on_set_cb: Callback on setting the coil
264271
: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+
]
268275
:param on_get_cb: Callback on getting the coil
269276
: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+
]
273280
"""
274281
self._set_reg_in_dict(reg_type='COILS',
275282
address=address,
@@ -412,9 +419,9 @@ def add_ist(self,
412419
:type value: bool or list of bool, optional
413420
:param on_get_cb: Callback on getting the discrete input register
414421
: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+
]
418425
"""
419426
self._set_reg_in_dict(reg_type='ISTS',
420427
address=address,
@@ -483,9 +490,9 @@ def add_ireg(self,
483490
:type value: Union[int, List[int]], optional
484491
:param on_get_cb: Callback on getting the input register
485492
: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+
]
489496
"""
490497
self._set_reg_in_dict(reg_type='IREGS',
491498
address=address,
@@ -561,14 +568,14 @@ def _set_reg_in_dict(self,
561568
:type value: Union[bool, int, List[bool], List[int]]
562569
:param on_set_cb: Callback on setting the register
563570
: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+
]
567574
:param on_get_cb: Callback on getting the register
568575
: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+
]
572579
573580
:raise KeyError: No register at specified address found
574581
"""
@@ -615,14 +622,14 @@ def _set_single_reg_in_dict(self,
615622
:type value: Union[bool, int]
616623
:param on_set_cb: Callback on setting the register
617624
: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+
]
621628
:param on_get_cb: Callback on getting the register
622629
: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+
]
626633
"""
627634
data = {'val': value}
628635

0 commit comments

Comments
 (0)