Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve pylint unhappy. #1799

Merged
merged 2 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def setup_async_client(description=None, cmdline=None):
client = AsyncModbusTcpClient(
args.host,
port=args.port, # on which port
# Common optional paramers:
# Common optional parameters:
framer=args.framer,
timeout=args.timeout,
retries=3,
Expand All @@ -73,7 +73,7 @@ def setup_async_client(description=None, cmdline=None):
client = AsyncModbusUdpClient(
args.host,
port=args.port,
# Common optional paramers:
# Common optional parameters:
framer=args.framer,
timeout=args.timeout,
# retries=3,
Expand All @@ -86,7 +86,7 @@ def setup_async_client(description=None, cmdline=None):
elif args.comm == "serial":
client = AsyncModbusSerialClient(
args.port,
# Common optional paramers:
# Common optional parameters:
# framer=ModbusRtuFramer,
timeout=args.timeout,
# retries=3,
Expand All @@ -104,7 +104,7 @@ def setup_async_client(description=None, cmdline=None):
client = AsyncModbusTlsClient(
args.host,
port=args.port,
# Common optional paramers:
# Common optional parameters:
framer=args.framer,
timeout=args.timeout,
# retries=3,
Expand Down
8 changes: 4 additions & 4 deletions examples/client_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def setup_sync_client(description=None, cmdline=None):
client = ModbusTcpClient(
args.host,
port=args.port,
# Common optional paramers:
# Common optional parameters:
framer=args.framer,
timeout=args.timeout,
# retries=3,
Expand All @@ -75,7 +75,7 @@ def setup_sync_client(description=None, cmdline=None):
client = ModbusUdpClient(
args.host,
port=args.port,
# Common optional paramers:
# Common optional parameters:
framer=args.framer,
timeout=args.timeout,
# retries=3,
Expand All @@ -88,7 +88,7 @@ def setup_sync_client(description=None, cmdline=None):
elif args.comm == "serial":
client = ModbusSerialClient(
port=args.port, # serial port
# Common optional paramers:
# Common optional parameters:
# framer=ModbusRtuFramer,
timeout=args.timeout,
# retries=3,
Expand All @@ -106,7 +106,7 @@ def setup_sync_client(description=None, cmdline=None):
client = ModbusTlsClient(
args.host,
port=args.port,
# Common optional paramers:
# Common optional parameters:
framer=args.framer,
timeout=args.timeout,
# retries=3,
Expand Down
2 changes: 1 addition & 1 deletion examples/contrib/solar.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main():
client = ModbusTcpClient(
"modbusServer.lan",
port=502,
# Common optional paramers:
# Common optional parameters:
framer=ModbusSocketFramer,
timeout=1,
retry_on_empty=True,
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/client/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def diag_restart_communication(
) -> ModbusResponse:
"""Diagnose restart communication (code 0x08 sub 0x01).

:param toggle: True if toogled.
:param toggle: True if toggled.
:param slave: (optional) Modbus slave ID
:param kwargs: (optional) Experimental parameters.
:raises ModbusException:
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/datastore/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ModbusBaseSlaveContext: # pylint: disable=too-few-public-methods
_fx_mapper.update([(i, "h") for i in (3, 6, 16, 22, 23)])
_fx_mapper.update([(i, "c") for i in (1, 5, 15)])

def decode(self, fx): # pylint: disable=invalid-name
def decode(self, fx):
"""Convert the function code to the datastore to.

:param fx: The function we are working with
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/repl/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ result.raw Return raw result dict.

```

Every command has auto suggetion on the arguments supported , supply arg and value are to be supplied in `arg=val` format.
Every command has auto suggestion on the arguments supported , supply arg and value are to be supplied in `arg=val` format.
```

> client.read_holding_registers count=4 address=9 slave=1
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/server/simulator/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pymodbus.factory import ServerDecoder
from pymodbus.logging import Log
from pymodbus.pdu import ExceptionResponse
from pymodbus.server import (
from pymodbus.server.async_io import (
ModbusSerialServer,
ModbusTcpServer,
ModbusTlsServer,
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/server/simulator/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""HTTP server for modbus simulator.

The modbus simulator contain 3 distint parts:
The modbus simulator contain 3 distinct parts:

- Datastore simulator, to define registers and their behaviour including actions: (simulator)(../../datastore/simulator.py)
- Modbus server: (server)(./http_server.py)
Expand Down
10 changes: 5 additions & 5 deletions pymodbus/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def dict_property(store, index):
getter = lambda self: store( # pylint: disable=unnecessary-lambda-assignment
self
)[index]
setter = lambda self, value: store( # pylint: disable=unnecessary-dunder-call,unnecessary-lambda-assignment
self
).__setitem__(
index, value
setter = (
lambda self, value: store( # pylint: disable=unnecessary-lambda-assignment
self
).__setitem__(index, value)
)
elif isinstance(store, str):
getter = lambda self: self.__getattribute__( # pylint: disable=unnecessary-dunder-call,unnecessary-lambda-assignment
Expand All @@ -97,7 +97,7 @@ def dict_property(store, index):
getter = lambda self: store[ # pylint: disable=unnecessary-lambda-assignment
index
]
setter = lambda self, value: store.__setitem__( # pylint: disable=unnecessary-dunder-call,unnecessary-lambda-assignment
setter = lambda self, value: store.__setitem__( # pylint: disable=unnecessary-lambda-assignment
index, value
)

Expand Down
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,19 @@ load-plugins=
pylint.extensions.bad_builtin,
pylint.extensions.check_elif,
pylint.extensions.code_style,
pylint.extensions.comparetozero,
pylint.extensions.comparison_placement,
pylint.extensions.confusing_elif,
pylint.extensions.docparams,
pylint.extensions.docstyle,
pylint.extensions.emptystring,
pylint.extensions.eq_without_hash,
pylint.extensions.for_any_all,
pylint.extensions.overlapping_exceptions,
pylint.extensions.private_import,
pylint.extensions.set_membership,
pylint.extensions.typing,
# NO longer supported:
# pylint.extensions.comparetozero,
# pylint.extensions.emptystring,
# NOT WANTED:
# pylint.extensions.mccabe, (replaced by ruff)
# pylint.extensions.broad_try_clause,
Expand Down
2 changes: 1 addition & 1 deletion test/sub_transport/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ async def test_str_magic(self, use_clc, client):
assert str(client) == f"ModbusProtocol({use_clc.comm_name})"

def test_generate_ssl(self, use_clc):
"""Test ssl generattion"""
"""Test ssl generation"""
with mock.patch("pymodbus.transport.transport.ssl.SSLContext"):
sslctx = use_clc.generate_ssl(True, "cert_file", "key_file")
assert sslctx
Expand Down
4 changes: 2 additions & 2 deletions test/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def test_default_value(self):
assert not default(1.1)
assert not default(1 + 1)
assert not default("string")
assert default([1, 2, 3]) == []
assert default({1: 1}) == {}
assert not default([1, 2, 3])
assert not default({1: 1})
assert not default(True)

def test_bit_packing(self):
Expand Down