





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        _a(    unittest.TestCase    ):







		def __init__(    self ,						__snake_case ,						__snake_case=7 ,						__snake_case=3 ,						__snake_case=3_0 ,						__snake_case=4_0_0 ,						__snake_case=True ,						__snake_case=None ,						__snake_case=0.9 ,						__snake_case=None ,						__snake_case=True ,						__snake_case=[0.5, 0.5, 0.5] ,						__snake_case=[0.5, 0.5, 0.5] ,						)      ->      Union[str, Any]:


							'''simple docstring'''

							_snake_case       :					Any				       =   size if size is not None else {"shortest_edge": 3_0}
							_snake_case       :					Any				       =   crop_size if crop_size is not None else {"height": 3_0, "width": 3_0}
							_snake_case       :					Any				       =   parent
							_snake_case       :					Optional[int]				       =   batch_size
							_snake_case       :					Dict				       =   num_channels
							_snake_case       :					Optional[int]				       =   min_resolution
							_snake_case       :					Optional[int]				       =   max_resolution
							_snake_case       :					Optional[int]				       =   do_resize_and_center_crop
							_snake_case       :					Optional[Any]				       =   size
							_snake_case       :					Dict				       =   crop_pct
							_snake_case       :					Optional[int]				       =   crop_size
							_snake_case       :					Optional[Any]				       =   do_normalize
							_snake_case       :					List[str]				       =   image_mean
							_snake_case       :					Dict				       =   image_std







		def        lowercase       (    self				)      ->      List[str]:


							'''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        _a(    __A	,   unittest.TestCase    ):
		lowerCamelCase__     :Optional[Any]   				=		PoolFormerImageProcessor if is_vision_available() else None







		def        lowercase       (    self				)      ->      Optional[Any]:


							'''simple docstring'''

							_snake_case       :					str				       =   PoolFormerImageProcessingTester(self				)







		@property
		def        lowercase       (    self				)      ->      Dict:


							'''simple docstring'''

							return self.image_processor_tester.prepare_image_processor_dict()







		def        lowercase       (    self				)      ->      Optional[Any]:


							'''simple docstring'''

							_snake_case       :					int				       =   self.image_processing_class(**self.image_processor_dict				)
							self.assertTrue(hasattr(__snake_case ,						"do_resize_and_center_crop"				)				)
							self.assertTrue(hasattr(__snake_case ,						"size"				)				)
							self.assertTrue(hasattr(__snake_case ,						"crop_pct"				)				)
							self.assertTrue(hasattr(__snake_case ,						"do_normalize"				)				)
							self.assertTrue(hasattr(__snake_case ,						"image_mean"				)				)
							self.assertTrue(hasattr(__snake_case ,						"image_std"				)				)







		def        lowercase       (    self				)      ->      Union[str, Any]:


							'''simple docstring'''

							_snake_case       :					str				       =   self.image_processing_class.from_dict(self.image_processor_dict				)
							self.assertEqual(image_processor.size ,						{"shortest_edge": 3_0}				)
							self.assertEqual(image_processor.crop_size ,						{"height": 3_0, "width": 3_0}				)

							_snake_case       :					Any				       =   self.image_processing_class.from_dict(self.image_processor_dict ,						size=4_2 ,						crop_size=8_4				)
							self.assertEqual(image_processor.size ,						{"shortest_edge": 4_2}				)
							self.assertEqual(image_processor.crop_size ,						{"height": 8_4, "width": 8_4}				)







		def        lowercase       (    self				)      ->      Union[str, Any]:


							'''simple docstring'''

							pass







		def        lowercase       (    self				)      ->      List[str]:


							'''simple docstring'''

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

							# Test not batched input
							_snake_case       :					Optional[int]				       =   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
							_snake_case       :					Optional[Any]				       =   image_processing(__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				)      ->      Union[str, Any]:


							'''simple docstring'''

							_snake_case       :					int				       =   self.image_processing_class(**self.image_processor_dict				)
							# create random numpy tensors
							_snake_case       :					Union[str, Any]				       =   prepare_image_inputs(self.image_processor_tester ,						equal_resolution=__snake_case ,						numpify=__snake_case				)
							for image in image_inputs:
												self.assertIsInstance(__snake_case ,						np.ndarray				)

							# Test not batched input
							_snake_case       :					List[Any]				       =   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
							_snake_case       :					List[Any]				       =   image_processing(__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				)      ->      Any:


							'''simple docstring'''

							_snake_case       :					str				       =   self.image_processing_class(**self.image_processor_dict				)
							# create random PyTorch tensors
							_snake_case       :					Optional[int]				       =   prepare_image_inputs(self.image_processor_tester ,						equal_resolution=__snake_case ,						torchify=__snake_case				)
							for image in image_inputs:
												self.assertIsInstance(__snake_case ,						torch.Tensor				)

							# Test not batched input
							_snake_case       :					Union[str, Any]				       =   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
							_snake_case       :					Union[str, Any]				       =   image_processing(__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"],
							    ) ,						)






import re







def    A				(							UpperCAmelCase				):
					_snake_case       :					Any				       =   re.compile(R"^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$"				)
					if match := re.search(UpperCAmelCase  ,  UpperCAmelCase				):
										return match.string == phone
					return False


if __name__ == "__main__":
							print(indian_phone_validator('+918827897895'))