in src/co_op_translator/utils/common/file_utils.py [0:0]
def get_filename_and_extension(file_path: str | Path) -> tuple[str, str]:
"""
Extract the filename without extension and the file extension from the given file path.
Args:
file_path (str | Path): The file path from which to extract the filename and extension.
Returns:
tuple[str, str]: A tuple containing the filename without extension and the file extension.
"""
# Ensure the file_path is a string or Path object
file_path = str(file_path) # Convert to string if it's a Path object
# Extract the base name (filename with extension) and split it into name and extension
original_filename, file_ext = os.path.splitext(os.path.basename(file_path))
# Return the filename without extension and the file extension in lowercase
return original_filename, file_ext.lower()