Exemplo n.º 1
0
def generate_binary_chunks(path: str, destination: Destination,
                           logger: Logger) -> AsyncIterator[InstallRequest]:
    if destination == InstallRequest.APP:
        if path.endswith(".ipa"):
            return _generate_ipa_chunks(ipa_path=path, logger=logger)
        elif path.endswith(".app"):
            return _generate_app_chunks(app_path=path, logger=logger)
    elif destination == InstallRequest.XCTEST:
        return _generate_xctest_chunks(path=path, logger=logger)
    elif destination == InstallRequest.DYLIB:
        return _generate_dylib_chunks(path=path, logger=logger)
    elif destination == InstallRequest.DSYM:
        return _generate_dsym_chunks(path=path, logger=logger)
    elif destination == InstallRequest.FRAMEWORK:
        return _generate_framework_chunks(path=path, logger=logger)
    raise GRPCError(
        status=Status(Status.FAILED_PRECONDITION),
        message=f"install invalid for {path} {destination}",
    )
Exemplo n.º 2
0
 def translate_exception(self, exception: Exception) -> Exception:
     if self.translate_exceptions and not isinstance(exception, GRPCError):
         return GRPCError(Status.INTERNAL, exception.args[0])
     return exception
Exemplo n.º 3
0
 async def Connect(self, stream):
     if self.__suspended:
         raise GRPCError(Status.CANCELLED, "Suspended")
     await stream.send_message(ConnectResponse(default_serializer_id=Serialization().default_serializer_id))
Exemplo n.º 4
0
 async def StreamStream(self, stream):
     raise GRPCError(Status.UNIMPLEMENTED)
Exemplo n.º 5
0
 async def UnaryUnary(self, stream):
     raise GRPCError(Status.UNIMPLEMENTED)
Exemplo n.º 6
0
 async def wrapper(stream):
     if event.metadata.get(api_header, "") != api_token and stream._method_name != '/grpc.health.v1.Health/Check':
         raise GRPCError(Status.UNAUTHENTICATED)
     return await method_func(stream)
Exemplo n.º 7
0
 async def UnaryUnary(self, stream):
     raise GRPCError(
         Status.DATA_LOSS,
         'Some data loss occurred',
         [Help(links=[Help.Link(url='https://example.com')])],
     )