
"""simple docstring"""

from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    center_crop,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, logging


UpperCamelCase     :    Dict       =			logging.get_logger(__name__)

class __lowerCAmelCase		(				__SCREAMING_SNAKE_CASE      ):






     """simple docstring"""




     lowercase						       =						["pixel_values"]





     def __init__(     self     ,					__UpperCAmelCase = True     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = PILImageResampling.BILINEAR     ,					__UpperCAmelCase = True     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = True     ,					__UpperCAmelCase = 1 / 255     ,					__UpperCAmelCase = True     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      super().__init__(**__UpperCAmelCase				)
      __UpperCamelCase      =	size if size is not None else {'shortest_edge': 256}
      __UpperCamelCase      =	get_size_dict(__UpperCAmelCase     ,					default_to_square=__UpperCAmelCase				)
      __UpperCamelCase      =	crop_size if crop_size is not None else {'height': 224, 'width': 224}
      __UpperCamelCase      =	get_size_dict(__UpperCAmelCase				)
      __UpperCamelCase      =	do_resize
      __UpperCamelCase      =	size
      __UpperCamelCase      =	resample
      __UpperCamelCase      =	do_center_crop
      __UpperCamelCase      =	crop_size
      __UpperCamelCase      =	do_rescale
      __UpperCamelCase      =	rescale_factor
      __UpperCamelCase      =	do_normalize
      __UpperCamelCase      =	image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
      __UpperCamelCase      =	image_std if image_std is not None else IMAGENET_STANDARD_STD





     def 						UpperCAmelCase (     self     ,					__UpperCAmelCase     ,					__UpperCAmelCase     ,					__UpperCAmelCase = PILImageResampling.BICUBIC     ,					__UpperCAmelCase = None     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      __UpperCamelCase      =	get_size_dict(__UpperCAmelCase     ,					default_to_square=__UpperCAmelCase				)
      if "shortest_edge" not in size:
       raise ValueError(F'The `size` parameter must contain the key `shortest_edge`. Got {size.keys()}'				)
      __UpperCamelCase      =	get_resize_output_image_size(__UpperCAmelCase     ,					size=size['shortest_edge']     ,					default_to_square=__UpperCAmelCase				)
      return resize(__UpperCAmelCase     ,					size=__UpperCAmelCase     ,					resample=__UpperCAmelCase     ,					data_format=__UpperCAmelCase     ,					**__UpperCAmelCase				)





     def 						UpperCAmelCase (     self     ,					__UpperCAmelCase     ,					__UpperCAmelCase     ,					__UpperCAmelCase = None     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      __UpperCamelCase      =	get_size_dict(__UpperCAmelCase				)
      return center_crop(__UpperCAmelCase     ,					size=(size['height'], size['width'])     ,					data_format=__UpperCAmelCase     ,					**__UpperCAmelCase				)





     def 						UpperCAmelCase (     self     ,					__UpperCAmelCase     ,					__UpperCAmelCase     ,					__UpperCAmelCase = None     ,					**__UpperCAmelCase				):

      '''simple docstring'''




      return rescale(__UpperCAmelCase     ,					scale=__UpperCAmelCase     ,					data_format=__UpperCAmelCase     ,					**__UpperCAmelCase				)





     def 						UpperCAmelCase (     self     ,					__UpperCAmelCase     ,					__UpperCAmelCase     ,					__UpperCAmelCase     ,					__UpperCAmelCase = None     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      return normalize(__UpperCAmelCase     ,					mean=__UpperCAmelCase     ,					std=__UpperCAmelCase     ,					data_format=__UpperCAmelCase     ,					**__UpperCAmelCase				)







     def 						UpperCAmelCase (     self     ,					__UpperCAmelCase     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = None     ,					__UpperCAmelCase = ChannelDimension.FIRST     ,					**__UpperCAmelCase     ,					):

      '''simple docstring'''




      __UpperCamelCase      =	do_resize if do_resize is not None else self.do_resize
      __UpperCamelCase      =	size if size is not None else self.size
      __UpperCamelCase      =	get_size_dict(__UpperCAmelCase     ,					default_to_square=__UpperCAmelCase				)
      __UpperCamelCase      =	resample if resample is not None else self.resample
      __UpperCamelCase      =	do_center_crop if do_center_crop is not None else self.do_center_crop
      __UpperCamelCase      =	crop_size if crop_size is not None else self.crop_size
      __UpperCamelCase      =	get_size_dict(__UpperCAmelCase				)
      __UpperCamelCase      =	do_rescale if do_rescale is not None else self.do_rescale
      __UpperCamelCase      =	rescale_factor if rescale_factor is not None else self.rescale_factor
      __UpperCamelCase      =	do_normalize if do_normalize is not None else self.do_normalize
      __UpperCamelCase      =	image_mean if image_mean is not None else self.image_mean
      __UpperCamelCase      =	image_std if image_std is not None else self.image_std

      __UpperCamelCase      =	make_list_of_images(__UpperCAmelCase				)

      if not valid_images(__UpperCAmelCase				):
       raise ValueError(
           'Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, '
           'torch.Tensor, tf.Tensor or jax.ndarray.'				)

      if do_resize and size is None:
       raise ValueError('Size must be specified if do_resize is True.'				)

      if do_center_crop and crop_size is None:
       raise ValueError('Crop size must be specified if do_center_crop is True.'				)

      if do_rescale and rescale_factor is None:
       raise ValueError('Rescale factor must be specified if do_rescale is True.'				)

      if do_normalize and (image_mean is None or image_std is None):
       raise ValueError('Image mean and std must be specified if do_normalize is True.'				)

      # All transformations expect numpy arrays.
      __UpperCamelCase      =	[to_numpy_array(__UpperCAmelCase				) for image in images]

      if do_resize:
       __UpperCamelCase      =	[self.resize(image=__UpperCAmelCase     ,					size=__UpperCAmelCase     ,					resample=__UpperCAmelCase				) for image in images]

      if do_center_crop:
       __UpperCamelCase      =	[self.center_crop(image=__UpperCAmelCase     ,					size=__UpperCAmelCase				) for image in images]

      if do_rescale:
       __UpperCamelCase      =	[self.rescale(image=__UpperCAmelCase     ,					scale=__UpperCAmelCase				) for image in images]

      if do_normalize:
       __UpperCamelCase      =	[self.normalize(image=__UpperCAmelCase     ,					mean=__UpperCAmelCase     ,					std=__UpperCAmelCase				) for image in images]

      __UpperCamelCase      =	[to_channel_dimension_format(__UpperCAmelCase     ,					__UpperCAmelCase				) for image in images]

      __UpperCamelCase      =	{'pixel_values': images}
      return BatchFeature(data=__UpperCAmelCase     ,					tensor_type=__UpperCAmelCase				)





"""simple docstring"""

def 							A						(    snake_case				:int		)				->     bool:
 return sum(i for i in range(1    , number // 2 + 1		) if number % i == 0		) == number


if __name__ == "__main__":
      print("Program to check whether a number is a Perfect number or not...")
      UpperCamelCase     :    Union[str, Any]       =			int(input("Enter number: ").strip())
      print(f'''{number} is {"" if perfect(number) else "not "}a Perfect Number.''')



