Skip to content

Commit

Permalink
Improve filename generation
Browse files Browse the repository at this point in the history
  • Loading branch information
opcode81 committed Jun 26, 2024
1 parent 410aaee commit 7f7a05d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/penai/utils/io.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from collections.abc import Generator
from contextlib import contextmanager
from pathlib import Path
Expand Down Expand Up @@ -29,7 +30,9 @@ def fn_compatible(name: str) -> str:
:param name: the name
:return: a string that can be used as a filename/directory name
"""
return name.replace("/", "")
name = name.replace("/", "")
name = re.sub(r"\s+", " ", name)
return name


@contextmanager
Expand Down

0 comments on commit 7f7a05d

Please sign in to comment.