updates ProxyDict types, ignores mypy error

This commit is contained in:
Mose Müller 2024-04-30 15:41:14 +02:00
parent ed80c92b1f
commit 88a630518b

View File

@ -75,10 +75,10 @@ def update_value(
) )
class ProxyDict(dict[str | float, Any]): class ProxyDict(dict[str, Any]):
def __init__( def __init__(
self, self,
original_dict: dict[str | float, Any], original_dict: dict[str, Any],
parent_path: str, parent_path: str,
sio_client: socketio.AsyncClient, sio_client: socketio.AsyncClient,
loop: asyncio.AbstractEventLoop, loop: asyncio.AbstractEventLoop,
@ -88,7 +88,7 @@ class ProxyDict(dict[str | float, Any]):
self._loop = loop self._loop = loop
self._sio = sio_client self._sio = sio_client
def __setitem__(self, key: str | float, value: Any) -> None: def __setitem__(self, key: str, value: Any) -> None:
observer_key = key observer_key = key
if isinstance(key, str): if isinstance(key, str):
observer_key = f'"{key}"' observer_key = f'"{key}"'
@ -97,7 +97,7 @@ class ProxyDict(dict[str | float, Any]):
update_value(self._sio, self._loop, full_access_path, value) update_value(self._sio, self._loop, full_access_path, value)
def pop(self, key: str) -> Any: def pop(self, key: str) -> Any: # type: ignore
"""Removes the element from the dictionary on the server. It does not return """Removes the element from the dictionary on the server. It does not return
any proxy as the corresponding object on the server does not live anymore.""" any proxy as the corresponding object on the server does not live anymore."""
@ -301,7 +301,7 @@ class ProxyLoader:
{ {
key: ProxyLoader.loads_proxy(value, sio_client, loop) key: ProxyLoader.loads_proxy(value, sio_client, loop)
for key, value in cast( for key, value in cast(
dict[str | float, SerializedObject], serialized_object["value"] dict[str, SerializedObject], serialized_object["value"]
).items() ).items()
}, },
parent_path=serialized_object["full_access_path"], parent_path=serialized_object["full_access_path"],