


'''simple docstring'''






from collections.abc import Callable

import numpy as np


def    _snake_case  (	A					,       A					,       A					,       A					,       A			)		->       np.array:
							lowerCAmelCase__			  =      int(np.ceil((x_end - xa) / step_size			)			)
							lowerCAmelCase__			  =      np.zeros((n + 1,)			)
							lowerCAmelCase__			  =      ya
							lowerCAmelCase__			  =      xa

							for k in range(A			):
														lowerCAmelCase__			  =      y[k] + step_size * ode_func(A					,       y[k]			)
														lowerCAmelCase__			  =      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()







"""simple docstring"""
import functools
import logging
import os
import sys
import threading
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

import huggingface_hub.utils as hf_hub_utils
from tqdm import auto as tqdm_lib


lowerCAmelCase__    						=			threading.Lock()
lowerCAmelCase__    						=			None

lowerCAmelCase__    						=			{
    'debug': logging.DEBUG,
    'info': logging.INFO,
    'warning': logging.WARNING,
    'error': logging.ERROR,
    'critical': logging.CRITICAL,
}

lowerCAmelCase__    						=			logging.WARNING

lowerCAmelCase__    						=			True





def 				lowercase__		(					):
				_SCREAMING_SNAKE_CASE   :		int       		=    os.getenv('TRANSFORMERS_VERBOSITY',						lowerCamelCase       )
				if env_level_str:
								if env_level_str in log_levels:
												return log_levels[env_level_str]
								else:
												logging.getLogger().warning(
												    f"""Unknown option TRANSFORMERS_VERBOSITY={env_level_str}, """
												    f"""has to be one of: { ", ".join(log_levels.keys()       ) }"""       )
				return _default_log_level





def 				lowercase__		(					):
				return __name__.split('.'       )[0]





def 				lowercase__		(					):
				return logging.getLogger(_get_library_name()       )





def 				lowercase__		(					):
				global _default_handler

				with _lock:
								if _default_handler:
												# This library has already configured the library root logger.
												return
								_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    logging.StreamHandler()  # Set sys.stderr as stream.
								_SCREAMING_SNAKE_CASE   :		Tuple       		=    sys.stderr.flush

								# Apply our default configuration to the library root logger.
								_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    _get_library_root_logger()
								library_root_logger.addHandler(_default_handler       )
								library_root_logger.setLevel(_get_default_logging_level()       )
								_SCREAMING_SNAKE_CASE   :		int       		=    False





def 				lowercase__		(					):
				global _default_handler

				with _lock:
								if not _default_handler:
												return

								_SCREAMING_SNAKE_CASE   :		Any       		=    _get_library_root_logger()
								library_root_logger.removeHandler(_default_handler       )
								library_root_logger.setLevel(logging.NOTSET       )
								_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    None





def 				lowercase__		(					):
				return log_levels





def 				lowercase__		(					lowerCamelCase = None       ):

				if name is None:
								_SCREAMING_SNAKE_CASE   :		Tuple       		=    _get_library_name()

				_configure_library_root_logger()
				return logging.getLogger(lowerCamelCase       )





def 				lowercase__		(					):
				_configure_library_root_logger()
				return _get_library_root_logger().getEffectiveLevel()





def 				lowercase__		(					lowerCamelCase       ):
				_configure_library_root_logger()
				_get_library_root_logger().setLevel(lowerCamelCase       )





def 				lowercase__		(					):
				return set_verbosity(lowerCamelCase       )





def 				lowercase__		(					):
				return set_verbosity(lowerCamelCase       )





def 				lowercase__		(					):
				return set_verbosity(lowerCamelCase       )





def 				lowercase__		(					):
				return set_verbosity(lowerCamelCase       )





def 				lowercase__		(					):
				_configure_library_root_logger()

				assert _default_handler is not None
				_get_library_root_logger().removeHandler(_default_handler       )





def 				lowercase__		(					):
				_configure_library_root_logger()

				assert _default_handler is not None
				_get_library_root_logger().addHandler(_default_handler       )





