




'''simple docstring'''


def 						snake_case_       (UpperCamelCase			:    int ):





							'''simple docstring'''


							_a      	=							abs(UpperCamelCase )
							_a      	=							0
							while n > 0:
														res += n % 10
														n //= 10
							return res
def 						snake_case_       (UpperCamelCase			:    int ):





							'''simple docstring'''


							_a      	=							abs(UpperCamelCase )
							return n if n < 10 else n % 10 + sum_of_digits(n // 10 )
def 						snake_case_       (UpperCamelCase			:    int ):





							'''simple docstring'''


							return sum(int(UpperCamelCase ) for c in str(abs(UpperCamelCase ) ) )
def 						snake_case_       ():





							'''simple docstring'''


							from collections.abc import Callable
							from timeit import timeit

							def benchmark_a_function(UpperCamelCase			:    Callable					,		UpperCamelCase			:    int ) -> None:
														_a      	=							f'{func.__name__}({value})'
														_a      	=							timeit(f'__main__.{call}'					,		setup='''import __main__''' )
														print(f'{call:56} = {func(UpperCamelCase )} -- {timing:.4f} seconds' )

							for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
														for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
																					benchmark_a_function(UpperCamelCase					,		UpperCamelCase )
														print()


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				benchmark()







'''simple docstring'''


import PIL.Image
import PIL.ImageOps
from packaging import version
from PIL import Image


if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('9.1.0'):
				_snake_case : Tuple  				=						{
				    'linear': PIL.Image.Resampling.BILINEAR,
				    'bilinear': PIL.Image.Resampling.BILINEAR,
				    'bicubic': PIL.Image.Resampling.BICUBIC,
				    'lanczos': PIL.Image.Resampling.LANCZOS,
				    'nearest': PIL.Image.Resampling.NEAREST,
				}
else:
				_snake_case : Any  				=						{
				    'linear': PIL.Image.LINEAR,
				    'bilinear': PIL.Image.BILINEAR,
				    'bicubic': PIL.Image.BICUBIC,
				    'lanczos': PIL.Image.LANCZOS,
				    'nearest': PIL.Image.NEAREST,
				}
def 						snake_case_       (UpperCamelCase			:    Optional[int] ):





							'''simple docstring'''


							_a      	=							(images / 2 + 0.5).clamp(0					,		1 )
							_a      	=							images.cpu().permute(0					,		2					,		3					,		1 ).float().numpy()
							_a      	=							numpy_to_pil(UpperCamelCase )
							return images

def 						snake_case_       (UpperCamelCase			:    str ):





							'''simple docstring'''


							if images.ndim == 3:
														_a      	=							images[None, ...]
							_a      	=							(images * 255).round().astype('''uint8''' )
							if images.shape[-1] == 1:
														# special case for grayscale (single channel) images
														_a      	=							[Image.fromarray(image.squeeze()					,		mode='''L''' ) for image in images]
							else:
														_a      	=							[Image.fromarray(UpperCamelCase ) for image in images]

							return pil_images

