1- from typing import Any , Dict , Optional
1+ from typing import Any , Mapping , Optional
22from grpclib import GRPCError , Status
33from grpclib .client import Channel
44from viam .proto .component .generic import GenericServiceStub , DoCommandRequest , DoCommandResponse
5- from viam .utils import dict_to_struct , struct_to_dict
5+ from viam .utils import dict_to_struct , struct_to_dict , ValueTypes
66
77from .generic import Generic
88
@@ -16,7 +16,7 @@ def __init__(self, name: str, channel: Channel):
1616 self .client = GenericServiceStub (channel )
1717 super ().__init__ (name )
1818
19- async def do_command (self , command : Dict [str , Any ], * , timeout : Optional [float ] = None ) -> Dict [str , Any ]:
19+ async def do_command (self , command : Mapping [str , Any ], * , timeout : Optional [float ] = None ) -> Mapping [str , Any ]:
2020 request = DoCommandRequest (name = self .name , command = dict_to_struct (command ))
2121 try :
2222 response : DoCommandResponse = await self .client .DoCommand (request , timeout = timeout )
@@ -28,7 +28,9 @@ async def do_command(self, command: Dict[str, Any], *, timeout: Optional[float]
2828 return struct_to_dict (response .result )
2929
3030
31- async def do_command (channel : Channel , name : str , command : Dict [str , Any ], * , timeout : Optional [float ] = None ) -> Dict [str , Any ]:
31+ async def do_command (
32+ channel : Channel , name : str , command : Mapping [str , ValueTypes ], * , timeout : Optional [float ] = None
33+ ) -> Mapping [str , ValueTypes ]:
3234 """Convenience method to allow component clients to execute ``do_command`` functions
3335
3436 Args:
0 commit comments