From 7ddcd97f68ddc045a56b0b44d67369a2954a5c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Tue, 6 Aug 2024 08:16:20 +0200 Subject: [PATCH] fixing ruff and mypy errors --- src/pydase/observer_pattern/observable/observable.py | 2 +- src/pydase/task/task.py | 2 +- src/pydase/utils/helpers.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pydase/observer_pattern/observable/observable.py b/src/pydase/observer_pattern/observable/observable.py index 474d684..9299fb3 100644 --- a/src/pydase/observer_pattern/observable/observable.py +++ b/src/pydase/observer_pattern/observable/observable.py @@ -24,7 +24,7 @@ class Observable(ObservableObject): for name, value in class_attrs.items(): if isinstance(value, property) or callable(value): continue - elif is_descriptor(value): + if is_descriptor(value): # Descriptors have to be stored as a class variable in another class to # work properly. So don't make it an instance attribute. self._initialise_new_objects(name, value) diff --git a/src/pydase/task/task.py b/src/pydase/task/task.py index e848f1d..257ef98 100644 --- a/src/pydase/task/task.py +++ b/src/pydase/task/task.py @@ -80,7 +80,7 @@ class Task(pydase.DataService, Generic[P, R]): # containing the function if instance: - async def bound_func(*args, **kwargs) -> R | None: + async def bound_func(*args: P.args, **kwargs: P.kwargs) -> R | None: return await self._func(instance, *args, **kwargs) self._bound_func = bound_func diff --git a/src/pydase/utils/helpers.py b/src/pydase/utils/helpers.py index a1812fd..3c5269f 100644 --- a/src/pydase/utils/helpers.py +++ b/src/pydase/utils/helpers.py @@ -197,6 +197,7 @@ def function_has_arguments(func: Callable[..., Any]) -> bool: # Check if there are any parameters left which would indicate additional arguments. return len(parameters) > 0 -def is_descriptor(obj): + +def is_descriptor(obj: object) -> bool: """Check if an object is a descriptor.""" return any(hasattr(obj, method) for method in ("__get__", "__set__", "__delete__"))