




'''simple docstring'''
import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs


if is_torch_available():
  import torch

if is_vision_available():
  from PIL import Image

  from transformers import VideoMAEImageProcessor






class 	SCREAMING_SNAKE_CASE(    unittest.TestCase					):

       def __init__(   self ,		lowerCamelCase__ ,		lowerCamelCase__=7 ,		lowerCamelCase__=3 ,		lowerCamelCase__=10 ,		lowerCamelCase__=18 ,		lowerCamelCase__=30 ,		lowerCamelCase__=400 ,		lowerCamelCase__=True ,		lowerCamelCase__=None ,		lowerCamelCase__=True ,		lowerCamelCase__=[0.5, 0.5, 0.5] ,		lowerCamelCase__=[0.5, 0.5, 0.5] ,		lowerCamelCase__=None ,		)   -> Optional[int]:

           """simple docstring"""



           __lowercase          =						size if size is not None else {"""shortest_edge""": 18}
           __lowercase          =						crop_size if crop_size is not None else {"""height""": 18, """width""": 18}

           __lowercase          =						parent
           __lowercase          =						batch_size
           __lowercase          =						num_channels
           __lowercase          =						num_frames
           __lowercase          =						image_size
           __lowercase          =						min_resolution
           __lowercase          =						max_resolution
           __lowercase          =						do_resize
           __lowercase          =						size
           __lowercase          =						do_normalize
           __lowercase          =						image_mean
           __lowercase          =						image_std
           __lowercase          =						crop_size




       def    snake_case__      (   self					)   -> Optional[Any]:

           """simple docstring"""



           return {
               "image_mean": self.image_mean,
               "image_std": self.image_std,
               "do_normalize": self.do_normalize,
               "do_resize": self.do_resize,
               "size": self.size,
               "crop_size": self.crop_size,
           }






@require_torch
@require_vision
class 	SCREAMING_SNAKE_CASE(    __A       ,				unittest.TestCase					):
       snake_case_			:					Optional[Any]   = VideoMAEImageProcessor if is_vision_available() else None

       def    snake_case__      (   self					)   -> List[Any]:

           """simple docstring"""



           __lowercase          =						VideoMAEImageProcessingTester(self					)

       @property
       def    snake_case__      (   self					)   -> List[Any]:

           """simple docstring"""



           return self.image_processor_tester.prepare_image_processor_dict()

       def    snake_case__      (   self					)   -> Any:

           """simple docstring"""



           __lowercase          =						self.image_processing_class(**self.image_processor_dict					)
           self.assertTrue(hasattr(lowerCamelCase__ ,		"""image_mean"""					)					)
           self.assertTrue(hasattr(lowerCamelCase__ ,		"""image_std"""					)					)
           self.assertTrue(hasattr(lowerCamelCase__ ,		"""do_normalize"""					)					)
           self.assertTrue(hasattr(lowerCamelCase__ ,		"""do_resize"""					)					)
           self.assertTrue(hasattr(lowerCamelCase__ ,		"""do_center_crop"""					)					)
           self.assertTrue(hasattr(lowerCamelCase__ ,		"""size"""					)					)

       def    snake_case__      (   self					)   -> List[str]:

           """simple docstring"""



           __lowercase          =						self.image_processing_class.from_dict(self.image_processor_dict					)
           self.assertEqual(image_processor.size ,		{"""shortest_edge""": 18}					)
           self.assertEqual(image_processor.crop_size ,		{"""height""": 18, """width""": 18}					)

           __lowercase          =						self.image_processing_class.from_dict(self.image_processor_dict ,		size=42 ,		crop_size=84					)
           self.assertEqual(image_processor.size ,		{"""shortest_edge""": 42}					)
           self.assertEqual(image_processor.crop_size ,		{"""height""": 84, """width""": 84}					)

       def    snake_case__      (   self					)   -> int:

           """simple docstring"""



           pass

       def    snake_case__      (   self					)   -> Any:

           """simple docstring"""



           __lowercase          =						self.image_processing_class(**self.image_processor_dict					)
           # create random PIL videos
           __lowercase          =						prepare_video_inputs(self.image_processor_tester ,		equal_resolution=lowerCamelCase__					)
           for video in video_inputs:
               self.assertIsInstance(lowerCamelCase__ ,		lowerCamelCase__					)
               self.assertIsInstance(video[0] ,		Image.Image					)

           # Test not batched input
           __lowercase          =						image_processing(video_inputs[0] ,		return_tensors="""pt"""					).pixel_values
           self.assertEqual(
               encoded_videos.shape ,		(
                   1,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size["""height"""],
                   self.image_processor_tester.crop_size["""width"""],
               ) ,		)

           # Test batched
           __lowercase          =						image_processing(lowerCamelCase__ ,		return_tensors="""pt"""					).pixel_values
           self.assertEqual(
               encoded_videos.shape ,		(
                   self.image_processor_tester.batch_size,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size["""height"""],
                   self.image_processor_tester.crop_size["""width"""],
               ) ,		)

       def    snake_case__      (   self					)   -> Optional[int]:

           """simple docstring"""



           __lowercase          =						self.image_processing_class(**self.image_processor_dict					)
           # create random numpy tensors
           __lowercase          =						prepare_video_inputs(self.image_processor_tester ,		equal_resolution=lowerCamelCase__ ,		numpify=lowerCamelCase__					)
           for video in video_inputs:
               self.assertIsInstance(lowerCamelCase__ ,		lowerCamelCase__					)
               self.assertIsInstance(video[0] ,		np.ndarray					)

           # Test not batched input
           __lowercase          =						image_processing(video_inputs[0] ,		return_tensors="""pt"""					).pixel_values
           self.assertEqual(
               encoded_videos.shape ,		(
                   1,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size["""height"""],
                   self.image_processor_tester.crop_size["""width"""],
               ) ,		)

           # Test batched
           __lowercase          =						image_processing(lowerCamelCase__ ,		return_tensors="""pt"""					).pixel_values
           self.assertEqual(
               encoded_videos.shape ,		(
                   self.image_processor_tester.batch_size,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size["""height"""],
                   self.image_processor_tester.crop_size["""width"""],
               ) ,		)




       def    snake_case__      (   self					)   -> Union[str, Any]:

           """simple docstring"""



           __lowercase          =						self.image_processing_class(**self.image_processor_dict					)
           # create random PyTorch tensors
           __lowercase          =						prepare_video_inputs(self.image_processor_tester ,		equal_resolution=lowerCamelCase__ ,		torchify=lowerCamelCase__					)
           for video in video_inputs:
               self.assertIsInstance(lowerCamelCase__ ,		lowerCamelCase__					)
               self.assertIsInstance(video[0] ,		torch.Tensor					)

           # Test not batched input
           __lowercase          =						image_processing(video_inputs[0] ,		return_tensors="""pt"""					).pixel_values
           self.assertEqual(
               encoded_videos.shape ,		(
                   1,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size["""height"""],
                   self.image_processor_tester.crop_size["""width"""],
               ) ,		)

           # Test batched
           __lowercase          =						image_processing(lowerCamelCase__ ,		return_tensors="""pt"""					).pixel_values
           self.assertEqual(
               encoded_videos.shape ,		(
                   self.image_processor_tester.batch_size,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size["""height"""],
                   self.image_processor_tester.crop_size["""width"""],
               ) ,		)










