


"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_torch_available,
)


_snake_case          =							{
    "configuration_wav2vec2": ["WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Wav2Vec2Config"],
    "feature_extraction_wav2vec2": ["Wav2Vec2FeatureExtractor"],
    "processing_wav2vec2": ["Wav2Vec2Processor"],
    "tokenization_wav2vec2": ["Wav2Vec2CTCTokenizer", "Wav2Vec2Tokenizer"],
}


try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_snake_case          =							[
			    "WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "Wav2Vec2ForAudioFrameClassification",
			    "Wav2Vec2ForCTC",
			    "Wav2Vec2ForMaskedLM",
			    "Wav2Vec2ForPreTraining",
			    "Wav2Vec2ForSequenceClassification",
			    "Wav2Vec2ForXVector",
			    "Wav2Vec2Model",
			    "Wav2Vec2PreTrainedModel",
			]

try:
			if not is_tf_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_snake_case          =							[
			    "TF_WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "TFWav2Vec2ForCTC",
			    "TFWav2Vec2Model",
			    "TFWav2Vec2PreTrainedModel",
			    "TFWav2Vec2ForSequenceClassification",
			]

try:
			if not is_flax_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_snake_case          =							[
			    "FlaxWav2Vec2ForCTC",
			    "FlaxWav2Vec2ForPreTraining",
			    "FlaxWav2Vec2Model",
			    "FlaxWav2Vec2PreTrainedModel",
			]


if TYPE_CHECKING:
			from .configuration_wavaveca import WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP, WavaVecaConfig
			from .feature_extraction_wavaveca import WavaVecaFeatureExtractor
			from .processing_wavaveca import WavaVecaProcessor
			from .tokenization_wavaveca import WavaVecaCTCTokenizer, WavaVecaTokenizer

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_wavaveca import (
						    WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST,
						    WavaVecaForAudioFrameClassification,
						    WavaVecaForCTC,
						    WavaVecaForMaskedLM,
						    WavaVecaForPreTraining,
						    WavaVecaForSequenceClassification,
						    WavaVecaForXVector,
						    WavaVecaModel,
						    WavaVecaPreTrainedModel,
						)

			try:
						if not is_tf_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_tf_wavaveca import (
						    TF_WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST,
						    TFWavaVecaForCTC,
						    TFWavaVecaForSequenceClassification,
						    TFWavaVecaModel,
						    TFWavaVecaPreTrainedModel,
						)

			try:
						if not is_flax_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_tf_wavaveca import (
						    FlaxWavaVecaForCTC,
						    FlaxWavaVecaForPreTraining,
						    FlaxWavaVecaModel,
						    FlaxWavaVecaPreTrainedModel,
						)


else:
			import sys

			_snake_case          =							_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)







"""simple docstring"""


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

_snake_case          =							TypeVar("KEY")
_snake_case          =							TypeVar("VAL")



@dataclass(frozen=SCREAMING_SNAKE_CASE_		,		slots=SCREAMING_SNAKE_CASE_ )
class   _a      (      Generic[KEY, VAL] ):
    a_    :				KEY
    a_    :				VAL





class   _a      (      _Item ):
    def __init__( self							:					List[str]				):
          super().__init__(SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__				)


    def __bool__( self							:					str				):
          return False





_snake_case          =							_DeletedItem()



