

import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin

class __UpperCamelCase    (							_a		):






					'''simple docstring'''



					__magic_name__     			=      "AutoFeatureExtractor"
					__magic_name__     			=      "Speech2Text2Tokenizer"





					def __init__(							self							,			lowerCamelCase__							,			lowerCamelCase__	):
						super().__init__(lowerCamelCase__							,			lowerCamelCase__	)
						UpperCAmelCase__:  Optional[Any]		       =   self.feature_extractor
						UpperCAmelCase__:  str		       =   False





					def __call__(							self							,			*lowerCamelCase__							,			**lowerCamelCase__	):
						# 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."	)
							UpperCAmelCase__:  List[str]		       =   kwargs.pop("raw_speech"	)
						else:
							UpperCAmelCase__:  Tuple		       =   kwargs.pop("audio"							,			lowerCamelCase__	)
						UpperCAmelCase__:  Dict		       =   kwargs.pop("sampling_rate"							,			lowerCamelCase__	)
						UpperCAmelCase__:  Dict		       =   kwargs.pop("text"							,			lowerCamelCase__	)
						if len(lowerCamelCase__	) > 0:
							UpperCAmelCase__:  Tuple		       =   args[0]
							UpperCAmelCase__:  Optional[int]		       =   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__:  str		       =   self.feature_extractor(lowerCamelCase__							,			*lowerCamelCase__							,			sampling_rate=lowerCamelCase__							,			**lowerCamelCase__	)
						if text is not None:
							UpperCAmelCase__:  Optional[Any]		       =   self.tokenizer(lowerCamelCase__							,			**lowerCamelCase__	)

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





					def       _UpperCAmelCase						(							self							,			*lowerCamelCase__							,			**lowerCamelCase__	):
						return self.tokenizer.batch_decode(*lowerCamelCase__							,			**lowerCamelCase__	)





					def       _UpperCAmelCase						(							self							,			*lowerCamelCase__							,			**lowerCamelCase__	):
						return self.tokenizer.decode(*lowerCamelCase__							,			**lowerCamelCase__	)





					@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__:  List[str]		       =   True
						UpperCAmelCase__:  str		       =   self.tokenizer
						yield
						UpperCAmelCase__:  Any		       =   self.feature_extractor
						UpperCAmelCase__:  Optional[int]		       =   False


from __future__ import annotations



def  _A  (			SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			):
	assert n > 1 and a > 0 and greatest_common_divisor(SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			) == 1
	((UpperCAmelCase__)       ,	(UpperCAmelCase__)       ,	(UpperCAmelCase__)):  Optional[Any]		       =   extended_gcd(SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			)  # Implemented below
	UpperCAmelCase__:  List[str]		       =   (b * s) % n
	return x



def  _A  (			SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			):
	((UpperCAmelCase__)       ,	(UpperCAmelCase__)):  int		       =   extended_euclid(SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			)  # Implemented below
	if b < 0:
		UpperCAmelCase__:  List[str]		       =   (b % n + n) % n
	return b



def  _A  (			SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  Union[str, Any]		       =   invert_modulo(SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			)
	UpperCAmelCase__:  Any		       =   (b * s) % n
	return x



def  _A  (			SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			):
	assert a >= 0 and b >= 0

	if b == 0:
		UpperCAmelCase__       ,	UpperCAmelCase__       ,	UpperCAmelCase__:  List[Any]		       =   a, 1, 0
	else:
		((UpperCAmelCase__)       ,	(UpperCAmelCase__)       ,	(UpperCAmelCase__)):  Tuple		       =   extended_gcd(SCREAMING_SNAKE_CASE  ,a % b			)
		UpperCAmelCase__:  Union[str, Any]		       =   q
		UpperCAmelCase__:  Union[str, Any]		       =   p - q * (a // b)

	assert a % d == 0 and b % d == 0
	assert d == a * x + b * y

	return (d, x, y)



def  _A  (			SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			):
	if b == 0:
		return (1, 0)
	((UpperCAmelCase__)       ,	(UpperCAmelCase__)):  List[str]		       =   extended_euclid(SCREAMING_SNAKE_CASE  ,a % b			)
	UpperCAmelCase__:  Optional[Any]		       =   a // b
	return (y, x - k * y)



def  _A  (			SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			):
	if a < b:
		UpperCAmelCase__       ,	UpperCAmelCase__:  str		       =   b, a

	while a % b != 0:
		UpperCAmelCase__       ,	UpperCAmelCase__:  Union[str, Any]		       =   b, a % b

	return b


if __name__ == "__main__":
					from doctest import testmod

					testmod(name="""modular_division""", verbose=True)
					testmod(name="""modular_division2""", verbose=True)
					testmod(name="""invert_modulo""", verbose=True)
					testmod(name="""extended_gcd""", verbose=True)
					testmod(name="""extended_euclid""", verbose=True)
					testmod(name="""greatest_common_divisor""", verbose=True)