




from .hash_table import HashTable


class 				__UpperCamelCase      (			a__	):





				'''simple docstring'''



				def __init__(			self							,			*UpperCAmelCase_							,			**UpperCAmelCase_    ):
											super().__init__(*__UpperCAmelCase							,			**__UpperCAmelCase    )






				def    __snake_case		(			self							,			UpperCAmelCase_							,			UpperCAmelCase_=None    ):
											lowerCAmelCase =		1
											lowerCAmelCase =		self.hash_function(key + i * i    )

											while self.values[new_key] is not None and self.values[new_key] != key:
																		i += 1
																		lowerCAmelCase =		(
																		    self.hash_function(key + i * i    )
																		    if not self.balanced_factor() >= self.lim_charge
																		    else None
																		)

																		if new_key is None:
																									break

											return new_key







"""simple docstring"""






import math
import os

import cva
import numpy as np

__snake_case												=							255.0
def    A_ ( _lowerCAmelCase  :       float,  _lowerCAmelCase  :       float							):






     """simple docstring"""

     _a     						=					np.mean((original - contrast) ** 2							)
     if mse == 0:
          return 1_00

     return 20 * math.logaa(PIXEL_MAX / math.sqrt(_lowerCAmelCase							)							)
def    A_ ( ):






     """simple docstring"""

     _a     						=					os.path.dirname(os.path.realpath(_lowerCAmelCase							)							)
     # Loading images (original image and compressed image)
     _a     						=					cva.imread(os.path.join(_lowerCAmelCase,  '''image_data/original_image.png'''							)							)
     _a     						=					cva.imread(os.path.join(_lowerCAmelCase,  '''image_data/compressed_image.png'''							),  1							)

     _a     						=					cva.imread(os.path.join(_lowerCAmelCase,  '''image_data/PSNR-example-base.png'''							)							)
     _a     						=					cva.imread(
         os.path.join(_lowerCAmelCase,  '''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(_lowerCAmelCase,  _lowerCAmelCase							)} dB'							)

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


if __name__ == "__main__":
   main()