
"""simple docstring"""
from typing import TYPE_CHECKING

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


lowercase_       :						Optional[Any]     					=	{
    '''configuration_whisper''': ['''WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''WhisperConfig''', '''WhisperOnnxConfig'''],
    '''feature_extraction_whisper''': ['''WhisperFeatureExtractor'''],
    '''processing_whisper''': ['''WhisperProcessor'''],
    '''tokenization_whisper''': ['''WhisperTokenizer'''],
}

try:
      if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase_       :						Tuple     					=	['''WhisperTokenizerFast''']

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase_       :						Optional[Any]     					=	[
          '''WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''WhisperForConditionalGeneration''',
          '''WhisperModel''',
          '''WhisperPreTrainedModel''',
          '''WhisperForAudioClassification''',
      ]

try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase_       :						int     					=	[
          '''TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''TFWhisperForConditionalGeneration''',
          '''TFWhisperModel''',
          '''TFWhisperPreTrainedModel''',
      ]

try:
      if not is_flax_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      lowercase_       :						Tuple     					=	[
          '''FlaxWhisperForConditionalGeneration''',
          '''FlaxWhisperModel''',
          '''FlaxWhisperPreTrainedModel''',
          '''FlaxWhisperForAudioClassification''',
      ]


if TYPE_CHECKING:
      from .configuration_whisper import WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP, WhisperConfig, WhisperOnnxConfig
      from .feature_extraction_whisper import WhisperFeatureExtractor
      from .processing_whisper import WhisperProcessor
      from .tokenization_whisper import WhisperTokenizer

      try:
            if not is_tokenizers_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_whisper_fast import WhisperTokenizerFast

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_whisper import (
                WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
                WhisperForAudioClassification,
                WhisperForConditionalGeneration,
                WhisperModel,
                WhisperPreTrainedModel,
            )

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_whisper import (
                TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
                TFWhisperForConditionalGeneration,
                TFWhisperModel,
                TFWhisperPreTrainedModel,
            )

      try:
            if not is_flax_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_flax_whisper import (
                FlaxWhisperForAudioClassification,
                FlaxWhisperForConditionalGeneration,
                FlaxWhisperModel,
                FlaxWhisperPreTrainedModel,
            )

else:
      import sys

      lowercase_       :						Tuple     					=	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





"""simple docstring"""
from typing import List

from .keymap import KEYMAP, get_character





def    _lowerCAmelCase    (     lowerCamelCase__							:							str				)  ->    Optional[int]:

  def decorator(lowerCamelCase__							:							int				):
    _SCREAMING_SNAKE_CASE   :				Optional[int]							    = getattr(lowerCamelCase__,						"handle_key",						[]				)
    handle += [key]
    setattr(lowerCamelCase__,						"handle_key",						lowerCamelCase__				)
    return func

  return decorator





def    _lowerCAmelCase    (     *lowerCamelCase__							:							List[str]				)  ->    Tuple:

  def decorator(lowerCamelCase__							:							Dict				):
    _SCREAMING_SNAKE_CASE   :				List[Any]							    = getattr(lowerCamelCase__,						"handle_key",						[]				)
    handle += keys
    setattr(lowerCamelCase__,						"handle_key",						lowerCamelCase__				)
    return func

  return decorator
class 			UpperCamelCase      (							__SCREAMING_SNAKE_CASE  ):
     def __new__(     cls  ,     snake_case__  ,     snake_case__  ,     snake_case__				):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE   :				Tuple							    = super().__new__(cls  ,     snake_case__  ,     snake_case__  ,     snake_case__				)
       if not hasattr(snake_case__  ,     "key_handler"				):
         setattr(snake_case__  ,     "key_handler"  ,     {}				)
       setattr(snake_case__  ,     "handle_input"  ,     KeyHandler.handle_input				)

       for value in attrs.values():
         _SCREAMING_SNAKE_CASE   :				Union[str, Any]							    = getattr(snake_case__  ,     "handle_key"  ,     []				)
         for key in handled_keys:
           _SCREAMING_SNAKE_CASE   :				Tuple							    = value
       return new_cls




     @staticmethod
     def 				__SCREAMING_SNAKE_CASE							(     cls				):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE   :				Any							    = get_character()
       if char != KEYMAP["undefined"]:
         _SCREAMING_SNAKE_CASE   :				Dict							    = ord(snake_case__				)
       _SCREAMING_SNAKE_CASE   :				Union[str, Any]							    = cls.key_handler.get(snake_case__				)
       if handler:
         _SCREAMING_SNAKE_CASE   :				Optional[int]							    = char
         return handler(cls				)
       else:
         return None





def    _lowerCAmelCase    (     cls							:							List[Any]				)  ->    str:
  return KeyHandler(cls.__name__,						cls.__bases__,						cls.__dict__.copy()				)



