mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 16:50:02 +02:00
fixing ruff and mypy errors
This commit is contained in:
parent
80da96657c
commit
7ddcd97f68
@ -24,7 +24,7 @@ class Observable(ObservableObject):
|
|||||||
for name, value in class_attrs.items():
|
for name, value in class_attrs.items():
|
||||||
if isinstance(value, property) or callable(value):
|
if isinstance(value, property) or callable(value):
|
||||||
continue
|
continue
|
||||||
elif is_descriptor(value):
|
if is_descriptor(value):
|
||||||
# Descriptors have to be stored as a class variable in another class to
|
# Descriptors have to be stored as a class variable in another class to
|
||||||
# work properly. So don't make it an instance attribute.
|
# work properly. So don't make it an instance attribute.
|
||||||
self._initialise_new_objects(name, value)
|
self._initialise_new_objects(name, value)
|
||||||
|
@ -80,7 +80,7 @@ class Task(pydase.DataService, Generic[P, R]):
|
|||||||
# containing the function
|
# containing the function
|
||||||
if instance:
|
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)
|
return await self._func(instance, *args, **kwargs)
|
||||||
|
|
||||||
self._bound_func = bound_func
|
self._bound_func = bound_func
|
||||||
|
@ -197,6 +197,7 @@ def function_has_arguments(func: Callable[..., Any]) -> bool:
|
|||||||
# Check if there are any parameters left which would indicate additional arguments.
|
# Check if there are any parameters left which would indicate additional arguments.
|
||||||
return len(parameters) > 0
|
return len(parameters) > 0
|
||||||
|
|
||||||
def is_descriptor(obj):
|
|
||||||
|
def is_descriptor(obj: object) -> bool:
|
||||||
"""Check if an object is a descriptor."""
|
"""Check if an object is a descriptor."""
|
||||||
return any(hasattr(obj, method) for method in ("__get__", "__set__", "__delete__"))
|
return any(hasattr(obj, method) for method in ("__get__", "__set__", "__delete__"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user