




import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin




class       _A				(		__lowercase     ):
		__a					    =       """MCTCTFeatureExtractor"""
		__a					    =       """AutoTokenizer"""






		def __init__(    self						,		_SCREAMING_SNAKE_CASE						,		_SCREAMING_SNAKE_CASE			):
								super().__init__(_SCREAMING_SNAKE_CASE						,		_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			self.feature_extractor
								_UpperCAmelCase      =			False






		def __call__(    self						,		*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			):
								# For backward compatibility
								if self._in_target_context_manager:
														return self.current_processor(*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			)

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

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






		def 				UpperCAmelCase (    self						,		*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			):
								return self.tokenizer.batch_decode(*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			)






		def 				UpperCAmelCase (    self						,		*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			):
								# For backward compatibility
								if self._in_target_context_manager:
														return self.current_processor.pad(*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			)

								_UpperCAmelCase      =			kwargs.pop("""input_features"""						,		_SCREAMING_SNAKE_CASE			)
								_UpperCAmelCase      =			kwargs.pop("""labels"""						,		_SCREAMING_SNAKE_CASE			)
								if len(_SCREAMING_SNAKE_CASE			) > 0:
														_UpperCAmelCase      =			args[0]
														_UpperCAmelCase      =			args[1:]

								if input_features is not None:
														_UpperCAmelCase      =			self.feature_extractor.pad(_SCREAMING_SNAKE_CASE						,		*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			)
								if labels is not None:
														_UpperCAmelCase      =			self.tokenizer.pad(_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			)

								if labels is None:
														return input_features
								elif input_features is None:
														return labels
								else:
														_UpperCAmelCase      =			labels["""input_ids"""]
														return input_features






		def 				UpperCAmelCase (    self						,		*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			):
								return self.tokenizer.decode(*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			)






		@contextmanager
		def 				UpperCAmelCase (    self			):
								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."""			)
								_UpperCAmelCase      =			True
								_UpperCAmelCase      =			self.tokenizer
								yield
								_UpperCAmelCase      =			self.feature_extractor
								_UpperCAmelCase      =			False





# flake8: noqa
# Lint as: python3
a													=			[
    "VerificationMode",
    "Version",
    "disable_progress_bar",
    "enable_progress_bar",
    "is_progress_bar_enabled",
    "experimental",
]

from .info_utils import VerificationMode
from .logging import disable_progress_bar, enable_progress_bar, is_progress_bar_enabled
from .version import Version
from .experimental import experimental