

import math
from timeit import timeit

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Optional[Any]       )      ->				Optional[int]:
				_UpperCAmelCase				:						List[str]       						=			0
				_UpperCAmelCase				:						Tuple       						=			abs(_lowerCamelCase       )
				while True:
								_UpperCAmelCase				:						Dict       						=			n // 10
								digits += 1
								if n == 0:
												break
				return digits

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Optional[int]       )      ->				List[Any]:
				return 1 if n == 0 else math.floor(math.log(abs(_lowerCamelCase       )     ,					10       ) + 1       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Union[str, Any]       )      ->				int:
				return len(str(abs(_lowerCamelCase       )       )       )

def 							__SCREAMING_SNAKE_CASE							( )      ->				Union[str, Any]:
				from collections.abc import Callable

				def benchmark_a_function(lowerCAmelCase:     Any     ,					lowerCAmelCase:     List[Any]       ) -> None:
								_UpperCAmelCase				:						int       						=			F'{func.__name__}({value})'
								_UpperCAmelCase				:						Dict       						=			timeit(F'__main__.{call}'     ,					setup="import __main__"       )
								print(F'{call}: {func(_lowerCamelCase       )} -- {timing} seconds'       )

				for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
								for func in (num_digits, num_digits_fast, num_digits_faster):
												benchmark_a_function(_lowerCamelCase     ,					_lowerCamelCase       )
								print()


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					benchmark()










"""simple docstring"""
from cva import destroyAllWindows, imread, imshow, waitKey






def        lowerCamelCase_  (						_lowerCamelCase			,   _lowerCamelCase				):
 lowerCamelCase__				,     lowerCamelCase__     :			Optional[Any]     				=						img.shape[0], img.shape[1]

 def to_grayscale(_lowerCamelCase			,   _lowerCamelCase			,   _lowerCamelCase				):
  return 0.2_126 * red + 0.587 * green + 0.114 * blue

 def normalize(_lowerCamelCase				):
  return min(_lowerCamelCase			,   255				)

 for i in range(_lowerCamelCase				):
  for j in range(_lowerCamelCase				):
   lowerCamelCase__     :			List[Any]     				=						int(to_grayscale(*img[i][j]				)				)
   lowerCamelCase__     :			Optional[int]     				=						[
       normalize(_lowerCamelCase				),
       normalize(greyscale + factor				),
       normalize(greyscale + 2 * factor				),
   ]

 return img


if __name__ == "__main__":
      # read original image
      A_			: List[str]				=			{
          percentage: imread("image_data/lena.jpg", 1) for percentage in (10, 20, 30, 40)
      }

      for percentage, img in images.items():
            make_sepia(img, percentage)

      for percentage, img in images.items():
            imshow(f"Original image with sepia (factor: {percentage})", img)

      waitKey(0)
      destroyAllWindows()

