
from typing import List

from .keymap import KEYMAP, get_character


def  _UpperCamelCase	(						_A      )    ->  Optional[int]:





    """simple docstring"""

    def decorator(_A      ):
        _UpperCAmelCase          =   getattr(_A					,      """handle_key"""					,      []      )
        handle += [key]
        setattr(_A					,      """handle_key"""					,      _A      )
        return func

    return decorator


def  _UpperCamelCase	(						*_A      )    ->  Optional[int]:





    """simple docstring"""

    def decorator(_A      ):
        _UpperCAmelCase          =   getattr(_A					,      """handle_key"""					,      []      )
        handle += keys
        setattr(_A					,      """handle_key"""					,      _A      )
        return func

    return decorator




class 		a_						( _UpperCAmelCase	):







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






        '''simple docstring'''






        _UpperCAmelCase          =   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():
            _UpperCAmelCase          =   getattr(__UpperCamelCase     ,					"""handle_key"""     ,					[]     )
            for key in handled_keys:
                _UpperCAmelCase          =   value
        return new_cls







    @staticmethod
    def      _snake_case					(			cls			:       Any     )		->Dict:






        '''simple docstring'''






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







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





    """simple docstring"""

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

"""simple docstring"""



from collections.abc import Callable

import numpy as np


def  _UpperCamelCase	(						_A					,      _A					,      _A					,      _A					,      _A      )    ->  np.array:





    """simple docstring"""

    _UpperCAmelCase          =   int(np.ceil((x_end - xa) / step_size      )      )
    _UpperCAmelCase          =   np.zeros((n + 1,)      )
    _UpperCAmelCase          =   ya
    _UpperCAmelCase          =   xa

    for k in range(_A      ):
        _UpperCAmelCase          =   y[k] + step_size * ode_func(_A					,      y[k]      )
        _UpperCAmelCase          =   y[k] + (
            (step_size / 2) * (ode_func(_A					,      y[k]      ) + ode_func(x + step_size					,      _A      ))
        )
        x += step_size

    return y


if __name__ == "__main__":
 import doctest

 doctest.testmod()