Update directory_and_stem in utils.py

This commit is contained in:
tcely 2025-05-24 23:03:45 -04:00 committed by GitHub
parent 2222a146b6
commit 360b39ebcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,11 +13,10 @@ from pathlib import Path
from urllib.parse import urlunsplit, urlencode, urlparse
from .errors import DatabaseConnectionError
def directory_and_stem(arg_path, /):
def directory_and_stem(arg_path, /, all_suffixes=False):
filepath = Path(arg_path)
stem = Path(filepath.stem)
while stem.suffixes and '' != stem.suffix:
while all_suffixes and stem.suffixes and '' != stem.suffix:
stem = Path(stem.stem)
return (filepath.parent, str(stem),)