




import unittest

import numpy as np

from transformers import is_tf_available
from transformers.testing_utils import require_tf


if is_tf_available():
 import tensorflow as tf

 from transformers.activations_tf import get_tf_activation

@require_tf
class 			_lowerCamelCase    (      unittest.TestCase ):

      """simple docstring"""

      def    snake_case						(  self       :			Tuple					):
          __UpperCamelCase			=    tf.constant([-100, -1.0, -0.1, 0, 0.1, 1.0, 1_00.0]					)
          __UpperCamelCase			=    get_tf_activation('''gelu'''					)
          __UpperCamelCase			=    get_tf_activation('''gelu_10'''					)

          __UpperCamelCase			=    gelu(snake_case					)
          __UpperCamelCase			=    geluaa(snake_case					)

          __UpperCamelCase			=    tf.where(y_gelu_aa < 10.0			,							1.0			,							0.0					)

          self.assertEqual(tf.math.reduce_max(snake_case					).numpy().item()			,							10.0					)
          self.assertTrue(np.allclose(y_gelu * clipped_mask			,							y_gelu_aa * clipped_mask					)					)







      def    snake_case						(  self       :			Tuple					):
          get_tf_activation('''gelu'''					)
          get_tf_activation('''gelu_10'''					)
          get_tf_activation('''gelu_fast'''					)
          get_tf_activation('''gelu_new'''					)
          get_tf_activation('''glu'''					)
          get_tf_activation('''mish'''					)
          get_tf_activation('''quick_gelu'''					)
          get_tf_activation('''relu'''					)
          get_tf_activation('''sigmoid'''					)
          get_tf_activation('''silu'''					)
          get_tf_activation('''swish'''					)
          get_tf_activation('''tanh'''					)
          with self.assertRaises(snake_case					):
              get_tf_activation('''bogus'''					)
          with self.assertRaises(snake_case					):
              get_tf_activation(snake_case					)









def      snake_case__							(  lowerCAmelCase_,       lowerCAmelCase_     ):





     """simple docstring"""







     if not isinstance(lowerCAmelCase_,       lowerCAmelCase_     ):
          raise TypeError('plaintext must be a string'     )
     if not isinstance(lowerCAmelCase_,       lowerCAmelCase_     ):
          raise TypeError('key must be a string'     )

     if not plaintext:
          raise ValueError('plaintext is empty'     )
     if not key:
          raise ValueError('key is empty'     )

     key += plaintext
     SCREAMING_SNAKE_CASE 		=plaintext.lower()
     SCREAMING_SNAKE_CASE 		=key.lower()
     SCREAMING_SNAKE_CASE 		=0
     SCREAMING_SNAKE_CASE 		=0
     SCREAMING_SNAKE_CASE 		=''
     while plaintext_iterator < len(lowerCAmelCase_     ):
          if (
              ord(plaintext[plaintext_iterator]     ) < 97
              or ord(plaintext[plaintext_iterator]     ) > 122
          ):
               ciphertext += plaintext[plaintext_iterator]
               plaintext_iterator += 1
          elif ord(key[key_iterator]     ) < 97 or ord(key[key_iterator]     ) > 122:
               key_iterator += 1
          else:
               ciphertext += chr(
                   (
                       (ord(plaintext[plaintext_iterator]     ) - 97 + ord(key[key_iterator]     ))
                       - 97
                   )
                   % 26
                   + 97     )
               key_iterator += 1
               plaintext_iterator += 1
     return ciphertext







def      snake_case__							(  lowerCAmelCase_,       lowerCAmelCase_     ):





     """simple docstring"""







     if not isinstance(lowerCAmelCase_,       lowerCAmelCase_     ):
          raise TypeError('ciphertext must be a string'     )
     if not isinstance(lowerCAmelCase_,       lowerCAmelCase_     ):
          raise TypeError('key must be a string'     )

     if not ciphertext:
          raise ValueError('ciphertext is empty'     )
     if not key:
          raise ValueError('key is empty'     )

     SCREAMING_SNAKE_CASE 		=key.lower()
     SCREAMING_SNAKE_CASE 		=0
     SCREAMING_SNAKE_CASE 		=0
     SCREAMING_SNAKE_CASE 		=''
     while ciphertext_iterator < len(lowerCAmelCase_     ):
          if (
              ord(ciphertext[ciphertext_iterator]     ) < 97
              or ord(ciphertext[ciphertext_iterator]     ) > 122
          ):
               plaintext += ciphertext[ciphertext_iterator]
          else:
               plaintext += chr(
                   (ord(ciphertext[ciphertext_iterator]     ) - ord(key[key_iterator]     )) % 26
                   + 97     )
               key += chr(
                   (ord(ciphertext[ciphertext_iterator]     ) - ord(key[key_iterator]     )) % 26
                   + 97     )
               key_iterator += 1
          ciphertext_iterator += 1
     return plaintext


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 _lowerCamelCase							=int(input("Type 1 to encrypt or 2 to decrypt:"))
 if operation == 1:
  _lowerCamelCase							=input("Typeplaintext to be encrypted:\n")
  _lowerCamelCase							=input("Type the key:\n")
  print(encrypt(plaintext, key))
 elif operation == 2:
  _lowerCamelCase							=input("Type the ciphertext to be decrypted:\n")
  _lowerCamelCase							=input("Type the key:\n")
  print(decrypt(ciphertext, key))
 decrypt("jsqqs avvwo", "coffee")

