





"""simple docstring"""


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

			"""simple docstring"""
			__lowerCAmelCase     :				Any										=  MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING







			def   _a      (      self						,   _A						,   _A						,   _A    ):






									'''simple docstring'''







									UpperCamelCase				:		Dict				   =			hf_hub_download(
									    repo_id="""nateraw/video-demo"""						,   filename="""archery.mp4"""						,   repo_type="""dataset"""    )
									UpperCamelCase				:		Union[str, Any]				   =			VideoClassificationPipeline(model=_A						,   image_processor=_A						,   top_k=2    )
									UpperCamelCase				:		Dict				   =			[
									    example_video_filepath,
									    """https://huggingface.co/datasets/nateraw/video-demo/resolve/main/archery.mp4""",
									]
									return video_classifier, examples







			def   _a      (      self						,   _A						,   _A    ):






									'''simple docstring'''







									for example in examples:
															UpperCamelCase				:		str				   =			video_classifier(_A    )

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







			@require_torch
			def   _a      (      self    ):






									'''simple docstring'''







									UpperCamelCase				:		List[str]				   =			"""hf-internal-testing/tiny-random-VideoMAEForVideoClassification"""
									UpperCamelCase				:		Dict				   =			VideoMAEFeatureExtractor(
									    size={"""shortest_edge""": 1_0}						,   crop_size={"""height""": 1_0, """width""": 1_0}    )
									UpperCamelCase				:		Union[str, Any]				   =			pipeline(
									    """video-classification"""						,   model=_A						,   feature_extractor=_A						,   frame_sampling_rate=4    )

									UpperCamelCase				:		List[Any]				   =			hf_hub_download(repo_id="""nateraw/video-demo"""						,   filename="""archery.mp4"""						,   repo_type="""dataset"""    )
									UpperCamelCase				:		str				   =			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"""}]						,   )

									UpperCamelCase				:		List[Any]				   =			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   _a      (      self    ):






									'''simple docstring'''







									pass










"""simple docstring"""


from math import ceil, sqrt

def      UpperCamelCase							(SCREAMING_SNAKE_CASE = 100_0000     ):
						UpperCamelCase				:		int				   =			0

						for outer_width in range(3							,     (limit // 4) + 2     ):
												if outer_width**2 > limit:
																		UpperCamelCase				:		Optional[Any]				   =			max(ceil(sqrt(outer_width**2 - limit     )     )							,     1     )
												else:
																		UpperCamelCase				:		str				   =			1
												if (outer_width - hole_width_lower_bound) % 2:
																		hole_width_lower_bound += 1

												answer += (outer_width - hole_width_lower_bound - 2) // 2 + 1

						return answer


if __name__ == "__main__":
		print(f'''{solution() = }''')



