async def connect_companion( context: DaemonContext, destination: ConnectionDestination, metadata: Optional[Dict[str, str]], ) -> GrpcConnectResponse: async with context.companion_manager.create_companion_for_target_with_destination( destination=destination, metadata=metadata) as companion: return GrpcConnectResponse(companion=companion_to_grpc(companion))
async def connect_companion( context: DaemonContext, destination: ConnectionDestination, metadata: Optional[Dict[str, str]], ) -> GrpcConnectResponse: async with context.companion_manager.create_companion_for_target_with_destination( destination=destination, metadata=metadata) as companion: # temporarily write to direct_companion_manager while we transition to daemonless context.direct_companion_manager.add_companion(companion) return GrpcConnectResponse(companion=companion_to_grpc(companion))
def target_to_grpc(target: TargetDescription) -> GrpcTargetDescription: screen_dimensions = target.screen_dimensions companion_info = target.companion_info return GrpcTargetDescription( udid=target.udid, name=target.name, screen_dimensions=(screen_dimensions_to_grpc(screen_dimensions) if screen_dimensions is not None else None), state=target.state, target_type=target.target_type, os_version=target.os_version, architecture=target.architecture, companion_info=(companion_to_grpc(companion_info) if companion_info is not None else None), )
def target_to_grpc(target: TargetDescription) -> GrpcTargetDescription: return GrpcTargetDescription( udid=target.udid, name=target.name, screen_dimensions=screen_dimensions_to_grpc(target.screen_dimensions) if target.screen_dimensions else None, state=target.state, target_type=target.target_type, os_version=target.os_version, architecture=target.architecture, companion_info=companion_to_grpc(target.companion_info) if target.companion_info else None, daemon_host=None, daemon_port=None, )
def target_to_grpc(target: TargetDescription) -> GrpcTargetDescription: return GrpcTargetDescription( udid=target.udid, name=target.name, # pyre-fixme[6]: Expected `ScreenDimensions` for 1st param but got # `Optional[ScreenDimensions]`. screen_dimensions=screen_dimensions_to_grpc(target.screen_dimensions) if target.screen_dimensions else None, state=target.state, target_type=target.target_type, os_version=target.os_version, architecture=target.architecture, # pyre-fixme[6]: Expected `CompanionInfo` for 1st param but got # `Optional[CompanionInfo]`. companion_info=companion_to_grpc(target.companion_info) if target.companion_info else None, )