Repository: ManimCommunity/manim
File: manim/mobject/types/image_mobject.py (Python)

Code before:
    def set_color(self):
        # Likely to be implemented in subclasses, but no obligation
        pass

    def set_resampling_algorithm(self, resampling_algorithm):
        """
        Sets the interpolation method for upscaling the image. By default the image is interpolated using bicubic algorithm. This method lets you change it.
        Interpolation is done internally using Pillow, and the function besides the string constants describing the algorithm accepts the Pillow integer constants.

        Parameters
        ----------
        resampling_algorithm : :class:`str` or :class:`str`. Either an integer constant described in the Pillow library, or
         one of the following string constants:
         * "bicubic' or 'cubic'
         * 'nearest' or 'none'
         * 'box'
         * 'bilinear' or 'linear'
         * 'hamming'
         * 'lanczos' or 'antialias'
        The string constants can be input either in lowercase or in UPPERCASE, like the corresponding constant name in the Pillow library.
        """
        if isinstance(resampling_algorithm, str):
            raise ValueError(
                    f"resampling_algorithm cannot be string. RESAMPLING_ALGORITHMS[\"<algorithm>\"] or Pillow resampling filter constants. Available algorithms: 'bicubic', 'nearest', 'box', 'bilinear', 'hamming', 'lanczos'."
                )
            self.resampling_algorithm = resampling_algorithm
        elif isinstance(resampling_algorithm, int):
            self.resampling_algorithm = resampling_algorithm
        else:
            raise ValueError(
                f"resampling_algorithm property supports either string value, one of 'bicubic', 'nearest', 'box', 'bilinear', 'hamming', 'lanczos' (case insensitive) or a Pillow resampling filter integer constant."
            )

    def reset_points(self):
        # Corresponding corners of image are fixed to these 3 points
        self.points = np.array(
            [
                UP + LEFT,
                UP + RIGHT,
                DOWN + LEFT,
            ]
        )
        self.center()
        h, w = self.get_pixel_array().shape[:2]
        if self.scale_to_resolution:
            height = h / self.scale_to_resolution * config["frame_height"]
        else:
            height = 3  # this is the case for ImageMobjectFromCamera
        self.stretch_to_fit_height(height)
        self.stretch_to_fit_width(height * w / h)


Review comment (suggestion):
Maybe it's the github diff that is misleading me, but what is the line 73? Given that it is right after the ValueError at line 70, it will never be reached. 

Code after:
    def set_color(self):
        # Likely to be implemented in subclasses, but no obligation
        pass

    def set_resampling_algorithm(self, resampling_algorithm):
        """
        Sets the interpolation method for upscaling the image. By default the image is interpolated using bicubic algorithm. This method lets you change it.
        Interpolation is done internally using Pillow, and the function besides the string constants describing the algorithm accepts the Pillow integer constants.

        Parameters
        ----------
        resampling_algorithm : :class:`int`, an integer constant described in the Pillow library, or one from the RESAMPLING_ALGORITHMS global dictionary, under the following keys:
         * 'bicubic' or 'cubic'
         * 'nearest' or 'none'
         * 'box'
         * 'bilinear' or 'linear'
         * 'hamming'
         * 'lanczos' or 'antialias'
        """
        if isinstance(resampling_algorithm, int):
            self.resampling_algorithm = resampling_algorithm
        else:
            raise ValueError(
                "resampling_algorithm has to be an int, one of the values defined in RESAMPLING_ALGORITHMS or a Pillow resampling filter constant. Available algorithms: 'bicubic', 'nearest', 'box', 'bilinear', 'hamming', 'lanczos'."
            )

    def reset_points(self):
        # Corresponding corners of image are fixed to these 3 points
        self.points = np.array(
            [
                UP + LEFT,
                UP + RIGHT,
                DOWN + LEFT,
            ]
        )
        self.center()
        h, w = self.get_pixel_array().shape[:2]
        if self.scale_to_resolution:
            height = h / self.scale_to_resolution * config["frame_height"]
        else:
            height = 3  # this is the case for ImageMobjectFromCamera
        self.stretch_to_fit_height(height)
        self.stretch_to_fit_width(height * w / h)


class ImageMobject(AbstractImageMobject):
    """Displays an Image from a numpy array or a file.

    Parameters
    ----------
    scale_to_resolution : :class:`int`