




'''simple docstring'''

from collections.abc import Iterator, MutableMapping
from dataclasses import dataclass
from typing import Generic, TypeVar

a       :						str								=		TypeVar('''KEY''')
a       :						Tuple								=		TypeVar('''VAL''')



@dataclass(frozen=_UpperCamelCase				,     slots=_UpperCamelCase	)
class 		SCREAMING_SNAKE_CASE__  (			Generic[KEY, VAL]	):
			__SCREAMING_SNAKE_CASE    =			42
			__SCREAMING_SNAKE_CASE    =			42







class 		SCREAMING_SNAKE_CASE__  (			_Item	):





			def __init__(      self						:    Tuple							):



						"""simple docstring"""




						super().__init__(a_      ,		a_							)






			def __bool__(      self						:    List[Any]							):



						"""simple docstring"""




						return False







a       :						Any								=		_DeletedItem()



class 		SCREAMING_SNAKE_CASE__  (			MutableMapping[KEY, VAL]	):





			def __init__(      self						:    Any      ,		a_						:    int = 8      ,		a_						:    float = 0.75							):



						"""simple docstring"""




						__snake_case			=		initial_block_size
						__snake_case			=		[None] * initial_block_size
						assert 0.0 < capacity_factor < 1.0
						__snake_case			=		capacity_factor
						__snake_case			=		0





			def 							A (      self						:    Union[str, Any]      ,		a_						:    KEY							):



						"""simple docstring"""




						return hash(a_							) % len(self._buckets							)





			def 							A (      self						:    Optional[Any]      ,		a_						:    int							):



						"""simple docstring"""




						return (ind + 1) % len(self._buckets							)





			def 							A (      self						:    List[str]      ,		a_						:    int      ,		a_						:    KEY      ,		a_						:    VAL							):



						"""simple docstring"""




						__snake_case			=		self._buckets[ind]
						if not stored:
									__snake_case			=		_Item(a_      ,		a_							)
									self._len += 1
									return True
						elif stored.key == key:
									__snake_case			=		_Item(a_      ,		a_							)
									return True
						else:
									return False





			def 							A (      self						:    Tuple							):



						"""simple docstring"""




						__snake_case			=		len(self._buckets							) * self._capacity_factor
						return len(self							) >= int(a_							)





			def 							A (      self						:    Optional[int]							):



						"""simple docstring"""




						if len(self._buckets							) <= self._initial_block_size:
									return False
						__snake_case			=		len(self._buckets							) * self._capacity_factor / 2
						return len(self							) < limit





			def 							A (      self						:    str      ,		a_						:    int							):



						"""simple docstring"""




						__snake_case			=		self._buckets
						__snake_case			=		[None] * new_size
						__snake_case			=		0
						for item in old_buckets:
									if item:
												self._add_item(item.key      ,		item.val							)





			def 							A (      self						:    List[Any]							):



						"""simple docstring"""




						self._resize(len(self._buckets							) * 2							)





			def 							A (      self						:    int							):



						"""simple docstring"""




						self._resize(len(self._buckets							) // 2							)





			def 							A (      self						:    List[Any]      ,		a_						:    KEY							):



						"""simple docstring"""




						__snake_case			=		self._get_bucket_index(a_							)
						for _ in range(len(self._buckets							)							):
									yield ind
									__snake_case			=		self._get_next_ind(a_							)





			def 							A (      self						:    str      ,		a_						:    KEY      ,		a_						:    VAL							):



						"""simple docstring"""




						for ind in self._iterate_buckets(a_							):
									if self._try_set(a_      ,		a_      ,		a_							):
												break





			def __setitem__(      self						:    Union[str, Any]      ,		a_						:    KEY      ,		a_						:    VAL							):



						"""simple docstring"""




						if self._is_full():
									self._size_up()

						self._add_item(a_      ,		a_							)





			def __delitem__(      self						:    List[str]      ,		a_						:    KEY							):



						"""simple docstring"""




						for ind in self._iterate_buckets(a_							):
									__snake_case			=		self._buckets[ind]
									if item is None:
												raise KeyError(a_							)
									if item is _deleted:
												continue
									if item.key == key:
												__snake_case			=		_deleted
												self._len -= 1
												break
						if self._is_sparse():
									self._size_down()





			def __getitem__(      self						:    Optional[int]      ,		a_						:    KEY							):



						"""simple docstring"""




						for ind in self._iterate_buckets(a_							):
									__snake_case			=		self._buckets[ind]
									if item is None:
												break
									if item is _deleted:
												continue
									if item.key == key:
												return item.val
						raise KeyError(a_							)





			def __len__(      self						:    Dict							):



						"""simple docstring"""




						return self._len





			def __iter__(      self						:    List[str]							):



						"""simple docstring"""




						yield from (item.key for item in self._buckets if item)






			def __repr__(      self						:    int							):



						"""simple docstring"""




						__snake_case			=		" ,".join(
						    f'''{item.key}: {item.val}''' for item in self._buckets if item							)
						return f'''HashMap({val_string})'''












import warnings
from contextlib import contextmanager

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


class     A     (SCREAMING_SNAKE_CASE       ):
			'''simple docstring'''




			__lowerCamelCase      :			Dict							     =       '''Wav2Vec2FeatureExtractor'''
			__lowerCamelCase      :			str							     =       '''AutoTokenizer'''






			def __init__(     self  :       Union[str, Any]				,      __lowerCAmelCase  :       List[Any]				,      __lowerCAmelCase  :       Optional[Any]  )      ->      Tuple:







					"""simple docstring"""






					super().__init__(__lowerCAmelCase				,      __lowerCAmelCase  )
					A__     =  self.feature_extractor
					A__     =  False






			@classmethod
			def   a_			(     cls  :       Union[str, Any]				,      __lowerCAmelCase  :       Optional[Any]				,      **__lowerCAmelCase  :       Union[str, Any]  )      ->      int:







					"""simple docstring"""






					try:
							return super().from_pretrained(__lowerCAmelCase				,      **__lowerCAmelCase  )
					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: """				,      __lowerCAmelCase				,      )

							A__     =  WavaVecaFeatureExtractor.from_pretrained(__lowerCAmelCase				,      **__lowerCAmelCase  )
							A__     =  WavaVecaCTCTokenizer.from_pretrained(__lowerCAmelCase				,      **__lowerCAmelCase  )

							return cls(feature_extractor=__lowerCAmelCase				,      tokenizer=__lowerCAmelCase  )






			def __call__(     self  :       Any				,      *__lowerCAmelCase  :       Union[str, Any]				,      **__lowerCAmelCase  :       List[Any]  )      ->      Optional[Any]:







					"""simple docstring"""






					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."""  )
							A__     =  kwargs.pop("""raw_speech"""  )
					else:
							A__     =  kwargs.pop("""audio"""				,      __lowerCAmelCase  )
					A__     =  kwargs.pop("""sampling_rate"""				,      __lowerCAmelCase  )
					A__     =  kwargs.pop("""text"""				,      __lowerCAmelCase  )
					if len(__lowerCAmelCase  ) > 0:
							A__     =  args[0]
							A__     =  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:
							A__     =  self.feature_extractor(__lowerCAmelCase				,      *__lowerCAmelCase				,      sampling_rate=__lowerCAmelCase				,      **__lowerCAmelCase  )
					if text is not None:
							A__     =  self.tokenizer(__lowerCAmelCase				,      **__lowerCAmelCase  )

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






			def   a_			(     self  :       List[str]				,      *__lowerCAmelCase  :       Optional[Any]				,      **__lowerCAmelCase  :       Tuple  )      ->      List[str]:







					"""simple docstring"""






					if self._in_target_context_manager:
							return self.current_processor.pad(*__lowerCAmelCase				,      **__lowerCAmelCase  )

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

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

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






			def   a_			(     self  :       Optional[int]				,      *__lowerCAmelCase  :       List[str]				,      **__lowerCAmelCase  :       List[Any]  )      ->      Dict:







					"""simple docstring"""






					return self.tokenizer.batch_decode(*__lowerCAmelCase				,      **__lowerCAmelCase  )






			def   a_			(     self  :       Any				,      *__lowerCAmelCase  :       List[str]				,      **__lowerCAmelCase  :       Union[str, Any]  )      ->      List[str]:







					"""simple docstring"""






					return self.tokenizer.decode(*__lowerCAmelCase				,      **__lowerCAmelCase  )







			@contextmanager
			def   a_			(     self  :       Union[str, Any]  )      ->      int:







					"""simple docstring"""






					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."""  )
					A__     =  True
					A__     =  self.tokenizer
					yield
					A__     =  self.feature_extractor
					A__     =  False



