Skip to content

Commit 62cb941

Browse files
Fix doc generation errors and re-organize examples (#914)
Fix doc generation errors and re-organize examples Co-authored-by: jan Iversen <[email protected]>
1 parent 67126da commit 62cb941

19 files changed

+36
-20
lines changed

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
# examples = os.path.join(parent_dir, "examples")
2727
example_contrib = os.path.join(parent_dir, "examples/contrib")
2828
example_common = os.path.join(parent_dir, "examples/common")
29-
example_gui = os.path.join(parent_dir, "examples/gui")
29+
# example_gui = os.path.join(parent_dir, "examples/gui")
3030

3131
sys.path.insert(0, os.path.abspath(os.pardir))
3232
sys.path.append(example_common)
3333
sys.path.append(example_contrib)
34-
sys.path.append(example_gui)
34+
# sys.path.append(example_gui)
3535
# sys.path.extend([examples, example_common, example_contrib, example_gui])
3636
# sys.path.insert(0, os.path.abspath("../"))
3737

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
==================================================
2+
Asyncio Server Example
3+
==================================================
4+
.. literalinclude:: ../../../examples/common/asyncio_server.py

doc/source/example/modules.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Examples
88

99
async_asyncio_client
1010
async_asyncio_serial_client
11+
asyncio_server
1112
asynchronous_asyncio_modbus_tls_client
1213
callback_server
1314
changing_framers
@@ -20,6 +21,7 @@ Examples
2021
synchronous_client
2122
synchronous_client_ext
2223
synchronous_server
24+
updating_server
2325

2426
asynchronous_asyncio_serial_client
2527
bcd_payload
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
==================================================
2+
Updating Server Example
3+
==================================================
4+
.. literalinclude:: ../../../examples/common/updating_server.py
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
pymodbus\.constants package
2+
===========================
3+
4+
.. automodule:: pymodbus.constants
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
:noindex:
9+
10+
Submodules
11+
----------
12+
13+
14+

doc/source/library/pymodbus.rst

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Subpackages
1212
.. toctree::
1313

1414
pymodbus.client
15+
pymodbus.constants
1516
pymodbus.datastore
1617
pymodbus.framer
1718
pymodbus.internal
@@ -38,15 +39,6 @@ pymodbus\.bit\_write\_message module
3839
:undoc-members:
3940
:show-inheritance:
4041

41-
pymodbus\.constants module
42-
--------------------------
43-
44-
.. automodule:: pymodbus.constants
45-
:members:
46-
:undoc-members:
47-
:show-inheritance:
48-
:noindex:
49-
5042
pymodbus\.device module
5143
-----------------------
5244

examples/common/synchronous_server.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
# --------------------------------------------------------------------------- #
1414
from pymodbus.version import version
1515

16-
# from pymodbus.server.sync import StartTcpServer #NOSONAR
17-
# from pymodbus.server.sync import StartTlsServer #NOSONAR
18-
# from pymodbus.server.sync import StartUdpServer #NOSONAR
19-
# from pymodbus.server.sync import StartSerialServer #NOSONAR
16+
from pymodbus.server.sync import StartTcpServer # NOSONAR
17+
# from pymodbus.server.sync import StartTlsServer # NOSONAR
18+
# from pymodbus.server.sync import StartUdpServer # NOSONAR
19+
# from pymodbus.server.sync import StartSerialServer # NOSONAR
2020
from pymodbus.device import ModbusDeviceIdentification
2121
from pymodbus.datastore import ModbusSequentialDataBlock
2222

23-
# from pymodbus.datastore import ModbusSparseDataBlock #NOSONAR
23+
# from pymodbus.datastore import ModbusSparseDataBlock # NOSONAR
2424
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
2525

2626
# from pymodbus.transaction import ModbusRtuFramer, ModbusBinaryFramer #NOSONAR
@@ -100,14 +100,14 @@ def run_server():
100100
ir=ModbusSequentialDataBlock(0, [17] * 100),
101101
)
102102

103-
ModbusServerContext(slaves=store, single=True)
103+
context = ModbusServerContext(slaves=store, single=True)
104104

105105
# ----------------------------------------------------------------------- #
106106
# initialize the server information
107107
# ----------------------------------------------------------------------- #
108108
# If you don"t set this or any fields, they are defaulted to empty strings.
109109
# ----------------------------------------------------------------------- #
110-
ModbusDeviceIdentification(
110+
identity = ModbusDeviceIdentification(
111111
info_name={
112112
"VendorName": "Pymodbus",
113113
"ProductCode": "PM",
@@ -122,7 +122,7 @@ def run_server():
122122
# run the server you want
123123
# ----------------------------------------------------------------------- #
124124
# Tcp:
125-
# StartTcpServer(context, identity=identity, address=("", 5020))
125+
StartTcpServer(context, identity=identity, address=("", 5020))
126126
#
127127
# TCP with different framer
128128
# StartTcpServer(context, identity=identity,

0 commit comments

Comments
 (0)