Skip to content

Commit b4d012a

Browse files
committed
fix(client): Add type ignore for async stub casting in Assets API client
- Added a type ignore comment in the `stub` property to handle the casting from a sync stub to an async stub. - This change ensures compatibility with the async implementation while maintaining type safety. These modifications improve the functionality of the Assets API client by addressing type issues rel Signed-off-by: eduardiazf <[email protected]>
1 parent c10b519 commit b4d012a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/frequenz/client/assets/_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def stub(self) -> assets_pb2_grpc.PlatformAssetsAsyncStub:
5757
"""
5858
if self._channel is None or self._stub is None:
5959
raise ClientNotConnected(server_url=self.server_url, operation="stub")
60-
return self._stub
60+
# This type: ignore is needed because the stub is a sync stub, but we need to
61+
# use the async stub, so we cast the sync stub to the async stub.
62+
return self._stub # type: ignore
6163

6264
async def get_microgrid_details( # noqa: DOC502 (raises ApiClientError indirectly)
6365
self, microgrid_id: int

0 commit comments

Comments
 (0)