UpperCAmelCase				 =   1000







def 						UpperCAmelCase							(		lowerCAmelCase_							)						->						float:
     return x * x







def 						UpperCAmelCase							(		lowerCAmelCase_    ,   lowerCAmelCase_    ,   lowerCAmelCase_    ,   lowerCAmelCase_ = 4							)						->						float:
     assert callable(
         lowerCAmelCase_							), f"""the function(object) passed should be callable your input : {function}"""
     assert isinstance(lowerCAmelCase_    ,   (float, int)							), f"""a should be float or integer your input : {a}"""
     assert isinstance(function(lowerCAmelCase_							)    ,   (float, int)							), (
         "the function should return integer or float return type of your function, "
         f"""{type(lowerCAmelCase_							)}"""
     )
     assert isinstance(lowerCAmelCase_    ,   (float, int)							), f"""b should be float or integer your input : {b}"""
     assert (
         isinstance(lowerCAmelCase_    ,   lowerCAmelCase_							) 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

     a	:     Optional[int]						      =    (b - a) / N_STEPS
     a	:     Optional[int]						      =    function(lowerCAmelCase_							) + function(lowerCAmelCase_							)

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

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


if __name__ == "__main__":
  import doctest

  doctest.testmod()
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


UpperCAmelCase				 =   {"""configuration_pegasus""": ["""PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PegasusConfig"""]}

try:
  if not is_sentencepiece_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   ["""PegasusTokenizer"""]

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   ["""PegasusTokenizerFast"""]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   [
      """PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """PegasusForCausalLM""",
      """PegasusForConditionalGeneration""",
      """PegasusModel""",
      """PegasusPreTrainedModel""",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   [
      """TFPegasusForConditionalGeneration""",
      """TFPegasusModel""",
      """TFPegasusPreTrainedModel""",
  ]

try:
  if not is_flax_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase				 =   [
      """FlaxPegasusForConditionalGeneration""",
      """FlaxPegasusModel""",
      """FlaxPegasusPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_pegasus import PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP, PegasusConfig

  try:
    if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_pegasus import PegasusTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_pegasus_fast import PegasusTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_pegasus import (
        PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST,
        PegasusForCausalLM,
        PegasusForConditionalGeneration,
        PegasusModel,
        PegasusPreTrainedModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_pegasus import TFPegasusForConditionalGeneration, TFPegasusModel, TFPegasusPreTrainedModel

  try:
    if not is_flax_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_flax_pegasus import (
        FlaxPegasusForConditionalGeneration,
        FlaxPegasusModel,
        FlaxPegasusPreTrainedModel,
    )

else:
  import sys

  UpperCAmelCase				 =   _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)