From ea58332d020fd101a2c39f975e5653c5328bafaf Mon Sep 17 00:00:00 2001 From: Martin Hoyer Date: Thu, 12 Sep 2024 14:42:52 +0200 Subject: [PATCH] Fix new ruff/pre-commit errors --- configshell/node.py | 8 ++++---- configshell/shell.py | 6 ++---- pyproject.toml | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configshell/node.py b/configshell/node.py index fdf4de2..8d1ec48 100644 --- a/configshell/node.py +++ b/configshell/node.py @@ -1243,12 +1243,12 @@ def ui_command_bookmarks(self, action, bookmark=None): if not self.shell.prefs['bookmarks']: bookmarks += "No bookmarks yet.\n" else: - for (bookmark, path) \ + for (b, path) \ in self.shell.prefs['bookmarks'].items(): - if len(bookmark) == 1: + if len(b) == 1: bookmark += '\0' - underline = ''.ljust(len(bookmark), '-') - bookmarks += f"{bookmark}\n{underline}\n{path}\n\n" + underline = ''.ljust(len(b), '-') + bookmarks += f"{b}\n{underline}\n{path}\n\n" self.shell.con.epy_write(bookmarks) return None else: diff --git a/configshell/shell.py b/configshell/shell.py index bc9b6e1..6022854 100644 --- a/configshell/shell.py +++ b/configshell/shell.py @@ -405,8 +405,7 @@ def _complete_token_pparam(self, text, path, command, pparams, kparams): for index in range(len(pparams)): if index < len(cmd_params): current_parameters[cmd_params[index]] = pparams[index] - for key, value in kparams.items(): - current_parameters[key] = value + current_parameters.update(kparams) self._completion_help_topic = command completion_method = target.get_completion_method(command) self.log.debug(f"Command {command} accepts parameters {cmd_params}.") @@ -547,8 +546,7 @@ def _complete_token_kparam(self, text, path, command, pparams, kparams): current_parameters = {} for index in range(len(pparams)): current_parameters[cmd_params[index]] = pparams[index] - for key, value in kparams.items(): - current_parameters[key] = value + current_parameters.update(kparams) completion_method = target.get_completion_method(command) if completion_method: completions = completion_method( diff --git a/pyproject.toml b/pyproject.toml index ec37959..e35fe29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,3 +98,5 @@ ignore = [ [tool.ruff.lint.per-file-ignores] # Possible hardcoded password assigned to: "current_token" "configshell/shell" = ["S105"] +# Required for pre-commit. Examples could be improved though. +"examples/*" = ["S"]