




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


if is_torch_available():
	import torch

if is_vision_available():
	from PIL import Image

	from transformers import SwinaSRImageProcessor
	from transformers.image_transforms import get_image_size

class 		lowercase_       (	unittest.TestCase				):




					def __init__(   self:		List[str],     _lowercase:		Any,     _lowercase:		Optional[int]=7,     _lowercase:		int=3,     _lowercase:		List[str]=18,     _lowercase:		Any=30,     _lowercase:		Optional[Any]=400,     _lowercase:		Union[str, Any]=True,     _lowercase:		List[Any]=1 / 255,     _lowercase:		Union[str, Any]=True,     _lowercase:		Tuple=8,     ):


									'''simple docstring'''


									__lowerCAmelCase					=  parent
									__lowerCAmelCase					=  batch_size
									__lowerCAmelCase					=  num_channels
									__lowerCAmelCase					=  image_size
									__lowerCAmelCase					=  min_resolution
									__lowerCAmelCase					=  max_resolution
									__lowerCAmelCase					=  do_rescale
									__lowerCAmelCase					=  rescale_factor
									__lowerCAmelCase					=  do_pad
									__lowerCAmelCase					=  pad_size




					def     _lowercase						(   self:		Optional[int]):


									'''simple docstring'''


									return {
									    "do_rescale": self.do_rescale,
									    "rescale_factor": self.rescale_factor,
									    "do_pad": self.do_pad,
									    "pad_size": self.pad_size,
									}







					def     _lowercase						(   self:		Union[str, Any],     _lowercase:		str=False,     _lowercase:		Union[str, Any]=False,     _lowercase:		Any=False):


									'''simple docstring'''


									assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"

									if equal_resolution:
													__lowerCAmelCase					=  []
													for i in range(self.batch_size):
																	image_inputs.append(
																	    np.random.randint(
																	        255,     size=(self.num_channels, self.max_resolution, self.max_resolution),     dtype=np.uinta))
									else:
													__lowerCAmelCase					=  []
													for i in range(self.batch_size):
																	__lowerCAmelCase	,				__lowerCAmelCase					=  np.random.choice(np.arange(self.min_resolution,     self.max_resolution),     2)
																	image_inputs.append(np.random.randint(255,     size=(self.num_channels, width, height),     dtype=np.uinta))

									if not numpify and not torchify:
													# PIL expects the channel dimension as last dimension
													__lowerCAmelCase					=  [Image.fromarray(np.moveaxis(_lowercase,     0,     -1)) for x in image_inputs]

									if torchify:
													__lowerCAmelCase					=  [torch.from_numpy(_lowercase) for x in image_inputs]

									return image_inputs





@require_torch
@require_vision
class 		lowercase_       (	lowerCAmelCase__						,							unittest.TestCase				):
					__UpperCamelCase     	= SwinaSRImageProcessor if is_vision_available() else None




					def     _lowercase						(   self:		Optional[Any]):


									'''simple docstring'''


									__lowerCAmelCase					=  SwinaSRImageProcessingTester(self)




					@property
					def     _lowercase						(   self:		Tuple):


									'''simple docstring'''


									return self.image_processor_tester.prepare_image_processor_dict()




					def     _lowercase						(   self:		List[str]):


									'''simple docstring'''


									__lowerCAmelCase					=  self.image_processing_class(**self.image_processor_dict)
									self.assertTrue(hasattr(_lowercase,     """do_rescale"""))
									self.assertTrue(hasattr(_lowercase,     """rescale_factor"""))
									self.assertTrue(hasattr(_lowercase,     """do_pad"""))
									self.assertTrue(hasattr(_lowercase,     """pad_size"""))




					def     _lowercase						(   self:		int):


									'''simple docstring'''


									pass




					def     _lowercase						(   self:		List[str],     _lowercase:		Optional[Any]):


									'''simple docstring'''


									__lowerCAmelCase	,				__lowerCAmelCase					=  get_image_size(_lowercase)
									__lowerCAmelCase					=  self.image_processor_tester.pad_size

									__lowerCAmelCase					=  (old_height // size + 1) * size - old_height
									__lowerCAmelCase					=  (old_width // size + 1) * size - old_width
									return old_height + pad_height, old_width + pad_width




					def     _lowercase						(   self:		Optional[int]):


									'''simple docstring'''


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

									# Test not batched input
									__lowerCAmelCase					=  image_processor(image_inputs[0],     return_tensors="""pt""").pixel_values
									__lowerCAmelCase	,				__lowerCAmelCase					=  self.calculate_expected_size(np.array(image_inputs[0]))
									self.assertEqual(
									    encoded_images.shape,     (
									        1,
									        self.image_processor_tester.num_channels,
									        expected_height,
									        expected_width,
									    ),     )




					def     _lowercase						(   self:		Tuple):


									'''simple docstring'''


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

									# Test not batched input
									__lowerCAmelCase					=  image_processor(image_inputs[0],     return_tensors="""pt""").pixel_values
									__lowerCAmelCase	,				__lowerCAmelCase					=  self.calculate_expected_size(image_inputs[0])
									self.assertEqual(
									    encoded_images.shape,     (
									        1,
									        self.image_processor_tester.num_channels,
									        expected_height,
									        expected_width,
									    ),     )







					def     _lowercase						(   self:		Any):


									'''simple docstring'''


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

									# Test not batched input
									__lowerCAmelCase					=  image_processor(image_inputs[0],     return_tensors="""pt""").pixel_values
									__lowerCAmelCase	,				__lowerCAmelCase					=  self.calculate_expected_size(image_inputs[0])
									self.assertEqual(
									    encoded_images.shape,     (
									        1,
									        self.image_processor_tester.num_channels,
									        expected_height,
									        expected_width,
									    ),     )







"""simple docstring"""


import math



def        _lowerCamelCase(__UpperCamelCase			)							->					bool:

	if 1 < number < 4:
		# 2 and 3 are primes
		return True
	elif number < 2 or number % 2 == 0 or number % 3 == 0:
		# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
		return False

	# All primes number are in format of 6k +/- 1
	for i in range(5       ,					int(math.sqrt(__UpperCamelCase			) + 1			)       ,					6			):
		if number % i == 0 or number % (i + 2) == 0:
			return False
	return True



def        _lowerCamelCase(__UpperCamelCase = 600851475143			)							->					int:

	try:
		_lowerCAmelCase								=int(__UpperCamelCase			)
	except (TypeError, ValueError):
		raise TypeError("""Parameter n must be int or castable to int."""			)
	if n <= 0:
		raise ValueError("""Parameter n must be greater than or equal to one."""			)
	_lowerCAmelCase								=0
	if is_prime(__UpperCamelCase			):
		return n
	while n % 2 == 0:
		n //= 2
	if is_prime(__UpperCamelCase			):
		return n
	for i in range(3       ,					int(math.sqrt(__UpperCamelCase			)			) + 1       ,					2			):
		if n % i == 0:
			if is_prime(n // i			):
				_lowerCAmelCase								=n // i
				break
			elif is_prime(__UpperCamelCase			):
				_lowerCAmelCase								=i
	return max_number


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



