Skip to content

Commit

Permalink
append_to_stem: Use to_arr
Browse files Browse the repository at this point in the history
  • Loading branch information
LightArrowsEXE committed Jun 3, 2024
1 parent 21c5309 commit 6624b4f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions stgpytools/types/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Iterable, Literal, TypeAlias, Union

from ..functions import to_arr

__all__ = [
'FilePathType', 'FileDescriptor',
'FileOpener',
Expand Down Expand Up @@ -102,10 +104,7 @@ def write_lines(
def append_to_stem(self, suffixes: str | Iterable[str], sep: str = "_") -> SPath:
"""Append a suffix to the stem of the path"""

if isinstance(suffixes, str):
suffixes = [suffixes]

return self.with_stem(sep.join([self.stem, *suffixes]))
return self.with_stem(sep.join([self.stem, *to_arr(suffixes)])) # type:ignore[list-item]


SPathLike = Union[str, Path, SPath]

0 comments on commit 6624b4f

Please sign in to comment.