
"""simple docstring"""




import unittest

import numpy as np

from transformers.testing_utils import 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 PoolFormerImageProcessor





class 			snake_case  (				unittest.TestCase ):

							def __init__(self							,							SCREAMING_SNAKE_CASE_							,							SCREAMING_SNAKE_CASE_=7							,							SCREAMING_SNAKE_CASE_=3							,							SCREAMING_SNAKE_CASE_=30							,							SCREAMING_SNAKE_CASE_=4_00							,							SCREAMING_SNAKE_CASE_=True							,							SCREAMING_SNAKE_CASE_=None							,							SCREAMING_SNAKE_CASE_=0.9							,							SCREAMING_SNAKE_CASE_=None							,							SCREAMING_SNAKE_CASE_=True							,							SCREAMING_SNAKE_CASE_=[0.5, 0.5, 0.5]							,							SCREAMING_SNAKE_CASE_=[0.5, 0.5, 0.5]							,							):

									"""simple docstring"""







									SCREAMING_SNAKE_CASE_    			=			size if size is not None else {'''shortest_edge''': 30}
									SCREAMING_SNAKE_CASE_    			=			crop_size if crop_size is not None else {'''height''': 30, '''width''': 30}
									SCREAMING_SNAKE_CASE_    			=			parent
									SCREAMING_SNAKE_CASE_    			=			batch_size
									SCREAMING_SNAKE_CASE_    			=			num_channels
									SCREAMING_SNAKE_CASE_    			=			min_resolution
									SCREAMING_SNAKE_CASE_    			=			max_resolution
									SCREAMING_SNAKE_CASE_    			=			do_resize_and_center_crop
									SCREAMING_SNAKE_CASE_    			=			size
									SCREAMING_SNAKE_CASE_    			=			crop_pct
									SCREAMING_SNAKE_CASE_    			=			crop_size
									SCREAMING_SNAKE_CASE_    			=			do_normalize
									SCREAMING_SNAKE_CASE_    			=			image_mean
									SCREAMING_SNAKE_CASE_    			=			image_std







							def _lowercase       (self     ):

									"""simple docstring"""







									return {
									    "size": self.size,
									    "do_resize_and_center_crop": self.do_resize_and_center_crop,
									    "crop_pct": self.crop_pct,
									    "crop_size": self.crop_size,
									    "do_normalize": self.do_normalize,
									    "image_mean": self.image_mean,
									    "image_std": self.image_std,
									}







