


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    :						Any     =							logging.get_logger(__name__)



class 							_UpperCamelCase (						A						):

   '''simple docstring'''







   a_				:							Tuple    = ["pixel_values"]

   def __init__(  self  : Union[str, Any]       ,  _lowerCamelCase  : bool = True       ,  _lowerCamelCase  : Optional[Dict[str, int]] = None       ,  _lowerCamelCase  : PILImageResampling = PILImageResampling.BILINEAR       ,  _lowerCamelCase  : bool = True       ,  _lowerCamelCase  : Dict[str, int] = None       ,  _lowerCamelCase  : bool = True       ,  _lowerCamelCase  : Union[int, float] = 1 / 2_5_5       ,  _lowerCamelCase  : bool = True       ,  _lowerCamelCase  : Optional[Union[float, List[float]]] = None       ,  _lowerCamelCase  : Optional[Union[float, List[float]]] = None       ,  **_lowerCamelCase  : List[Any]       ,  ):






         '''simple docstring'''



         super().__init__(**_lowerCamelCase							)
         __lowerCamelCase     :      List[Any]       						=						size if size is not None else {"""shortest_edge""": 2_5_6}
         __lowerCamelCase     :      str       						=						get_size_dict(_lowerCamelCase       ,  default_to_square=_lowerCamelCase							)
         __lowerCamelCase     :      Any       						=						crop_size if crop_size is not None else {"""height""": 2_2_4, """width""": 2_2_4}
         __lowerCamelCase     :      Dict       						=						get_size_dict(_lowerCamelCase							)
         __lowerCamelCase     :      int       						=						do_resize
         __lowerCamelCase     :      List[Any]       						=						size
         __lowerCamelCase     :      Any       						=						resample
         __lowerCamelCase     :      List[Any]       						=						do_center_crop
         __lowerCamelCase     :      str       						=						crop_size
         __lowerCamelCase     :      List[str]       						=						do_rescale
         __lowerCamelCase     :      List[str]       						=						rescale_factor
         __lowerCamelCase     :      List[Any]       						=						do_normalize
         __lowerCamelCase     :      Tuple       						=						image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
         __lowerCamelCase     :      Any       						=						image_std if image_std is not None else IMAGENET_STANDARD_STD

   def   _snake_case    (  self  : int       ,  _lowerCamelCase  : np.ndarray       ,  _lowerCamelCase  : Dict[str, int]       ,  _lowerCamelCase  : PILImageResampling = PILImageResampling.BICUBIC       ,  _lowerCamelCase  : Optional[Union[str, ChannelDimension]] = None       ,  **_lowerCamelCase  : Union[str, Any]       ,  ):






         '''simple docstring'''



         __lowerCamelCase     :      Optional[int]       						=						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()}"""							)
         __lowerCamelCase     :      Any       						=						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   _snake_case    (  self  : str       ,  _lowerCamelCase  : np.ndarray       ,  _lowerCamelCase  : Dict[str, int]       ,  _lowerCamelCase  : Optional[Union[str, ChannelDimension]] = None       ,  **_lowerCamelCase  : Optional[int]       ,  ):






         '''simple docstring'''



         __lowerCamelCase     :      Optional[int]       						=						get_size_dict(_lowerCamelCase							)
         return center_crop(_lowerCamelCase       ,  size=(size["""height"""], size["""width"""])       ,  data_format=_lowerCamelCase       ,  **_lowerCamelCase							)

   def   _snake_case    (  self  : Any       ,  _lowerCamelCase  : np.ndarray       ,  _lowerCamelCase  : float       ,  _lowerCamelCase  : Optional[Union[str, ChannelDimension]] = None       ,  **_lowerCamelCase  : str							):






         '''simple docstring'''



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

   def   _snake_case    (  self  : str       ,  _lowerCamelCase  : np.ndarray       ,  _lowerCamelCase  : Union[float, List[float]]       ,  _lowerCamelCase  : Union[float, List[float]]       ,  _lowerCamelCase  : Optional[Union[str, ChannelDimension]] = None       ,  **_lowerCamelCase  : List[Any]       ,  ):






         '''simple docstring'''



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


   def   _snake_case    (  self  : Dict       ,  _lowerCamelCase  : ImageInput       ,  _lowerCamelCase  : Optional[bool] = None       ,  _lowerCamelCase  : Dict[str, int] = None       ,  _lowerCamelCase  : PILImageResampling = None       ,  _lowerCamelCase  : bool = None       ,  _lowerCamelCase  : Dict[str, int] = None       ,  _lowerCamelCase  : Optional[bool] = None       ,  _lowerCamelCase  : Optional[float] = None       ,  _lowerCamelCase  : Optional[bool] = None       ,  _lowerCamelCase  : Optional[Union[float, List[float]]] = None       ,  _lowerCamelCase  : Optional[Union[float, List[float]]] = None       ,  _lowerCamelCase  : Optional[Union[str, TensorType]] = None       ,  _lowerCamelCase  : Union[str, ChannelDimension] = ChannelDimension.FIRST       ,  **_lowerCamelCase  : str       ,  ):






         '''simple docstring'''



         __lowerCamelCase     :      str       						=						do_resize if do_resize is not None else self.do_resize
         __lowerCamelCase     :      List[Any]       						=						size if size is not None else self.size
         __lowerCamelCase     :      str       						=						get_size_dict(_lowerCamelCase       ,  default_to_square=_lowerCamelCase							)
         __lowerCamelCase     :      List[str]       						=						resample if resample is not None else self.resample
         __lowerCamelCase     :      List[Any]       						=						do_center_crop if do_center_crop is not None else self.do_center_crop
         __lowerCamelCase     :      Tuple       						=						crop_size if crop_size is not None else self.crop_size
         __lowerCamelCase     :      List[Any]       						=						get_size_dict(_lowerCamelCase							)
         __lowerCamelCase     :      List[Any]       						=						do_rescale if do_rescale is not None else self.do_rescale
         __lowerCamelCase     :      Dict       						=						rescale_factor if rescale_factor is not None else self.rescale_factor
         __lowerCamelCase     :      int       						=						do_normalize if do_normalize is not None else self.do_normalize
         __lowerCamelCase     :      Dict       						=						image_mean if image_mean is not None else self.image_mean
         __lowerCamelCase     :      Tuple       						=						image_std if image_std is not None else self.image_std

         __lowerCamelCase     :      Tuple       						=						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."""							)

         # All transformations expect numpy arrays.
         __lowerCamelCase     :      str       						=						[to_numpy_array(_lowerCamelCase							) for image in images]

         if do_resize:
               __lowerCamelCase     :      Union[str, Any]       						=						[self.resize(image=_lowerCamelCase       ,  size=_lowerCamelCase       ,  resample=_lowerCamelCase							) for image in images]

         if do_center_crop:
               __lowerCamelCase     :      List[Any]       						=						[self.center_crop(image=_lowerCamelCase       ,  size=_lowerCamelCase							) for image in images]

         if do_rescale:
               __lowerCamelCase     :      int       						=						[self.rescale(image=_lowerCamelCase       ,  scale=_lowerCamelCase							) for image in images]

         if do_normalize:
               __lowerCamelCase     :      Any       						=						[self.normalize(image=_lowerCamelCase       ,  mean=_lowerCamelCase       ,  std=_lowerCamelCase							) for image in images]

         __lowerCamelCase     :      Tuple       						=						[to_channel_dimension_format(_lowerCamelCase       ,  _lowerCamelCase							) for image in images]

         __lowerCamelCase     :      str       						=						{"""pixel_values""": images}
         return BatchFeature(data=_lowerCamelCase       ,  tensor_type=_lowerCamelCase							)







def   _UpperCAmelCase       (     ):
      """simple docstring"""




      __lowerCamelCase     :      Optional[int]       						=						[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

      __lowerCamelCase     :      str       						=						6
      __lowerCamelCase     :      Optional[int]       						=						1
      __lowerCamelCase     :      Optional[int]       						=						1_901

      __lowerCamelCase     :      Optional[Any]       						=						0

      while year < 2_001:
            day += 7

            if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
                  if day > days_per_month[month - 1] and month != 2:
                        month += 1
                        __lowerCamelCase     :      Tuple       						=						day - days_per_month[month - 2]
                  elif day > 29 and month == 2:
                        month += 1
                        __lowerCamelCase     :      str       						=						day - 29
            else:
                  if day > days_per_month[month - 1]:
                        month += 1
                        __lowerCamelCase     :      Any       						=						day - days_per_month[month - 2]

            if month > 12:
                  year += 1
                  __lowerCamelCase     :      Optional[Any]       						=						1

            if year < 2_001 and day == 1:
                  sundays += 1
      return sundays


if __name__ == "__main__":
    print(solution())



