"""simple docstring"""







from typing import Dict, 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_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    is_valid_image,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


if is_vision_available():
	import PIL


_a					:					Dict=			logging.get_logger(__name__)
def   __UpperCAmelCase    (   UpperCAmelCase_   :    Dict  )							->      List[List[ImageInput]]:

	'''simple docstring'''





	if isinstance(UpperCAmelCase_      ,							(list, tuple)  ) and isinstance(videos[0]      ,							(list, tuple)  ) and is_valid_image(videos[0][0]  ):
		return videos

	elif isinstance(UpperCAmelCase_      ,							(list, tuple)  ) and is_valid_image(videos[0]  ):
		return [videos]

	elif is_valid_image(UpperCAmelCase_  ):
		return [[videos]]

	raise ValueError(F"Could not make batched video from {videos}"  )

class 		UpperCamelCase      (   lowercase						):
				UpperCAmelCase    :				Optional[int]   =		["""pixel_values"""]



				def __init__(self    :				Any     ,  _A    :				bool = True     ,  _A    :				Dict[str, int] = None     ,  _A    :				PILImageResampling = PILImageResampling.BILINEAR     ,  _A    :				bool = True     ,  _A    :				Dict[str, int] = None     ,  _A    :				bool = True     ,  _A    :				Union[int, float] = 1 / 2_55     ,  _A    :				bool = True     ,  _A    :				Optional[Union[float, List[float]]] = None     ,  _A    :				Optional[Union[float, List[float]]] = None     ,  **_A    :				str     ,  )   ->     None:
					super().__init__(**_A)
					__snake_case      :							str						=			size if size is not None else {'shortest_edge': 2_24}
					__snake_case      :							int						=			get_size_dict(_A     ,  default_to_square=_A)
					__snake_case      :							Union[str, Any]						=			crop_size if crop_size is not None else {'height': 2_24, 'width': 2_24}
					__snake_case      :							str						=			get_size_dict(_A     ,  param_name='crop_size')

					__snake_case      :							int						=			do_resize
					__snake_case      :							List[str]						=			size
					__snake_case      :							Dict						=			do_center_crop
					__snake_case      :							Tuple						=			crop_size
					__snake_case      :							Any						=			resample
					__snake_case      :							List[Any]						=			do_rescale
					__snake_case      :							Union[str, Any]						=			rescale_factor
					__snake_case      :							str						=			do_normalize
					__snake_case      :							Optional[int]						=			image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
					__snake_case      :							Any						=			image_std if image_std is not None else IMAGENET_STANDARD_STD



				def  _lowercase					(self    :				Optional[int]     ,  _A    :				np.ndarray     ,  _A    :				Dict[str, int]     ,  _A    :				PILImageResampling = PILImageResampling.BILINEAR     ,  _A    :				Optional[Union[str, ChannelDimension]] = None     ,  **_A    :				Any     ,  )   ->     np.ndarray:
					__snake_case      :							Tuple						=			get_size_dict(_A     ,  default_to_square=_A)
					if "shortest_edge" in size:
						__snake_case      :							int						=			get_resize_output_image_size(_A     ,  size['shortest_edge']     ,  default_to_square=_A)
					elif "height" in size and "width" in size:
						__snake_case      :							Union[str, Any]						=			(size['height'], size['width'])
					else:
						raise ValueError(f"Size must have 'height' and 'width' or 'shortest_edge' as keys. Got {size.keys()}")
					return resize(_A     ,  size=_A     ,  resample=_A     ,  data_format=_A     ,  **_A)



				def  _lowercase					(self    :				List[Any]     ,  _A    :				np.ndarray     ,  _A    :				Dict[str, int]     ,  _A    :				Optional[Union[str, ChannelDimension]] = None     ,  **_A    :				int     ,  )   ->     np.ndarray:
					__snake_case      :							List[str]						=			get_size_dict(_A)
					if "height" not in size or "width" not in size:
						raise ValueError(f"Size must have 'height' and 'width' as keys. Got {size.keys()}")
					return center_crop(_A     ,  size=(size['height'], size['width'])     ,  data_format=_A     ,  **_A)



				def  _lowercase					(self    :				Dict     ,  _A    :				np.ndarray     ,  _A    :				Union[int, float]     ,  _A    :				Optional[Union[str, ChannelDimension]] = None     ,  **_A    :				List[str]     ,  )   ->     Optional[Any]:
					return rescale(_A     ,  scale=_A     ,  data_format=_A     ,  **_A)



				def  _lowercase					(self    :				List[Any]     ,  _A    :				np.ndarray     ,  _A    :				Union[float, List[float]]     ,  _A    :				Union[float, List[float]]     ,  _A    :				Optional[Union[str, ChannelDimension]] = None     ,  **_A    :				Optional[int]     ,  )   ->     np.ndarray:
					return normalize(_A     ,  mean=_A     ,  std=_A     ,  data_format=_A     ,  **_A)



				def  _lowercase					(self    :				Optional[Any]     ,  _A    :				ImageInput     ,  _A    :				bool = None     ,  _A    :				Dict[str, int] = None     ,  _A    :				PILImageResampling = None     ,  _A    :				bool = None     ,  _A    :				Dict[str, int] = None     ,  _A    :				bool = None     ,  _A    :				float = None     ,  _A    :				bool = None     ,  _A    :				Optional[Union[float, List[float]]] = None     ,  _A    :				Optional[Union[float, List[float]]] = None     ,  _A    :				Optional[ChannelDimension] = ChannelDimension.FIRST     ,  )   ->     np.ndarray:
					if do_resize and size is None or resample is None:
						raise ValueError('Size and resample 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.
					__snake_case      :							Union[str, Any]						=			to_numpy_array(_A)

					if do_resize:
						__snake_case      :							Optional[Any]						=			self.resize(image=_A     ,  size=_A     ,  resample=_A)

					if do_center_crop:
						__snake_case      :							Optional[Any]						=			self.center_crop(_A     ,  size=_A)

					if do_rescale:
						__snake_case      :							Optional[Any]						=			self.rescale(image=_A     ,  scale=_A)

					if do_normalize:
						__snake_case      :							Tuple						=			self.normalize(image=_A     ,  mean=_A     ,  std=_A)

					__snake_case      :							Optional[Any]						=			to_channel_dimension_format(_A     ,  _A)
					return image






				def  _lowercase					(self    :				Union[str, Any]     ,  _A    :				ImageInput     ,  _A    :				bool = None     ,  _A    :				Dict[str, int] = None     ,  _A    :				PILImageResampling = None     ,  _A    :				bool = None     ,  _A    :				Dict[str, int] = None     ,  _A    :				bool = None     ,  _A    :				float = None     ,  _A    :				bool = None     ,  _A    :				Optional[Union[float, List[float]]] = None     ,  _A    :				Optional[Union[float, List[float]]] = None     ,  _A    :				Optional[Union[str, TensorType]] = None     ,  _A    :				ChannelDimension = ChannelDimension.FIRST     ,  **_A    :				List[str]     ,  )   ->     PIL.Image.Image:
					__snake_case      :							List[str]						=			do_resize if do_resize is not None else self.do_resize
					__snake_case      :							List[str]						=			resample if resample is not None else self.resample
					__snake_case      :							Union[str, Any]						=			do_center_crop if do_center_crop is not None else self.do_center_crop
					__snake_case      :							Union[str, Any]						=			do_rescale if do_rescale is not None else self.do_rescale
					__snake_case      :							Optional[Any]						=			rescale_factor if rescale_factor is not None else self.rescale_factor
					__snake_case      :							Dict						=			do_normalize if do_normalize is not None else self.do_normalize
					__snake_case      :							List[str]						=			image_mean if image_mean is not None else self.image_mean
					__snake_case      :							Tuple						=			image_std if image_std is not None else self.image_std

					__snake_case      :							int						=			size if size is not None else self.size
					__snake_case      :							str						=			get_size_dict(_A     ,  default_to_square=_A)
					__snake_case      :							int						=			crop_size if crop_size is not None else self.crop_size
					__snake_case      :							List[str]						=			get_size_dict(_A     ,  param_name='crop_size')

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

					__snake_case      :							List[Any]						=			make_batched(_A)

					__snake_case      :							Tuple						=			[
					    [
					        self._preprocess_image(
					            image=_A     ,  do_resize=_A     ,  size=_A     ,  resample=_A     ,  do_center_crop=_A     ,  crop_size=_A     ,  do_rescale=_A     ,  rescale_factor=_A     ,  do_normalize=_A     ,  image_mean=_A     ,  image_std=_A     ,  data_format=_A     ,  )
					        for img in video
					    ]
					    for video in videos
					]

					__snake_case      :							str						=			{'pixel_values': videos}
					return BatchFeature(data=_A     ,  tensor_type=_A)






"""simple docstring"""







from decimal import Decimal, getcontext
from math import ceil, factorial
def   __UpperCAmelCase    (   UpperCAmelCase_   :    int  )							->      str:

	'''simple docstring'''





	if not isinstance(UpperCAmelCase_      ,							UpperCAmelCase_  ):
		raise TypeError('Undefined for non-integers'  )
	elif precision < 1:
		raise ValueError('Undefined for non-natural numbers'  )

	__snake_case      :							Any						=			precision
	__snake_case      :							Optional[int]						=			ceil(precision / 14  )
	__snake_case      :							List[Any]						=			42_68_80 * Decimal(1_00_05  ).sqrt()
	__snake_case      :							Optional[Any]						=			1
	__snake_case      :							Union[str, Any]						=			13_59_14_09
	__snake_case      :							int						=			Decimal(UpperCAmelCase_  )
	for k in range(1      ,							UpperCAmelCase_  ):
		__snake_case      :							Union[str, Any]						=			factorial(6 * k  ) // (factorial(3 * k  ) * factorial(UpperCAmelCase_  ) ** 3)
		linear_term += 5_45_14_01_34
		exponential_term *= -26_25_37_41_26_40_76_80_00
		partial_sum += Decimal(multinomial_term * linear_term  ) / exponential_term
	return str(constant_term / partial_sum  )[:-1]


if __name__ == "__main__":
	_a					:					List[Any]=			50
	print(f'''The first {n} digits of pi is: {pi(n)}''')