@require_torch
@require_vision
class 			snake_case  (				__lowercase							,      unittest.TestCase ):
							UpperCAmelCase__      =   PoolFormerImageProcessor if is_vision_available() else None

							def _lowercase       (self     ):

									"""simple docstring"""







									SCREAMING_SNAKE_CASE_    			=			PoolFormerImageProcessingTester(self     )

							@property
							def _lowercase       (self     ):

									"""simple docstring"""







									return self.image_processor_tester.prepare_image_processor_dict()

							def _lowercase       (self     ):

									"""simple docstring"""







									SCREAMING_SNAKE_CASE_    			=			self.image_processing_class(**self.image_processor_dict     )
									self.assertTrue(hasattr(SCREAMING_SNAKE_CASE_							,							'''do_resize_and_center_crop'''     )     )
									self.assertTrue(hasattr(SCREAMING_SNAKE_CASE_							,							'''size'''     )     )
									self.assertTrue(hasattr(SCREAMING_SNAKE_CASE_							,							'''crop_pct'''     )     )
									self.assertTrue(hasattr(SCREAMING_SNAKE_CASE_							,							'''do_normalize'''     )     )
									self.assertTrue(hasattr(SCREAMING_SNAKE_CASE_							,							'''image_mean'''     )     )
									self.assertTrue(hasattr(SCREAMING_SNAKE_CASE_							,							'''image_std'''     )     )

							def _lowercase       (self     ):

									"""simple docstring"""







									SCREAMING_SNAKE_CASE_    			=			self.image_processing_class.from_dict(self.image_processor_dict     )
									self.assertEqual(image_processor.size							,							{'''shortest_edge''': 30}     )
									self.assertEqual(image_processor.crop_size							,							{'''height''': 30, '''width''': 30}     )

									SCREAMING_SNAKE_CASE_    			=			self.image_processing_class.from_dict(self.image_processor_dict							,							size=42							,							crop_size=84     )
									self.assertEqual(image_processor.size							,							{'''shortest_edge''': 42}     )
									self.assertEqual(image_processor.crop_size							,							{'''height''': 84, '''width''': 84}     )

							def _lowercase       (self     ):

									"""simple docstring"""







									pass

							def _lowercase       (self     ):

									"""simple docstring"""







									SCREAMING_SNAKE_CASE_    			=			self.image_processing_class(**self.image_processor_dict     )
									# create random PIL images
									SCREAMING_SNAKE_CASE_    			=			prepare_image_inputs(self.image_processor_tester							,							equal_resolution=SCREAMING_SNAKE_CASE_     )
									for image in image_inputs:
											self.assertIsInstance(SCREAMING_SNAKE_CASE_							,							Image.Image     )

									# Test not batched input
									SCREAMING_SNAKE_CASE_    			=			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.crop_size['''height'''],
									        self.image_processor_tester.crop_size['''width'''],
									    )							,							)

									# Test batched
									SCREAMING_SNAKE_CASE_    			=			image_processing(SCREAMING_SNAKE_CASE_							,							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.crop_size['''height'''],
									        self.image_processor_tester.crop_size['''width'''],
									    )							,							)

							def _lowercase       (self     ):

									"""simple docstring"""







									SCREAMING_SNAKE_CASE_    			=			self.image_processing_class(**self.image_processor_dict     )
									# create random numpy tensors
									SCREAMING_SNAKE_CASE_    			=			prepare_image_inputs(self.image_processor_tester							,							equal_resolution=SCREAMING_SNAKE_CASE_							,							numpify=SCREAMING_SNAKE_CASE_     )
									for image in image_inputs:
											self.assertIsInstance(SCREAMING_SNAKE_CASE_							,							np.ndarray     )

									# Test not batched input
									SCREAMING_SNAKE_CASE_    			=			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.crop_size['''height'''],
									        self.image_processor_tester.crop_size['''width'''],
									    )							,							)

									# Test batched
									SCREAMING_SNAKE_CASE_    			=			image_processing(SCREAMING_SNAKE_CASE_							,							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.crop_size['''height'''],
									        self.image_processor_tester.crop_size['''width'''],
									    )							,							)







							def _lowercase       (self     ):

									"""simple docstring"""







									SCREAMING_SNAKE_CASE_    			=			self.image_processing_class(**self.image_processor_dict     )
									# create random PyTorch tensors
									SCREAMING_SNAKE_CASE_    			=			prepare_image_inputs(self.image_processor_tester							,							equal_resolution=SCREAMING_SNAKE_CASE_							,							torchify=SCREAMING_SNAKE_CASE_     )
									for image in image_inputs:
											self.assertIsInstance(SCREAMING_SNAKE_CASE_							,							torch.Tensor     )

									# Test not batched input
									SCREAMING_SNAKE_CASE_    			=			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.crop_size['''height'''],
									        self.image_processor_tester.crop_size['''width'''],
									    )							,							)

									# Test batched
									SCREAMING_SNAKE_CASE_    			=			image_processing(SCREAMING_SNAKE_CASE_							,							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.crop_size['''height'''],
									        self.image_processor_tester.crop_size['''width'''],
									    )							,							)

"""simple docstring"""




def 							_lowerCamelCase			(			__a     ):
		if divisor % 5 == 0 or divisor % 2 == 0:
				return 0
		SCREAMING_SNAKE_CASE_    			=			1
		SCREAMING_SNAKE_CASE_    			=			1
		while repunit:
				SCREAMING_SNAKE_CASE_    			=			(10 * repunit + 1) % divisor
				repunit_index += 1
		return repunit_index



def 							_lowerCamelCase			(			__a = 1_000_000     ):
		SCREAMING_SNAKE_CASE_    			=			limit - 1
		if divisor % 2 == 0:
				divisor += 1
		while least_divisible_repunit(__a     ) <= limit:
				divisor += 2
		return divisor


if __name__ == "__main__":
						print(f'''{solution() = }''')