

from typing import List

from .keymap import KEYMAP, get_character



def    __UpperCAmelCase (	__a      :			str	)			->     Dict:

					"""simple docstring"""

					def decorator(__a      :			List[Any]	):
										_a	:    Dict         =		getattr(__a		,'''handle_key'''		,[]	)
										handle += [key]
										setattr(__a		,'''handle_key'''		,__a	)
										return func

					return decorator



def    __UpperCAmelCase (	*__a      :			List[str]	)			->     Tuple:

					"""simple docstring"""

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

					return decorator

class 				UpperCAmelCase_		(			__lowercase   ):
							"""simple docstring"""







							def __new__(			cls       ,							_a       ,							_a       ,							_a       )    ->    Dict:
												_a	:    Optional[Any]         =		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():
																	_a	:    List[Any]         =		getattr(_a       ,							'''handle_key'''       ,							[]       )
																	for key in handled_keys:
																						_a	:    Tuple         =		value
												return new_cls




							@staticmethod
							def 				__lowercase				(			cls       )    ->    List[Any]:
												_a	:    Optional[Any]         =		get_character()
												if char != KEYMAP["undefined"]:
																	_a	:    List[str]         =		ord(_a       )
												_a	:    Tuple         =		cls.key_handler.get(_a       )
												if handler:
																	_a	:    int         =		char
																	return handler(cls       )
												else:
																	return None



def    __UpperCAmelCase (	cls      :			Any	)			->     Any:

					"""simple docstring"""

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






def    __UpperCAmelCase (	__a      :			str	)			->     int:

					"""simple docstring"""

					assert column_title.isupper()
					_a	:    Optional[Any]         =		0
					_a	:    List[Any]         =		len(__a	) - 1
					_a	:    List[str]         =		0

					while index >= 0:
										_a	:    Dict         =		(ord(column_title[index]	) - 64) * pow(26		,__a	)
										answer += value
										power += 1
										index -= 1

					return answer


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

			testmod()



