From 1415af50015d2cb716548463a6e78475e9b426e4 Mon Sep 17 00:00:00 2001 From: tcely Date: Thu, 22 May 2025 09:53:36 -0400 Subject: [PATCH] Allow skipping the loop --- tubesync/sync/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tubesync/sync/utils.py b/tubesync/sync/utils.py index 5bc90d25..762e29fe 100644 --- a/tubesync/sync/utils.py +++ b/tubesync/sync/utils.py @@ -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,)