


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


SCREAMING_SNAKE_CASE			: int				   =					logging.get_logger(__name__)


if is_vision_available():
 import PIL






class _lowerCamelCase(		_snake_case  ):
       lowercase_					:      int       					=     ["""pixel_values"""]
       def __init__(   self, lowerCamelCase = True, lowerCamelCase = None, lowerCamelCase = PILImageResampling.BICUBIC, lowerCamelCase = True, lowerCamelCase = None, lowerCamelCase = True, lowerCamelCase = 1 / 2_55, lowerCamelCase = True, lowerCamelCase = None, lowerCamelCase = None, lowerCamelCase = True, **lowerCamelCase, )			->  Tuple:




           """simple docstring"""

           super().__init__(**__snake_case)
           _lowercase			:				int 						=						size if size is not None else {"""shortest_edge""": 2_24}
           _lowercase			:				Optional[Any] 						=						get_size_dict(__snake_case, default_to_square=__snake_case)
           _lowercase			:				Optional[Any] 						=						crop_size if crop_size is not None else {"""height""": 2_24, """width""": 2_24}
           _lowercase			:				Any 						=						get_size_dict(__snake_case, default_to_square=__snake_case, param_name='crop_size')

           _lowercase			:				str 						=						do_resize
           _lowercase			:				Union[str, Any] 						=						size
           _lowercase			:				List[str] 						=						resample
           _lowercase			:				str 						=						do_center_crop
           _lowercase			:				Optional[Any] 						=						crop_size
           _lowercase			:				Tuple 						=						do_rescale
           _lowercase			:				Dict 						=						rescale_factor
           _lowercase			:				Optional[Any] 						=						do_normalize
           _lowercase			:				List[Any] 						=						image_mean if image_mean is not None else OPENAI_CLIP_MEAN
           _lowercase			:				Optional[Any] 						=						image_std if image_std is not None else OPENAI_CLIP_STD
           _lowercase			:				Optional[int] 						=						do_convert_rgb
       def      UpperCamelCase	(   self, lowerCamelCase, lowerCamelCase, lowerCamelCase = PILImageResampling.BICUBIC, lowerCamelCase = None, **lowerCamelCase, )			->  Any:




           """simple docstring"""

           _lowercase			:				int 						=						get_size_dict(__snake_case, default_to_square=__snake_case)
           if "shortest_edge" not in size:
               raise ValueError(F'''The `size` parameter must contain the key `shortest_edge`. Got {size.keys()}''')
           _lowercase			:				Any 						=						get_resize_output_image_size(__snake_case, size=size['shortest_edge'], default_to_square=__snake_case)
           return resize(__snake_case, size=__snake_case, resample=__snake_case, data_format=__snake_case, **__snake_case)
       def      UpperCamelCase	(   self, lowerCamelCase, lowerCamelCase, lowerCamelCase = None, **lowerCamelCase, )			->  Dict:




           """simple docstring"""

           _lowercase			:				List[str] 						=						get_size_dict(__snake_case)
           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(__snake_case, size=(size['height'], size['width']), data_format=__snake_case, **__snake_case)
       def      UpperCamelCase	(   self, lowerCamelCase, lowerCamelCase, lowerCamelCase = None, **lowerCamelCase, )			->  List[str]:




           """simple docstring"""

           return rescale(__snake_case, scale=__snake_case, data_format=__snake_case, **__snake_case)
       def      UpperCamelCase	(   self, lowerCamelCase, lowerCamelCase, lowerCamelCase, lowerCamelCase = None, **lowerCamelCase, )			->  List[Any]:




           """simple docstring"""

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




       def      UpperCamelCase	(   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, )			->  List[str]:




           """simple docstring"""

           _lowercase			:				Optional[int] 						=						do_resize if do_resize is not None else self.do_resize
           _lowercase			:				Any 						=						size if size is not None else self.size
           _lowercase			:				List[str] 						=						get_size_dict(__snake_case, param_name='size', default_to_square=__snake_case)
           _lowercase			:				Any 						=						resample if resample is not None else self.resample
           _lowercase			:				Optional[Any] 						=						do_center_crop if do_center_crop is not None else self.do_center_crop
           _lowercase			:				str 						=						crop_size if crop_size is not None else self.crop_size
           _lowercase			:				Optional[int] 						=						get_size_dict(__snake_case, param_name='crop_size', default_to_square=__snake_case)
           _lowercase			:				Optional[int] 						=						do_rescale if do_rescale is not None else self.do_rescale
           _lowercase			:				int 						=						rescale_factor if rescale_factor is not None else self.rescale_factor
           _lowercase			:				Tuple 						=						do_normalize if do_normalize is not None else self.do_normalize
           _lowercase			:				List[str] 						=						image_mean if image_mean is not None else self.image_mean
           _lowercase			:				List[Any] 						=						image_std if image_std is not None else self.image_std
           _lowercase			:				Any 						=						do_convert_rgb if do_convert_rgb is not None else self.do_convert_rgb

           _lowercase			:				Optional[Any] 						=						make_list_of_images(__snake_case)

           if not valid_images(__snake_case):
               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			:				Optional[int] 						=						[convert_to_rgb(__snake_case) for image in images]

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

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

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

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

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

           _lowercase			:				str 						=						[to_channel_dimension_format(__snake_case, __snake_case) for image in images]

           _lowercase			:				int 						=						{"""pixel_values""": images}
           return BatchFeature(data=__snake_case, tensor_type=__snake_case)






