

'''simple docstring'''
from typing import List

from .keymap import KEYMAP, get_character


def 	_lowerCAmelCase (						_UpperCamelCase						:					str    )				->      Dict:
     """simple docstring"""




     def decorator(_UpperCamelCase						:					Optional[int]    ):
          _SCREAMING_SNAKE_CASE							   =getattr(_UpperCamelCase							,			'handle_key'							,			[]    )
          handle += [key]
          setattr(_UpperCamelCase							,			'handle_key'							,			_UpperCamelCase    )
          return func

     return decorator


def 	_lowerCAmelCase (						*_UpperCamelCase						:					List[str]    )				->      Tuple:
     """simple docstring"""




     def decorator(_UpperCamelCase						:					Any    ):
          _SCREAMING_SNAKE_CASE							   =getattr(_UpperCamelCase							,			'handle_key'							,			[]    )
          handle += keys
          setattr(_UpperCamelCase							,			'handle_key'							,			_UpperCamelCase    )
          return func

     return decorator







class 							A__   (	A__  ):





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





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =super().__new__(cls							, _a							, _a							, _a			)
       if not hasattr(_a							, 'key_handler'			):
            setattr(_a							, 'key_handler'							, {}			)
       setattr(_a							, 'handle_input'							, KeyHandler.handle_input			)

       for value in attrs.values():
            _SCREAMING_SNAKE_CASE							   =getattr(_a							, 'handle_key'							, []			)
            for key in handled_keys:
                 _SCREAMING_SNAKE_CASE							   =value
       return new_cls





  @staticmethod
  def 						A  (		cls				:     int			)     ->   Tuple:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE							   =get_character()
       if char != KEYMAP["undefined"]:
            _SCREAMING_SNAKE_CASE							   =ord(_a			)
       _SCREAMING_SNAKE_CASE							   =cls.key_handler.get(_a			)
       if handler:
            _SCREAMING_SNAKE_CASE							   =char
            return handler(cls			)
       else:
            return None


def 	_lowerCAmelCase (						cls						:					int    )				->      Optional[int]:
     """simple docstring"""




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



'''simple docstring'''
def 	_lowerCAmelCase (						_UpperCamelCase						:					str    )				->      bool:
     """simple docstring"""




     _SCREAMING_SNAKE_CASE							   =0
     for ch in input_str:
          _SCREAMING_SNAKE_CASE							   =ord(_UpperCamelCase    )
          _SCREAMING_SNAKE_CASE							   =pow(2							,			_UpperCamelCase    )

          # If we already turned on bit for current character's unicode
          if bitmap >> ch_unicode & 1 == 1:
               return False
          bitmap |= ch_bit_index_on
     return True


if __name__ == "__main__":
     import doctest

     doctest.testmod()
