Skip to content

Commit c4582d3

Browse files
committed
allow single path into get_latests_fileversions
1 parent 7d08e93 commit c4582d3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/fagfunksjoner/paths/versions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ def get_latest_fileversions(glob_list_path: list[str] | str) -> list[str]:
2020
- Locally: https://docs.python.org/3/library/glob.html
2121
2222
Args:
23-
glob_list_path: List of strings that represents a filepath.
23+
glob_list_path: List of strings or single string that represents a filepath.
2424
Recommend that the list is created with glob operation.
2525
2626
Returns:
2727
list[str]: List of strings with unique filepaths and its latest versions
2828
29+
Raises:
30+
TypeError: If parameter does not fit with type-narrowing to list of strings.
2931
3032
Example::
3133
@@ -40,7 +42,7 @@ def get_latest_fileversions(glob_list_path: list[str] | str) -> list[str]:
4042
infiles = glob_list_path
4143
else:
4244
raise TypeError("Expecting glob_list_path to be a str or a list of str.")
43-
45+
4446
# Extract unique base names by splitting before the version part
4547
uniques = set(file.rsplit("_v", 1)[0] for file in infiles)
4648
result = []

0 commit comments

Comments
 (0)