

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,
    convert_to_rgb,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    OPENAI_CLIP_MEAN,
    OPENAI_CLIP_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


lowercase_   							=  logging.get_logger(__name__)


if is_vision_available():
  import PIL





class 					__lowerCAmelCase	(   SCREAMING_SNAKE_CASE				):
  _a		     =    ["""pixel_values"""]




  def __init__(							self				,  lowerCAmelCase = True				,  lowerCAmelCase = None				,  lowerCAmelCase = PILImageResampling.BICUBIC				,  lowerCAmelCase = True				,  lowerCAmelCase = None				,  lowerCAmelCase = True				,  lowerCAmelCase = 1 / 255				,  lowerCAmelCase = True				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = True				,  **lowerCAmelCase				,  )    ->					None:
        '''simple docstring'''






        super().__init__(**lowerCAmelCase   )
        _lowercase      			=size if size is not None else {'shortest_edge': 224}
        _lowercase      			=get_size_dict(lowerCAmelCase				,  default_to_square=lowerCAmelCase   )
        _lowercase      			=crop_size if crop_size is not None else {'height': 224, 'width': 224}
        _lowercase      			=get_size_dict(lowerCAmelCase				,  default_to_square=lowerCAmelCase				,  param_name='crop_size'   )

        _lowercase      			=do_resize
        _lowercase      			=size
        _lowercase      			=resample
        _lowercase      			=do_center_crop
        _lowercase      			=crop_size
        _lowercase      			=do_rescale
        _lowercase      			=rescale_factor
        _lowercase      			=do_normalize
        _lowercase      			=image_mean if image_mean is not None else OPENAI_CLIP_MEAN
        _lowercase      			=image_std if image_std is not None else OPENAI_CLIP_STD
        _lowercase      			=do_convert_rgb




  def     A__	(							self				,  lowerCAmelCase				,  lowerCAmelCase				,  lowerCAmelCase = PILImageResampling.BICUBIC				,  lowerCAmelCase = None				,  **lowerCAmelCase				,  )    ->					np.ndarray:
        '''simple docstring'''






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




  def     A__	(							self				,  lowerCAmelCase				,  lowerCAmelCase				,  lowerCAmelCase = None				,  **lowerCAmelCase				,  )    ->					np.ndarray:
        '''simple docstring'''






        _lowercase      			=get_size_dict(lowerCAmelCase   )
        if "height" not in size or "width" not in size:
              raise ValueError(F'''The `size` parameter must contain the keys (height, width). Got {size.keys()}'''   )
        return center_crop(lowerCAmelCase				,  size=(size['height'], size['width'])				,  data_format=lowerCAmelCase				,  **lowerCAmelCase   )




  def     A__	(							self				,  lowerCAmelCase				,  lowerCAmelCase				,  lowerCAmelCase = None				,  **lowerCAmelCase				,  )    ->					Optional[int]:
        '''simple docstring'''






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




  def     A__	(							self				,  lowerCAmelCase				,  lowerCAmelCase				,  lowerCAmelCase				,  lowerCAmelCase = None				,  **lowerCAmelCase				,  )    ->					np.ndarray:
        '''simple docstring'''






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




  def     A__	(							self				,  lowerCAmelCase				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = None				,  lowerCAmelCase = ChannelDimension.FIRST				,  **lowerCAmelCase				,  )    ->					PIL.Image.Image:
        '''simple docstring'''






        _lowercase      			=do_resize if do_resize is not None else self.do_resize
        _lowercase      			=size if size is not None else self.size
        _lowercase      			=get_size_dict(lowerCAmelCase				,  param_name='size'				,  default_to_square=lowerCAmelCase   )
        _lowercase      			=resample if resample is not None else self.resample
        _lowercase      			=do_center_crop if do_center_crop is not None else self.do_center_crop
        _lowercase      			=crop_size if crop_size is not None else self.crop_size
        _lowercase      			=get_size_dict(lowerCAmelCase				,  param_name='crop_size'				,  default_to_square=lowerCAmelCase   )
        _lowercase      			=do_rescale if do_rescale is not None else self.do_rescale
        _lowercase      			=rescale_factor if rescale_factor is not None else self.rescale_factor
        _lowercase      			=do_normalize if do_normalize is not None else self.do_normalize
        _lowercase      			=image_mean if image_mean is not None else self.image_mean
        _lowercase      			=image_std if image_std is not None else self.image_std
        _lowercase      			=do_convert_rgb if do_convert_rgb is not None else self.do_convert_rgb

        _lowercase      			=make_list_of_images(lowerCAmelCase   )

        if not valid_images(lowerCAmelCase   ):
              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.'   )

        # PIL RGBA images are converted to RGB
        if do_convert_rgb:
              _lowercase      			=[convert_to_rgb(lowerCAmelCase   ) for image in images]

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

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

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

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

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

        _lowercase      			=[to_channel_dimension_format(lowerCAmelCase				,  lowerCAmelCase   ) for image in images]

        _lowercase      			={'pixel_values': images}
        return BatchFeature(data=lowerCAmelCase				,  tensor_type=lowerCAmelCase   )





def 	a (     A__      :  int	)       -> bool:





      """simple docstring"""



      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...')
  lowercase_   							=  int(input('Enter number: ').strip())
  print(f"{number} is {'' if perfect(number) else 'not '}a Perfect Number.")


