From e47ea5f2e574491e69d9eb8ab9ee6fe13c7d78d5 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 23 May 2023 12:54:15 +0200 Subject: [PATCH] Fix pylint errors In a previous patch the dependency on cmd2 was changed from cmd2==1.5 to cmd2>=1.5. After this was merged, this lead to the docker images getting rebuilt and now having a higher cmd2 version that gets used in the CI checks. So while the patch was in review, pylint was actually running with a lower cmd2 version and was taking different code paths. Fix for: pySim-shell.py:30:4: E0611: No name 'fg' in module 'cmd2' (no-name-in-module) pySim-shell.py:30:4: E0611: No name 'bg' in module 'cmd2' (no-name-in-module) pySim-shell.py:154:8: E1123: Unexpected keyword argument 'use_ipython' in method call (unexpected-keyword-arg) pySim-shell.py:171:30: E1120: No value for argument 'settable_object' in constructor call (no-value-for-parameter) pySim-shell.py:173:30: E1120: No value for argument 'settable_object' in constructor call (no-value-for-parameter) pySim-shell.py:175:30: E1120: No value for argument 'settable_object' in constructor call (no-value-for-parameter) pySim-shell.py:176:30: E1120: No value for argument 'settable_object' in constructor call (no-value-for-parameter) Fixes: f8a3d2b3 ("requirements.txt: allow cmd2 versions greater than 1.5") Fixes: OS#6034 Change-Id: I182d3a2b87e70ed551a70c88d3d531a36bf53f53 --- pySim-shell.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pySim-shell.py b/pySim-shell.py index 51cd9c6f..2b8c0be9 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -27,7 +27,7 @@ from packaging import version from cmd2 import style # cmd2 >= 2.3.0 has deprecated the bg/fg in favor of Bg/Fg :( if version.parse(cmd2.__version__) < version.parse("2.3.0"): - from cmd2 import fg, bg + from cmd2 import fg, bg # pylint: disable=no-name-in-module RED = fg.red LIGHT_RED = fg.bright_red LIGHT_GREEN = fg.bright_green @@ -151,6 +151,7 @@ class PysimApp(cmd2.Cmd): else: kwargs = {'include_ipy': True} + # pylint: disable=unexpected-keyword-arg super().__init__(persistent_history_file='~/.pysim_shell_history', allow_cli_args=False, auto_load_commands=False, startup_script=script, **kwargs) self.intro = style('Welcome to pySim-shell!', fg=RED) @@ -168,11 +169,15 @@ class PysimApp(cmd2.Cmd): self.apdu_trace = False if version.parse(cmd2.__version__) < version.parse("2.0.0"): + # pylint: disable=no-value-for-parameter self.add_settable(cmd2.Settable('numeric_path', bool, 'Print File IDs instead of names', onchange_cb=self._onchange_numeric_path)) + # pylint: disable=no-value-for-parameter self.add_settable(cmd2.Settable('conserve_write', bool, 'Read and compare before write', onchange_cb=self._onchange_conserve_write)) + # pylint: disable=no-value-for-parameter self.add_settable(cmd2.Settable('json_pretty_print', bool, 'Pretty-Print JSON output')) + # pylint: disable=no-value-for-parameter self.add_settable(cmd2.Settable('apdu_trace', bool, 'Trace and display APDUs exchanged with card', onchange_cb=self._onchange_apdu_trace)) else: