



'''simple docstring'''






import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin

class        SCREAMING_SNAKE_CASE(							_a    ):







	"""simple docstring"""






	lowerCamelCase__    				= """Speech2TextFeatureExtractor"""
	lowerCamelCase__    				= """Speech2TextTokenizer"""







	def __init__(		self    :  Optional[Any]	,    __snake_case    :  str	,    __snake_case    :  Any	)    ->	List[Any]:
								super().__init__(_A	,    _A	)
								UpperCAmelCase				: Optional[Any]											=	self.feature_extractor
								UpperCAmelCase				: Dict											=	False







	def __call__(		self    :  List[Any]	,    *__snake_case    :  List[str]	,    **__snake_case    :  int	)    ->	Optional[Any]:
								# For backward compatibility
								if self._in_target_context_manager:
															return self.current_processor(*_A	,    **_A	)

								if "raw_speech" in kwargs:
															warnings.warn('''Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead.'''	)
															UpperCAmelCase				: str											=	kwargs.pop('''raw_speech'''	)
								else:
															UpperCAmelCase				: Any											=	kwargs.pop('''audio'''	,    _A	)
								UpperCAmelCase				: Optional[Any]											=	kwargs.pop('''sampling_rate'''	,    _A	)
								UpperCAmelCase				: Tuple											=	kwargs.pop('''text'''	,    _A	)
								if len(_A	) > 0:
															UpperCAmelCase				: Union[str, Any]											=	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				: Optional[int]											=	self.feature_extractor(_A	,    *_A	,    sampling_rate=_A	,    **_A	)
								if text is not None:
															UpperCAmelCase				: int											=	self.tokenizer(_A	,    **_A	)

								if text is None:
															return inputs
								elif audio is None:
															return encodings
								else:
															UpperCAmelCase				: Tuple											=	encodings['''input_ids''']
															return inputs







	def   A			(		self    :  List[Any]	,    *__snake_case    :  int	,    **__snake_case    :  Any	)    ->	Any:
								return self.tokenizer.batch_decode(*_A	,    **_A	)







	def   A			(		self    :  List[str]	,    *__snake_case    :  Any	,    **__snake_case    :  List[str]	)    ->	str:
								return self.tokenizer.decode(*_A	,    **_A	)







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










'''simple docstring'''






# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


UpperCamelCase__:     List[str]										=    re.compile(r"^(?P<major>\d+)" r"\.(?P<minor>\d+)" r"\.(?P<patch>\d+)$")

@total_ordering
@dataclass
class        SCREAMING_SNAKE_CASE:







	"""simple docstring"""






	lowerCamelCase__    				= 42
	lowerCamelCase__    				= None
	lowerCamelCase__    				= None
	lowerCamelCase__    				= None
	lowerCamelCase__    				= None







	def   A			(		self    :  Optional[Any]	)    ->	Dict:
								UpperCAmelCase							,	UpperCAmelCase							,	UpperCAmelCase				: Any											=	_str_to_version_tuple(self.version_str	)







	def __repr__(		self    :  str	)    ->	Optional[Any]:
								return F"""{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}"""







	@property
	def   A			(		self    :  Tuple	)    ->	Dict:
								return self.major, self.minor, self.patch







	def   A			(		self    :  str	,    __snake_case    :  Any	)    ->	Tuple:
								if isinstance(__snake_case	,    __snake_case	):
															return Version(__snake_case	)
								elif isinstance(__snake_case	,    __snake_case	):
															return other
								raise TypeError(F"""{other} (type {type(__snake_case	)}) cannot be compared to version."""	)







	def __eq__(		self    :  str	,    __snake_case    :  Union[str, Any]	)    ->	List[Any]:
								try:
															UpperCAmelCase				: Dict											=	self._validate_operand(__snake_case	)
								except (TypeError, ValueError):
															return False
								else:
															return self.tuple == other.tuple







	def __lt__(		self    :  Any	,    __snake_case    :  int	)    ->	Optional[int]:
								UpperCAmelCase				: int											=	self._validate_operand(__snake_case	)
								return self.tuple < other.tuple







	def __hash__(		self    :  List[str]	)    ->	str:
								return hash(_version_tuple_to_str(self.tuple	)	)







	@classmethod
	def   A			(		cls    :  Any	,    __snake_case    :  Tuple	)    ->	Union[str, Any]:
								UpperCAmelCase				: Optional[Any]											=	{f.name for f in dataclasses.fields(cls	)}
								return cls(**{k: v for k, v in dic.items() if k in field_names}	)







	def   A			(		self    :  Dict	)    ->	str:
								return self.version_str


def 				snake_case_  (      _lowerCAmelCase						:		Optional[Any]						)   ->     List[Any]:
							UpperCAmelCase				: Optional[Any]											=	_VERSION_REG.match(_lowerCAmelCase						)
							if not res:
														raise ValueError(f"""Invalid version '{version_str}'. Format should be x.y.z with {{x,y,z}} being digits."""						)
							return tuple(int(_lowerCAmelCase						) for v in [res.group('''major'''						), res.group('''minor'''						), res.group('''patch'''						)]						)




def 				snake_case_  (      _lowerCAmelCase						:		List[str]						)   ->     List[Any]:
							return ".".join(str(_lowerCAmelCase						) for v in version_tuple						)





