Repository: ManimCommunity/manim
File: manim/scene/scene_file_writer.py (Python)

Code before:
        sections_output_dir : :class:`pathlib.Path`
            where are section videos stored

        output_name : str
            name of movie without extension and basis for section video names

    Some useful attributes are:
        "write_to_movie" (bool=False)
            Whether or not to write the animations into a video file.
        "movie_file_extension" (str=".mp4")
            The file-type extension of the outputted video.
        "partial_movie_files"
            List of all the partial-movie files.

    """

    force_output_as_scene_name = False

    def __init__(
        self,
        renderer: CairoRenderer | OpenGLRenderer,
        scene_name: StrPath,
        **kwargs: Any,
    ) -> None:
        self.renderer = renderer
        self.init_output_directories(str(scene_name))
        self.init_audio()
        self.frame_count = 0
        self.partial_movie_files: list[str] = []
        self.subcaptions: list[srt.Subtitle] = []
        self.sections: list[Section] = []
        # first section gets automatically created for convenience
        # if you need the first section to be skipped, add a first section by hand, it will replace this one
        self.next_section(
            name="autocreated", type_=DefaultSectionType.NORMAL, skip_animations=False
        )

    def init_output_directories(self, scene_name: str) -> None:
        """Initialise output directories.

        Notes
        -----
        The directories are read from ``config``, for example
        ``config['media_dir']``.  If the target directories don't already
        exist, they will be created.

        """
        if config["dry_run"]:  # in dry-run mode there is no output
            return

        module_name = config.get_dir("input_file").stem if config["input_file"] else ""

Review comment (suggestion):
I would say that the `scene_name` parameter itself should always be a string, because:
- the name (`scene_name`) suggests a string, not a path
- currently, only strings are passed as `scene_name` in the source code as well

So, instead of doing this conversion to string here, I suggest changing the parameter type hint itself to `str`.

Inside `manim.utils.testing,_test_class_makers`, there's also a `DummySceneFIleWriter` class which overrides most methods. `DummySceneFileWriter.__init__()` also types `scene_name` as `StrPath`, so I would also like to ask you to please modify that type hint as well.

Code after:
        sections_output_dir : :class:`pathlib.Path`
            where are section videos stored

        output_name : str
            name of movie without extension and basis for section video names

    Some useful attributes are:
        "write_to_movie" (bool=False)
            Whether or not to write the animations into a video file.
        "movie_file_extension" (str=".mp4")
            The file-type extension of the outputted video.
        "partial_movie_files"
            List of all the partial-movie files.

    """

    force_output_as_scene_name = False

    def __init__(
        self,
        renderer: CairoRenderer | OpenGLRenderer,
        scene_name: str,
        **kwargs: Any,
    ) -> None:
        self.renderer = renderer
        self.init_output_directories(scene_name)
        self.init_audio()
        self.frame_count = 0
        self.partial_movie_files: list[str | None] = []
        self.subcaptions: list[srt.Subtitle] = []
        self.sections: list[Section] = []
        # first section gets automatically created for convenience
        # if you need the first section to be skipped, add a first section by hand, it will replace this one
        self.next_section(
            name="autocreated", type_=DefaultSectionType.NORMAL, skip_animations=False
        )

    def init_output_directories(self, scene_name: str) -> None:
        """Initialise output directories.

        Notes
        -----
        The directories are read from ``config``, for example
        ``config['media_dir']``.  If the target directories don't already
        exist, they will be created.

        """
        if config["dry_run"]:  # in dry-run mode there is no output
            return

        module_name = config.get_dir("input_file").stem if config["input_file"] else ""