






from __future__ import annotations

from typing import Generic, TypeVar

a    =       TypeVar('T')
class        __snake_case(					__UpperCamelCase      ):
 pass
class        __snake_case(					__UpperCamelCase      ):
 pass
class        __snake_case(					Generic[T]      ):



 def __init__(	self   :   Any ,		UpperCAmelCase__   :   int = 10	):

    """simple docstring"""






    lowercase__						:	list[T]         = []
    lowercase__						:	List[str]         = limit



 def __bool__(	self   :   Optional[int]	):

    """simple docstring"""






    return bool(self.stack	)



 def __str__(	self   :   Union[str, Any]	):

    """simple docstring"""






    return str(self.stack	)



 def 						UpperCAmelCase    (	self   :   List[Any] ,		UpperCAmelCase__   :   T	):

    """simple docstring"""






    if len(self.stack	) >= self.limit:
       raise StackOverflowError
    self.stack.append(UpperCAmelCase__	)



 def 						UpperCAmelCase    (	self   :   Any	):

    """simple docstring"""






    if not self.stack:
       raise StackUnderflowError
    return self.stack.pop()



 def 						UpperCAmelCase    (	self   :   int	):

    """simple docstring"""






    if not self.stack:
       raise StackUnderflowError
    return self.stack[-1]



 def 						UpperCAmelCase    (	self   :   str	):

    """simple docstring"""






    return not bool(self.stack	)



 def 						UpperCAmelCase    (	self   :   Dict	):

    """simple docstring"""






    return self.size() == self.limit



 def 						UpperCAmelCase    (	self   :   List[str]	):

    """simple docstring"""






    return len(self.stack	)







 def __contains__(	self   :   Optional[int] ,		UpperCAmelCase__   :   T	):

    """simple docstring"""






    return item in self.stack
def       a__						(  ):
   lowercase__						:	Stack[int]         = Stack(10					)
   assert bool(A					) is False
   assert stack.is_empty() is True
   assert stack.is_full() is False
   assert str(A					) == "[]"

   try:
      lowercase__						:	Optional[Any]         = stack.pop()
      raise AssertionError  # This should not happen
   except StackUnderflowError:
      assert True  # This should happen

   try:
      lowercase__						:	Dict         = stack.peek()
      raise AssertionError  # This should not happen
   except StackUnderflowError:
      assert True  # This should happen

   for i in range(10					):
      assert stack.size() == i
      stack.push(A					)

   assert bool(A					)
   assert not stack.is_empty()
   assert stack.is_full()
   assert str(A					) == str(list(range(10					)					)					)
   assert stack.pop() == 9
   assert stack.peek() == 8

   stack.push(100					)
   assert str(A					) == str([0, 1, 2, 3, 4, 5, 6, 7, 8, 100]					)

   try:
      stack.push(200					)
      raise AssertionError  # This should not happen
   except StackOverflowError:
      assert True  # This should happen

   assert not stack.is_empty()
   assert stack.size() == 10

   assert 5 in stack
   assert 55 not in stack


if __name__ == "__main__":
 test_stack()










import os
import sys
import time

from . import transposition_cipher as trans_cipher
def       a__						(  ):
   lowercase__						:	Union[str, Any]         = """Prehistoric Men.txt"""
   lowercase__						:	Optional[Any]         = """Output.txt"""
   lowercase__						:	List[str]         = int(input("""Enter key: """					)					)
   lowercase__						:	Tuple         = input("""Encrypt/Decrypt [e/d]: """					)

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

   lowercase__						:	str         = time.time()
   if mode.lower().startswith("""e"""					):
      with open(A					) as f:
         lowercase__						:	Optional[int]         = f.read()
      lowercase__						:	List[str]         = trans_cipher.encrypt_message(A		,				A					)
   elif mode.lower().startswith("""d"""					):
      with open(A					) as f:
         lowercase__						:	int         = f.read()
      lowercase__						:	int         = trans_cipher.decrypt_message(A		,				A					)

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

   lowercase__						:	Optional[Any]         = round(time.time() - start_time		,				2					)
   print(("""Done (""", total_time, """seconds )""")					)


if __name__ == "__main__":
 main()


