





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 LevitImageProcessor





class 			lowerCAmelCase__( unittest.TestCase    ):






       '''simple docstring'''


       def __init__(      self    ,						__lowerCamelCase    ,						__lowerCamelCase=7    ,						__lowerCamelCase=3    ,						__lowerCamelCase=1_8    ,						__lowerCamelCase=3_0    ,						__lowerCamelCase=4_0_0    ,						__lowerCamelCase=True    ,						__lowerCamelCase=None    ,						__lowerCamelCase=True    ,						__lowerCamelCase=None    ,						__lowerCamelCase=True    ,						__lowerCamelCase=[0.5, 0.5, 0.5]    ,						__lowerCamelCase=[0.5, 0.5, 0.5]    ,						)			->     List[Any]:
            _SCREAMING_SNAKE_CASE       :	int						    =							size if size is not None else {'''shortest_edge''': 1_8}
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							crop_size if crop_size is not None else {'''height''': 1_8, '''width''': 1_8}
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							parent
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							batch_size
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							num_channels
            _SCREAMING_SNAKE_CASE       :	Any						    =							image_size
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							min_resolution
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							max_resolution
            _SCREAMING_SNAKE_CASE       :	Any						    =							do_resize
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							size
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							do_center_crop
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							crop_size
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							do_normalize
            _SCREAMING_SNAKE_CASE       :	Dict						    =							image_mean
            _SCREAMING_SNAKE_CASE       :	str						    =							image_std







       def     UpperCamelCase_			(      self							)			->     Dict:
            return {
                "image_mean": self.image_mean,
                "image_std": self.image_std,
                "do_normalize": self.do_normalize,
                "do_resize": self.do_resize,
                "do_center_crop": self.do_center_crop,
                "size": self.size,
                "crop_size": self.crop_size,
            }





@require_torch
@require_vision
class 			lowerCAmelCase__( a__  ,     unittest.TestCase    ):






       '''simple docstring'''


       __snake_case 			=    LevitImageProcessor if is_vision_available() else None




       def     UpperCamelCase_			(      self							)			->     List[str]:
            _SCREAMING_SNAKE_CASE       :	int						    =							LevitImageProcessingTester(self							)




       @property
       def     UpperCamelCase_			(      self							)			->     List[str]:
            return self.image_processor_tester.prepare_image_processor_dict()




       def     UpperCamelCase_			(      self							)			->     Tuple:
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							self.image_processing_class(**self.image_processor_dict							)
            self.assertTrue(hasattr(lowercase__    ,						"image_mean"							)							)
            self.assertTrue(hasattr(lowercase__    ,						"image_std"							)							)
            self.assertTrue(hasattr(lowercase__    ,						"do_normalize"							)							)
            self.assertTrue(hasattr(lowercase__    ,						"do_resize"							)							)
            self.assertTrue(hasattr(lowercase__    ,						"do_center_crop"							)							)
            self.assertTrue(hasattr(lowercase__    ,						"size"							)							)




       def     UpperCamelCase_			(      self							)			->     Optional[Any]:
            _SCREAMING_SNAKE_CASE       :	str						    =							self.image_processing_class.from_dict(self.image_processor_dict							)
            self.assertEqual(image_processor.size    ,						{"shortest_edge": 1_8}							)
            self.assertEqual(image_processor.crop_size    ,						{"height": 1_8, "width": 1_8}							)

            _SCREAMING_SNAKE_CASE       :	Tuple						    =							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     UpperCamelCase_			(      self							)			->     Tuple:
            pass




       def     UpperCamelCase_			(      self							)			->     Optional[int]:
            _SCREAMING_SNAKE_CASE       :	Dict						    =							self.image_processing_class(**self.image_processor_dict							)
            # create random PIL images
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							prepare_image_inputs(self.image_processor_tester    ,						equal_resolution=lowercase__							)
            for image in image_inputs:
                 self.assertIsInstance(lowercase__    ,						Image.Image							)

            # Test not batched input
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							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       :	Any						    =							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.crop_size["height"],
                    self.image_processor_tester.crop_size["width"],
                )    ,						)




       def     UpperCamelCase_			(      self							)			->     List[Any]:
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							self.image_processing_class(**self.image_processor_dict							)
            # create random numpy tensors
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							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
            _SCREAMING_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
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							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.crop_size["height"],
                    self.image_processor_tester.crop_size["width"],
                )    ,						)







       def     UpperCamelCase_			(      self							)			->     Optional[Any]:
            _SCREAMING_SNAKE_CASE       :	Dict						    =							self.image_processing_class(**self.image_processor_dict							)
            # create random PyTorch tensors
            _SCREAMING_SNAKE_CASE       :	str						    =							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
            _SCREAMING_SNAKE_CASE       :	Dict						    =							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       :	Dict						    =							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.crop_size["height"],
                    self.image_processor_tester.crop_size["width"],
                )    ,						)






from __future__ import annotations

UpperCamelCase__      =[True] * 100_0001
UpperCamelCase__      =2
while i * i <= 100_0000:
       if seive[i]:
              for j in range(i * i, 100_0001, i):
                     UpperCamelCase__      =False
       i += 1






def     lowerCamelCase__			(__lowerCamelCase	):
     return seive[n]






def     lowerCamelCase__			(__lowerCamelCase	):
     return any(digit in "02468" for digit in str(__lowerCamelCase	)	)






def     lowerCamelCase__			(__lowerCamelCase = 1000000	):
     _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							[2]  # result already includes the number 2.
     for num in range(3,       limit + 1,       2	):
          if is_prime(__lowerCamelCase	) and not contains_an_even_digit(__lowerCamelCase	):
               _SCREAMING_SNAKE_CASE       :	List[Any]						    =							str(__lowerCamelCase	)
               _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							[int(str_num[j:] + str_num[:j]	) for j in range(len(__lowerCamelCase	)	)]
               if all(is_prime(__lowerCamelCase	) for i in list_nums	):
                    result.append(__lowerCamelCase	)
     return result






def     lowerCamelCase__			():
     return len(find_circular_primes()	)


if __name__ == "__main__":
       print(f"{len(find_circular_primes()) = }")