Skip to content

Commit

Permalink
Fix type exception type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Garulf committed Jan 25, 2024
1 parent e42ab34 commit 11622e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pyflowlauncher/event.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


from typing import Any, Callable, Iterable
from typing import Any, Callable, Iterable, Type


class EventHandler:
Expand All @@ -21,7 +21,7 @@ def add_methods(self, methods: Iterable[Callable[..., Any]]):
for method in methods:
self.add_method(method)

def add_exception_handler(self, exception: Exception, handler: Callable[..., Any]):
def add_exception_handler(self, exception: Type[Exception], handler: Callable[..., Any]):
self._handlers[exception] = handler

def __call__(self, method: str, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions pyflowlauncher/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys
from functools import wraps
from typing import Any, Callable, Iterable, Optional, Union
from typing import Any, Callable, Iterable, Optional, Type, Union
from pathlib import Path
import json

Expand Down Expand Up @@ -44,7 +44,7 @@ def method(self, method: Method) -> Method:
"""Register a method to be called when the plugin is run."""
return self.on_method(method)

def add_exception_handler(self, exception: Exception, handler: Callable[..., Any]) -> None:
def add_exception_handler(self, exception: Type[Exception], handler: Callable[..., Any]) -> None:
"""Add exception handler to be called when an exception is raised in a method."""
self._event_handler.add_exception_handler(exception, handler)

Expand Down

0 comments on commit 11622e5

Please sign in to comment.