






'''simple docstring'''



from typing import List

from .keymap import KEYMAP, get_character


def 				lowercase_					(     __A			:							str      )							->   List[Any]:



 """simple docstring"""




 def decorator(__A			:							Tuple      ):
  lowercase       : List[Any]						=getattr(__A       ,   '''handle_key'''       ,   []      )
  handle += [key]
  setattr(__A       ,   '''handle_key'''       ,   __A      )
  return func

 return decorator


def 				lowercase_					(     *__A			:							List[str]      )							->   List[str]:



 """simple docstring"""




 def decorator(__A			:							Optional[int]      ):
  lowercase       : Union[str, Any]						=getattr(__A       ,   '''handle_key'''       ,   []      )
  handle += keys
  setattr(__A       ,   '''handle_key'''       ,   __A      )
  return func

 return decorator
class UpperCAmelCase_       (     __A					):




      """simple docstring"""




      def __new__(			cls      :		Dict  ,   UpperCAmelCase      :		str  ,   UpperCAmelCase      :		Any  ,   UpperCAmelCase      :		Optional[Any]		)	->	str:


       '''simple docstring'''

       lowercase       : str						=super().__new__(cls  ,   UpperCAmelCase  ,   UpperCAmelCase  ,   UpperCAmelCase		)
       if not hasattr(UpperCAmelCase  ,   '''key_handler'''		):
        setattr(UpperCAmelCase  ,   '''key_handler'''  ,   {}		)
       setattr(UpperCAmelCase  ,   '''handle_input'''  ,   KeyHandler.handle_input		)

       for value in attrs.values():
        lowercase       : Any						=getattr(UpperCAmelCase  ,   '''handle_key'''  ,   []		)
        for key in handled_keys:
         lowercase       : Dict						=value
       return new_cls






      @staticmethod
      def 					A__   (			cls      :		Union[str, Any]		)	->	Dict:


       '''simple docstring'''

       lowercase       : Tuple						=get_character()
       if char != KEYMAP["undefined"]:
        lowercase       : str						=ord(UpperCAmelCase		)
       lowercase       : Dict						=cls.key_handler.get(UpperCAmelCase		)
       if handler:
        lowercase       : Tuple						=char
        return handler(cls		)
       else:
        return None





def 				lowercase_					(     cls			:							Optional[Any]      )							->   Any:



 """simple docstring"""




 return KeyHandler(cls.__name__       ,   cls.__bases__       ,   cls.__dict__.copy()      )










'''simple docstring'''






from __future__ import annotations







def 					_a						(       _lowerCamelCase    ,	_lowerCamelCase = None    ,	_lowerCamelCase = None ) ->				None:



			"""simple docstring"""


			if start is None:
						__snake_case					:      Optional[Any]							      =     0

			if end is None:
						__snake_case					:      Optional[Any]							      =     len(_lowerCamelCase ) - 1

			if start >= end:
						return

			__snake_case					:      Tuple							      =     (start + end) // 2

			slowsort(_lowerCamelCase    ,	_lowerCamelCase    ,	_lowerCamelCase )
			slowsort(_lowerCamelCase    ,	mid + 1    ,	_lowerCamelCase )

			if sequence[end] < sequence[mid]:
						__snake_case      ,     __snake_case					:      str							      =     sequence[mid], sequence[end]

			slowsort(_lowerCamelCase    ,	_lowerCamelCase    ,	end - 1 )


if __name__ == "__main__":
	from doctest import testmod

	testmod()


