Allow skipping the loop

This commit is contained in:
tcely 2025-05-22 09:53:36 -04:00 committed by GitHub
parent a066ba49f2
commit 1415af5001
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -130,10 +130,10 @@ def file_is_editable(filepath):
return False
def directory_and_stem(arg_path):
def directory_and_stem(arg_path, /, *, only_once=False):
filepath = Path(arg_path)
stem = Path(filepath.stem)
while stem.suffixes and '' != stem.suffix:
while not only_once and stem.suffixes and '' != stem.suffix:
stem = Path(stem.stem)
stem = str(stem)
return (filepath.parent, stem,)