



"""simple docstring"""







def       __SCREAMING_SNAKE_CASE      (   __UpperCAmelCase	):
		# must be
		_lowercase							:      Union[str, Any]			=					[list(__UpperCAmelCase	) for row in matrix]
		if matrix and isinstance(__UpperCAmelCase					,							__UpperCAmelCase	):
				if isinstance(matrix[0]					,							__UpperCAmelCase	):
						_lowercase							:      int			=					0
						for row in matrix:
								if prev_len == 0:
										_lowercase							:      Dict			=					len(__UpperCAmelCase	)
										_lowercase							:      Optional[int]			=					True
								else:
										_lowercase							:      Tuple			=					prev_len == len(__UpperCAmelCase	)
				else:
						_lowercase							:      Dict			=					True
		else:
				_lowercase							:      Union[str, Any]			=					False

		return result


def       __SCREAMING_SNAKE_CASE      (   __UpperCAmelCase	):
		if check_matrix(__UpperCAmelCase	) and len(__UpperCAmelCase	) > 0:
				_lowercase							:      str			=					[list(__UpperCAmelCase	) for row in a]
				_lowercase							:      Union[str, Any]			=					len(__UpperCAmelCase	)
				if isinstance(a[0]					,							__UpperCAmelCase	):
						_lowercase							:      Tuple			=					len(a[0]	)
				else:
						for dat in a:
								print(__UpperCAmelCase	)
						return

				# horizotal printing increasing
				for i in range(0					,							__UpperCAmelCase	):
						print(a[0][i]	)
				# vertical printing down
				for i in range(1					,							__UpperCAmelCase	):
						print(a[i][mat_col - 1]	)
				# horizotal printing decreasing
				if mat_row > 1:
						for i in range(mat_col - 2					,							-1					,							-1	):
								print(a[mat_row - 1][i]	)
        # vertical printing up
				for i in range(mat_row - 2					,							0					,							-1	):
						print(a[i][0]	)
				_lowercase							:      Tuple			=					[row[1 : mat_col - 1] for row in a[1 : mat_row - 1]]
				if len(__UpperCAmelCase	) > 0:
						spiral_print_clockwise(__UpperCAmelCase	)
				else:
						return
		else:
				print("""Not a valid matrix"""	)
				return


def       __SCREAMING_SNAKE_CASE      (   __UpperCAmelCase	):
		if matrix:
				return list(matrix.pop(0	)	) + spiral_traversal(list(zip(*__UpperCAmelCase	)	)[::-1]	)
		else:
				return []


# driver code
if __name__ == "__main__":
		import doctest

		doctest.testmod()

		UpperCAmelCase:   List[Any]       			=							[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
		spiral_print_clockwise(a)






import math
import os

import cva
import numpy as np

__UpperCAmelCase      = 255.0





def 	snake_case_      (__A     :						float					,   __A     :						float     )			->	float:
   __lowerCAmelCase  :			Any					    =						np.mean((original - contrast) ** 2     )
   if mse == 0:
      return 1_0_0

   return 2_0 * math.logaa(PIXEL_MAX / math.sqrt(__A     )     )





def 	snake_case_      ()			->	None:
   __lowerCAmelCase  :			int					    =						os.path.dirname(os.path.realpath(__A     )     )
   # Loading images (original image and compressed image)
   __lowerCAmelCase  :			Tuple					    =						cva.imread(os.path.join(__A					,   """image_data/original_image.png"""     )     )
   __lowerCAmelCase  :			Dict					    =						cva.imread(os.path.join(__A					,   """image_data/compressed_image.png"""     )					,   1     )

   __lowerCAmelCase  :			Optional[int]					    =						cva.imread(os.path.join(__A					,   """image_data/PSNR-example-base.png"""     )     )
   __lowerCAmelCase  :			Optional[int]					    =						cva.imread(
       os.path.join(__A					,   """image_data/PSNR-example-comp-10.jpg"""     )					,   1     )

   # Value expected: 29.73dB
   print("""-- First Test --"""     )
   print(f'''PSNR value is {peak_signal_to_noise_ratio(__A					,   __A     )} dB'''     )

   # # Value expected: 31.53dB (Wikipedia Example)
   print("""\n-- Second Test --"""     )
   print(f'''PSNR value is {peak_signal_to_noise_ratio(__A					,   __A     )} dB'''     )


if __name__ == "__main__":
   main()


