# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from gRPC_impl.mytorch.cuda import cuda_pb2 as mytorch_dot_cuda_dot_cuda__pb2
from gRPC_impl import shared_msg_types_pb2 as shared__msg__types__pb2

GRPC_GENERATED_VERSION = '1.71.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in mytorch/cuda/cuda_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class CudaServiceStub(object):
    """/////////////////////////////////////////////////////////////////////////////////
    Service definition
    /////////////////////////////////////////////////////////////////////////////////
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.is_available = channel.unary_unary(
                '/mytorch.CudaService/is_available',
                request_serializer=mytorch_dot_cuda_dot_cuda__pb2.is_available_request.SerializeToString,
                response_deserializer=mytorch_dot_cuda_dot_cuda__pb2.is_available_response.FromString,
                _registered_method=True)
        self.empty_cache = channel.unary_unary(
                '/mytorch.CudaService/empty_cache',
                request_serializer=mytorch_dot_cuda_dot_cuda__pb2.empty_cache_request.SerializeToString,
                response_deserializer=mytorch_dot_cuda_dot_cuda__pb2.empty_cache_response.FromString,
                _registered_method=True)
        self.memory_allocated = channel.unary_unary(
                '/mytorch.CudaService/memory_allocated',
                request_serializer=mytorch_dot_cuda_dot_cuda__pb2.memory_allocated_request.SerializeToString,
                response_deserializer=mytorch_dot_cuda_dot_cuda__pb2.memory_allocated_response.FromString,
                _registered_method=True)
        self.memory_reserved = channel.unary_unary(
                '/mytorch.CudaService/memory_reserved',
                request_serializer=mytorch_dot_cuda_dot_cuda__pb2.memory_reserved_request.SerializeToString,
                response_deserializer=mytorch_dot_cuda_dot_cuda__pb2.memory_reserved_response.FromString,
                _registered_method=True)
        self.get_device_properties = channel.unary_unary(
                '/mytorch.CudaService/get_device_properties',
                request_serializer=mytorch_dot_cuda_dot_cuda__pb2.get_device_properties_request.SerializeToString,
                response_deserializer=mytorch_dot_cuda_dot_cuda__pb2.get_device_properties_response.FromString,
                _registered_method=True)
        self.get_device_name = channel.unary_unary(
                '/mytorch.CudaService/get_device_name',
                request_serializer=shared__msg__types__pb2.Empty.SerializeToString,
                response_deserializer=shared__msg__types__pb2.StringValue.FromString,
                _registered_method=True)


class CudaServiceServicer(object):
    """/////////////////////////////////////////////////////////////////////////////////
    Service definition
    /////////////////////////////////////////////////////////////////////////////////
    """

    def is_available(self, request, context):
        """create a torch.nn.Sequential module on the server and return its UUID to the client
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def empty_cache(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def memory_allocated(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def memory_reserved(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def get_device_properties(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def get_device_name(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_CudaServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'is_available': grpc.unary_unary_rpc_method_handler(
                    servicer.is_available,
                    request_deserializer=mytorch_dot_cuda_dot_cuda__pb2.is_available_request.FromString,
                    response_serializer=mytorch_dot_cuda_dot_cuda__pb2.is_available_response.SerializeToString,
            ),
            'empty_cache': grpc.unary_unary_rpc_method_handler(
                    servicer.empty_cache,
                    request_deserializer=mytorch_dot_cuda_dot_cuda__pb2.empty_cache_request.FromString,
                    response_serializer=mytorch_dot_cuda_dot_cuda__pb2.empty_cache_response.SerializeToString,
            ),
            'memory_allocated': grpc.unary_unary_rpc_method_handler(
                    servicer.memory_allocated,
                    request_deserializer=mytorch_dot_cuda_dot_cuda__pb2.memory_allocated_request.FromString,
                    response_serializer=mytorch_dot_cuda_dot_cuda__pb2.memory_allocated_response.SerializeToString,
            ),
            'memory_reserved': grpc.unary_unary_rpc_method_handler(
                    servicer.memory_reserved,
                    request_deserializer=mytorch_dot_cuda_dot_cuda__pb2.memory_reserved_request.FromString,
                    response_serializer=mytorch_dot_cuda_dot_cuda__pb2.memory_reserved_response.SerializeToString,
            ),
            'get_device_properties': grpc.unary_unary_rpc_method_handler(
                    servicer.get_device_properties,
                    request_deserializer=mytorch_dot_cuda_dot_cuda__pb2.get_device_properties_request.FromString,
                    response_serializer=mytorch_dot_cuda_dot_cuda__pb2.get_device_properties_response.SerializeToString,
            ),
            'get_device_name': grpc.unary_unary_rpc_method_handler(
                    servicer.get_device_name,
                    request_deserializer=shared__msg__types__pb2.Empty.FromString,
                    response_serializer=shared__msg__types__pb2.StringValue.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'mytorch.CudaService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('mytorch.CudaService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class CudaService(object):
    """/////////////////////////////////////////////////////////////////////////////////
    Service definition
    /////////////////////////////////////////////////////////////////////////////////
    """

    @staticmethod
    def is_available(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/mytorch.CudaService/is_available',
            mytorch_dot_cuda_dot_cuda__pb2.is_available_request.SerializeToString,
            mytorch_dot_cuda_dot_cuda__pb2.is_available_response.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def empty_cache(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/mytorch.CudaService/empty_cache',
            mytorch_dot_cuda_dot_cuda__pb2.empty_cache_request.SerializeToString,
            mytorch_dot_cuda_dot_cuda__pb2.empty_cache_response.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def memory_allocated(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/mytorch.CudaService/memory_allocated',
            mytorch_dot_cuda_dot_cuda__pb2.memory_allocated_request.SerializeToString,
            mytorch_dot_cuda_dot_cuda__pb2.memory_allocated_response.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def memory_reserved(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/mytorch.CudaService/memory_reserved',
            mytorch_dot_cuda_dot_cuda__pb2.memory_reserved_request.SerializeToString,
            mytorch_dot_cuda_dot_cuda__pb2.memory_reserved_response.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def get_device_properties(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/mytorch.CudaService/get_device_properties',
            mytorch_dot_cuda_dot_cuda__pb2.get_device_properties_request.SerializeToString,
            mytorch_dot_cuda_dot_cuda__pb2.get_device_properties_response.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def get_device_name(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/mytorch.CudaService/get_device_name',
            shared__msg__types__pb2.Empty.SerializeToString,
            shared__msg__types__pb2.StringValue.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