'''simple docstring'''
A							:				int			     =	(1, 153, 370, 371, 1_634, 24_678_051, 115_132_219_018_763_992_565_095_597_973_971_522_401)
A							:				tuple			     =	(-153, -1, 0, 1.2, 200, "A", [], {}, None)
def     snake_case_  (       a__		:     int      ):



    """simple docstring"""




    if not isinstance(a__   ,a__      ) or n < 1:
        return False

    # Initialization of sum and number of digits.
    __lowercase          =						0
    __lowercase          =						0
    __lowercase          =						n
    # Calculation of digits of the number
    while temp > 0:
        number_of_digits += 1
        temp //= 10
    # Dividing number into separate digits and find Armstrong number
    __lowercase          =						n
    while temp > 0:
        __lowercase          =						temp % 10
        total += rem**number_of_digits
        temp //= 10
    return n == total
def     snake_case_  (       a__		:     int      ):



    """simple docstring"""




    if not isinstance(a__   ,a__      ) or n < 1:
        return False

    # Init a "histogram" of the digits
    __lowercase          =						[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    __lowercase          =						0
    __lowercase          =						0
    __lowercase          =						n
    while temp > 0:
        __lowercase    ,__lowercase          =						divmod(a__   ,10      )
        digit_histogram[rem] += 1
        digit_total += 1

    for cnt, i in zip(a__   ,range(len(a__      )      )      ):
        total += cnt * i**digit_total

    return n == total
def     snake_case_  (       a__		:     int      ):



    """simple docstring"""




    if not isinstance(a__   ,a__      ) or n < 1:
        return False
    __lowercase          =						len(str(a__      )      )  # the power that all digits will be raised to
    # check if sum of each digit multiplied expo times is equal to number
    return n == sum(int(a__      ) ** expo for i in str(a__      )      )
def     snake_case_  (       ):



    """simple docstring"""




    __lowercase          =						int(input("""Enter an integer to see if it is an Armstrong number: """      ).strip()      )
    print(f'{num} is {"" if armstrong_number(a__      ) else "not "}an Armstrong number.'      )
    print(f'{num} is {"" if narcissistic_number(a__      ) else "not "}an Armstrong number.'      )
    print(f'{num} is {"" if pluperfect_number(a__      ) else "not "}an Armstrong number.'      )


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  main()




