async def describe(self) -> TargetDescription: response = await self.stub.describe(TargetDescriptionRequest()) target = response.target_description return target_to_py( target=target, companion=CompanionInfo(address=self.address, udid=target.udid, is_local=self.is_local), )
async def _companion_to_target( self, companion: CompanionInfo) -> TargetDescription: channel = Channel(companion.host, companion.port, loop=asyncio.get_event_loop()) stub = CompanionServiceStub(channel=channel) response = await stub.describe(TargetDescriptionRequest()) channel.close() return target_to_py(response.target_description)
async def describe(self, fetch_diagnostics: bool = False) -> TargetDescription: response = await self.stub.describe( TargetDescriptionRequest(fetch_diagnostics=fetch_diagnostics) ) target = response.target_description return target_to_py( target=target, companion=CompanionInfo( address=self.address, udid=target.udid, is_local=self.is_local ), )
async def describe(self, fetch_diagnostics: bool = False) -> TargetDescription: response = await self.stub.describe( TargetDescriptionRequest(fetch_diagnostics=fetch_diagnostics)) target = response.target_description return target_to_py( target=target, # Use the local understanding of the companion instead of the remote's. companion=CompanionInfo(address=self.address, udid=target.udid, is_local=self.is_local), # Extract the companion metadata from the response. metadata=response.companion.metadata, )
async def _companion_to_target( self, companion: CompanionInfo) -> Optional[TargetDescription]: try: channel = Channel(companion.host, companion.port, loop=asyncio.get_event_loop()) stub = CompanionServiceStub(channel=channel) response = await stub.describe(TargetDescriptionRequest()) channel.close() return target_to_py(response.target_description) except Exception: self.logger.warning(f"Failed to describe {companion}, removing it") self.direct_companion_manager.remove_companion( Address(companion.host, companion.port)) return None
async def describe(self) -> TargetDescription: async with self.get_stub() as stub: response = await stub.describe(TargetDescriptionRequest()) return target_to_py(response.target_description)
async def client(client: CompanionClient) -> TargetDescriptionResponse: return await client.stub.describe(TargetDescriptionRequest())
async def describe(self) -> TargetDescription: response = await self.stub.describe(TargetDescriptionRequest()) return target_to_py(response.target_description)
async def client(client: CompanionClient) -> TargetDescription: response = await client.stub.describe(TargetDescriptionRequest()) return target_to_py(response.target_description)
async def describe(self) -> TargetDescription: response = await self.stub.describe(TargetDescriptionRequest()) return target_to_py(target=response.target_description, companion_info=None)