

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






			"""simple docstring"""




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

				"""simple docstring"""


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







			def 			__lowerCAmelCase (    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 SCREAMING_SNAKE_CASE  (		__snake_case							,						unittest.TestCase							):






			"""simple docstring"""




			__A						  =  PoolFormerImageProcessor if is_vision_available() else None


			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				snake_case_      		= PoolFormerImageProcessingTester(self							)


			@property
			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				return self.image_processor_tester.prepare_image_processor_dict()


			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


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


			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				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}							)

				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 			__lowerCAmelCase (    self							):

				"""simple docstring"""


				pass


			def 			__lowerCAmelCase (    self							):

				"""simple docstring"""


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

				# Test not batched input
				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
				snake_case_      		= image_processing(__UpperCamelCase ,				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 			__lowerCAmelCase (    self							):

				"""simple docstring"""


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

				# Test not batched input
				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
				snake_case_      		= image_processing(__UpperCamelCase ,				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 			__lowerCAmelCase (    self							):

				"""simple docstring"""


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

				# Test not batched input
				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
				snake_case_      		= image_processing(__UpperCamelCase ,				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'],
				    ) ,				)



from collections import defaultdict





def a(lowercase__			, lowercase__	):





	'''simple docstring'''
	snake_case_      		= first_str.lower().strip()
	snake_case_      		= second_str.lower().strip()

	# Remove whitespace
	snake_case_      		= first_str.replace(' '			, ''	)
	snake_case_      		= second_str.replace(' '			, ''	)

	# Strings of different lengths are not anagrams
	if len(lowercase__	) != len(lowercase__	):
		return False

	# Default values for count should be 0
	snake_case_      		= defaultdict(lowercase__	)

	# For each character in input strings,
	# increment count in the corresponding
	for i in range(len(lowercase__	)	):
		count[first_str[i]] += 1
		count[second_str[i]] -= 1

	return all(_count == 0 for _count in count.values()	)


if __name__ == "__main__":
		from doctest import testmod

		testmod()
		A											=     input('Enter the first string ').strip()
		A											=     input('Enter the second string ').strip()

		A											=     check_anagrams(input_a, input_b)
		print(f"""{input_a} and {input_b} are {"" if status else "not "}anagrams.""")
