



'''simple docstring'''






from string import ascii_uppercase

A_							: Dict						 =	{str(ord(c) - 5_5): c for c in ascii_uppercase}




def     snake_case_					(     lowerCAmelCase_       ,   lowerCAmelCase_		)->		Tuple:





       '''simple docstring'''


       if isinstance(lowerCAmelCase_       ,   lowerCAmelCase_		):
              raise TypeError("""int() can't convert non-string with explicit base"""		)
       if num < 0:
              raise ValueError("""parameter must be positive int"""		)
       if isinstance(lowerCAmelCase_       ,   lowerCAmelCase_		):
              raise TypeError("""'str' object cannot be interpreted as an integer"""		)
       if isinstance(lowerCAmelCase_       ,   lowerCAmelCase_		):
              raise TypeError("""'float' object cannot be interpreted as an integer"""		)
       if base in (0, 1):
              raise ValueError("""base must be >= 2"""		)
       if base > 36:
              raise ValueError("""base must be <= 36"""		)
       _UpperCAmelCase  :						str			     = ""
       _UpperCAmelCase  :						Optional[Any]			     = 0
       _UpperCAmelCase  :						List[Any]			     = 0
       while div != 1:
              _UpperCAmelCase  :						Optional[Any]			     = divmod(lowerCAmelCase_       ,   lowerCAmelCase_		)
              if base >= 11 and 9 < mod < 36:
                     _UpperCAmelCase  :						int			     = ALPHABET_VALUES[str(lowerCAmelCase_		)]
              else:
                     _UpperCAmelCase  :						List[str]			     = str(lowerCAmelCase_		)
              new_value += actual_value
              _UpperCAmelCase  :						Dict			     = num // base
              _UpperCAmelCase  :						Tuple			     = div
              if div == 0:
                     return str(new_value[::-1]		)
              elif div == 1:
                     new_value += str(lowerCAmelCase_		)
                     return str(new_value[::-1]		)

       return new_value[::-1]


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   for base in range(2, 3_7):
      for num in range(1_0_0_0):
         assert int(decimal_to_any(num, base), base) == num, (
             num,
             base,
             decimal_to_any(num, base),
             int(decimal_to_any(num, base), base),
         )







"""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       SCREAMING_SNAKE_CASE__				(		unittest.TestCase				):
       """simple docstring"""


       a  :				int   =MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING

       def        lowercase__							(						self		,     snake_case__		,     snake_case__		,     snake_case__						):






         """simple docstring"""





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

       def        lowercase__							(						self		,     snake_case__		,     snake_case__						):






         """simple docstring"""





         for example in examples:
           lowerCAmelCase     :     str								=							video_classifier(snake_case__						)

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

       @require_torch
       def        lowercase__							(						self						):






         """simple docstring"""





         lowerCAmelCase     :     Union[str, Any]								=							"hf-internal-testing/tiny-random-VideoMAEForVideoClassification"
         lowerCAmelCase     :     str								=							VideoMAEFeatureExtractor(
             size={"shortest_edge": 10}		,     crop_size={"height": 10, "width": 10}						)
         lowerCAmelCase     :     int								=							pipeline(
             "video-classification"		,     model=snake_case__		,     feature_extractor=snake_case__		,     frame_sampling_rate=4						)

         lowerCAmelCase     :     Optional[int]								=							hf_hub_download(repo_id="nateraw/video-demo"		,     filename="archery.mp4"		,     repo_type="dataset"						)
         lowerCAmelCase     :     Union[str, Any]								=							video_classifier(snake_case__		,     top_k=2						)
         self.assertEqual(
             nested_simplify(snake_case__		,     decimals=4						)		,     [{"score": 0.5199, "label": "LABEL_0"}, {"score": 0.4801, "label": "LABEL_1"}]		,     )

         lowerCAmelCase     :     Tuple								=							video_classifier(
             [
                 video_file_path,
                 video_file_path,
             ]		,     top_k=2		,     )
         self.assertEqual(
             nested_simplify(snake_case__		,     decimals=4						)		,     [
                 [{"score": 0.5199, "label": "LABEL_0"}, {"score": 0.4801, "label": "LABEL_1"}],
                 [{"score": 0.5199, "label": "LABEL_0"}, {"score": 0.4801, "label": "LABEL_1"}],
             ]		,     )







       @require_tf
       def        lowercase__							(						self						):






         """simple docstring"""





         pass





