From a0d95b19c0e8d61ccab6bea69d1adace910d9157 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:38:45 +0000 Subject: [PATCH] ci: [pre-commit.ci] autoupdate (#227) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci: [pre-commit.ci] autoupdate updates: - [github.com/crate-ci/typos: v1.27.0 → typos-dict-v0.11.37](https://github.com/crate-ci/typos/compare/v1.27.0...typos-dict-v0.11.37) - [github.com/astral-sh/ruff-pre-commit: v0.7.2 → v0.8.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.2...v0.8.1) - [github.com/abravalheri/validate-pyproject: v0.22 → v0.23](https://github.com/abravalheri/validate-pyproject/compare/v0.22...v0.23) * style: [pre-commit.ci] auto fixes [...] --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Talley Lambert --- .pre-commit-config.yaml | 6 +++--- src/app_model/__init__.py | 2 +- src/app_model/backends/qt/__init__.py | 6 +++--- src/app_model/backends/qt/_qaction.py | 6 ++---- src/app_model/expressions/__init__.py | 8 ++++---- src/app_model/expressions/_expressions.py | 2 +- src/app_model/registries/__init__.py | 2 +- src/app_model/registries/_commands_reg.py | 10 +++++----- src/app_model/types/__init__.py | 4 ++-- src/app_model/types/_keys/__init__.py | 2 +- 10 files changed, 23 insertions(+), 25 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ceee40..970593f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,20 +5,20 @@ ci: repos: - repo: https://github.com/crate-ci/typos - rev: v1.27.0 + rev: typos-dict-v0.11.37 hooks: - id: typos args: [] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.2 + rev: v0.8.1 hooks: - id: ruff args: ["--fix", "--unsafe-fixes"] - id: ruff-format - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.22 + rev: v0.23 hooks: - id: validate-pyproject diff --git a/src/app_model/__init__.py b/src/app_model/__init__.py index bb41d91..265235a 100644 --- a/src/app_model/__init__.py +++ b/src/app_model/__init__.py @@ -11,4 +11,4 @@ from .registries._register import register_action from .types import Action -__all__ = ["__version__", "Application", "Action", "register_action"] +__all__ = ["Action", "Application", "__version__", "register_action"] diff --git a/src/app_model/backends/qt/__init__.py b/src/app_model/backends/qt/__init__.py index e81c564..0e95014 100644 --- a/src/app_model/backends/qt/__init__.py +++ b/src/app_model/backends/qt/__init__.py @@ -16,10 +16,7 @@ __all__ = [ "QCommandAction", "QCommandRuleAction", - "qkey2modelkey", "QKeyBindingSequence", - "qkeycombo2modelkey", - "qkeysequence2modelkeybinding", "QMenuItemAction", "QModelKeyBindingEdit", "QModelMainWindow", @@ -27,6 +24,9 @@ "QModelMenuBar", "QModelSubmenu", "QModelToolBar", + "qkey2modelkey", + "qkeycombo2modelkey", + "qkeysequence2modelkeybinding", "qmods2modelmods", "to_qicon", ] diff --git a/src/app_model/backends/qt/_qaction.py b/src/app_model/backends/qt/_qaction.py index e6753d2..862ac34 100644 --- a/src/app_model/backends/qt/_qaction.py +++ b/src/app_model/backends/qt/_qaction.py @@ -107,10 +107,8 @@ def update_from_context(self, ctx: Mapping[str, object]) -> None: """Update the enabled state of this menu item from `ctx`.""" self.setEnabled(expr.eval(ctx) if (expr := self._cmd_rule.enablement) else True) if expr2 := self._cmd_rule.toggled: - if ( - isinstance(expr2, Expr) - or isinstance(expr2, ToggleRule) - and (expr2 := expr2.condition) + if isinstance(expr2, Expr) or ( + isinstance(expr2, ToggleRule) and (expr2 := expr2.condition) ): self.setChecked(expr2.eval(ctx)) diff --git a/src/app_model/expressions/__init__.py b/src/app_model/expressions/__init__.py index aa4544b..108e628 100644 --- a/src/app_model/expressions/__init__.py +++ b/src/app_model/expressions/__init__.py @@ -16,7 +16,6 @@ ) __all__ = [ - "app_model_context", "BinOp", "BoolOp", "Compare", @@ -25,12 +24,13 @@ "ContextKey", "ContextKeyInfo", "ContextNamespace", - "create_context", "Expr", - "get_context", "IfExp", "Name", + "UnaryOp", + "app_model_context", + "create_context", + "get_context", "parse_expression", "safe_eval", - "UnaryOp", ] diff --git a/src/app_model/expressions/_expressions.py b/src/app_model/expressions/_expressions.py index 8988906..bf39e17 100644 --- a/src/app_model/expressions/_expressions.py +++ b/src/app_model/expressions/_expressions.py @@ -619,7 +619,7 @@ def visit_Constant(self, node: ast.Constant) -> None: def visit_BoolOp(self, node: ast.BoolOp) -> Any: op = f" {_OPS[type(node.op)]} " for idx, value in enumerate(node.values): - self.write(idx and op or "", value) + self.write((idx and op) or "", value) def visit_Compare(self, node: ast.Compare) -> None: self.visit(node.left) diff --git a/src/app_model/registries/__init__.py b/src/app_model/registries/__init__.py index 39a0338..176ba4e 100644 --- a/src/app_model/registries/__init__.py +++ b/src/app_model/registries/__init__.py @@ -9,6 +9,6 @@ "CommandsRegistry", "KeyBindingsRegistry", "MenusRegistry", - "register_action", "RegisteredCommand", + "register_action", ] diff --git a/src/app_model/registries/_commands_reg.py b/src/app_model/registries/_commands_reg.py index a719972..cde7c0c 100644 --- a/src/app_model/registries/_commands_reg.py +++ b/src/app_model/registries/_commands_reg.py @@ -38,13 +38,13 @@ class RegisteredCommand(Generic[P, R]): """ __slots__ = ( - "id", + "_initialized", + "_injected_callback", + "_injection_store", + "_resolved_callback", "callback", + "id", "title", - "_resolved_callback", - "_injection_store", - "_injected_callback", - "_initialized", ) def __init__( diff --git a/src/app_model/types/__init__.py b/src/app_model/types/__init__.py index fb91ee0..39a6530 100644 --- a/src/app_model/types/__init__.py +++ b/src/app_model/types/__init__.py @@ -38,15 +38,15 @@ "Icon", "KeyBinding", "KeyBindingRule", + "KeyBindingSource", "KeyChord", "KeyCode", "KeyCombo", "KeyMod", - "KeyBindingSource", - "OperatingSystem", "MenuItem", "MenuItemBase", "MenuRule", + "OperatingSystem", "ScanCode", "SimpleKeyBinding", "StandardKeyBinding", diff --git a/src/app_model/types/_keys/__init__.py b/src/app_model/types/_keys/__init__.py index a0ab624..85eb996 100644 --- a/src/app_model/types/_keys/__init__.py +++ b/src/app_model/types/_keys/__init__.py @@ -9,6 +9,6 @@ "KeyCombo", "KeyMod", "ScanCode", - "StandardKeyBinding", "SimpleKeyBinding", + "StandardKeyBinding", ]