





from __future__ import annotations

from string import ascii_letters



def 							lowerCAmelCase_				(    A_  ,A_  ,A_ = None):
    UpperCamelCase__:					str												=      alphabet or ascii_letters

    # The final result string
    UpperCamelCase__:					str												=      ""

    for character in input_string:
        if character not in alpha:
            # Append without encryption if character is not in the alphabet
            result += character
        else:
            # Get the index of the new key and make sure it isn't too large
            UpperCamelCase__:					Dict												=      (alpha.index(A_) + key) % len(A_)

            # Append the encoded character to the alphabet
            result += alpha[new_key]

    return result



def 							lowerCAmelCase_				(    A_  ,A_  ,A_ = None):
    key *= -1

    return encrypt(A_  ,A_  ,A_)



def 							lowerCAmelCase_				(    A_  ,A_ = None):
    UpperCamelCase__:					Tuple												=      alphabet or ascii_letters

    # To store data on all the combinations
    UpperCamelCase__:					Optional[int]												=      {}

    # Cycle through each combination
    for key in range(1  ,len(A_) + 1):
        # Decrypt the message and store the result in the data
        UpperCamelCase__:					Tuple												=      decrypt(A_  ,A_  ,A_)

    return brute_force_data


if __name__ == "__main__":
   while True:
      print(f"\n{'-' * 10}\n Menu\n{'-' * 10}")
      print(*['''1.Encrypt''', '''2.Decrypt''', '''3.BruteForce''', '''4.Quit'''], sep='''\n''')

      # get user input
      A__:  int       					=					input('''\nWhat would you like to do?: ''').strip() or '''4'''

      # run functions based on what the user chose
      if choice not in ("1", "2", "3", "4"):
         print('''Invalid choice, please enter a valid choice''')
      elif choice == "1":
         A__:  Tuple       					=					input('''Please enter the string to be encrypted: ''')
         A__:  Optional[int]       					=					int(input('''Please enter off-set: ''').strip())

         print(encrypt(input_string, key))
      elif choice == "2":
         A__:  str       					=					input('''Please enter the string to be decrypted: ''')
         A__:  Union[str, Any]       					=					int(input('''Please enter off-set: ''').strip())

         print(decrypt(input_string, key))
      elif choice == "3":
         A__:  int       					=					input('''Please enter the string to be decrypted: ''')
         A__:  List[Any]       					=					brute_force(input_string)

         for key, value in brute_force_data.items():
            print(f"Key: {key} | Message: {value}")

      elif choice == "4":
         print('''Goodbye.''')
         break








import inspect

from diffusers.utils import is_flax_available
from diffusers.utils.testing_utils import require_flax


if is_flax_available():
   import jax




@require_flax
class    _a  :

      """simple docstring"""


      def 	UpperCAmelCase_   (						self:	int			):
          '''simple docstring'''


          UpperCamelCase__							,				UpperCamelCase__:					Optional[int]												=      self.prepare_init_args_and_inputs_for_common()

          UpperCamelCase__:					Tuple												=      self.model_class(**__lowerCamelCase			)
          UpperCamelCase__:					Union[str, Any]												=      model.init(inputs_dict["prng_key"]					,  inputs_dict["sample"]			)
          jax.lax.stop_gradient(__lowerCamelCase			)

          UpperCamelCase__:					int												=      model.apply(__lowerCamelCase					,  inputs_dict["sample"]			)

          if isinstance(__lowerCamelCase					,  __lowerCamelCase			):
              UpperCamelCase__:					str												=      output.sample

          self.assertIsNotNone(__lowerCamelCase			)
          UpperCamelCase__:					Union[str, Any]												=      inputs_dict["sample"].shape
          self.assertEqual(output.shape					,  __lowerCamelCase					,  "Input and output shapes do not match"			)






      def 	UpperCAmelCase_   (						self:	Union[str, Any]			):
          '''simple docstring'''


          UpperCamelCase__							,				UpperCamelCase__:					List[str]												=      self.prepare_init_args_and_inputs_for_common()

          UpperCamelCase__:					List[Any]												=      16
          UpperCamelCase__:					int												=      (16, 32)

          UpperCamelCase__:					Tuple												=      self.model_class(**__lowerCamelCase			)
          UpperCamelCase__:					Union[str, Any]												=      model.init(inputs_dict["prng_key"]					,  inputs_dict["sample"]			)
          jax.lax.stop_gradient(__lowerCamelCase			)

          UpperCamelCase__:					Union[str, Any]												=      model.apply(__lowerCamelCase					,  inputs_dict["sample"]			)

          if isinstance(__lowerCamelCase					,  __lowerCamelCase			):
              UpperCamelCase__:					Dict												=      output.sample

          self.assertIsNotNone(__lowerCamelCase			)
          UpperCamelCase__:					Optional[Any]												=      inputs_dict["sample"].shape
          self.assertEqual(output.shape					,  __lowerCamelCase					,  "Input and output shapes do not match"			)






      def 	UpperCAmelCase_   (						self:	Tuple			):
          '''simple docstring'''


          UpperCamelCase__:					List[str]												=      "kwargs" in inspect.signature(self.model_class.__init__			).parameters
          UpperCamelCase__:					Any												=      len(self.model_class._deprecated_kwargs			) > 0

          if has_kwarg_in_model_class and not has_deprecated_kwarg:
              raise ValueError(
                  F"{self.model_class} has `**kwargs` in its __init__ method but has not defined any deprecated kwargs"
                  " under the `_deprecated_kwargs` class attribute. Make sure to either remove `**kwargs` if there are"
                  " no deprecated arguments or add the deprecated argument with `_deprecated_kwargs ="
                  " [<deprecated_argument>]`"			)

          if not has_kwarg_in_model_class and has_deprecated_kwarg:
              raise ValueError(
                  F"{self.model_class} doesn't have `**kwargs` in its __init__ method but has defined deprecated kwargs"
                  " under the `_deprecated_kwargs` class attribute. Make sure to either add the `**kwargs` argument to"
                  F" {self.model_class}.__init__ if there are deprecated arguments or remove the deprecated argument"
                  " from `_deprecated_kwargs = [<deprecated_argument>]`"			)

