Skip to content

Commit ff47fd2

Browse files
author
Jan Sebastian Rothe
committed
Another attempt at fix
1 parent 1c8e6e2 commit ff47fd2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/fagfunksjoner/paths/versions.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def construct_file_pattern(filepath: str, version_denoter: str = "*") -> str:
157157
return f"{filepath_no_version}_v{version_denoter}{file_ext}"
158158

159159

160-
def get_fileversions(filepath: str) -> any:
160+
def get_fileversions(filepath: str) -> list[str] | list[None]:
161161
"""Retrieves a list of file versions matching a specified pattern.
162162
163163
This function generates a glob pattern based on the provided file path and retrieves
@@ -183,10 +183,10 @@ def get_fileversions(filepath: str) -> any:
183183
):
184184
# Use a GCS file system client for cloud storage files.
185185
fs = FileClient.get_gcs_file_system()
186-
files = fs.glob(glob_pattern)
186+
files = list(fs.glob(glob_pattern))
187187
else:
188188
# Use the standard glob module for local files.
189-
files = glob.glob(glob_pattern)
189+
files = list(glob.glob(glob_pattern))
190190

191191
# Extract the base file name from the glob pattern for logging purposes.
192192
base_file_name = get_file_name(glob_pattern)
@@ -195,13 +195,12 @@ def get_fileversions(filepath: str) -> any:
195195
if files:
196196
# Log the number of found versions and return the list of files.
197197
logger.info(f"Found {len(files)} versions of file: {base_file_name}")
198-
return files
199198
else:
200199
# Log a warning if no files were found with the given pattern and return None.
201200
logger.warning(
202201
f"Can't find any files with this name, glob-pattern: {glob_pattern}."
203202
)
204-
return None
203+
return files
205204

206205

207206
def latest_version_path(filepath: str) -> str:

0 commit comments

Comments
 (0)