


from typing import Dict, Iterable, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    center_crop,
    get_resize_output_image_size,
    normalize,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_DEFAULT_MEAN,
    IMAGENET_DEFAULT_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, logging


lowerCAmelCase	=							logging.get_logger(__name__)


class 	_a							(      UpperCamelCase__      ):
							_lowercase     :      List[Any]  				=			['''pixel_values''']

							def __init__(							self:     List[Any]   ,						UpperCamelCase_:     str = True   ,						UpperCamelCase_:     Any = None   ,						UpperCamelCase_:     List[Any] = PILImageResampling.BICUBIC   ,						UpperCamelCase_:     List[Any] = True   ,						UpperCamelCase_:     Tuple = None   ,						UpperCamelCase_:     int = True   ,						UpperCamelCase_:     Dict = 1 / 255   ,						UpperCamelCase_:     str = True   ,						UpperCamelCase_:     str = IMAGENET_DEFAULT_MEAN   ,						UpperCamelCase_:     Tuple = IMAGENET_DEFAULT_STD   ,						**UpperCamelCase_:     List[Any]   ,						)      ->       None:





									"""simple docstring"""







									super().__init__(**lowerCamelCase_							)
									lowercase__						=				size if size is not None else {'''shortest_edge''': 224}
									lowercase__						=				get_size_dict(lowerCamelCase_   ,						default_to_square=lowerCamelCase_							)
									lowercase__						=				crop_size if crop_size is not None else {'''height''': 224, '''width''': 224}
									lowercase__						=				get_size_dict(lowerCamelCase_   ,						param_name='''crop_size'''							)

									lowercase__						=				do_resize
									lowercase__						=				size
									lowercase__						=				resample
									lowercase__						=				do_center_crop
									lowercase__						=				crop_size
									lowercase__						=				do_rescale
									lowercase__						=				rescale_factor
									lowercase__						=				do_normalize
									lowercase__						=				image_mean if image_mean is not None else IMAGENET_DEFAULT_MEAN
									lowercase__						=				image_std if image_std is not None else IMAGENET_DEFAULT_STD

							def 				lowerCamelCase_			(							self:     str   ,						UpperCamelCase_:     Optional[int]   ,						UpperCamelCase_:     Union[str, Any]   ,						UpperCamelCase_:     List[Any] = PILImageResampling.BICUBIC   ,						UpperCamelCase_:     Union[str, Any] = None   ,						**UpperCamelCase_:     str   ,						)      ->       np.ndarray:





									"""simple docstring"""







									lowercase__						=				get_size_dict(lowerCamelCase_   ,						default_to_square=lowerCamelCase_							)
									# size_dict is a dict with either keys "height" and "width" or "shortest_edge"
									if "shortest_edge" in size:
											lowercase__						=				int((256 / 224) * size['''shortest_edge''']							)
											lowercase__						=				get_resize_output_image_size(lowerCamelCase_   ,						size=lowerCamelCase_   ,						default_to_square=lowerCamelCase_							)
											lowercase__						=				{'''height''': output_size[0], '''width''': output_size[1]}
									if "height" not in size_dict or "width" not in size_dict:
											raise ValueError(
											    f'Size dict must have keys \'height\' and \'width\' or \'shortest_edge\'. Got {size_dict.keys()}'							)
									return resize(
									    lowerCamelCase_   ,						size=(size_dict['''height'''], size_dict['''width'''])   ,						resample=lowerCamelCase_   ,						data_format=lowerCamelCase_   ,						**lowerCamelCase_							)

							def 				lowerCamelCase_			(							self:     Dict   ,						UpperCamelCase_:     str   ,						UpperCamelCase_:     int   ,						UpperCamelCase_:     Optional[Any] = None   ,						**UpperCamelCase_:     Tuple   ,						)      ->       np.ndarray:





									"""simple docstring"""







									lowercase__						=				get_size_dict(lowerCamelCase_							)
									if "height" not in size or "width" not in size:
											raise ValueError(f'Size dict must have keys \'height\' and \'width\'. Got {size.keys()}'							)
									return center_crop(lowerCamelCase_   ,						size=(size['''height'''], size['''width'''])   ,						data_format=lowerCamelCase_   ,						**lowerCamelCase_							)

							def 				lowerCamelCase_			(							self:     str   ,						UpperCamelCase_:     Tuple   ,						UpperCamelCase_:     int   ,						UpperCamelCase_:     Optional[Any] = None   ,						**UpperCamelCase_:     str   ,						)      ->       np.ndarray:





									"""simple docstring"""







									return rescale(lowerCamelCase_   ,						scale=lowerCamelCase_   ,						data_format=lowerCamelCase_   ,						**lowerCamelCase_							)

							def 				lowerCamelCase_			(							self:     Union[str, Any]   ,						UpperCamelCase_:     Optional[Any]   ,						UpperCamelCase_:     List[str]   ,						UpperCamelCase_:     int   ,						UpperCamelCase_:     Union[str, Any] = None   ,						**UpperCamelCase_:     Optional[Any]   ,						)      ->       np.ndarray:





									"""simple docstring"""







									return normalize(lowerCamelCase_   ,						mean=lowerCamelCase_   ,						std=lowerCamelCase_   ,						data_format=lowerCamelCase_   ,						**lowerCamelCase_							)


							def 				lowerCamelCase_			(							self:     List[Any]   ,						UpperCamelCase_:     Optional[int]   ,						UpperCamelCase_:     Optional[int] = None   ,						UpperCamelCase_:     Optional[Any] = None   ,						UpperCamelCase_:     List[str] = None   ,						UpperCamelCase_:     Optional[int] = None   ,						UpperCamelCase_:     Dict = None   ,						UpperCamelCase_:     str = None   ,						UpperCamelCase_:     str = None   ,						UpperCamelCase_:     List[str] = None   ,						UpperCamelCase_:     Any = None   ,						UpperCamelCase_:     str = None   ,						UpperCamelCase_:     List[str] = None   ,						UpperCamelCase_:     Union[str, Any] = ChannelDimension.FIRST   ,						**UpperCamelCase_:     Optional[int]   ,						)      ->       BatchFeature:





									"""simple docstring"""







									lowercase__						=				do_resize if do_resize is not None else self.do_resize
									lowercase__						=				resample if resample is not None else self.resample
									lowercase__						=				do_center_crop if do_center_crop is not None else self.do_center_crop
									lowercase__						=				do_rescale if do_rescale is not None else self.do_rescale
									lowercase__						=				rescale_factor if rescale_factor is not None else self.rescale_factor
									lowercase__						=				do_normalize if do_normalize is not None else self.do_normalize
									lowercase__						=				image_mean if image_mean is not None else self.image_mean
									lowercase__						=				image_std if image_std is not None else self.image_std

									lowercase__						=				size if size is not None else self.size
									lowercase__						=				get_size_dict(lowerCamelCase_   ,						default_to_square=lowerCamelCase_							)
									lowercase__						=				crop_size if crop_size is not None else self.crop_size
									lowercase__						=				get_size_dict(lowerCamelCase_   ,						param_name='''crop_size'''							)

									lowercase__						=				make_list_of_images(lowerCamelCase_							)

									if not valid_images(lowerCamelCase_							):
											raise ValueError(
											    '''Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, '''
											    '''torch.Tensor, tf.Tensor or jax.ndarray.'''							)

									if do_resize and size is None:
											raise ValueError('''Size must be specified if do_resize is True.'''							)

									if do_center_crop and crop_size is None:
											raise ValueError('''Crop size must be specified if do_center_crop is True.'''							)

									if do_rescale and rescale_factor is None:
											raise ValueError('''Rescale factor must be specified if do_rescale is True.'''							)

									if do_normalize and (image_mean is None or image_std is None):
											raise ValueError('''Image mean and std must be specified if do_normalize is True.'''							)

									# All transformations expect numpy arrays.
									lowercase__						=				[to_numpy_array(lowerCamelCase_							) for image in images]

									if do_resize:
											lowercase__						=				[self.resize(lowerCamelCase_   ,						lowerCamelCase_   ,						lowerCamelCase_							) for image in images]

									if do_center_crop:
											lowercase__						=				[self.center_crop(lowerCamelCase_   ,						lowerCamelCase_							) for image in images]

									if do_rescale:
											lowercase__						=				[self.rescale(lowerCamelCase_   ,						lowerCamelCase_							) for image in images]

									if do_normalize:
											lowercase__						=				[self.normalize(lowerCamelCase_   ,						lowerCamelCase_   ,						lowerCamelCase_							) for image in images]

									lowercase__						=				[to_channel_dimension_format(lowerCamelCase_   ,						lowerCamelCase_							) for image in images]

									lowercase__						=				{'''pixel_values''': images}
									return BatchFeature(data=lowerCamelCase_   ,						tensor_type=lowerCamelCase_							)






def       _a			(				SCREAMING_SNAKE_CASE						,    SCREAMING_SNAKE_CASE					):


		"""simple docstring"""




		return base * power(SCREAMING_SNAKE_CASE						,    (exponent - 1)					) if exponent else 1


if __name__ == "__main__":
			print('Raise base to the power of exponent using recursion...')
			lowerCAmelCase	=							int(input('Enter the base: ').strip())
			lowerCAmelCase	=							int(input('Enter the exponent: ').strip())
			lowerCAmelCase	=							power(base, abs(exponent))
			if exponent < 0:  # power() does not properly deal w/ negative exponents
						lowerCAmelCase	=							1 / result
			print(f"""{base} to the power of {exponent} is {result}""")


