Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/app_model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
6 changes: 3 additions & 3 deletions src/app_model/backends/qt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
__all__ = [
"QCommandAction",
"QCommandRuleAction",
"qkey2modelkey",
"QKeyBindingSequence",
"qkeycombo2modelkey",
"qkeysequence2modelkeybinding",
"QMenuItemAction",
"QModelKeyBindingEdit",
"QModelMainWindow",
"QModelMenu",
"QModelMenuBar",
"QModelSubmenu",
"QModelToolBar",
"qkey2modelkey",
"qkeycombo2modelkey",
"qkeysequence2modelkeybinding",
"qmods2modelmods",
"to_qicon",
]
6 changes: 2 additions & 4 deletions src/app_model/backends/qt/_qaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
8 changes: 4 additions & 4 deletions src/app_model/expressions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
)

__all__ = [
"app_model_context",
"BinOp",
"BoolOp",
"Compare",
Expand All @@ -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",
]
2 changes: 1 addition & 1 deletion src/app_model/expressions/_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/app_model/registries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"CommandsRegistry",
"KeyBindingsRegistry",
"MenusRegistry",
"register_action",
"RegisteredCommand",
"register_action",
]
10 changes: 5 additions & 5 deletions src/app_model/registries/_commands_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
4 changes: 2 additions & 2 deletions src/app_model/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
"Icon",
"KeyBinding",
"KeyBindingRule",
"KeyBindingSource",
"KeyChord",
"KeyCode",
"KeyCombo",
"KeyMod",
"KeyBindingSource",
"OperatingSystem",
"MenuItem",
"MenuItemBase",
"MenuRule",
"OperatingSystem",
"ScanCode",
"SimpleKeyBinding",
"StandardKeyBinding",
Expand Down
2 changes: 1 addition & 1 deletion src/app_model/types/_keys/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"KeyCombo",
"KeyMod",
"ScanCode",
"StandardKeyBinding",
"SimpleKeyBinding",
"StandardKeyBinding",
]