mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 00:40:01 +02:00
client: fixes async function handling
This commit is contained in:
parent
a1ac0c2f88
commit
bcf37067ad
@ -1,7 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from copy import copy
|
|
||||||
from typing import TYPE_CHECKING, Any, cast
|
from typing import TYPE_CHECKING, Any, cast
|
||||||
|
|
||||||
import socketio # type: ignore
|
import socketio # type: ignore
|
||||||
@ -202,24 +201,7 @@ class ProxyClassMixin:
|
|||||||
def _handle_serialized_method(
|
def _handle_serialized_method(
|
||||||
self, attr_name: str, serialized_object: SerializedObject
|
self, attr_name: str, serialized_object: SerializedObject
|
||||||
) -> None:
|
) -> None:
|
||||||
def add_prefix_to_last_path_element(s: str, prefix: str) -> str:
|
|
||||||
parts = s.split(".")
|
|
||||||
parts[-1] = f"{prefix}_{parts[-1]}"
|
|
||||||
return ".".join(parts)
|
|
||||||
|
|
||||||
if serialized_object["type"] == "method":
|
if serialized_object["type"] == "method":
|
||||||
if serialized_object["async"] is True:
|
|
||||||
start_method = copy(serialized_object)
|
|
||||||
start_method["full_access_path"] = add_prefix_to_last_path_element(
|
|
||||||
start_method["full_access_path"], "start"
|
|
||||||
)
|
|
||||||
stop_method = copy(serialized_object)
|
|
||||||
stop_method["full_access_path"] = add_prefix_to_last_path_element(
|
|
||||||
stop_method["full_access_path"], "stop"
|
|
||||||
)
|
|
||||||
self._add_method_proxy(f"start_{attr_name}", start_method)
|
|
||||||
self._add_method_proxy(f"stop_{attr_name}", stop_method)
|
|
||||||
else:
|
|
||||||
self._add_method_proxy(attr_name, serialized_object)
|
self._add_method_proxy(attr_name, serialized_object)
|
||||||
|
|
||||||
def _add_method_proxy(
|
def _add_method_proxy(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user