


"""simple docstring"""




def       a_ (	lowercase__ :str     ):
			__lowerCamelCase          =      """"""
			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       a_ (	lowercase__ :str     ):
			__lowerCamelCase          =      [chr(i + 65     ) for i in range(26     )]
			# Remove duplicate characters from key
			__lowerCamelCase          =      remove_duplicates(key.upper()     )
			__lowerCamelCase          =      len(lowercase__     )
			# First fill cipher with key characters
			__lowerCamelCase          =      {alphabet[i]: char for i, char in enumerate(lowercase__     )}
			# Then map remaining characters in alphabet to
			# the alphabet from the beginning
			for i in range(len(lowercase__     ),			26     ):
						__lowerCamelCase          =      alphabet[i - offset]
						# Ensure we are not mapping letters to letters previously mapped
						while char in key:
									offset -= 1
									__lowerCamelCase          =      alphabet[i - offset]
						__lowerCamelCase          =      char
			return cipher_alphabet





def       a_ (	lowercase__ :str,			lowercase__ :dict[str, str]     ):
			return "".join(cipher_map.get(lowercase__,			lowercase__     ) for ch in message.upper()     )





def       a_ (	lowercase__ :str,			lowercase__ :dict[str, str]     ):
			__lowerCamelCase          =      {v: k for k, v in cipher_map.items()}
			return "".join(rev_cipher_map.get(lowercase__,			lowercase__     ) for ch in message.upper()     )





def       a_ (	):
			__lowerCamelCase          =      input("""Enter message to encode or decode: """     ).strip()
			__lowerCamelCase          =      input("""Enter keyword: """     ).strip()
			__lowerCamelCase          =      input("""Encipher or decipher? E/D:"""     ).strip()[0].lower()
			try:
						__lowerCamelCase          =      {"""e""": encipher, """d""": decipher}[option]
			except KeyError:
						raise KeyError("""invalid input option"""     )
			__lowerCamelCase          =      create_cipher_map(lowercase__     )
			print(func(lowercase__,			lowercase__     )     )


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					main()








"""simple docstring"""




import json
import os
import tempfile

from transformers.testing_utils import check_json_file_has_correct_format




class 			__snake_case   :
							__a					 =       None




							def   __a   (     self:    int   ):
										__lowerCamelCase          =      self.feature_extraction_class(**self.feat_extract_dict   )
										__lowerCamelCase          =      json.loads(feat_extract.to_json_string()   )
										for key, value in self.feat_extract_dict.items():
													self.assertEqual(obj[key]     ,							A_   )




							def   __a   (     self:    List[str]   ):
										__lowerCamelCase          =      self.feature_extraction_class(**self.feat_extract_dict   )

										with tempfile.TemporaryDirectory() as tmpdirname:
													__lowerCamelCase          =      os.path.join(A_     ,							"""feat_extract.json"""   )
													feat_extract_first.to_json_file(A_   )
													__lowerCamelCase          =      self.feature_extraction_class.from_json_file(A_   )

										self.assertEqual(feat_extract_second.to_dict()     ,							feat_extract_first.to_dict()   )




							def   __a   (     self:    Optional[Any]   ):
										__lowerCamelCase          =      self.feature_extraction_class(**self.feat_extract_dict   )

										with tempfile.TemporaryDirectory() as tmpdirname:
													__lowerCamelCase          =      feat_extract_first.save_pretrained(A_   )[0]
													check_json_file_has_correct_format(A_   )
													__lowerCamelCase          =      self.feature_extraction_class.from_pretrained(A_   )

										self.assertEqual(feat_extract_second.to_dict()     ,							feat_extract_first.to_dict()   )




							def   __a   (     self:    List[Any]   ):
										__lowerCamelCase          =      self.feature_extraction_class()
										self.assertIsNotNone(A_   )




