



"""simple docstring"""
import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin





class 		__UpperCAmelCase				(	snake_case__					):







 """simple docstring"""




 _snake_case       :							int      	=	"MCTCTFeatureExtractor"
 _snake_case       :							Union[str, Any]      	=	"AutoTokenizer"





 def __init__(				self					: Union[str, Any]						, A_					: Union[str, Any]						, A_					: Dict	)->	Dict:
   super().__init__(UpperCAmelCase_						, UpperCAmelCase_	)
   __UpperCamelCase  						=							self.feature_extractor
   __UpperCamelCase  						=							False





 def __call__(				self					: str						, *A_					: Dict						, **A_					: Dict	)->	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."	)
     __UpperCamelCase  						=							kwargs.pop("raw_speech"	)
   else:
     __UpperCamelCase  						=							kwargs.pop("audio"						, UpperCAmelCase_	)
   __UpperCamelCase  						=							kwargs.pop("sampling_rate"						, UpperCAmelCase_	)
   __UpperCamelCase  						=							kwargs.pop("text"						, UpperCAmelCase_	)
   if len(UpperCAmelCase_	) > 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(UpperCAmelCase_						, *UpperCAmelCase_						, sampling_rate=UpperCAmelCase_						, **UpperCAmelCase_	)
   if text is not None:
     __UpperCamelCase  						=							self.tokenizer(UpperCAmelCase_						, **UpperCAmelCase_	)

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





 def  A  (				self					: Optional[int]						, *A_					: List[Any]						, **A_					: Union[str, Any]	)->	Dict:
   return self.tokenizer.batch_decode(*UpperCAmelCase_						, **UpperCAmelCase_	)





 def  A  (				self					: str						, *A_					: Optional[int]						, **A_					: Dict	)->	Optional[int]:
   # For backward compatibility
   if self._in_target_context_manager:
     return self.current_processor.pad(*UpperCAmelCase_						, **UpperCAmelCase_	)

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

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

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





 def  A  (				self					: Tuple						, *A_					: Optional[int]						, **A_					: Optional[int]	)->	Optional[Any]:
   return self.tokenizer.decode(*UpperCAmelCase_						, **UpperCAmelCase_	)





 @contextmanager
 def  A  (				self					: Union[str, Any]	)->	List[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."	)
   __UpperCamelCase  						=							True
   __UpperCamelCase  						=							self.tokenizer
   yield
   __UpperCamelCase  						=							self.feature_extractor
   __UpperCamelCase  						=							False




'''simple docstring'''





from __future__ import annotations




def 							lowerCamelCase	(					_snake_case	:    list[int]							):





    '''simple docstring'''


    return len(set(_snake_case							)							) == len(_snake_case							)


if __name__ == "__main__":
 import doctest

 doctest.testmod()




