1313# --------------------------------------------------------------------------- #
1414from 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
2020from pymodbus .device import ModbusDeviceIdentification
2121from pymodbus .datastore import ModbusSequentialDataBlock
2222
23- # from pymodbus.datastore import ModbusSparseDataBlock # NOSONAR
23+ # from pymodbus.datastore import ModbusSparseDataBlock # NOSONAR
2424from 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