

'''simple docstring'''


import unittest

from datasets import load_dataset

from transformers.pipelines import pipeline
from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow




@is_pipeline_test
@require_torch
class     a			(				unittest.TestCase       ):






						"""simple docstring"""




						@require_torch
						def       __magic_name__							(							self					:      Tuple  ):



								'''simple docstring'''



								snake_case__						:       Any       						=  pipeline(
								    task='''zero-shot-audio-classification'''			,			model='''hf-internal-testing/tiny-clap-htsat-unfused'''  )
								snake_case__						:       Union[str, Any]       						=  load_dataset('''ashraq/esc50'''  )
								snake_case__						:       Optional[int]       						=  dataset['''train''']['''audio'''][-1]['''array''']
								snake_case__						:       Any       						=  audio_classifier(snake_case_			,			candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']  )
								self.assertEqual(
								    nested_simplify(snake_case_  )			,			[{'''score''': 0.5_0_1, '''label''': '''Sound of a dog'''}, {'''score''': 0.4_9_9, '''label''': '''Sound of vaccum cleaner'''}]			,			)







						@unittest.skip('''No models are available in TF'''  )
						def       __magic_name__							(							self					:      str  ):



								'''simple docstring'''



								pass







						@slow
						@require_torch
						def       __magic_name__							(							self					:      List[str]  ):



								'''simple docstring'''



								snake_case__						:       int       						=  pipeline(
								    task='''zero-shot-audio-classification'''			,			model='''laion/clap-htsat-unfused'''			,			)
								# This is an audio of a dog
								snake_case__						:       Any       						=  load_dataset('''ashraq/esc50'''  )
								snake_case__						:       List[Any]       						=  dataset['''train''']['''audio'''][-1]['''array''']
								snake_case__						:       List[Any]       						=  audio_classifier(snake_case_			,			candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']  )

								self.assertEqual(
								    nested_simplify(snake_case_  )			,			[
								        {'''score''': 0.9_9_9, '''label''': '''Sound of a dog'''},
								        {'''score''': 0.0_0_1, '''label''': '''Sound of vaccum cleaner'''},
								    ]			,			)

								snake_case__						:       int       						=  audio_classifier([audio] * 5			,			candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']  )
								self.assertEqual(
								    nested_simplify(snake_case_  )			,			[
								        [
								            {'''score''': 0.9_9_9, '''label''': '''Sound of a dog'''},
								            {'''score''': 0.0_0_1, '''label''': '''Sound of vaccum cleaner'''},
								        ],
								    ]
								    * 5			,			)
								snake_case__						:       Any       						=  audio_classifier(
								    [audio] * 5			,			candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']			,			batch_size=5  )
								self.assertEqual(
								    nested_simplify(snake_case_  )			,			[
								        [
								            {'''score''': 0.9_9_9, '''label''': '''Sound of a dog'''},
								            {'''score''': 0.0_0_1, '''label''': '''Sound of vaccum cleaner'''},
								        ],
								    ]
								    * 5			,			)







						@unittest.skip('''No models are available in TF'''  )
						def       __magic_name__							(							self					:      Optional[int]  ):



								'''simple docstring'''



								pass






'''simple docstring'''


def 	_a       (				__lowerCAmelCase		:      float   ,							__lowerCAmelCase		:      float   ,							__lowerCAmelCase		:      int     ):

		"""simple docstring"""

		if principal <= 0:
				raise Exception('''Principal borrowed must be > 0'''     )
		if rate_per_annum < 0:
				raise Exception('''Rate of interest must be >= 0'''     )
		if years_to_repay <= 0 or not isinstance(__lowerCAmelCase   ,							__lowerCAmelCase     ):
				raise Exception('''Years to repay must be an integer > 0'''     )

		# Yearly rate is divided by 12 to get monthly rate
		snake_case__						:       int       						=  rate_per_annum / 12

		# Years to repay is multiplied by 12 to get number of payments as payment is monthly
		snake_case__						:       Tuple       						=  years_to_repay * 12

		return (
		    principal
		    * rate_per_month
		    * (1 + rate_per_month) ** number_of_payments
		    / ((1 + rate_per_month) ** number_of_payments - 1)
		)


if __name__ == "__main__":
					import doctest

					doctest.testmod()



