

import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin
from .feature_extraction_wavaveca import WavaVecaFeatureExtractor
from .tokenization_wavaveca import WavaVecaCTCTokenizer





class       snake_case_  (						_snake_case   ):







			'''simple docstring'''

			SCREAMING_SNAKE_CASE	:  List[str]		     =							"""Wav2Vec2FeatureExtractor"""
			SCREAMING_SNAKE_CASE	:  str		     =							"""AutoTokenizer"""







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







			@classmethod
			def 							snake_case__(	cls					:							Any				,  _UpperCamelCase					:							List[Any]				,  **_UpperCamelCase					:							List[Any]				) ->Optional[int]:
									try:
															return super().from_pretrained(__snake_case				,  **__snake_case				)
									except OSError:
															warnings.warn(
															    f'''Loading a tokenizer inside {cls.__name__} from a config that does not'''
															    ''' include a `tokenizer_class` attribute is deprecated and will be '''
															    '''removed in v5. Please add `\'tokenizer_class\': \'Wav2Vec2CTCTokenizer\'`'''
															    ''' attribute to either your `config.json` or `tokenizer_config.json` '''
															    '''file to suppress this warning: '''				,  __snake_case				,  )

															snake_case_  =      WavaVecaFeatureExtractor.from_pretrained(__snake_case				,  **__snake_case				)
															snake_case_  =      WavaVecaCTCTokenizer.from_pretrained(__snake_case				,  **__snake_case				)

															return cls(feature_extractor=__snake_case				,  tokenizer=__snake_case				)







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

									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'''				,  __snake_case				)
									snake_case_  =      kwargs.pop('''sampling_rate'''				,  __snake_case				)
									snake_case_  =      kwargs.pop('''text'''				,  __snake_case				)
									if len(__snake_case				) > 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(__snake_case				,  *__snake_case				,  sampling_rate=__snake_case				,  **__snake_case				)
									if text is not None:
															snake_case_  =      self.tokenizer(__snake_case				,  **__snake_case				)

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







			def 							snake_case__(	self					:							Optional[Any]				,  *_UpperCamelCase					:							Optional[int]				,  **_UpperCamelCase					:							Tuple				) ->Optional[Any]:
									# For backward compatibility
									if self._in_target_context_manager:
															return self.current_processor.pad(*__snake_case				,  **__snake_case				)

									snake_case_  =      kwargs.pop('''input_features'''				,  __snake_case				)
									snake_case_  =      kwargs.pop('''labels'''				,  __snake_case				)
									if len(__snake_case				) > 0:
															snake_case_  =      args[0]
															snake_case_  =      args[1:]

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

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







			def 							snake_case__(	self					:							List[Any]				,  *_UpperCamelCase					:							int				,  **_UpperCamelCase					:							str				) ->Union[str, Any]:
									return self.tokenizer.batch_decode(*__snake_case				,  **__snake_case				)







			def 							snake_case__(	self					:							Any				,  *_UpperCamelCase					:							Tuple				,  **_UpperCamelCase					:							str				) ->Optional[Any]:
									return self.tokenizer.decode(*__snake_case				,  **__snake_case				)







			@contextmanager
			def 							snake_case__(	self					:							Dict				) ->Optional[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



'''simple docstring'''


import math







def      snake_case_  (    SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				assert isinstance(SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	) and (
				    number >= 0
				), "'number' must been an int and positive"

				if 1 < number < 4:
								# 2 and 3 are primes
								return True
				elif number < 2 or not number % 2:
								# Negatives, 0, 1 and all even numbers are not primes
								return False

				_SCREAMING_SNAKE_CASE					:			List[str]							= range(3				, int(math.sqrt(SCREAMING_SNAKE_CASE__	) + 1	)				, 2	)
				return not any(not number % i for i in odd_numbers	)







def      snake_case_  (    SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__=1				, **SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE					:			Dict							= factor * value
				_SCREAMING_SNAKE_CASE					:			Optional[Any]							= value

				while not is_prime(SCREAMING_SNAKE_CASE__	):
								value += 1 if not ("desc" in kwargs and kwargs["desc"] is True) else -1

				if value == first_value_val:
								return next_prime(value + 1				, **SCREAMING_SNAKE_CASE__	)
				return value




