From cc424aeb03e6c320a461682e4c1cdec66602412d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:55:21 +0000 Subject: [PATCH 1/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- qtpy/_utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/qtpy/_utils.py b/qtpy/_utils.py index 0ada4c15..347eba3b 100644 --- a/qtpy/_utils.py +++ b/qtpy/_utils.py @@ -83,7 +83,9 @@ def add_action(self, *args, old_add_action): member: bytes # if args and isinstance(args[0], QIcon): - if any(map(lambda arg: isinstance(arg, QIcon), args[:1])): # Better to use previous line instead of this + if any( + isinstance(arg, QIcon) for arg in args[:1] + ): # Better to use previous line instead of this icon, *args = args else: icon = QIcon() @@ -99,12 +101,11 @@ def add_action(self, *args, old_add_action): bytes, ], ) - ): - if len(args) >= 2: - text, shortcut, *args = args - action = old_add_action(self, icon, text, *args) - action.setShortcut(shortcut) - return action + ) and len(args) >= 2: + text, shortcut, *args = args + action = old_add_action(self, icon, text, *args) + action.setShortcut(shortcut) + return action return old_add_action(self, *args) From 1a77685ba0e33500319bbc6ff6ecb2e7a489275a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:58:06 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- qtpy/_utils.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/qtpy/_utils.py b/qtpy/_utils.py index 347eba3b..780de22d 100644 --- a/qtpy/_utils.py +++ b/qtpy/_utils.py @@ -90,18 +90,21 @@ def add_action(self, *args, old_add_action): else: icon = QIcon() - if all( - isinstance(arg, t) - for arg, t in zip( - args, - [ - str, - (QKeySequence, QKeySequence.StandardKey, str, int), - QObject, - bytes, - ], + if ( + all( + isinstance(arg, t) + for arg, t in zip( + args, + [ + str, + (QKeySequence, QKeySequence.StandardKey, str, int), + QObject, + bytes, + ], + ) ) - ) and len(args) >= 2: + and len(args) >= 2 + ): text, shortcut, *args = args action = old_add_action(self, icon, text, *args) action.setShortcut(shortcut)