'''simple docstring'''


import argparse
import datetime







def      snake_case_  (    SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE					:			Optional[int]							= {
				    """0""": """Sunday""",
				    """1""": """Monday""",
				    """2""": """Tuesday""",
				    """3""": """Wednesday""",
				    """4""": """Thursday""",
				    """5""": """Friday""",
				    """6""": """Saturday""",
				}

				_SCREAMING_SNAKE_CASE					:			Optional[int]							= {0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 0}

				# Validate
				if not 0 < len(SCREAMING_SNAKE_CASE__	) < 11:
								raise ValueError("""Must be 10 characters long"""	)

				# Get month
				_SCREAMING_SNAKE_CASE					:			int							= int(date_input[0] + date_input[1]	)
				# Validate
				if not 0 < m < 13:
								raise ValueError("""Month must be between 1 - 12"""	)

				_SCREAMING_SNAKE_CASE					:			str							= date_input[2]
				# Validate
				if sep_a not in ["-", "/"]:
								raise ValueError("""Date separator must be '-' or '/'"""	)

				# Get day
				_SCREAMING_SNAKE_CASE					:			int							= int(date_input[3] + date_input[4]	)
				# Validate
				if not 0 < d < 32:
								raise ValueError("""Date must be between 1 - 31"""	)

				# Get second separator
				_SCREAMING_SNAKE_CASE					:			str							= date_input[5]
				# Validate
				if sep_a not in ["-", "/"]:
								raise ValueError("""Date separator must be '-' or '/'"""	)

				# Get year
				_SCREAMING_SNAKE_CASE					:			int							= int(date_input[6] + date_input[7] + date_input[8] + date_input[9]	)
				# Arbitrary year range
				if not 45 < y < 8500:
								raise ValueError(
								    """Year out of range. There has to be some sort of limit...right?"""	)

				# Get datetime obj for validation
				_SCREAMING_SNAKE_CASE					:			Optional[int]							= datetime.date(int(SCREAMING_SNAKE_CASE__	)				, int(SCREAMING_SNAKE_CASE__	)				, int(SCREAMING_SNAKE_CASE__	)	)

				# Start math
				if m <= 2:
								_SCREAMING_SNAKE_CASE					:			Union[str, Any]							= y - 1
								_SCREAMING_SNAKE_CASE					:			Optional[int]							= m + 12
				# maths var
				_SCREAMING_SNAKE_CASE					:			int							= int(str(SCREAMING_SNAKE_CASE__	)[:2]	)
				_SCREAMING_SNAKE_CASE					:			int							= int(str(SCREAMING_SNAKE_CASE__	)[2:]	)
				_SCREAMING_SNAKE_CASE					:			int							= int(2.6 * m - 5.3_9	)
				_SCREAMING_SNAKE_CASE					:			int							= int(c / 4	)
				_SCREAMING_SNAKE_CASE					:			int							= int(k / 4	)
				_SCREAMING_SNAKE_CASE					:			int							= int(d + k	)
				_SCREAMING_SNAKE_CASE					:			int							= int(t + u + v + x	)
				_SCREAMING_SNAKE_CASE					:			int							= int(z - (2 * c)	)
				_SCREAMING_SNAKE_CASE					:			int							= round(w % 7	)
				# End math

				# Validate math
				if f != convert_datetime_days[dt_ck.weekday()]:
								raise AssertionError("""The date was evaluated incorrectly. Contact developer."""	)

				# Response
				_SCREAMING_SNAKE_CASE					:			str							= f"""Your date {date_input}, is a {days[str(SCREAMING_SNAKE_CASE__	)]}!"""
				return response


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				UpperCAmelCase_						:  Tuple				  =						argparse.ArgumentParser(
				    description=(
				        'Find out what day of the week nearly any date is or was. Enter '
				        'date as a string in the mm-dd-yyyy or mm/dd/yyyy format'
				    )
				)
				parser.add_argument(
				    'date_input', type=str, help='Date as a string (mm-dd-yyyy or mm/dd/yyyy)'
				)
				UpperCAmelCase_						:  List[Any]				  =						parser.parse_args()
				zeller(args.date_input)




