



"""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 				UpperCamelCase__       (     unittest.TestCase  ):




      """simple docstring"""




      @require_torch
      def 					SCREAMING_SNAKE_CASE__			(				self    :				Any	):
        lowerCAmelCase_       :    str								=			pipeline(
            task='zero-shot-audio-classification'   ,      model='hf-internal-testing/tiny-clap-htsat-unfused'	)
        lowerCAmelCase_       :    Tuple								=			load_dataset('ashraq/esc50'	)
        lowerCAmelCase_       :    Optional[Any]								=			dataset['train']['audio'][-1]['array']
        lowerCAmelCase_       :    int								=			audio_classifier(SCREAMING_SNAKE_CASE_   ,      candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']	)
        self.assertEqual(
            nested_simplify(SCREAMING_SNAKE_CASE_	)   ,      [{'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 					SCREAMING_SNAKE_CASE__			(				self    :				Dict	):
        pass



      @slow
      @require_torch
      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[Any]	):
        lowerCAmelCase_       :    int								=			pipeline(
            task='zero-shot-audio-classification'   ,      model='laion/clap-htsat-unfused'   ,      )
        # This is an audio of a dog
        lowerCAmelCase_       :    List[Any]								=			load_dataset('ashraq/esc50'	)
        lowerCAmelCase_       :    Any								=			dataset['train']['audio'][-1]['array']
        lowerCAmelCase_       :    Tuple								=			audio_classifier(SCREAMING_SNAKE_CASE_   ,      candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']	)

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

        lowerCAmelCase_       :    Optional[int]								=			audio_classifier([audio] * 5   ,      candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']	)
        self.assertEqual(
            nested_simplify(SCREAMING_SNAKE_CASE_	)   ,      [
                [
                    {'score': 0.9_99, 'label': 'Sound of a dog'},
                    {'score': 0.0_01, 'label': 'Sound of vaccum cleaner'},
                ],
            ]
            * 5   ,      )
        lowerCAmelCase_       :    Tuple								=			audio_classifier(
            [audio] * 5   ,      candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']   ,      batch_size=5	)
        self.assertEqual(
            nested_simplify(SCREAMING_SNAKE_CASE_	)   ,      [
                [
                    {'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 					SCREAMING_SNAKE_CASE__			(				self    :				List[Any]	):
        pass










"""simple docstring"""







import re

def     UpperCamelCase_   (   lowerCAmelCase__				:    str						)						->       bool:

  """simple docstring"""




  lowerCAmelCase_       :    str								=			re.compile(
      R'^(?:0|94|\+94|0{2}94)' R'7(0|1|2|4|5|6|7|8)' R'(-| |)' R'\d{7}$'						)

  return bool(re.search(lowerCAmelCase__   ,       lowerCAmelCase__						)						)


if __name__ == "__main__":
     lowercase__		:    Optional[int]				   =     """0094702343221"""

     print(is_sri_lankan_phone_number(phone))





