


"""simple docstring"""



lowercase_							 =       10_00
def     UpperCAmelCase    (					_lowercase   :      float  )	->   float:


	"""simple docstring"""




	return x * x
def     UpperCAmelCase    (					_lowercase   :      List[str] ,      _lowercase   :      float ,      _lowercase   :      float ,      _lowercase   :      int = 4  )	->   float:


	"""simple docstring"""




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

	lowerCAmelCase_			       = (b - a) / N_STEPS
	lowerCAmelCase_			       = function(_lowercase  ) + function(_lowercase  )

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

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


if __name__ == "__main__":
		import doctest

		doctest.testmod()



"""simple docstring"""



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,
)


lowercase_							 =       {'configuration_pegasus': ['PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusConfig']}

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

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

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

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

try:
		if not is_flax_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase_							 =       [
		    '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

		lowercase_							 =       _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)