class   _a      (      MutableMapping[KEY, VAL] ):
    def __init__( self							:					Optional[Any]							,					SCREAMING_SNAKE_CASE__							:					int = 8							,					SCREAMING_SNAKE_CASE__							:					float = 0.75				):
          lowerCamelCase__           =		initial_block_size
          lowerCamelCase__           =		[None] * initial_block_size
          assert 0.0 < capacity_factor < 1.0
          lowerCamelCase__           =		capacity_factor
          lowerCamelCase__           =		0
    def      _UpperCamelCase       ( self							:					Optional[int]							,					SCREAMING_SNAKE_CASE__							:					KEY				):
          return hash(SCREAMING_SNAKE_CASE__				) % len(self._buckets				)
    def      _UpperCamelCase       ( self							:					str							,					SCREAMING_SNAKE_CASE__							:					int				):
          return (ind + 1) % len(self._buckets				)
    def      _UpperCamelCase       ( self							:					Union[str, Any]							,					SCREAMING_SNAKE_CASE__							:					int							,					SCREAMING_SNAKE_CASE__							:					KEY							,					SCREAMING_SNAKE_CASE__							:					VAL				):
          lowerCamelCase__           =		self._buckets[ind]
          if not stored:
                lowerCamelCase__           =		_Item(SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__				)
                self._len += 1
                return True
          elif stored.key == key:
                lowerCamelCase__           =		_Item(SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__				)
                return True
          else:
                return False
    def      _UpperCamelCase       ( self							:					Dict				):
          lowerCamelCase__           =		len(self._buckets				) * self._capacity_factor
          return len(self				) >= int(SCREAMING_SNAKE_CASE__				)
    def      _UpperCamelCase       ( self							:					int				):
          if len(self._buckets				) <= self._initial_block_size:
                return False
          lowerCamelCase__           =		len(self._buckets				) * self._capacity_factor / 2
          return len(self				) < limit
    def      _UpperCamelCase       ( self							:					List[str]							,					SCREAMING_SNAKE_CASE__							:					int				):
          lowerCamelCase__           =		self._buckets
          lowerCamelCase__           =		[None] * new_size
          lowerCamelCase__           =		0
          for item in old_buckets:
                if item:
                      self._add_item(item.key							,					item.val				)
    def      _UpperCamelCase       ( self							:					List[str]				):
          self._resize(len(self._buckets				) * 2				)
    def      _UpperCamelCase       ( self							:					Optional[int]				):
          self._resize(len(self._buckets				) // 2				)
    def      _UpperCamelCase       ( self							:					Any							,					SCREAMING_SNAKE_CASE__							:					KEY				):
          lowerCamelCase__           =		self._get_bucket_index(SCREAMING_SNAKE_CASE__				)
          for _ in range(len(self._buckets				)				):
                yield ind
                lowerCamelCase__           =		self._get_next_ind(SCREAMING_SNAKE_CASE__				)
    def      _UpperCamelCase       ( self							:					Optional[Any]							,					SCREAMING_SNAKE_CASE__							:					KEY							,					SCREAMING_SNAKE_CASE__							:					VAL				):
          for ind in self._iterate_buckets(SCREAMING_SNAKE_CASE__				):
                if self._try_set(SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__				):
                      break
    def __setitem__( self							:					Dict							,					SCREAMING_SNAKE_CASE__							:					KEY							,					SCREAMING_SNAKE_CASE__							:					VAL				):
          if self._is_full():
                self._size_up()

          self._add_item(SCREAMING_SNAKE_CASE__							,					SCREAMING_SNAKE_CASE__				)
    def __delitem__( self							:					Dict							,					SCREAMING_SNAKE_CASE__							:					KEY				):
          for ind in self._iterate_buckets(SCREAMING_SNAKE_CASE__				):
                lowerCamelCase__           =		self._buckets[ind]
                if item is None:
                      raise KeyError(SCREAMING_SNAKE_CASE__				)
                if item is _deleted:
                      continue
                if item.key == key:
                      lowerCamelCase__           =		_deleted
                      self._len -= 1
                      break
          if self._is_sparse():
                self._size_down()
    def __getitem__( self							:					str							,					SCREAMING_SNAKE_CASE__							:					KEY				):
          for ind in self._iterate_buckets(SCREAMING_SNAKE_CASE__				):
                lowerCamelCase__           =		self._buckets[ind]
                if item is None:
                      break
                if item is _deleted:
                      continue
                if item.key == key:
                      return item.val
          raise KeyError(SCREAMING_SNAKE_CASE__				)
    def __len__( self							:					List[Any]				):
          return self._len
    def __iter__( self							:					Optional[int]				):
          yield from (item.key for item in self._buckets if item)


    def __repr__( self							:					str				):
          lowerCamelCase__           =		' ,'.join(
              F'{item.key}: {item.val}' for item in self._buckets if item				)
          return F'HashMap({val_string})'



