From 270173b722bcf01f2e010ede51d51cf611732209 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 00:09:47 +0000 Subject: [PATCH 1/4] ci(pre-commit.ci): autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/abravalheri/validate-pyproject: v0.19 → v0.22](https://github.com/abravalheri/validate-pyproject/compare/v0.19...v0.22) - [github.com/crate-ci/typos: v1.24.5 → v1.27.0](https://github.com/crate-ci/typos/compare/v1.24.5...v1.27.0) - [github.com/astral-sh/ruff-pre-commit: v0.6.4 → v0.7.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.4...v0.7.2) - [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.13.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.2...v1.13.0) --- .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 a9614433f..3b4900f6d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,23 +5,23 @@ ci: repos: - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.19 + rev: v0.22 hooks: - id: validate-pyproject - repo: https://github.com/crate-ci/typos - rev: v1.24.5 + rev: v1.27.0 hooks: - id: typos - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.4 + rev: v0.7.2 hooks: - id: ruff args: ["--fix"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.11.2 + rev: v1.13.0 hooks: - id: mypy files: "^src/" From d7a74994cb2dea4f8e96dfc542d8e04e003c9b23 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 00:11:11 +0000 Subject: [PATCH 2/4] style(pre-commit.ci): auto fixes [...] --- src/magicgui/schema/_ui_field.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/magicgui/schema/_ui_field.py b/src/magicgui/schema/_ui_field.py index f6b825a19..67f61bb7a 100644 --- a/src/magicgui/schema/_ui_field.py +++ b/src/magicgui/schema/_ui_field.py @@ -166,7 +166,7 @@ def __post_init__(self) -> None: decimal_places: int | None = field( default=None, metadata={ - "descripion": "Maximum number of digits within the decimal. It does " + "description": "Maximum number of digits within the decimal. It does " "not include trailing decimal zeroes." }, ) From 38c3b40c8e3ba9c8c913488836a0b683685fb236 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 8 Nov 2024 08:10:55 -0500 Subject: [PATCH 3/4] fix linting --- .pre-commit-config.yaml | 4 ++-- src/magicgui/_util.py | 2 +- src/magicgui/widgets/_function_gui.py | 4 ++-- .../widgets/bases/_categorical_widget.py | 2 +- x.py | 22 +++++++++++++++++++ 5 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 x.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b4900f6d..eabbee82f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,12 +10,12 @@ repos: - id: validate-pyproject - repo: https://github.com/crate-ci/typos - rev: v1.27.0 + rev: typos-dict-v0.11.34 hooks: - id: typos - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.2 + rev: v0.7.3 hooks: - id: ruff args: ["--fix"] diff --git a/src/magicgui/_util.py b/src/magicgui/_util.py index 8f113acaf..6f2cd496a 100644 --- a/src/magicgui/_util.py +++ b/src/magicgui/_util.py @@ -66,7 +66,7 @@ def call_it() -> T: return debounced - return decorator if function is None else decorator(function) # type: ignore + return decorator if function is None else decorator(function) def throttle(t: float) -> Callable[[Callable[P, T]], Callable[P, T | None]]: diff --git a/src/magicgui/widgets/_function_gui.py b/src/magicgui/widgets/_function_gui.py index b15455ce9..d94f4a041 100644 --- a/src/magicgui/widgets/_function_gui.py +++ b/src/magicgui/widgets/_function_gui.py @@ -225,7 +225,7 @@ def _disable_button_and_call() -> None: self._call_button = cast(PushButton, self._call_button) self._call_button.enabled = False try: - self.__call__() + self.__call__() # type: ignore [call-arg] finally: self._call_button.enabled = True @@ -257,7 +257,7 @@ def _on_change(self) -> None: if self.persist: self._dump() if self._auto_call: - self() + self() # type: ignore [call-arg] @property def call_button(self) -> PushButton | None: diff --git a/src/magicgui/widgets/bases/_categorical_widget.py b/src/magicgui/widgets/bases/_categorical_widget.py index 0ba1484db..d172caa3b 100644 --- a/src/magicgui/widgets/bases/_categorical_widget.py +++ b/src/magicgui/widgets/bases/_categorical_widget.py @@ -131,7 +131,7 @@ def choices(self) -> tuple[T | None, ...]: @choices.setter def choices(self, choices: ChoicesType) -> None: - str_func: Callable = _get_name if isinstance(choices, EnumMeta) else str # type: ignore + str_func: Callable = _get_name if isinstance(choices, EnumMeta) else str if isinstance(choices, dict): if "choices" not in choices or "key" not in choices: raise ValueError( diff --git a/x.py b/x.py new file mode 100644 index 000000000..2253689a0 --- /dev/null +++ b/x.py @@ -0,0 +1,22 @@ +from typing import Any, Optional + +from magicgui import magicgui, register_type +from magicgui.widgets import FunctionGui + + +class Thing: ... + + +def on_thing_received(wdg: FunctionGui, thing: Any, type_: type) -> None: + print(f"Received a {type_}:", thing) + + +register_type(Thing, return_callback=on_thing_received) + + +@magicgui +def my_widget() -> Optional[Thing]: + return Thing() + + +my_widget() From 03c5325f5bfefb7cb34d0a8b3447a41485dcacba Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Fri, 8 Nov 2024 08:11:46 -0500 Subject: [PATCH 4/4] remove x --- x.py | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 x.py diff --git a/x.py b/x.py deleted file mode 100644 index 2253689a0..000000000 --- a/x.py +++ /dev/null @@ -1,22 +0,0 @@ -from typing import Any, Optional - -from magicgui import magicgui, register_type -from magicgui.widgets import FunctionGui - - -class Thing: ... - - -def on_thing_received(wdg: FunctionGui, thing: Any, type_: type) -> None: - print(f"Received a {type_}:", thing) - - -register_type(Thing, return_callback=on_thing_received) - - -@magicgui -def my_widget() -> Optional[Thing]: - return Thing() - - -my_widget()