def 				lowercase__		(					lowerCamelCase       ):
				_configure_library_root_logger()

				assert handler is not None
				_get_library_root_logger().addHandler(lowerCamelCase       )





def 				lowercase__		(					lowerCamelCase       ):
				_configure_library_root_logger()

				assert handler is not None and handler not in _get_library_root_logger().handlers
				_get_library_root_logger().removeHandler(lowerCamelCase       )





def 				lowercase__		(					):
				_configure_library_root_logger()
				_SCREAMING_SNAKE_CASE   :		List[str]       		=    False





def 				lowercase__		(					):
				_configure_library_root_logger()
				_SCREAMING_SNAKE_CASE   :		int       		=    True





def 				lowercase__		(					):
				_SCREAMING_SNAKE_CASE   :		Any       		=    _get_library_root_logger().handlers

				for handler in handlers:
								_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    logging.Formatter('[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s'       )
								handler.setFormatter(lowerCamelCase       )





def 				lowercase__		(					):
				_SCREAMING_SNAKE_CASE   :		List[str]       		=    _get_library_root_logger().handlers

				for handler in handlers:
								handler.setFormatter(lowerCamelCase       )





def 				lowercase__		(					self,						*lowerCamelCase,						**lowerCamelCase       ):
				_SCREAMING_SNAKE_CASE   :		str       		=    os.getenv('TRANSFORMERS_NO_ADVISORY_WARNINGS',						lowerCamelCase       )
				if no_advisory_warnings:
								return
				self.warning(*lowerCamelCase,						**lowerCamelCase       )


lowerCAmelCase__    						=			warning_advice





@functools.lru_cache(lowerCamelCase       )
def 				lowercase__		(					self,						*lowerCamelCase,						**lowerCamelCase       ):
				self.warning(*lowerCamelCase,						**lowerCamelCase       )


lowerCAmelCase__    						=			warning_once


class _lowerCAmelCase						:







						def __init__(    self   ,				*lowerCAmelCase_   ,				**lowerCAmelCase_							)		->							Optional[int]:  # pylint: disable=unused-argument
										_SCREAMING_SNAKE_CASE   :		Tuple       		=    args[0] if args else None







						def __iter__(    self							)		->							Dict:
										return iter(self._iterator							)







						def __getattr__(    self   ,				lowerCAmelCase_							)		->							Tuple:

										def empty_fn(*lowerCAmelCase_   ,				**lowerCAmelCase_							):  # pylint: disable=unused-argument
														return

										return empty_fn







						def __enter__(    self							)		->							List[Any]:
										return self







						def __exit__(    self   ,				lowerCAmelCase_   ,				lowerCAmelCase_   ,				lowerCAmelCase_							)		->							Optional[Any]:
										return







class _lowerCAmelCase						:







						def __call__(    self   ,				*lowerCAmelCase_   ,				**lowerCAmelCase_							)		->							Optional[Any]:
										if _tqdm_active:
														return tqdm_lib.tqdm(*lowerCAmelCase_   ,				**lowerCAmelCase_							)
										else:
														return EmptyTqdm(*lowerCAmelCase_   ,				**lowerCAmelCase_							)







						def 			A      (    self   ,				*lowerCAmelCase_   ,				**lowerCAmelCase_							)		->							List[str]:
										_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    None
										if _tqdm_active:
														return tqdm_lib.tqdm.set_lock(*lowerCAmelCase_   ,				**lowerCAmelCase_							)







						def 			A      (    self							)		->							Any:
										if _tqdm_active:
														return tqdm_lib.tqdm.get_lock()







lowerCAmelCase__    						=			_tqdm_cls()





def 				lowercase__		(					):
				global _tqdm_active
				return bool(_tqdm_active       )





def 				lowercase__		(					):
				global _tqdm_active
				_SCREAMING_SNAKE_CASE   :		int       		=    True
				hf_hub_utils.enable_progress_bars()






def 				lowercase__		(					):
				global _tqdm_active
				_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    False
				hf_hub_utils.disable_progress_bars()

