

import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin







class  __lowerCamelCase				(	__snake_case	):
      lowerCamelCase_	:      List[Any]          =					'AutoFeatureExtractor'
      lowerCamelCase_	:      Dict          =					'Speech2Text2Tokenizer'







      def __init__(     self							,  lowerCamelCase							,  lowerCamelCase   )						->       Optional[int]:
        super().__init__(lowerCamelCase							,  lowerCamelCase   )
        snake_case_       						=      self.feature_extractor
        snake_case_       						=      False







      def __call__(     self							,  *lowerCamelCase							,  **lowerCamelCase   )						->       int:
        # For backward compatibility
        if self._in_target_context_manager:
          return self.current_processor(*lowerCamelCase							,  **lowerCamelCase   )

        if "raw_speech" in kwargs:
          warnings.warn("""Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."""   )
          snake_case_       						=      kwargs.pop("""raw_speech"""   )
        else:
          snake_case_       						=      kwargs.pop("""audio"""							,  lowerCamelCase   )
        snake_case_       						=      kwargs.pop("""sampling_rate"""							,  lowerCamelCase   )
        snake_case_       						=      kwargs.pop("""text"""							,  lowerCamelCase   )
        if len(lowerCamelCase   ) > 0:
          snake_case_       						=      args[0]
          snake_case_       						=      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:
          snake_case_       						=      self.feature_extractor(lowerCamelCase							,  *lowerCamelCase							,  sampling_rate=lowerCamelCase							,  **lowerCamelCase   )
        if text is not None:
          snake_case_       						=      self.tokenizer(lowerCamelCase							,  **lowerCamelCase   )

        if text is None:
          return inputs
        elif audio is None:
          return encodings
        else:
          snake_case_       						=      encodings["""input_ids"""]
          return inputs







      def 	lowerCAmelCase_    (     self							,  *lowerCamelCase							,  **lowerCamelCase   )						->       Any:
        return self.tokenizer.batch_decode(*lowerCamelCase							,  **lowerCamelCase   )







      def 	lowerCAmelCase_    (     self							,  *lowerCamelCase							,  **lowerCamelCase   )						->       Union[str, Any]:
        return self.tokenizer.decode(*lowerCamelCase							,  **lowerCamelCase   )







      @contextmanager
      def 	lowerCAmelCase_    (     self   )						->       Union[str, 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."""   )
        snake_case_       						=      True
        snake_case_       						=      self.tokenizer
        yield
        snake_case_       						=      self.feature_extractor
        snake_case_       						=      False


def    UpperCamelCase(					lowercase_							)	->				int:





  '''simple docstring'''





  return int(lowercase_							) if x - int(lowercase_							) <= 0 else int(lowercase_							) + 1


if __name__ == "__main__":
    import doctest

    doctest.testmod()