From 68d108e11533efe7f723ef888aa534cc0f580757 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Fri, 21 Oct 2022 13:43:40 +0200 Subject: [PATCH] Clean noqa directive. --- TODO_pylint | 3 --- doc/api/pydoc/build.py | 8 ++++---- doc/api/pydoctor/build.py | 2 +- pymodbus/repl/client/main.py | 4 ++-- pymodbus/server/async_io.py | 6 +++--- setup_commands.py | 8 ++++---- test/test_device.py | 4 +--- tox.ini | 8 ++++---- 8 files changed, 19 insertions(+), 24 deletions(-) diff --git a/TODO_pylint b/TODO_pylint index 1eaeab3e5..fb8a7d2ca 100644 --- a/TODO_pylint +++ b/TODO_pylint @@ -1,6 +1,3 @@ -Resolve: -noqa - pylint general: see .pylintrc [MESSAGES CONTROL] diff --git a/doc/api/pydoc/build.py b/doc/api/pydoc/build.py index b799a892e..271d963a3 100644 --- a/doc/api/pydoc/build.py +++ b/doc/api/pydoc/build.py @@ -99,9 +99,9 @@ def classify_class_attrs(cls): class DefaultFormatter(pydoc.HTMLDoc): """Default formatter.""" - def docmodule( # noqa: C901 + def docmodule( self, object, name=None, mod=None, packageContext=None, *ignored - ): # noqa: C901 + ): """Produce HTML documentation for a module object.""" my_name = object.__name__ # ignore the passed-in name parts = split(my_name, ".") @@ -197,7 +197,7 @@ def docmodule( # noqa: C901 # FIX classlist = map(lambda (key, value): value, classes) contents = [ self.formattree( - inspect.getclasstree(classlist, 1), my_name # noqa: F821 + inspect.getclasstree(classlist, 1), my_name ) ] for key, value in classes: @@ -271,7 +271,7 @@ def moduleSection(self, object, packageContext): items.append( self.modpkglink((modname, name, ispackage, isshadowed)) ) - except: # noqa: E722 + except: items.append( self.modpkglink((modname, name, ispackage, isshadowed)) ) diff --git a/doc/api/pydoctor/build.py b/doc/api/pydoctor/build.py index 140148823..774653b65 100755 --- a/doc/api/pydoctor/build.py +++ b/doc/api/pydoctor/build.py @@ -27,5 +27,5 @@ if os.path.exists("../../../build"): shutil.move("html", "../../../build/pydoctor") -except: # noqa: E722 pylint: disable=bare-except +except: # pylint: disable=bare-except print("Pydoctor unavailable...not building") diff --git a/pymodbus/repl/client/main.py b/pymodbus/repl/client/main.py index f40ce155f..1a44542be 100644 --- a/pymodbus/repl/client/main.py +++ b/pymodbus/repl/client/main.py @@ -1,6 +1,6 @@ """Pymodbus REPL Entry point.""" # pylint: disable=anomalous-backslash-in-string -# flake8: noqa: W605 +# flake8: noqa import logging import pathlib import sys @@ -169,7 +169,7 @@ def _parse_val(arg_name, val): return kwargs, execute -def cli(client): # noqa: C901 pylint: disable=too-complex +def cli(client): # pylint: disable=too-complex """Run client definition.""" use_keys = KeyBindings() history_file = pathlib.Path.home().joinpath(".pymodhis") diff --git a/pymodbus/server/async_io.py b/pymodbus/server/async_io.py index 6191cbe5b..bafbce42b 100755 --- a/pymodbus/server/async_io.py +++ b/pymodbus/server/async_io.py @@ -469,7 +469,7 @@ def _send_(self, data): # --------------------------------------------------------------------------- # -class ModbusTcpServer: # pylint: disable=too-many-instance-attributes +class ModbusTcpServer: """A modbus threaded tcp socket server. We inherit and overload the socket server so that we @@ -659,7 +659,7 @@ def __init__( # pylint: disable=too-many-arguments self.factory_parms["ssl"] = self.sslctx -class ModbusUdpServer: # pylint: disable=too-many-instance-attributes +class ModbusUdpServer: """A modbus threaded udp socket server. We inherit and overload the socket server so that we @@ -762,7 +762,7 @@ async def server_close(self): self.protocol = None -class ModbusSerialServer: # pylint: disable=too-many-instance-attributes +class ModbusSerialServer: """A modbus threaded serial socket server. We inherit and overload the socket server so that we diff --git a/setup_commands.py b/setup_commands.py index 44c3c8896..293795e20 100755 --- a/setup_commands.py +++ b/setup_commands.py @@ -109,18 +109,18 @@ def _try_pyflakes(self): def _try_pychecker(self): try: - import pychecker # noqa: F401 + import pychecker sys.argv = """pychecker pymodbus/*.py""".split() - main() # noqa: F821 + main() return True except Exception: return False def _try_pylint(self): try: - import pylint # noqa: F401 + import pylint sys.argv = """pylint pymodbus/*.py""".split() - main() # noqa: F821 + main() return True except Exception: return False diff --git a/test/test_device.py b/test/test_device.py index a85a1fc1a..d32ab3506 100644 --- a/test/test_device.py +++ b/test/test_device.py @@ -350,8 +350,6 @@ def test_modbus_plus_statistics_helpers(self): [0], [0, 0, 0, 0, 0, 0, 0, 0], ] - stats_summary = [ # noqa: C416 pylint: disable=unnecessary-comprehension - x for x in statistics.summary() - ] + stats_summary = list(statistics.summary()) self.assertEqual(sorted(summary), sorted(stats_summary)) self.assertEqual(0x00, sum(sum(value[1]) for value in statistics)) diff --git a/tox.ini b/tox.ini index 61bf3bcdb..5110a0bb5 100644 --- a/tox.ini +++ b/tox.ini @@ -22,13 +22,13 @@ setenv = deps = -r requirements.txt ignore_errors = false commands = - pylint --recursive=y doc examples pymodbus test + pylint --recursive=y examples pymodbus test [testenv:codespell] deps = -r requirements.txt ignore_errors = false commands = - codespell --ignore-words-list asend --skip="_build" doc examples pymodbus test + codespell --ignore-words-list asend --skip="_build" examples pymodbus test [testenv:isort] deps = -r requirements.txt @@ -46,13 +46,13 @@ commands = deps = -r requirements.txt ignore_errors = false commands = - bandit -r -c bandit.yaml doc/ examples/ pymodbus/ test/ + bandit -r -c bandit.yaml examples/ pymodbus/ test/ [testenv:flake8] deps = -r requirements.txt ignore_errors = false commands = - flake8 doc/ examples/ pymodbus/ test/ + flake8 examples/ pymodbus/ test/ [testenv:black] deps = -r requirements.txt