mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-23 20:47:59 +02:00
pulls get_value out of ProxyClassMixin
This commit is contained in:
@ -74,6 +74,21 @@ def update_value(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_value(
|
||||||
|
sio_client: socketio.AsyncClient,
|
||||||
|
loop: asyncio.AbstractEventLoop,
|
||||||
|
access_path: str,
|
||||||
|
) -> Any:
|
||||||
|
async def get_result() -> Any:
|
||||||
|
return await sio_client.call("get_value", access_path)
|
||||||
|
|
||||||
|
result = asyncio.run_coroutine_threadsafe(
|
||||||
|
get_result(),
|
||||||
|
loop=loop,
|
||||||
|
).result()
|
||||||
|
return ProxyLoader.loads_proxy(result, sio_client, loop)
|
||||||
|
|
||||||
|
|
||||||
class ProxyDict(dict[str, Any]):
|
class ProxyDict(dict[str, Any]):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -242,16 +257,11 @@ class ProxyClassMixin:
|
|||||||
self, attr_name: str, serialized_object: SerializedObject
|
self, attr_name: str, serialized_object: SerializedObject
|
||||||
) -> None:
|
) -> None:
|
||||||
def getter_proxy() -> Any:
|
def getter_proxy() -> Any:
|
||||||
async def get_result() -> Any:
|
get_value(
|
||||||
return await self._sio.call(
|
sio_client=self._sio,
|
||||||
"get_value", serialized_object["full_access_path"]
|
|
||||||
)
|
|
||||||
|
|
||||||
result = asyncio.run_coroutine_threadsafe(
|
|
||||||
get_result(),
|
|
||||||
loop=self._loop,
|
loop=self._loop,
|
||||||
).result()
|
access_path=serialized_object["full_access_path"],
|
||||||
return ProxyLoader.loads_proxy(result, self._sio, self._loop)
|
)
|
||||||
|
|
||||||
dict.__setitem__(self._proxy_getters, attr_name, getter_proxy) # type: ignore
|
dict.__setitem__(self._proxy_getters, attr_name, getter_proxy) # type: ignore
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user