
import unittest

from huggingface_hub import hf_hub_download

from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor
from transformers.pipelines import VideoClassificationPipeline, pipeline
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_decord,
    require_tf,
    require_torch,
    require_torch_or_tf,
    require_vision,
)

from .test_pipelines_common import ANY



@is_pipeline_test
@require_torch_or_tf
@require_vision
@require_decord
class    a_ (			unittest.TestCase    ):
			a	:			Dict					   =							MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING






			def    UpperCamelCase_				(      self				,			__UpperCamelCase				,			__UpperCamelCase				,			__UpperCamelCase  ):
									_lowercase					       =					hf_hub_download(
									    repo_id="""nateraw/video-demo"""				,			filename="""archery.mp4"""				,			repo_type="""dataset"""  )
									_lowercase					       =					VideoClassificationPipeline(model=A_				,			image_processor=A_				,			top_k=2  )
									_lowercase					       =					[
									    example_video_filepath,
									    """https://huggingface.co/datasets/nateraw/video-demo/resolve/main/archery.mp4""",
									]
									return video_classifier, examples






			def    UpperCamelCase_				(      self				,			__UpperCamelCase				,			__UpperCamelCase  ):
									for example in examples:
															_lowercase					       =					video_classifier(A_  )

															self.assertEqual(
															    A_				,			[
															        {"""score""": ANY(A_  ), """label""": ANY(A_  )},
															        {"""score""": ANY(A_  ), """label""": ANY(A_  )},
															    ]				,			)






			@require_torch
			def    UpperCamelCase_				(      self  ):
									_lowercase					       =					"""hf-internal-testing/tiny-random-VideoMAEForVideoClassification"""
									_lowercase					       =					VideoMAEFeatureExtractor(
									    size={"""shortest_edge""": 10}				,			crop_size={"""height""": 10, """width""": 10}  )
									_lowercase					       =					pipeline(
									    """video-classification"""				,			model=A_				,			feature_extractor=A_				,			frame_sampling_rate=4  )

									_lowercase					       =					hf_hub_download(repo_id="""nateraw/video-demo"""				,			filename="""archery.mp4"""				,			repo_type="""dataset"""  )
									_lowercase					       =					video_classifier(A_				,			top_k=2  )
									self.assertEqual(
									    nested_simplify(A_				,			decimals=4  )				,			[{"""score""": 0.51_99, """label""": """LABEL_0"""}, {"""score""": 0.48_01, """label""": """LABEL_1"""}]				,			)

									_lowercase					       =					video_classifier(
									    [
									        video_file_path,
									        video_file_path,
									    ]				,			top_k=2				,			)
									self.assertEqual(
									    nested_simplify(A_				,			decimals=4  )				,			[
									        [{"""score""": 0.51_99, """label""": """LABEL_0"""}, {"""score""": 0.48_01, """label""": """LABEL_1"""}],
									        [{"""score""": 0.51_99, """label""": """LABEL_0"""}, {"""score""": 0.48_01, """label""": """LABEL_1"""}],
									    ]				,			)






			@require_tf
			def    UpperCamelCase_				(      self  ):
									pass

"""simple docstring"""


from maths.prime_check import is_prime






def    _snake_case					(		snake_case__ :  int  ):
	if not isinstance(snake_case__						,   snake_case__  ):
		A     = F'Input value of [number={number}] must be an integer'
		raise TypeError(snake_case__  )
	if is_prime(snake_case__  ) and is_prime(number + 2  ):
		return number + 2
	else:
		return -1


if __name__ == "__main__":
		import doctest

		doctest.testmod()