'''simple docstring'''






import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast





@dataclass
class     A__							(       datasets.BuilderConfig   ):





   """simple docstring"""





   UpperCamelCase_       :						Optional[datasets.Features]    				=     None





class     A__							(       datasets.ArrowBasedBuilder   ):





   """simple docstring"""





   UpperCamelCase_       :						str    				=     PandasConfig




   def 			_lowerCAmelCase		( self     :		Any			)       ->    List[Any]:







      """simple docstring"""




      return datasets.DatasetInfo(features=self.config.features			)




   def 			_lowerCAmelCase		( self     :		str						,     lowerCAmelCase__     :		List[str]			)       ->    Optional[int]:







      """simple docstring"""




      if not self.config.data_files:
         raise ValueError(F"""At least one data file must be specified, but got data_files={self.config.data_files}"""			)
      _UpperCAmelCase							:	List[Any]							=   dl_manager.download_and_extract(self.config.data_files			)
      if isinstance(__a						,     (str, list, tuple)			):
         _UpperCAmelCase							:	int							=   data_files
         if isinstance(__a						,     __a			):
            _UpperCAmelCase							:	Optional[Any]							=   [files]
         # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
         _UpperCAmelCase							:	int							=   [dl_manager.iter_files(__a			) for file in files]
         return [datasets.SplitGenerator(name=datasets.Split.TRAIN						,     gen_kwargs={"files": files}			)]
      _UpperCAmelCase							:	List[str]							=   []
      for split_name, files in data_files.items():
         if isinstance(__a						,     __a			):
            _UpperCAmelCase							:	Dict							=   [files]
         # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
         _UpperCAmelCase							:	Dict							=   [dl_manager.iter_files(__a			) for file in files]
         splits.append(datasets.SplitGenerator(name=__a						,     gen_kwargs={"files": files}			)			)
      return splits




   def 			_lowerCAmelCase		( self     :		str						,     lowerCAmelCase__     :		pa.Table			)       ->    Optional[Any]:







      """simple docstring"""




      if self.config.features is not None:
         # more expensive cast to support nested features with keys in a different order
         # allows str <-> int/float or str to Audio for example
         _UpperCAmelCase							:	Optional[Any]							=   table_cast(__a						,     self.config.features.arrow_schema			)
      return pa_table




   def 			_lowerCAmelCase		( self     :		List[str]						,     lowerCAmelCase__     :		List[Any]			)       ->    Optional[Any]:







      """simple docstring"""




      for i, file in enumerate(itertools.chain.from_iterable(__a			)			):
         with open(__a						,     "rb"			) as f:
            _UpperCAmelCase							:	Optional[int]							=   pa.Table.from_pandas(pd.read_pickle(__a			)			)
            yield i, self._cast_table(__a			)
'''simple docstring'''





import math





def 	lowerCAmelCase_				(					)    ->      None:


     '''simple docstring'''




     UpperCAmelCase_           =   input("Enter message: "			)
     UpperCAmelCase_           =   int(input(f"""Enter key [2-{len(snake_case_			) - 1}]: """			)			)
     UpperCAmelCase_           =   input("Encryption/Decryption [e/d]: "			)

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

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





def 	lowerCAmelCase_				(					snake_case_       : int					,    snake_case_       : str			)    ->      str:


     '''simple docstring'''




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





def 	lowerCAmelCase_				(					snake_case_       : int					,    snake_case_       : str			)    ->      str:


     '''simple docstring'''




     UpperCAmelCase_           =   math.ceil(len(snake_case_			) / key			)
     UpperCAmelCase_           =   key
     UpperCAmelCase_           =   (num_cols * num_rows) - len(snake_case_			)
     UpperCAmelCase_           =   [""] * num_cols
     UpperCAmelCase_           =   0
     UpperCAmelCase_           =   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)
          ):
               UpperCAmelCase_           =   0
               row += 1

     return "".join(snake_case_			)


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    main()




