Skip to content
Closed
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ default_install_hook_types: [pre-commit, commit-msg]

repos:
- repo: https://github.com/crate-ci/typos
rev: v1.16.26
rev: v1.18.1
hooks:
- id: typos

- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.0
hooks:
- id: ruff
args: ["--fix", "--unsafe-fixes"]

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
rev: v0.16
hooks:
- id: validate-pyproject

Expand Down
4 changes: 2 additions & 2 deletions demo/multi_file/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

sys.path.append(str(pathlib.Path(__file__).parent.parent))

from qtpy.QtWidgets import QApplication # noqa: E402
from qtpy.QtWidgets import QApplication

from multi_file.app import MyApp # noqa: E402
from multi_file.app import MyApp

qapp = QApplication.instance() or QApplication([])
app = MyApp()
Expand Down
9 changes: 3 additions & 6 deletions src/app_model/_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ def dispose(self) -> None:
self._disposers.pop()[1]()

@overload
def register_action(self, action: Action) -> DisposeCallable:
...
def register_action(self, action: Action) -> DisposeCallable: ...

@overload
def register_action(
Expand All @@ -227,8 +226,7 @@ def register_action(
menus: list[MenuRuleOrDict] | None = ...,
keybindings: list[KeyBindingRuleOrDict] | None = ...,
palette: bool = True,
) -> CommandDecorator:
...
) -> CommandDecorator: ...

@overload
def register_action(
Expand All @@ -244,8 +242,7 @@ def register_action(
menus: list[MenuRuleOrDict] | None = ...,
keybindings: list[KeyBindingRuleOrDict] | None = ...,
palette: bool = True,
) -> DisposeCallable:
...
) -> DisposeCallable: ...

def register_action(
self,
Expand Down
1 change: 1 addition & 0 deletions src/app_model/backends/qt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Qt objects for app_model."""

from ._qaction import QCommandAction, QCommandRuleAction, QMenuItemAction
from ._qkeybindingedit import QModelKeyBindingEdit
from ._qkeymap import (
Expand Down
1 change: 1 addition & 0 deletions src/app_model/expressions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Abstraction on expressions, and contexts in which to evaluate them."""

from ._context import Context, app_model_context, create_context, get_context
from ._context_keys import ContextKey, ContextKeyInfo, ContextNamespace
from ._expressions import (
Expand Down
1 change: 1 addition & 0 deletions src/app_model/expressions/_expressions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provides `Expr` and its subclasses."""

from __future__ import annotations

import ast
Expand Down
1 change: 1 addition & 0 deletions src/app_model/registries/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""App-model registries, such as menus, keybindings, commands."""

from ._commands_reg import CommandsRegistry
from ._keybindings_reg import KeyBindingsRegistry
from ._menus_reg import MenusRegistry
Expand Down
11 changes: 5 additions & 6 deletions src/app_model/registries/_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@


@overload
def register_action(app: Application | str, id_or_action: Action) -> DisposeCallable:
...
def register_action(
app: Application | str, id_or_action: Action
) -> DisposeCallable: ...


@overload
Expand All @@ -39,8 +40,7 @@ def register_action(
menus: list[MenuRuleOrDict] | None = ...,
keybindings: list[KeyBindingRuleOrDict] | None = ...,
palette: bool = True,
) -> CommandDecorator:
...
) -> CommandDecorator: ...


@overload
Expand All @@ -57,8 +57,7 @@ def register_action(
menus: list[MenuRuleOrDict] | None = ...,
keybindings: list[KeyBindingRuleOrDict] | None = ...,
palette: bool = True,
) -> DisposeCallable:
...
) -> DisposeCallable: ...


def register_action(
Expand Down
1 change: 1 addition & 0 deletions src/app_model/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""App-model types."""

from typing import TYPE_CHECKING

from ._action import Action
Expand Down
9 changes: 3 additions & 6 deletions src/app_model/types/_keys/_key_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,16 +655,13 @@ class KeyMod(IntFlag):
WinCtrl = 1 << 8 # meta key on windows, ctrl key on mac

@overload # type: ignore
def __or__(self, other: "KeyMod") -> "KeyMod":
...
def __or__(self, other: "KeyMod") -> "KeyMod": ...

@overload
def __or__(self, other: KeyCode) -> "KeyCombo":
...
def __or__(self, other: KeyCode) -> "KeyCombo": ...

@overload
def __or__(self, other: int) -> int:
...
def __or__(self, other: int) -> int: ...

def __or__(
self, other: Union["KeyMod", KeyCode, int]
Expand Down
3 changes: 1 addition & 2 deletions tests/test_context/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
def test_create_context():
"""You can create a context for any object"""

class T:
...
class T: ...

t = T()
tid = id(t)
Expand Down