From 6c9f7f441f53e246331b80eb03112832b88ff8d2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:02:33 +0000 Subject: [PATCH 1/2] ci: [pre-commit.ci] autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/crate-ci/typos: v1.16.26 → v1.18.1](https://github.com/crate-ci/typos/compare/v1.16.26...v1.18.1) - [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/23.12.1...24.1.1) - [github.com/astral-sh/ruff-pre-commit: v0.1.9 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.9...v0.2.0) - [github.com/abravalheri/validate-pyproject: v0.15 → v0.16](https://github.com/abravalheri/validate-pyproject/compare/v0.15...v0.16) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d7b47645..cf2a316d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 From 5af133151e4fd5b6456086b2673156362cc30f30 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:02:53 +0000 Subject: [PATCH 2/2] style: [pre-commit.ci] auto fixes [...] --- demo/multi_file/__main__.py | 4 ++-- src/app_model/_app.py | 9 +++------ src/app_model/backends/qt/__init__.py | 1 + src/app_model/expressions/__init__.py | 1 + src/app_model/expressions/_expressions.py | 1 + src/app_model/registries/__init__.py | 1 + src/app_model/registries/_register.py | 11 +++++------ src/app_model/types/__init__.py | 1 + src/app_model/types/_keys/_key_codes.py | 9 +++------ tests/test_context/test_context.py | 3 +-- 10 files changed, 19 insertions(+), 22 deletions(-) diff --git a/demo/multi_file/__main__.py b/demo/multi_file/__main__.py index 0449f11e..91e6466d 100644 --- a/demo/multi_file/__main__.py +++ b/demo/multi_file/__main__.py @@ -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() diff --git a/src/app_model/_app.py b/src/app_model/_app.py index 8219ac0c..3d342f5e 100644 --- a/src/app_model/_app.py +++ b/src/app_model/_app.py @@ -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( @@ -227,8 +226,7 @@ def register_action( menus: list[MenuRuleOrDict] | None = ..., keybindings: list[KeyBindingRuleOrDict] | None = ..., palette: bool = True, - ) -> CommandDecorator: - ... + ) -> CommandDecorator: ... @overload def register_action( @@ -244,8 +242,7 @@ def register_action( menus: list[MenuRuleOrDict] | None = ..., keybindings: list[KeyBindingRuleOrDict] | None = ..., palette: bool = True, - ) -> DisposeCallable: - ... + ) -> DisposeCallable: ... def register_action( self, diff --git a/src/app_model/backends/qt/__init__.py b/src/app_model/backends/qt/__init__.py index 55048701..e81c5641 100644 --- a/src/app_model/backends/qt/__init__.py +++ b/src/app_model/backends/qt/__init__.py @@ -1,4 +1,5 @@ """Qt objects for app_model.""" + from ._qaction import QCommandAction, QCommandRuleAction, QMenuItemAction from ._qkeybindingedit import QModelKeyBindingEdit from ._qkeymap import ( diff --git a/src/app_model/expressions/__init__.py b/src/app_model/expressions/__init__.py index b6067d85..aa4544b3 100644 --- a/src/app_model/expressions/__init__.py +++ b/src/app_model/expressions/__init__.py @@ -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 ( diff --git a/src/app_model/expressions/_expressions.py b/src/app_model/expressions/_expressions.py index 0c9dd83c..4675d0f3 100644 --- a/src/app_model/expressions/_expressions.py +++ b/src/app_model/expressions/_expressions.py @@ -1,4 +1,5 @@ """Provides `Expr` and its subclasses.""" + from __future__ import annotations import ast diff --git a/src/app_model/registries/__init__.py b/src/app_model/registries/__init__.py index 1a0755f4..2a10441b 100644 --- a/src/app_model/registries/__init__.py +++ b/src/app_model/registries/__init__.py @@ -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 diff --git a/src/app_model/registries/_register.py b/src/app_model/registries/_register.py index c5584de9..e943570b 100644 --- a/src/app_model/registries/_register.py +++ b/src/app_model/registries/_register.py @@ -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 @@ -39,8 +40,7 @@ def register_action( menus: list[MenuRuleOrDict] | None = ..., keybindings: list[KeyBindingRuleOrDict] | None = ..., palette: bool = True, -) -> CommandDecorator: - ... +) -> CommandDecorator: ... @overload @@ -57,8 +57,7 @@ def register_action( menus: list[MenuRuleOrDict] | None = ..., keybindings: list[KeyBindingRuleOrDict] | None = ..., palette: bool = True, -) -> DisposeCallable: - ... +) -> DisposeCallable: ... def register_action( diff --git a/src/app_model/types/__init__.py b/src/app_model/types/__init__.py index 1502e921..52e6609f 100644 --- a/src/app_model/types/__init__.py +++ b/src/app_model/types/__init__.py @@ -1,4 +1,5 @@ """App-model types.""" + from typing import TYPE_CHECKING from ._action import Action diff --git a/src/app_model/types/_keys/_key_codes.py b/src/app_model/types/_keys/_key_codes.py index 1b5cbabb..4c719d48 100644 --- a/src/app_model/types/_keys/_key_codes.py +++ b/src/app_model/types/_keys/_key_codes.py @@ -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] diff --git a/tests/test_context/test_context.py b/tests/test_context/test_context.py index ca4ed478..2a40fe3d 100644 --- a/tests/test_context/test_context.py +++ b/tests/test_context/test_context.py @@ -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)