

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 ViTImageProcessor






class _UpperCamelCase							(							unittest.TestCase      ):
			'''simple docstring'''







			def __init__(	self							:       Tuple					,					a							:       int					,					a							:       Optional[int]=13					,					a							:       Optional[int]=3					,					a							:       int=224					,					a							:       Optional[int]=30					,					a							:       int=400					,					a							:       Union[str, Any]=True					,					a							:       int=None					,					a							:       Tuple=True					,					a							:       Tuple=[0.5, 0.5, 0.5]					,					a							:       Optional[int]=[0.5, 0.5, 0.5]					,					)							->				Optional[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE      :					str    =				size if size is not None else {"height": 18, "width": 18}
				SCREAMING_SNAKE_CASE      :					Union[str, Any]    =				parent
				SCREAMING_SNAKE_CASE      :					int    =				batch_size
				SCREAMING_SNAKE_CASE      :					int    =				num_channels
				SCREAMING_SNAKE_CASE      :					Any    =				image_size
				SCREAMING_SNAKE_CASE      :					Tuple    =				min_resolution
				SCREAMING_SNAKE_CASE      :					str    =				max_resolution
				SCREAMING_SNAKE_CASE      :					int    =				do_resize
				SCREAMING_SNAKE_CASE      :					List[Any]    =				size
				SCREAMING_SNAKE_CASE      :					int    =				do_normalize
				SCREAMING_SNAKE_CASE      :					Tuple    =				image_mean
				SCREAMING_SNAKE_CASE      :					Tuple    =				image_std






			def 							__UpperCamelCase       (	self							:       Any		)							->				Optional[int]:

				"""simple docstring"""

				return {
				    "image_mean": self.image_mean,
				    "image_std": self.image_std,
				    "do_normalize": self.do_normalize,
				    "do_resize": self.do_resize,
				    "size": self.size,
				}






@require_torch
@require_vision
class _UpperCamelCase							(							__A							,		unittest.TestCase      ):
			'''simple docstring'''







			lowerCamelCase__							=ViTImageProcessor if is_vision_available() else None
			def 							__UpperCamelCase       (	self							:       Union[str, Any]		)							->				List[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE      :					List[Any]    =				EfficientFormerImageProcessorTester(self		)
			@property
			def 							__UpperCamelCase       (	self							:       Any		)							->				List[str]:

				"""simple docstring"""

				return self.image_proc_tester.prepare_image_processor_dict()
			def 							__UpperCamelCase       (	self							:       List[Any]		)							->				Dict:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE      :					List[Any]    =				self.image_processing_class(**self.image_processor_dict		)
				self.assertTrue(hasattr(a					,					"image_mean"		)		)
				self.assertTrue(hasattr(a					,					"image_std"		)		)
				self.assertTrue(hasattr(a					,					"do_normalize"		)		)
				self.assertTrue(hasattr(a					,					"do_resize"		)		)
				self.assertTrue(hasattr(a					,					"size"		)		)
			def 							__UpperCamelCase       (	self							:       int		)							->				str:

				"""simple docstring"""

				pass
			def 							__UpperCamelCase       (	self							:       Optional[Any]		)							->				List[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE      :					Tuple    =				self.image_processing_class(**self.image_processor_dict		)
				# create random PIL images
				SCREAMING_SNAKE_CASE      :					Any    =				prepare_image_inputs(self.image_proc_tester					,					equal_resolution=a		)
				for image in image_inputs:
					self.assertIsInstance(a					,					Image.Image		)

				# Test not batched input
				SCREAMING_SNAKE_CASE      :					List[str]    =				image_processor(image_inputs[0]					,					return_tensors="pt"		).pixel_values
				self.assertEqual(
				    encoded_images.shape					,					(
				        1,
				        self.image_proc_tester.num_channels,
				        self.image_proc_tester.size["height"],
				        self.image_proc_tester.size["width"],
				    )					,					)

				# Test batched
				SCREAMING_SNAKE_CASE      :					str    =				image_processor(a					,					return_tensors="pt"		).pixel_values
				self.assertEqual(
				    encoded_images.shape					,					(
				        self.image_proc_tester.batch_size,
				        self.image_proc_tester.num_channels,
				        self.image_proc_tester.size["height"],
				        self.image_proc_tester.size["width"],
				    )					,					)
			def 							__UpperCamelCase       (	self							:       List[str]		)							->				Any:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE      :					Dict    =				self.image_processing_class(**self.image_processor_dict		)
				# create random numpy tensors
				SCREAMING_SNAKE_CASE      :					int    =				prepare_image_inputs(self.image_proc_tester					,					equal_resolution=a					,					numpify=a		)
				for image in image_inputs:
					self.assertIsInstance(a					,					np.ndarray		)

				# Test not batched input
				SCREAMING_SNAKE_CASE      :					Optional[Any]    =				image_processor(image_inputs[0]					,					return_tensors="pt"		).pixel_values
				self.assertEqual(
				    encoded_images.shape					,					(
				        1,
				        self.image_proc_tester.num_channels,
				        self.image_proc_tester.size["height"],
				        self.image_proc_tester.size["width"],
				    )					,					)

				# Test batched
				SCREAMING_SNAKE_CASE      :					Any    =				image_processor(a					,					return_tensors="pt"		).pixel_values
				self.assertEqual(
				    encoded_images.shape					,					(
				        self.image_proc_tester.batch_size,
				        self.image_proc_tester.num_channels,
				        self.image_proc_tester.size["height"],
				        self.image_proc_tester.size["width"],
				    )					,					)






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

				"""simple docstring"""

				SCREAMING_SNAKE_CASE      :					Dict    =				self.image_processing_class(**self.image_processor_dict		)
				# create random PyTorch tensors
				SCREAMING_SNAKE_CASE      :					Any    =				prepare_image_inputs(self.image_proc_tester					,					equal_resolution=a					,					torchify=a		)
				for image in image_inputs:
					self.assertIsInstance(a					,					torch.Tensor		)

				# Test not batched input
				SCREAMING_SNAKE_CASE      :					Optional[Any]    =				image_processor(image_inputs[0]					,					return_tensors="pt"		).pixel_values
				self.assertEqual(
				    encoded_images.shape					,					(
				        1,
				        self.image_proc_tester.num_channels,
				        self.image_proc_tester.size["height"],
				        self.image_proc_tester.size["width"],
				    )					,					)

				# Test batched
				SCREAMING_SNAKE_CASE      :					Optional[Any]    =				image_processor(a					,					return_tensors="pt"		).pixel_values
				self.assertEqual(
				    encoded_images.shape					,					(
				        self.image_proc_tester.batch_size,
				        self.image_proc_tester.num_channels,
				        self.image_proc_tester.size["height"],
				        self.image_proc_tester.size["width"],
				    )					,					)
"""simple docstring"""






from __future__ import annotations

from math import pi, sqrt



def SCREAMING_SNAKE_CASE__			(   __UpperCAmelCase       ,    __UpperCAmelCase )  ->  tuple:

   if inductance <= 0:
      raise ValueError('''Inductance cannot be 0 or negative''' )

   elif capacitance <= 0:
      raise ValueError('''Capacitance cannot be 0 or negative''' )

   else:
      return (
          "Resonant frequency",
          float(1 / (2 * pi * (sqrt(inductance * capacitance ))) ),
      )


if __name__ == "__main__":
       import doctest

       doctest.testmod()
