

'''simple docstring'''







def    UpperCAmelCase__     (   UpperCAmelCase__					)      ->      str:
       A_						       =   """"""
       for ch in key:
              if ch == " " or ch not in key_no_dups and ch.isalpha():
                     key_no_dups += ch
       return key_no_dups
def    UpperCAmelCase__     (   UpperCAmelCase__					)      ->      dict[str, str]:
       A_						       =   [chr(i + 65					) for i in range(26					)]
       # Remove duplicate characters from key
       A_						       =   remove_duplicates(key.upper()					)
       A_						       =   len(UpperCAmelCase__					)
       # First fill cipher with key characters
       A_						       =   {alphabet[i]: char for i, char in enumerate(UpperCAmelCase__					)}
       # Then map remaining characters in alphabet to
       # the alphabet from the beginning
       for i in range(len(UpperCAmelCase__					),							26					):
              A_						       =   alphabet[i - offset]
              # Ensure we are not mapping letters to letters previously mapped
              while char in key:
                     offset -= 1
                     A_						       =   alphabet[i - offset]
              A_						       =   char
       return cipher_alphabet
def    UpperCAmelCase__     (   UpperCAmelCase__,							UpperCAmelCase__					)      ->      str:
       return "".join(cipher_map.get(UpperCAmelCase__,							UpperCAmelCase__					) for ch in message.upper()					)
def    UpperCAmelCase__     (   UpperCAmelCase__,							UpperCAmelCase__					)      ->      str:
       A_						       =   {v: k for k, v in cipher_map.items()}
       return "".join(rev_cipher_map.get(UpperCAmelCase__,							UpperCAmelCase__					) for ch in message.upper()					)
def    UpperCAmelCase__     (   )      ->      None:
       A_						       =   input("""Enter message to encode or decode: """					).strip()
       A_						       =   input("""Enter keyword: """					).strip()
       A_						       =   input("""Encipher or decipher? E/D:"""					).strip()[0].lower()
       try:
              A_						       =   {"""e""": encipher, """d""": decipher}[option]
       except KeyError:
              raise KeyError("""invalid input option"""					)
       A_						       =   create_cipher_map(UpperCAmelCase__					)
       print(func(UpperCAmelCase__,							UpperCAmelCase__					)					)


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      main()



'''simple docstring'''







from typing import TYPE_CHECKING

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


__lowerCamelCase									=     {
    '''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:
      __lowerCamelCase									=     ['''WhisperTokenizerFast''']

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

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

try:
      if not is_flax_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowerCamelCase									=     [
          '''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

      __lowerCamelCase									=     _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
