





from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset


class   A      (SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''




			def        a_	(      self       :   Union[str, Any]       )     ->     Optional[Any]:







					"""simple docstring"""






					return [
					    {"col_1": 3, "col_2": "a"},
					    {"col_1": 2, "col_2": "b"},
					    {"col_1": 1, "col_2": "c"},
					    {"col_1": 0, "col_2": "d"},
					]






			def        a_	(      self       :   List[Any]       )     ->     Dict:







					"""simple docstring"""






					A__  				=       {"""col_1""": [3, 2, 1, 0], """col_2""": ["""a""", """b""", """c""", """d"""]}
					return Dataset.from_dict(__lowerCAmelCase       )






			def        a_	(      self       :   Dict       )     ->     Union[str, Any]:







					"""simple docstring"""






					A__  				=       self._create_example_records()
					A__  				=       Dataset.from_list(__lowerCAmelCase       )
					self.assertListEqual(dset.column_names							,     ["""col_1""", """col_2"""]       )
					for i, r in enumerate(__lowerCAmelCase       ):
							self.assertDictEqual(__lowerCAmelCase							,     example_records[i]       )






			def        a_	(      self       :   List[Any]       )     ->     Union[str, Any]:







					"""simple docstring"""






					A__  				=       self._create_example_records()
					A__  				=       Dataset.from_list(__lowerCAmelCase       )
					A__  				=       Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]}       )
					self.assertEqual(dset.info							,     dset_from_dict.info       )






			def        a_	(      self       :   Any       )     ->     Optional[Any]:  # checks what happens with missing columns







					"""simple docstring"""






					A__  				=       [{"""col_1""": 1}, {"""col_2""": """x"""}]
					A__  				=       Dataset.from_list(__lowerCAmelCase       )
					self.assertDictEqual(dset[0]							,     {"""col_1""": 1}       )
					self.assertDictEqual(dset[1]							,     {"""col_1""": None}       )  # NB: first record is used for columns






			def        a_	(      self       :   int       )     ->     List[Any]:  # checks if the type can be inferred from the second record







					"""simple docstring"""






					A__  				=       [{"""col_1""": []}, {"""col_1""": [1, 2]}]
					A__  				=       Dataset.from_list(__lowerCAmelCase       )
					self.assertEqual(dset.info.features["""col_1"""]							,     Sequence(Value("""int64"""       )       )       )







			def        a_	(      self       :   Union[str, Any]       )     ->     Any:







					"""simple docstring"""






					A__  				=       Dataset.from_list([]       )
					self.assertEqual(len(__lowerCAmelCase       )							,     0       )
					self.assertListEqual(dset.column_names							,     []       )










import math







def        __lowerCamelCase (							)		->    None:






		"""simple docstring"""

		A__  				=       input("""Enter message: """   )
		A__  				=       int(input(F'Enter key [2-{len(__a   ) - 1}]: '   )   )
		A__  				=       input("""Encryption/Decryption [e/d]: """   )

		if mode.lower().startswith("""e"""   ):
				A__  				=       encrypt_message(__a   ,					__a   )
		elif mode.lower().startswith("""d"""   ):
				A__  				=       decrypt_message(__a   ,					__a   )

		# Append pipe symbol (vertical bar) to identify spaces at the end.
		print(F'Output:\n{text + "|"}'   )







def        __lowerCamelCase (							__a       :int   ,					__a       :str   )		->    str:






		"""simple docstring"""

		A__  				=       [""""""] * key
		for col in range(__a   ):
				A__  				=       col
				while pointer < len(__a   ):
						cipher_text[col] += message[pointer]
						pointer += key
		return "".join(__a   )







def        __lowerCamelCase (							__a       :int   ,					__a       :str   )		->    str:






		"""simple docstring"""

		A__  				=       math.ceil(len(__a   ) / key   )
		A__  				=       key
		A__  				=       (num_cols * num_rows) - len(__a   )
		A__  				=       [""""""] * num_cols
		A__  				=       0
		A__  				=       0

		for symbol in message:
				plain_text[col] += symbol
				col += 1

				if (
				    (col == num_cols)
				    or (col == num_cols - 1)
				    and (row >= num_rows - num_shaded_boxes)
				):
						A__  				=       0
						row += 1

		return "".join(__a   )


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					main()



