# 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 phonexia.grpc.technologies.language_identification.v1 import language_identification_pb2 as phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2

GRPC_GENERATED_VERSION = '1.76.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},'
        + ' but the generated code in phonexia/grpc/technologies/language_identification/v1/language_identification_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 LanguageIdentificationStub(object):
    """Service implementing language identification.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Identify = channel.stream_unary(
                '/phonexia.grpc.technologies.language_identification.v1.LanguageIdentification/Identify',
                request_serializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.IdentifyRequest.SerializeToString,
                response_deserializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.IdentifyResponse.FromString,
                _registered_method=True)
        self.ListSupportedLanguages = channel.unary_unary(
                '/phonexia.grpc.technologies.language_identification.v1.LanguageIdentification/ListSupportedLanguages',
                request_serializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ListSupportedLanguagesRequest.SerializeToString,
                response_deserializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ListSupportedLanguagesResponse.FromString,
                _registered_method=True)
        self.Extract = channel.stream_unary(
                '/phonexia.grpc.technologies.language_identification.v1.LanguageIdentification/Extract',
                request_serializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ExtractRequest.SerializeToString,
                response_deserializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ExtractResponse.FromString,
                _registered_method=True)
        self.Adapt = channel.stream_unary(
                '/phonexia.grpc.technologies.language_identification.v1.LanguageIdentification/Adapt',
                request_serializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.AdaptRequest.SerializeToString,
                response_deserializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.AdaptResponse.FromString,
                _registered_method=True)


class LanguageIdentificationServicer(object):
    """Service implementing language identification.
    """

    def Identify(self, request_iterator, context):
        """Performs language identification on the given audio or languageprint.
        Returns list of scores for each built-in or added language.
        Built-in languages are identified by the RFC 5646 language codes.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListSupportedLanguages(self, request, context):
        """Retrieve built-in or added languages available to identify in the input.
        This method will return a list of supported languages.
        Built-in languages are identified by the RFC 5646 language codes.
        Languages added via language adaptation are identified by a custom identifier.
        protolint:disable:this MAX_LINE_LENGTH
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Extract(self, request_iterator, context):
        """Performs languageprint extraction on the given audio.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Adapt(self, request_iterator, context):
        """Perform supervised adaptation of the technology using custom-annotated data.
        Individual languages can be adapted for better performance on custom data.
        Alternatively, new languages can be introduced via the adaptation.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_LanguageIdentificationServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Identify': grpc.stream_unary_rpc_method_handler(
                    servicer.Identify,
                    request_deserializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.IdentifyRequest.FromString,
                    response_serializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.IdentifyResponse.SerializeToString,
            ),
            'ListSupportedLanguages': grpc.unary_unary_rpc_method_handler(
                    servicer.ListSupportedLanguages,
                    request_deserializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ListSupportedLanguagesRequest.FromString,
                    response_serializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ListSupportedLanguagesResponse.SerializeToString,
            ),
            'Extract': grpc.stream_unary_rpc_method_handler(
                    servicer.Extract,
                    request_deserializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ExtractRequest.FromString,
                    response_serializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ExtractResponse.SerializeToString,
            ),
            'Adapt': grpc.stream_unary_rpc_method_handler(
                    servicer.Adapt,
                    request_deserializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.AdaptRequest.FromString,
                    response_serializer=phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.AdaptResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'phonexia.grpc.technologies.language_identification.v1.LanguageIdentification', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('phonexia.grpc.technologies.language_identification.v1.LanguageIdentification', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class LanguageIdentification(object):
    """Service implementing language identification.
    """

    @staticmethod
    def Identify(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_unary(
            request_iterator,
            target,
            '/phonexia.grpc.technologies.language_identification.v1.LanguageIdentification/Identify',
            phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.IdentifyRequest.SerializeToString,
            phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.IdentifyResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListSupportedLanguages(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,
            '/phonexia.grpc.technologies.language_identification.v1.LanguageIdentification/ListSupportedLanguages',
            phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ListSupportedLanguagesRequest.SerializeToString,
            phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ListSupportedLanguagesResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Extract(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_unary(
            request_iterator,
            target,
            '/phonexia.grpc.technologies.language_identification.v1.LanguageIdentification/Extract',
            phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ExtractRequest.SerializeToString,
            phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.ExtractResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Adapt(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_unary(
            request_iterator,
            target,
            '/phonexia.grpc.technologies.language_identification.v1.LanguageIdentification/Adapt',
            phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.AdaptRequest.SerializeToString,
            phonexia_dot_grpc_dot_technologies_dot_language__identification_dot_v1_dot_language__identification__pb2.AdaptResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
