"""simple docstring"""


import os
import sys
import time

from . import transposition_cipher as trans_cipher





def       lowerCamelCase_			( )							-> None:




				'''simple docstring'''



				lowerCamelCase__ ="Prehistoric Men.txt"
				lowerCamelCase__ ="Output.txt"
				lowerCamelCase__ =int(input("Enter key: "    )    )
				lowerCamelCase__ =input("Encrypt/Decrypt [e/d]: "    )

				if not os.path.exists(__lowerCAmelCase    ):
								print(F'''File {input_file} does not exist. Quitting...'''    )
								sys.exit()
				if os.path.exists(__lowerCAmelCase    ):
								print(F'''Overwrite {output_file}? [y/n]'''    )
								lowerCamelCase__ =input("> "    )
								if not response.lower().startswith("y"    ):
												sys.exit()

				lowerCamelCase__ =time.time()
				if mode.lower().startswith("e"    ):
								with open(__lowerCAmelCase    ) as f:
												lowerCamelCase__ =f.read()
								lowerCamelCase__ =trans_cipher.encrypt_message(__lowerCAmelCase       ,   __lowerCAmelCase    )
				elif mode.lower().startswith("d"    ):
								with open(__lowerCAmelCase    ) as f:
												lowerCamelCase__ =f.read()
								lowerCamelCase__ =trans_cipher.decrypt_message(__lowerCAmelCase       ,   __lowerCAmelCase    )

				with open(__lowerCAmelCase       ,   "w"    ) as output_obj:
								output_obj.write(__lowerCAmelCase    )

				lowerCamelCase__ =round(time.time() - start_time       ,   2    )
				print(("Done (", total_time, "seconds )")    )


if __name__ == "__main__":
	main()



"""simple docstring"""


from __future__ import annotations

from collections.abc import Generator





def       lowerCamelCase_			( __lowerCAmelCase    )							-> Generator[int, None, None]:




						'''simple docstring'''



						if not isinstance(__lowerCAmelCase       ,   __lowerCAmelCase    ) or n < 1:
												raise Exception("Sequence only defined for positive integers"    )

						yield n
						while n != 1:
												if n % 2 == 0:
																		n //= 2
												else:
																		lowerCamelCase__ =3 * n + 1
												yield n





def       lowerCamelCase_			( )							-> List[str]:




						'''simple docstring'''



						lowerCamelCase__ =43
						lowerCamelCase__ =tuple(collatz_sequence(__lowerCAmelCase    )    )
						print(__lowerCAmelCase    )
						print(F'''Collatz sequence from {n} took {len(__lowerCAmelCase    )} steps.'''    )


if __name__ == "__main__":
	main()


