






'''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    _lowerCAmelCase			(		unittest.TestCase      ):



				"""simple docstring"""



				@require_torch
				def 					__magic_name__							(      self    :    str):






											'''simple docstring'''







											snake_case__	  =       pipeline(
											    task="""zero-shot-audio-classification"""			,		model="""hf-internal-testing/tiny-clap-htsat-unfused""")
											snake_case__	  =       load_dataset("""ashraq/esc50""")
											snake_case__	  =       dataset["""train"""]["""audio"""][-1]["""array"""]
											snake_case__	  =       audio_classifier(UpperCamelCase__			,		candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""])
											self.assertEqual(
											    nested_simplify(UpperCamelCase__)			,		[{"""score""": 0.5_01, """label""": """Sound of a dog"""}, {"""score""": 0.4_99, """label""": """Sound of vaccum cleaner"""}]			,		)



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






											'''simple docstring'''







											pass



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






											'''simple docstring'''







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

											self.assertEqual(
											    nested_simplify(UpperCamelCase__)			,		[
											        {"""score""": 0.9_99, """label""": """Sound of a dog"""},
											        {"""score""": 0.0_01, """label""": """Sound of vaccum cleaner"""},
											    ]			,		)

											snake_case__	  =       audio_classifier([audio] * 5			,		candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""])
											self.assertEqual(
											    nested_simplify(UpperCamelCase__)			,		[
											        [
											            {"""score""": 0.9_99, """label""": """Sound of a dog"""},
											            {"""score""": 0.0_01, """label""": """Sound of vaccum cleaner"""},
											        ],
											    ]
											    * 5			,		)
											snake_case__	  =       audio_classifier(
											    [audio] * 5			,		candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]			,		batch_size=5)
											self.assertEqual(
											    nested_simplify(UpperCamelCase__)			,		[
											        [
											            {"""score""": 0.9_99, """label""": """Sound of a dog"""},
											            {"""score""": 0.0_01, """label""": """Sound of vaccum cleaner"""},
											        ],
											    ]
											    * 5			,		)



				@unittest.skip("""No models are available in TF""")
				def 					__magic_name__							(      self    :    List[str]):






											'''simple docstring'''







											pass








import random
from typing import Any

def _UpperCAmelCase   (	a						:	list ):
							for _ in range(len(a ) ):
														snake_case__	  =       random.randint(0  ,					len(a ) - 1 )
														snake_case__	  =       random.randint(0  ,					len(a ) - 1 )
														snake_case__  , snake_case__	  =       data[b], data[a]
							return data


if __name__ == "__main__":
	a__       =     [0, 1, 2, 3, 4, 5, 6, 7]
	a__       =     ["""python""", """says""", """hello""", """!"""]
	print("""Fisher-Yates Shuffle:""")
	print("""List""", integers, strings)
	print("""FY Shuffle""", fisher_yates_shuffle(integers), fisher_yates_shuffle(strings))
