'''simple docstring'''

from unittest.mock import patch

import datasets
from datasets import Dataset


def __a			(						)						->				Optional[int]:
      '''simple docstring'''


      lowercase_     			=   Dataset.from_dict({"col_1": [3, 2, 0, 1]}					)

      with patch("tqdm.auto.tqdm"					) as mock_tqdm:
            datasets.disable_progress_bar()
            dset.map(lambda __lowerCamelCase					: {"col_2": x["col_1"] + 1}					)
            mock_tqdm.assert_not_called()

            mock_tqdm.reset_mock()

            datasets.enable_progress_bar()
            dset.map(lambda __lowerCamelCase					: {"col_2": x["col_1"] + 1}					)
            mock_tqdm.assert_called()










"""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()