




import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin





class        lowerCamelCase__(   __lowerCamelCase):
      UpperCAmelCase__ :      Union[str, Any]       						=  'AutoFeatureExtractor'
      UpperCAmelCase__ :      int       						=  'Speech2Text2Tokenizer'
      def __init__(							self:					str       ,			UpperCamelCase_:					Any       ,			UpperCamelCase_:					Any  ):
             super().__init__(UpperCamelCase_       ,			UpperCamelCase_  )
             __lowerCamelCase  =		self.feature_extractor
             __lowerCamelCase  =		False
      def __call__(							self:					Dict       ,			*UpperCamelCase_:					Union[str, Any]       ,			**UpperCamelCase_:					Tuple  ):
             # For backward compatibility
             if self._in_target_context_manager:
                    return self.current_processor(*UpperCamelCase_       ,			**UpperCamelCase_  )

             if "raw_speech" in kwargs:
                    warnings.warn("""Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."""  )
                    __lowerCamelCase  =		kwargs.pop("""raw_speech"""  )
             else:
                    __lowerCamelCase  =		kwargs.pop("""audio"""       ,			UpperCamelCase_  )
             __lowerCamelCase  =		kwargs.pop("""sampling_rate"""       ,			UpperCamelCase_  )
             __lowerCamelCase  =		kwargs.pop("""text"""       ,			UpperCamelCase_  )
             if len(UpperCamelCase_  ) > 0:
                    __lowerCamelCase  =		args[0]
                    __lowerCamelCase  =		args[1:]

             if audio is None and text is None:
                    raise ValueError("""You need to specify either an `audio` or `text` input to process."""  )

             if audio is not None:
                    __lowerCamelCase  =		self.feature_extractor(UpperCamelCase_       ,			*UpperCamelCase_       ,			sampling_rate=UpperCamelCase_       ,			**UpperCamelCase_  )
             if text is not None:
                    __lowerCamelCase  =		self.tokenizer(UpperCamelCase_       ,			**UpperCamelCase_  )

             if text is None:
                    return inputs
             elif audio is None:
                    return encodings
             else:
                    __lowerCamelCase  =		encodings["""input_ids"""]
                    return inputs
      def      lowerCAmelCase__		(							self:					Any       ,			*UpperCamelCase_:					Union[str, Any]       ,			**UpperCamelCase_:					Optional[Any]  ):
             return self.tokenizer.batch_decode(*UpperCamelCase_       ,			**UpperCamelCase_  )
      def      lowerCAmelCase__		(							self:					List[str]       ,			*UpperCamelCase_:					Dict       ,			**UpperCamelCase_:					Tuple  ):
             return self.tokenizer.decode(*UpperCamelCase_       ,			**UpperCamelCase_  )




      @contextmanager
      def      lowerCAmelCase__		(							self:					Any  ):
             warnings.warn(
                 """`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your """
                 """labels by using the argument `text` of the regular `__call__` method (either in the same call as """
                 """your audio inputs, or in a separate call."""  )
             __lowerCamelCase  =		True
             __lowerCamelCase  =		self.tokenizer
             yield
             __lowerCamelCase  =		self.feature_extractor
             __lowerCamelCase  =		False







from typing import Callable




def    lowerCamelCase__			(		A__			:   Callable      ):





       '''simple docstring'''



       def wrapper(A__			:   int      ):
              __lowerCamelCase  =		function_with_docstring.__doc__
              return target_function

       return wrapper

