




from dataclasses import dataclass
from typing import Callable, Optional

import datasets



@dataclass
class     a  (     datasets.BuilderConfig    ):

					'''simple docstring'''





					lowerCAmelCase       : Optional[Any]     	=						None
					lowerCAmelCase       : Union[str, Any]     	=						None
					lowerCAmelCase       : Optional[int]     	=						None
					def 						lowerCamelCase_     (			self     :    Tuple       ):
									assert self.generator is not None, "generator must be specified"

									if self.gen_kwargs is None:
													UpperCAmelCase_											=  {}



class     a  (     datasets.GeneratorBasedBuilder    ):

					'''simple docstring'''





					lowerCAmelCase       : int     	=						GeneratorConfig
					def 						lowerCamelCase_     (			self     :    List[str]       ):
									return datasets.DatasetInfo(features=self.config.features       )
					def 						lowerCamelCase_     (			self     :    Any      ,					__snake_case     :    Optional[int]       ):
									return [datasets.SplitGenerator(name=datasets.Split.TRAIN      ,					gen_kwargs=self.config.gen_kwargs       )]




					def 						lowerCamelCase_     (			self     :    Optional[int]      ,					**__snake_case     :    Union[str, Any]       ):
									for idx, ex in enumerate(self.config.generator(**snake_case_       )       ):
													yield idx, ex











_lowerCamelCase    				=		10_00




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		float   )						->							float:
    return x * x




def       SCREAMING_SNAKE_CASE			( __UpperCamelCase    :		Optional[int] ,  __UpperCamelCase    :		float ,  __UpperCamelCase    :		float ,  __UpperCamelCase    :		int = 4   )						->							float:
    assert callable(
        __UpperCamelCase   ), f'the function(object) passed should be callable your input : {function}'
    assert isinstance(__UpperCamelCase ,  (float, int)   ), f'a should be float or integer your input : {a}'
    assert isinstance(function(__UpperCamelCase   ) ,  (float, int)   ), (
        "the function should return integer or float return type of your function, "
        f'{type(__UpperCamelCase   )}'
    )
    assert isinstance(__UpperCamelCase ,  (float, int)   ), f'b should be float or integer your input : {b}'
    assert (
        isinstance(__UpperCamelCase ,  __UpperCamelCase   ) and precision > 0
    ), f'precision should be positive integer your input : {precision}'

    # just applying the formula of simpson for approximate integration written in
    # mentioned article in first comment of this file and above this function

    UpperCAmelCase_											=  (b - a) / N_STEPS
    UpperCAmelCase_											=  function(__UpperCamelCase   ) + function(__UpperCamelCase   )

    for i in range(1 ,  __UpperCamelCase   ):
        UpperCAmelCase_											=  a + h * i
        result += function(__UpperCamelCase   ) * (4 if i % 2 else 2)

    result *= h / 3
    return round(__UpperCamelCase ,  __UpperCamelCase   )


if __name__ == "__main__":
 import doctest

 doctest.testmod()





