
from typing import Literal

_A       =					"ABCDEFGHIJKLMNOPQRSTUVWXYZ"






def        lowerCamelCase__    (    __lowerCAmelCase  :  Any   ,							__lowerCAmelCase  :  Optional[int]   ,							__lowerCAmelCase  :  List[Any]    ):




			"""simple docstring"""


			lowerCAmelCase_      =     LETTERS if mode == "decrypt" else key
			lowerCAmelCase_      =     key if mode == "decrypt" else LETTERS
			lowerCAmelCase_      =     ""
			# loop through each symbol in the message
			for symbol in message:
						if symbol.upper() in chars_a:
									# encrypt/decrypt the symbol
									lowerCAmelCase_      =     chars_a.find(symbol.upper()    )
									if symbol.isupper():
												translated += chars_b[sym_index].upper()
									else:
												translated += chars_b[sym_index].lower()
						else:
									# symbol is not in LETTERS, just add it
									translated += symbol
			return translated






def        lowerCamelCase__    (    __lowerCAmelCase  :  Dict   ,							__lowerCAmelCase  :  Dict    ):




			"""simple docstring"""


			return translate_message(__UpperCamelCase   ,							__UpperCamelCase   ,							"encrypt"    )






def        lowerCamelCase__    (    __lowerCAmelCase  :  Optional[Any]   ,							__lowerCAmelCase  :  Optional[int]    ):




			"""simple docstring"""


			return translate_message(__UpperCamelCase   ,							__UpperCamelCase   ,							"decrypt"    )






def        lowerCamelCase__    (    ):




			"""simple docstring"""


			lowerCAmelCase_      =     "Hello World"
			lowerCAmelCase_      =     "QWERTYUIOPASDFGHJKLZXCVBNM"
			lowerCAmelCase_      =     "decrypt"  # set to 'encrypt' or 'decrypt'

			if mode == "encrypt":
						lowerCAmelCase_      =     encrypt_message(__UpperCamelCase   ,							__UpperCamelCase    )
			elif mode == "decrypt":
						lowerCAmelCase_      =     decrypt_message(__UpperCamelCase   ,							__UpperCamelCase    )
			print(F"""Using the key {key}, the {mode}ed message is: {translated}"""    )


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			main()





import torch
import torch.nn.functional as F

from diffusers import VQDiffusionScheduler

from .test_schedulers import SchedulerCommonTest





class      _lowerCAmelCase (     __a	):
				_lowercase      		=(VQDiffusionScheduler,)




				def 					__a						( self    ,    **_UpperCamelCase					)    ->				List[str]:
							lowerCAmelCase_      =     {
							    "num_vec_classes": 4_097,
							    "num_train_timesteps": 100,
							}

							config.update(**_UpperCamelCase					)
							return config




				def 					__a						( self    ,    _UpperCamelCase					)    ->				str:
							lowerCAmelCase_      =     4
							lowerCAmelCase_      =     8
							lowerCAmelCase_      =     8

							lowerCAmelCase_      =     torch.randint(0    ,    _UpperCamelCase    ,    (batch_size, height * width)					)

							return sample




				@property
				def 					__a						( self					)    ->				List[str]:
							assert False




				def 					__a						( self    ,    _UpperCamelCase					)    ->				Tuple:
							def model(_UpperCamelCase    ,    _UpperCamelCase    ,    *_UpperCamelCase					):
										lowerCAmelCase_     ,  lowerCAmelCase_      =     sample.shape
										lowerCAmelCase_      =     torch.rand((batch_size, num_vec_classes - 1, num_latent_pixels)					)
										lowerCAmelCase_      =     F.log_softmax(logits.double()    ,    dim=1					).float()
										return return_value

							return model




				def 					__a						( self					)    ->				str:
							for timesteps in [2, 5, 100, 1_000]:
										self.check_over_configs(num_train_timesteps=_UpperCamelCase					)




				def 					__a						( self					)    ->				Dict:
							for num_vec_classes in [5, 100, 1_000, 4_000]:
										self.check_over_configs(num_vec_classes=_UpperCamelCase					)




				def 					__a						( self					)    ->				Tuple:
							for t in [0, 50, 99]:
										self.check_over_forward(time_step=_UpperCamelCase					)




				def 					__a						( self					)    ->				List[str]:
							pass



