



'''simple docstring'''





lowercase_									=    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"




def lowerCAmelCase    ():



     """simple docstring"""



     _a           =    input('''Enter message: ''')
     _a           =    input('''Enter key [alphanumeric]: ''')
     _a           =    input('''Encrypt/Decrypt [e/d]: ''')

     if mode.lower().startswith('''e'''):
          _a           =    '''encrypt'''
          _a           =    encrypt_message(__A    ,      __A)
     elif mode.lower().startswith('''d'''):
          _a           =    '''decrypt'''
          _a           =    decrypt_message(__A    ,      __A)

     print(F'''\n{mode.title()}ed message:''')
     print(__A)




def lowerCAmelCase    (__A    ,      __A):



     """simple docstring"""



     return translate_message(__A    ,      __A    ,      '''encrypt''')




def lowerCAmelCase    (__A    ,      __A):



     """simple docstring"""



     return translate_message(__A    ,      __A    ,      '''decrypt''')




def lowerCAmelCase    (__A    ,      __A    ,      __A):



     """simple docstring"""



     _a           =    []
     _a           =    0
     _a           =    key.upper()

     for symbol in message:
          _a           =    LETTERS.find(symbol.upper())
          if num != -1:
               if mode == "encrypt":
                    num += LETTERS.find(key[key_index])
               elif mode == "decrypt":
                    num -= LETTERS.find(key[key_index])

               num %= len(__A)

               if symbol.isupper():
                    translated.append(LETTERS[num])
               elif symbol.islower():
                    translated.append(LETTERS[num].lower())

               key_index += 1
               if key_index == len(__A):
                    _a           =    0
          else:
               translated.append(__A)
     return "".join(__A)


if __name__ == "__main__":
  main()







import shutil
import tempfile
import unittest

import numpy as np
import pytest

from transformers import is_speech_available, is_vision_available
from transformers.testing_utils import require_torch


if is_vision_available():
 from transformers import TvltImageProcessor

if is_speech_available():
 from transformers import TvltFeatureExtractor

from transformers import TvltProcessor

@require_torch
class     A__   (       unittest.TestCase      ):







    """simple docstring"""

    def 						a_     (			self       ):
         snake_case											=							'''ZinengTang/tvlt-base'''
         snake_case											=							tempfile.mkdtemp()
    def 						a_     (			self     ,   **__snake_case       ):
         return TvltImageProcessor.from_pretrained(self.checkpoint     ,   **__snake_case       )
    def 						a_     (			self     ,   **__snake_case       ):
         return TvltFeatureExtractor.from_pretrained(self.checkpoint     ,   **__snake_case       )
    def 						a_     (			self       ):
         shutil.rmtree(self.tmpdirname       )
    def 						a_     (			self       ):
         snake_case											=							self.get_image_processor()
         snake_case											=							self.get_feature_extractor()

         snake_case											=							TvltProcessor(image_processor=__snake_case     ,   feature_extractor=__snake_case       )
         processor.save_pretrained(self.tmpdirname       )
         snake_case											=							TvltProcessor.from_pretrained(self.tmpdirname       )

         self.assertIsInstance(processor.feature_extractor     ,   __snake_case       )
         self.assertIsInstance(processor.image_processor     ,   __snake_case       )
    def 						a_     (			self       ):
         snake_case											=							self.get_image_processor()
         snake_case											=							self.get_feature_extractor()

         snake_case											=							TvltProcessor(image_processor=__snake_case     ,   feature_extractor=__snake_case       )

         snake_case											=							np.ones([1_2_0_0_0]       )

         snake_case											=							feature_extractor(__snake_case     ,   return_tensors='''np'''       )
         snake_case											=							processor(audio=__snake_case     ,   return_tensors='''np'''       )

         for key in audio_dict.keys():
              self.assertAlmostEqual(audio_dict[key].sum()     ,   input_processor[key].sum()     ,   delta=1E-2       )
    def 						a_     (			self       ):
         snake_case											=							self.get_image_processor()
         snake_case											=							self.get_feature_extractor()

         snake_case											=							TvltProcessor(image_processor=__snake_case     ,   feature_extractor=__snake_case       )

         snake_case											=							np.ones([3, 2_2_4, 2_2_4]       )

         snake_case											=							image_processor(__snake_case     ,   return_tensors='''np'''       )
         snake_case											=							processor(images=__snake_case     ,   return_tensors='''np'''       )

         for key in image_dict.keys():
              self.assertAlmostEqual(image_dict[key].sum()     ,   input_processor[key].sum()     ,   delta=1E-2       )
    def 						a_     (			self       ):
         snake_case											=							self.get_image_processor()
         snake_case											=							self.get_feature_extractor()

         snake_case											=							TvltProcessor(image_processor=__snake_case     ,   feature_extractor=__snake_case       )

         snake_case											=							np.ones([1_2_0_0_0]       )
         snake_case											=							np.ones([3, 2_2_4, 2_2_4]       )

         snake_case											=							processor(audio=__snake_case     ,   images=__snake_case       )

         self.assertListEqual(list(inputs.keys()       )     ,   ['''audio_values''', '''audio_mask''', '''pixel_values''', '''pixel_mask''']       )

         # test if it raises when no input is passed
         with pytest.raises(__snake_case       ):
              processor()




    def 						a_     (			self       ):
         snake_case											=							self.get_image_processor()
         snake_case											=							self.get_feature_extractor()

         snake_case											=							TvltProcessor(image_processor=__snake_case     ,   feature_extractor=__snake_case       )

         self.assertListEqual(
             processor.model_input_names     ,   image_processor.model_input_names + feature_extractor.model_input_names     ,   msg='''`processor` and `image_processor`+`feature_extractor` model input names do not match'''     ,   )




