dgs.utils.utils.replace_file_type¶
- dgs.utils.utils.replace_file_type(fp: str, new_type: str, old_types: None | list[str] = None) str [source]¶
Replace the file extension of a file path with a new type.
- Parameters:
fp – The original file path.
new_type – The new file type to replace the old one.
old_types – A list of old file types that are allowed to be replaced.
- Returns:
The file path with the new file type.
- Raises:
ValueError – If the old file type is not in the list of allowed types.