





from typing import Dict

from .base import GenericTensor, Pipeline


class   A      (SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''




			def        a_	(      self       :   List[Any]							,     __lowerCAmelCase       :   Any=None							,     __lowerCAmelCase       :   Any=None							,     __lowerCAmelCase       :   str=None							,     **__lowerCAmelCase       :   Optional[Any]       )     ->     List[str]:







					"""simple docstring"""






					if tokenize_kwargs is None:
							A__  				=       {}

					if truncation is not None:
							if "truncation" in tokenize_kwargs:
									raise ValueError(
									    """truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)"""       )
							A__  				=       truncation

					A__  				=       tokenize_kwargs

					A__  				=       {}
					if return_tensors is not None:
							A__  				=       return_tensors

					return preprocess_params, {}, postprocess_params






			def        a_	(      self       :   Union[str, Any]							,     __lowerCAmelCase       :   Union[str, Any]							,     **__lowerCAmelCase       :   List[str]       )     ->     Dict[str, GenericTensor]:







					"""simple docstring"""






					A__  				=       self.framework
					A__  				=       self.tokenizer(__lowerCAmelCase							,     return_tensors=__lowerCAmelCase							,     **__lowerCAmelCase       )
					return model_inputs






			def        a_	(      self       :   str							,     __lowerCAmelCase       :   Any       )     ->     Union[str, Any]:







					"""simple docstring"""






					A__  				=       self.model(**__lowerCAmelCase       )
					return model_outputs






			def        a_	(      self       :   str							,     __lowerCAmelCase       :   Union[str, Any]							,     __lowerCAmelCase       :   List[str]=False       )     ->     Dict:







					"""simple docstring"""






					if return_tensors:
							return model_outputs[0]
					if self.framework == "pt":
							return model_outputs[0].tolist()
					elif self.framework == "tf":
							return model_outputs[0].numpy().tolist()







			def __call__(      self       :   str							,     *__lowerCAmelCase       :   Union[str, Any]							,     **__lowerCAmelCase       :   List[str]       )     ->     Dict:







					"""simple docstring"""






					return super().__call__(*__lowerCAmelCase							,     **__lowerCAmelCase       )










def        __lowerCamelCase (							__a       :float   ,					__a       :list[float]   )		->    float:






		"""simple docstring"""

		if discount_rate < 0:
				raise ValueError("""Discount rate cannot be negative"""   )
		if not cash_flows:
				raise ValueError("""Cash flows list cannot be empty"""   )
		A__  				=       sum(
		    cash_flow / ((1 + discount_rate) ** i) for i, cash_flow in enumerate(__a   )   )
		return round(__a   ,					ndigits=2   )


if __name__ == "__main__":
					import doctest

					doctest.testmod()



