Repository: ManimCommunity/manim
File: manim/mobject/svg/svg_mobject.py (Python)

Code before:
        )
        self._move_into_position(width, height)

    def _ensure_valid_file(self):
        """Reads self.file_name and determines whether the given input file_name
        is valid.
        """
        if self.file_name is None:
            raise Exception("Must specify file for SVGMobject")

        if self.file_name.exists():
            self.file_path = self.file_name
            return

        relative = Path.cwd() / self.file_name
        if relative.exists():
            self.file_path = relative
            return

        possible_paths = [
            config.get_dir("assets_dir") / self.file_name,
            config.get_dir("assets_dir") / self.file_name + ".svg",
            config.get_dir("assets_dir") / self.file_name + ".xdv",
            self.file_path,
            self.file_path / ".svg",
            self.file_path / ".xdv",
        ]
        for path in possible_paths:
            if path.exists():
                self.file_path = path
                return
        error = f"From: {Path.cwd()}, could not find {self.file_name} at either of these locations: {possible_paths}"
        raise OSError(error)

    def generate_points(self):
        """Called by the Mobject abstract base class. Responsible for generating
        the SVGMobject's points from XML tags, populating self.mobjects, and
        any submobjects within self.mobjects.
        """
        doc = minidom_parse(str(self.file_path))
        for node in doc.childNodes:
            if not isinstance(node, MinidomElement) or node.tagName != "svg":
                continue
            mobjects = self._get_mobjects_from(node, self._initial_svg_style)
            if self.unpack_groups:
                self.add(*mobjects)
            else:
                self.add(*mobjects[0].submobjects)
        doc.unlink()

    init_points = generate_points

Review comment (suggestion):
1) The operator `+` is not supported between a Path and a Literal.
2) `self.file_path / ".svg"` will give you `filepath/.svg` which is probably not what you want.

Code after:
        )
        self._move_into_position(width, height)

    def _ensure_valid_file(self):
        """Reads self.file_name and determines whether the given input file_name
        is valid.
        """
        if self.file_name is None:
            raise Exception("Must specify file for SVGMobject")

        if self.file_name.exists():
            self.file_path = self.file_name
            return

        relative = Path.cwd() / self.file_name
        if relative.exists():
            self.file_path = relative
            return

        possible_paths = [
            config.get_dir("assets_dir") / self.file_name,
            config.get_dir("assets_dir") / self.file_name.with_suffix(".svg"),
            config.get_dir("assets_dir") / self.file_name.with_suffix(".xdv"),
            self.file_path,
            self.file_path.with_suffix(".svg"),
            self.file_path.with_suffix(".xdv"),
        ]
        for path in possible_paths:
            if path.exists():
                self.file_path = path
                return
        error = f"From: {Path.cwd()}, could not find {self.file_name} at either of these locations: {possible_paths}"
        raise OSError(error)

    def generate_points(self):
        """Called by the Mobject abstract base class. Responsible for generating
        the SVGMobject's points from XML tags, populating self.mobjects, and
        any submobjects within self.mobjects.
        """
        doc = minidom_parse(str(self.file_path))
        for node in doc.childNodes:
            if not isinstance(node, MinidomElement) or node.tagName != "svg":
                continue
            mobjects = self._get_mobjects_from(node, self._initial_svg_style)
            if self.unpack_groups:
                self.add(*mobjects)
            else:
                self.add(*mobjects[0].submobjects)
        doc.unlink()

    init_points = generate_points