



"""simple docstring"""
from typing import List

from .keymap import KEYMAP, get_character

def       _snake_case						(						UpperCamelCase						:		str						):

 def decorator(UpperCamelCase						:		Union[str, Any]						):
  UpperCAmelCase	:					List[str]	=	getattr(UpperCamelCase			,		"""handle_key"""			,		[]						)
  handle += [key]
  setattr(UpperCamelCase			,		"""handle_key"""			,		UpperCamelCase						)
  return func

 return decorator

def       _snake_case						(						*UpperCamelCase						:		List[str]						):

 def decorator(UpperCamelCase						:		str						):
  UpperCAmelCase	:					Tuple	=	getattr(UpperCamelCase			,		"""handle_key"""			,		[]						)
  handle += keys
  setattr(UpperCamelCase			,		"""handle_key"""			,		UpperCamelCase						)
  return func

 return decorator



class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__ ):

   def __new__(   cls      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)  ->      Optional[Any]:





    '''simple docstring'''




    UpperCAmelCase	:					Tuple	=	super().__new__(cls      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)
    if not hasattr(_SCREAMING_SNAKE_CASE      ,     """key_handler"""						):
     setattr(_SCREAMING_SNAKE_CASE      ,     """key_handler"""      ,     {}						)
    setattr(_SCREAMING_SNAKE_CASE      ,     """handle_input"""      ,     KeyHandler.handle_input						)

    for value in attrs.values():
     UpperCAmelCase	:					Any	=	getattr(_SCREAMING_SNAKE_CASE      ,     """handle_key"""      ,     []						)
     for key in handled_keys:
      UpperCAmelCase	:					Optional[Any]	=	value
    return new_cls




   @staticmethod
   def 	SCREAMING_SNAKE_CASE     (   cls						)  ->      Dict:





    '''simple docstring'''




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

def       _snake_case						(						cls						:		Tuple						):
 return KeyHandler(cls.__name__			,		cls.__bases__			,		cls.__dict__.copy()						)





"""simple docstring"""
from collections.abc import Callable

import numpy as np

def       _snake_case						(						UpperCamelCase						:		Callable			,		UpperCamelCase						:		float			,		UpperCamelCase						:		float			,		UpperCamelCase						:		float			,		UpperCamelCase						:		float						):
 UpperCAmelCase	:					Any	=	int(np.ceil((x_end - xa) / step_size						)						)
 UpperCAmelCase	:					Optional[Any]	=	np.zeros((n + 1,)						)
 UpperCAmelCase	:					Optional[int]	=	ya
 UpperCAmelCase	:					int	=	xa

 for k in range(UpperCamelCase						):
  UpperCAmelCase	:					Optional[int]	=	y[k] + step_size * ode_func(UpperCamelCase			,		y[k]						)
  UpperCAmelCase	:					Optional[int]	=	y[k] + (
      (step_size / 2) * (ode_func(UpperCamelCase			,		y[k]						) + ode_func(x + step_size			,		UpperCamelCase						))
  )
  x += step_size

 return y


if __name__ == "__main__":
      import doctest

      doctest.testmod()
