
SCREAMING_SNAKE_CASE				:List[Any]									=							[4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
SCREAMING_SNAKE_CASE				:Union[str, Any]									=							[3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
SCREAMING_SNAKE_CASE				:int									=							{
    0: 'Sunday',
    1: 'Monday',
    2: 'Tuesday',
    3: 'Wednesday',
    4: 'Thursday',
    5: 'Friday',
    6: 'Saturday',
}


def 		UpperCAmelCase     (      a_						,  a_						,  a_		)						->      str:







				"""simple docstring"""



				assert len(str(a_		)		) > 2, "year should be in YYYY format"
				assert 1 <= month <= 1_2, "month should be between 1 to 12"
				assert 1 <= day <= 3_1, "day should be between 1 to 31"

				# Doomsday algorithm:
				__A       =					year // 1_0_0
				__A       =					(5 * (century % 4) + 2) % 7
				__A       =					year % 1_0_0
				__A       =					centurian % 1_2
				__A       =					(
				    (centurian // 1_2) + centurian_m + (centurian_m // 4) + century_anchor
				) % 7
				__A       =					(
				    DOOMSDAY_NOT_LEAP[month - 1]
				    if (year % 4 != 0) or (centurian == 0 and (year % 4_0_0) == 0)
				    else DOOMSDAY_LEAP[month - 1]
				)
				__A       =					(dooms_day + day - day_anchor) % 7
				return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
					import doctest

					doctest.testmod()






'''simple docstring'''
import unittest

import numpy as np

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

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
							import torch

if is_vision_available():
							from PIL import Image

							from transformers import DonutImageProcessor
class   __UpperCAmelCase				(     unittest.TestCase				):



					'''simple docstring'''





					def __init__(	self     :						int      ,       _lowercase     :						Any      ,       _lowercase     :						Tuple=7      ,       _lowercase     :						Tuple=3      ,       _lowercase     :						str=18      ,       _lowercase     :						Union[str, Any]=30      ,       _lowercase     :						Dict=400      ,       _lowercase     :						int=True      ,       _lowercase     :						List[Any]=None      ,       _lowercase     :						int=True      ,       _lowercase     :						Optional[int]=False      ,       _lowercase     :						str=True      ,       _lowercase     :						Union[str, Any]=True      ,       _lowercase     :						Any=[0.5, 0.5, 0.5]      ,       _lowercase     :						str=[0.5, 0.5, 0.5]      ,       )    ->							Optional[Any]:
								A_									= parent
								A_									= batch_size
								A_									= num_channels
								A_									= image_size
								A_									= min_resolution
								A_									= max_resolution
								A_									= do_resize
								A_									= size if size is not None else {'height': 18, 'width': 20}
								A_									= do_thumbnail
								A_									= do_align_axis
								A_									= do_pad
								A_									= do_normalize
								A_									= image_mean
								A_									= image_std



					def     __snake_case						(	self     :						int)    ->							int:
								return {
								    "do_resize": self.do_resize,
								    "size": self.size,
								    "do_thumbnail": self.do_thumbnail,
								    "do_align_long_axis": self.do_align_axis,
								    "do_pad": self.do_pad,
								    "do_normalize": self.do_normalize,
								    "image_mean": self.image_mean,
								    "image_std": self.image_std,
								}





@require_torch
@require_vision
class   __UpperCAmelCase				(     lowerCAmelCase			,unittest.TestCase				):



					'''simple docstring'''





					_UpperCamelCase							=		DonutImageProcessor if is_vision_available() else None



					def     __snake_case						(	self     :						Optional[int])    ->							Union[str, Any]:
								A_									= DonutImageProcessingTester(self)



					@property
					def     __snake_case						(	self     :						int)    ->							int:
								return self.image_processor_tester.prepare_image_processor_dict()



					def     __snake_case						(	self     :						Any)    ->							Tuple:
								A_									= self.image_processing_class(**self.image_processor_dict)
								self.assertTrue(hasattr(_lowercase      ,       'do_resize'))
								self.assertTrue(hasattr(_lowercase      ,       'size'))
								self.assertTrue(hasattr(_lowercase      ,       'do_thumbnail'))
								self.assertTrue(hasattr(_lowercase      ,       'do_align_long_axis'))
								self.assertTrue(hasattr(_lowercase      ,       'do_pad'))
								self.assertTrue(hasattr(_lowercase      ,       'do_normalize'))
								self.assertTrue(hasattr(_lowercase      ,       'image_mean'))
								self.assertTrue(hasattr(_lowercase      ,       'image_std'))



					def     __snake_case						(	self     :						int)    ->							Optional[int]:
								A_									= self.image_processing_class.from_dict(self.image_processor_dict)
								self.assertEqual(image_processor.size      ,       {'height': 18, 'width': 20})

								A_									= self.image_processing_class.from_dict(self.image_processor_dict      ,       size=42)
								self.assertEqual(image_processor.size      ,       {'height': 42, 'width': 42})

								# Previous config had dimensions in (width, height) order
								A_									= self.image_processing_class.from_dict(self.image_processor_dict      ,       size=(42, 84))
								self.assertEqual(image_processor.size      ,       {'height': 84, 'width': 42})



					def     __snake_case						(	self     :						Optional[Any])    ->							Optional[Any]:
								pass



					@is_flaky()
					def     __snake_case						(	self     :						List[str])    ->							int:
								# Initialize image_processing
								A_									= self.image_processing_class(**self.image_processor_dict)
								# create random PIL images
								A_									= prepare_image_inputs(self.image_processor_tester      ,       equal_resolution=_lowercase)
								for image in image_inputs:
											self.assertIsInstance(_lowercase      ,       Image.Image)

								# Test not batched input
								A_									= image_processing(image_inputs[0]      ,       return_tensors='pt').pixel_values
								self.assertEqual(
								    encoded_images.shape      ,       (
								        1,
								        self.image_processor_tester.num_channels,
								        self.image_processor_tester.size['height'],
								        self.image_processor_tester.size['width'],
								    )      ,       )

								# Test batched
								A_									= image_processing(_lowercase      ,       return_tensors='pt').pixel_values
								self.assertEqual(
								    encoded_images.shape      ,       (
								        self.image_processor_tester.batch_size,
								        self.image_processor_tester.num_channels,
								        self.image_processor_tester.size['height'],
								        self.image_processor_tester.size['width'],
								    )      ,       )



					@is_flaky()
					def     __snake_case						(	self     :						List[Any])    ->							List[Any]:
								# Initialize image_processing
								A_									= self.image_processing_class(**self.image_processor_dict)
								# create random numpy tensors
								A_									= prepare_image_inputs(self.image_processor_tester      ,       equal_resolution=_lowercase      ,       numpify=_lowercase)
								for image in image_inputs:
											self.assertIsInstance(_lowercase      ,       np.ndarray)

								# Test not batched input
								A_									= image_processing(image_inputs[0]      ,       return_tensors='pt').pixel_values
								self.assertEqual(
								    encoded_images.shape      ,       (
								        1,
								        self.image_processor_tester.num_channels,
								        self.image_processor_tester.size['height'],
								        self.image_processor_tester.size['width'],
								    )      ,       )

								# Test batched
								A_									= image_processing(_lowercase      ,       return_tensors='pt').pixel_values
								self.assertEqual(
								    encoded_images.shape      ,       (
								        self.image_processor_tester.batch_size,
								        self.image_processor_tester.num_channels,
								        self.image_processor_tester.size['height'],
								        self.image_processor_tester.size['width'],
								    )      ,       )



					@is_flaky()
					def     __snake_case						(	self     :						Dict)    ->							int:
								# Initialize image_processing
								A_									= self.image_processing_class(**self.image_processor_dict)
								# create random PyTorch tensors
								A_									= prepare_image_inputs(self.image_processor_tester      ,       equal_resolution=_lowercase      ,       torchify=_lowercase)
								for image in image_inputs:
											self.assertIsInstance(_lowercase      ,       torch.Tensor)

								# Test not batched input
								A_									= image_processing(image_inputs[0]      ,       return_tensors='pt').pixel_values
								self.assertEqual(
								    encoded_images.shape      ,       (
								        1,
								        self.image_processor_tester.num_channels,
								        self.image_processor_tester.size['height'],
								        self.image_processor_tester.size['width'],
								    )      ,       )

								# Test batched
								A_									= image_processing(_lowercase      ,       return_tensors='pt').pixel_values
								self.assertEqual(
								    encoded_images.shape      ,       (
								        self.image_processor_tester.batch_size,
								        self.image_processor_tester.num_channels,
								        self.image_processor_tester.size['height'],
								        self.image_processor_tester.size['width'],
								    )      ,       )




