From e443d07d98d1a3f17fa808ac8480df6c5d1723c7 Mon Sep 17 00:00:00 2001 From: spacemanspiff2007 <10754716+spacemanspiff2007@users.noreply.github.com> Date: Thu, 24 Oct 2024 06:32:12 +0200 Subject: [PATCH] Fix Handy Wecker --- .pre-commit-config.yaml | 4 ++-- src/HABApp/rule/rule.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c6a1b9b7..3bc493d6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,14 +20,14 @@ repos: - id: ruff name: ruff unused imports # F401 [*] {name} imported but unused - args: [ "--select", "F401,I001", "--extend-exclude", "__init__.py", "--fix"] + args: [ "--select", "F401", "--extend-exclude", "__init__.py", "--fix"] - id: ruff # I001 [*] Import block is un-sorted or un-formatted # UP035 [*] Import from {target} instead: {names} # Q000 [*] Double quote found but single quotes preferred # Q001 [*] Double quote multiline found but single quotes preferred - args: [ "--select", "UP035,Q000,Q001", "--fix"] + args: [ "--select", "I001,UP035,Q000,Q001", "--fix"] - repo: https://github.com/JelleZijlstra/autotyping diff --git a/src/HABApp/rule/rule.py b/src/HABApp/rule/rule.py index a6526583..464fa723 100644 --- a/src/HABApp/rule/rule.py +++ b/src/HABApp/rule/rule.py @@ -106,7 +106,7 @@ def __repr__(self) -> str: return f'<{cls_name}{" ".join(parts)}>' - def post_event(self, name: BaseItem | str, event: Any): + def post_event(self, name: BaseItem | str, event: Any) -> None: """ Post an event to the event bus @@ -142,7 +142,7 @@ def listen_event(self, name: BaseItem | str, event_filter = HABApp.core.events.NoEventFilter() if not isinstance(event_filter, EventFilterBase): msg = f'Argument event_filter must be an instance of event filter (is {event_filter})' - raise ValueError(msg) + raise TypeError(msg) listener = ContextBoundEventBusListener(name, cb, event_filter, parent_ctx=self._habapp_ctx) return self._habapp_ctx.add_event_listener(listener)