diff --git a/examples/modbus_forwarder.py b/examples/modbus_forwarder.py index 7933f1bb3..2a98e16da 100755 --- a/examples/modbus_forwarder.py +++ b/examples/modbus_forwarder.py @@ -56,7 +56,7 @@ async def run_forwarder(args): ) args.client.connect() assert args.client.connected - # If required to communicate with a specified client use slave= + # If required to communicate with a specified client use slave= # in RemoteSlaveContext # For e.g to forward the requests to slave with slave address 1 use # store = RemoteSlaveContext(client, slave=1) diff --git a/examples/server_async.py b/examples/server_async.py index 86166341d..d205be648 100755 --- a/examples/server_async.py +++ b/examples/server_async.py @@ -152,7 +152,7 @@ async def run_async_server(args): # custom_functions=[], # allow custom handling framer=args.framer, # The framer strategy to use # ignore_missing_slaves=True, # ignore request to a missing slave - # broadcast_enable=False, # treat slave_id 0 as broadcast address, + # broadcast_enable=False, # treat slave 0 as broadcast address, # timeout=1, # waiting time for request to complete ) elif args.comm == "udp": @@ -167,7 +167,7 @@ async def run_async_server(args): # custom_functions=[], # allow custom handling framer=args.framer, # The framer strategy to use # ignore_missing_slaves=True, # ignore request to a missing slave - # broadcast_enable=False, # treat slave_id 0 as broadcast address, + # broadcast_enable=False, # treat slave 0 as broadcast address, # timeout=1, # waiting time for request to complete ) elif args.comm == "serial": @@ -186,7 +186,7 @@ async def run_async_server(args): baudrate=args.baudrate, # The baud rate to use for the serial device # handle_local_echo=False, # Handle local echo of the USB-to-RS485 adaptor # ignore_missing_slaves=True, # ignore request to a missing slave - # broadcast_enable=False, # treat slave_id 0 as broadcast address, + # broadcast_enable=False, # treat slave 0 as broadcast address, ) elif args.comm == "tls": address = (args.host if args.host else "", args.port if args.port else None) @@ -207,7 +207,7 @@ async def run_async_server(args): ), # The key file path for TLS (used if sslctx is None) # password="none", # The password for for decrypting the private key file # ignore_missing_slaves=True, # ignore request to a missing slave - # broadcast_enable=False, # treat slave_id 0 as broadcast address, + # broadcast_enable=False, # treat slave 0 as broadcast address, # timeout=1, # waiting time for request to complete ) return server diff --git a/examples/server_sync.py b/examples/server_sync.py index 871acd5f6..7c735b2d2 100755 --- a/examples/server_sync.py +++ b/examples/server_sync.py @@ -78,7 +78,7 @@ def run_sync_server(args): # custom_functions=[], # allow custom handling framer=args.framer, # The framer strategy to use # ignore_missing_slaves=True, # ignore request to a missing slave - # broadcast_enable=False, # treat slave_id 0 as broadcast address, + # broadcast_enable=False, # treat slave 0 as broadcast address, # timeout=1, # waiting time for request to complete ) elif args.comm == "udp": @@ -90,7 +90,7 @@ def run_sync_server(args): # custom_functions=[], # allow custom handling framer=args.framer, # The framer strategy to use # ignore_missing_slaves=True, # ignore request to a missing slave - # broadcast_enable=False, # treat slave_id 0 as broadcast address, + # broadcast_enable=False, # treat slave 0 as broadcast address, # timeout=1, # waiting time for request to complete ) elif args.comm == "serial": @@ -109,7 +109,7 @@ def run_sync_server(args): baudrate=args.baudrate, # The baud rate to use for the serial device # handle_local_echo=False, # Handle local echo of the USB-to-RS485 adaptor # ignore_missing_slaves=True, # ignore request to a missing slave - # broadcast_enable=False, # treat slave_id 0 as broadcast address, + # broadcast_enable=False, # treat slave 0 as broadcast address, ) elif args.comm == "tls": address = ("", args.port) if args.port else None @@ -130,7 +130,7 @@ def run_sync_server(args): ), # The key file path for TLS (used if sslctx is None) # password=None, # The password for for decrypting the private key file # ignore_missing_slaves=True, # ignore request to a missing slave - # broadcast_enable=False, # treat slave_id 0 as broadcast address, + # broadcast_enable=False, # treat slave 0 as broadcast address, # timeout=1, # waiting time for request to complete ) return server diff --git a/test/server/test_server_context.py b/test/server/test_server_context.py index 6c9148011..73e3b6247 100644 --- a/test/server/test_server_context.py +++ b/test/server/test_server_context.py @@ -17,8 +17,8 @@ def setup_method(self): def test_single_context_gets(self): """Test getting on a single context.""" - for slave_id in range(0, 0xFF): - assert self.slave == self.context[slave_id] + for dev_id in range(0, 0xFF): + assert self.slave == self.context[dev_id] def test_single_context_deletes(self): """Test removing on multiple context.""" @@ -70,8 +70,8 @@ def setup_method(self): def test_multiple_context_gets(self): """Test getting on multiple context.""" - for slave_id in range(0, 10): - assert self.slaves[slave_id] == self.context[slave_id] + for dev_id in range(0, 10): + assert self.slaves[dev_id] == self.context[dev_id] def test_multiple_context_deletes(self): """Test removing on multiple context.""" @@ -81,9 +81,9 @@ def test_multiple_context_deletes(self): def test_multiple_context_iter(self): """Test iterating over multiple context.""" - for slave_id, slave in self.context: - assert slave == self.slaves[slave_id] - assert slave_id in self.context + for dev_id, slave in self.context: + assert slave == self.slaves[dev_id] + assert dev_id in self.context def test_multiple_context_default(self): """Test that the multiple context default values work.""" @@ -94,8 +94,8 @@ def test_multiple_context_default(self): def test_multiple_context_set(self): """Test a setting multiple slave contexts.""" slaves = {id: ModbusSlaveContext() for id in range(10)} - for slave_id, slave in iter(slaves.items()): - self.context[slave_id] = slave - for slave_id, slave in iter(slaves.items()): - actual = self.context[slave_id] + for dev_id, slave in iter(slaves.items()): + self.context[dev_id] = slave + for dev_id, slave in iter(slaves.items()): + actual = self.context[dev_id] assert slave == actual